| | |
| | | lblVersion2.Text = "æ¬å°çæ¬:" + Pub_Class.ClsPub.VersionOld; |
| | | lblIPAddress.Text = "IP:" + Pub_Class.ClsPub.IPAddress + " " + Pub_Class.ClsPub.ComputerName; |
| | | CheckUseOrgID(); |
| | | textBox1.Focus(); |
| | | } |
| | | |
| | | //æ ¡éªç»ç» |
| | |
| | | Application.Exit(); |
| | | } |
| | | } |
| | | |
| | | private void button1_Click(object sender, EventArgs e) |
| | | { |
| | | //textBox1.Focus(); |
| | | string HPassWord = textBox1.Text.Trim().ToString(); |
| | | //MessageBox.Show(HPassWord); |
| | | SQLHelper.ClsCN oCn1 = new SQLHelper.ClsCN(); |
| | | //1.æ¥æ¾æ°æ®åºæä½å管ç表é颿¯å¦æå¯¹åºè¿ä¸ªå å¯å符串对åºçè®°å½ |
| | | DataSet DSet = oCn1.RunProcReturn("select Czymc,Czmm from Gy_Czygl where HICNumber ='" + HPassWord + "'", "Gy_Czygl"); |
| | | if (DSet == null || DSet.Tables[0].Rows.Count == 0) |
| | | //if (DSet == null|| DSet.Tables[0].Rows.Count == 0) |
| | | { |
| | | MessageBox.Show("æ²¡ææ¾å°å¯¹åºèåä¿¡æ¯ï¼è¯·éæ°å·å¡" + DBUtility.ClsPub.sExeReturnInfo); |
| | | //textBox1.Text = ""; |
| | | return; |
| | | } |
| | | else |
| | | { |
| | | cmbUser.Text = ClsPub.isStrNull(DSet.Tables[0].Rows[0]["Czymc"]); |
| | | |
| | | if (AllowLogin() != true) |
| | | return; |
| | | DataSet ds = null; |
| | | ClsCNmaster oCn = new ClsCNmaster(); |
| | | ClsCN oCnLoc = new ClsCN(); |
| | | string sDataBase; |
| | | string sDataBase_K3 = ""; |
| | | string sDataBase_K32 = ""; |
| | | string sDataBase_K33 = ""; |
| | | sDataBase = oCn.GetDataBase(cmbAccount.Text.Trim(), ref sDataBase_K3); |
| | | ClsIni oIni = new ClsIni(); |
| | | ClsIni.WriteIni("Erp", "DataBase", sDataBase.Trim(), DBUtility.ClsPub.AppPath + @"/HXERP.ini"); |
| | | ClsIni.WriteIni("K3Erp", "DataBase", sDataBase_K3.Trim(), DBUtility.ClsPub.AppPath + @"/HXERP.ini"); |
| | | DAL.ClsUser oUser = new DAL.ClsUser(); |
| | | |
| | | ds = oUser.CheckCzymc_AB(cmbUser.Text.Trim(), textBox1.Text.Trim()); |
| | | if (ds == null) |
| | | { |
| | | MessageBox.Show("éæ©çå¸å¥ä¸åå¨ï¼", "æç¤º"); |
| | | return; |
| | | } |
| | | if (ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | ClsPub.CurUserID = ds.Tables[0].Rows[0]["Czybm"].ToString(); |
| | | this.Close(); |
| | | isOk = true; |
| | | } |
| | | else |
| | | { |
| | | MessageBox.Show("é误çç¨æ·å¯ç ï¼", "æç¤º", MessageBoxButtons.OK, MessageBoxIcon.Error); |
| | | return; |
| | | } |
| | | //å¾å°å½åä¼è®¡æé´ |
| | | int sYear = 0; |
| | | int sPeriod = 0; |
| | | if (!ClsPub.Sub_GetCurPeriod(ref sYear, ref sPeriod)) |
| | | { |
| | | MessageBox.Show("å¾å°å½åä¼è®¡æé´å¤±è´¥ï¼", "æç¤º", MessageBoxButtons.OK, MessageBoxIcon.Error); |
| | | isOk = false; |
| | | return; |
| | | } |
| | | // |
| | | this.Close(); |
| | | isOk = true; |
| | | ClsIni.WriteIni("Erp", "DataBaseNumber", cmbAccount.Text.Trim(), DBUtility.ClsPub.AppPath + @"/HXERP.ini"); |
| | | //åå
¥ç¨æ·åå¯ç |
| | | // |
| | | UserName = cmbUser.Text.Trim() + "," + UserName; |
| | | string[] str = UserName.Split(','); |
| | | List<string> listStr = new List<string>(); |
| | | foreach (string eachStr in str) |
| | | { |
| | | if (!listStr.Contains(eachStr)) |
| | | listStr.Add(eachStr); |
| | | } |
| | | UserName = ""; |
| | | if (listStr.Count > 10) |
| | | { |
| | | listStr.RemoveAt(10); |
| | | } |
| | | foreach (string eachStr in listStr) |
| | | { |
| | | UserName = UserName + eachStr + ","; |
| | | } |
| | | UserName = UserName.Remove(UserName.LastIndexOf(","), 1); |
| | | // |
| | | ClsIni.WriteIni("UserInfo", "UserName", UserName, DBUtility.ClsPub.AppPath + @"/HXERP.ini"); |
| | | ClsIni.WriteIni("UserInfo", "HOrgName", cmbHOrg.Text.ToString(), DBUtility.ClsPub.AppPath + @"/HXERP.ini"); |
| | | ClsPub.CurUserName = cmbUser.Text.Trim(); |
| | | ClsPub.AppPath = System.Environment.CurrentDirectory; |
| | | ClsPub.HOrgID = ClsPub.get_ORGANIZATIONSIDByName(ClsPub.isStrNull(cmbHOrg.Text)); |
| | | ClsPub.HOrgNumber = ClsPub.get_ORGANIZATIONSNOByName(ClsPub.isStrNull(cmbHOrg.Text)); |
| | | ClsPub.HOrgName = ClsPub.isStrNull(cmbHOrg.Text); |
| | | if (chkRemember.Checked == true) |
| | | { |
| | | ClsIni.WriteIni("UserInfo", "UserPsd", "", DBUtility.ClsPub.AppPath + @"/HXERP.ini"); |
| | | ClsIni.WriteIni("UserInfo", "Remember", "1", DBUtility.ClsPub.AppPath + @"/HXERP.ini"); |
| | | } |
| | | else |
| | | { |
| | | ClsIni.WriteIni("UserInfo", "UserPsd", "", DBUtility.ClsPub.AppPath + @"/HXERP.ini"); |
| | | ClsIni.WriteIni("UserInfo", "Remember", "0", DBUtility.ClsPub.AppPath + @"/HXERP.ini"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void textBox1_TextChanged(object sender, EventArgs e) |
| | | { |
| | | //string HPassWord = textBox1.Text.Trim().ToString(); |
| | | ////MessageBox.Show(HPassWord); |
| | | //SQLHelper.ClsCN oCn1 = new SQLHelper.ClsCN(); |
| | | ////1.æ¥æ¾æ°æ®åºæä½å管ç表é颿¯å¦æå¯¹åºè¿ä¸ªå å¯å符串对åºçè®°å½ |
| | | //DataSet DSet = oCn1.RunProcReturn("select Czybm,Czmm from Gy_Czygl where HICNumber ='" + HPassWord + "'", "Gy_Czygl"); |
| | | //if (DSet == null || DSet.Tables[0].Rows.Count == 0) |
| | | ////if (DSet == null|| DSet.Tables[0].Rows.Count == 0) |
| | | //{ |
| | | // MessageBox.Show("æ²¡ææ¾å°å¯¹åºèåä¿¡æ¯ï¼è¯·éæ°å·å¡" + DBUtility.ClsPub.sExeReturnInfo); |
| | | // //textBox1.Text = ""; |
| | | // return; |
| | | //} |
| | | //else |
| | | //{ |
| | | // cmbUser.Text = ClsPub.isStrNull(DSet.Tables[0].Rows[0]["Czybm"]); |
| | | |
| | | // if (AllowLogin() != true) |
| | | // return; |
| | | // DataSet ds = null; |
| | | // ClsCNmaster oCn = new ClsCNmaster(); |
| | | // ClsCN oCnLoc = new ClsCN(); |
| | | // string sDataBase; |
| | | // string sDataBase_K3 = ""; |
| | | // string sDataBase_K32 = ""; |
| | | // string sDataBase_K33 = ""; |
| | | // sDataBase = oCn.GetDataBase(cmbAccount.Text.Trim(), ref sDataBase_K3); |
| | | // ClsIni oIni = new ClsIni(); |
| | | // ClsIni.WriteIni("Erp", "DataBase", sDataBase.Trim(), DBUtility.ClsPub.AppPath + @"/HXERP.ini"); |
| | | // ClsIni.WriteIni("K3Erp", "DataBase", sDataBase_K3.Trim(), DBUtility.ClsPub.AppPath + @"/HXERP.ini"); |
| | | // DAL.ClsUser oUser = new DAL.ClsUser(); |
| | | |
| | | // ds = oUser.CheckCzymc(cmbUser.Text.Trim(),textBox1.Text.Trim()); |
| | | // if (ds == null) |
| | | // { |
| | | // MessageBox.Show("éæ©çå¸å¥ä¸åå¨ï¼", "æç¤º"); |
| | | // return; |
| | | // } |
| | | // if (ds.Tables[0].Rows.Count > 0) |
| | | // { |
| | | // ClsPub.CurUserID = ds.Tables[0].Rows[0]["Czybm"].ToString(); |
| | | // this.Close(); |
| | | // isOk = true; |
| | | // } |
| | | // else |
| | | // { |
| | | // MessageBox.Show("é误çç¨æ·å¯ç ï¼", "æç¤º", MessageBoxButtons.OK, MessageBoxIcon.Error); |
| | | // return; |
| | | // } |
| | | // //å¾å°å½åä¼è®¡æé´ |
| | | // int sYear = 0; |
| | | // int sPeriod = 0; |
| | | // if (!ClsPub.Sub_GetCurPeriod(ref sYear, ref sPeriod)) |
| | | // { |
| | | // MessageBox.Show("å¾å°å½åä¼è®¡æé´å¤±è´¥ï¼", "æç¤º", MessageBoxButtons.OK, MessageBoxIcon.Error); |
| | | // isOk = false; |
| | | // return; |
| | | // } |
| | | // // |
| | | // this.Close(); |
| | | // isOk = true; |
| | | // ClsIni.WriteIni("Erp", "DataBaseNumber", cmbAccount.Text.Trim(), DBUtility.ClsPub.AppPath + @"/HXERP.ini"); |
| | | // //åå
¥ç¨æ·åå¯ç |
| | | // // |
| | | // UserName = cmbUser.Text.Trim() + "," + UserName; |
| | | // string[] str = UserName.Split(','); |
| | | // List<string> listStr = new List<string>(); |
| | | // foreach (string eachStr in str) |
| | | // { |
| | | // if (!listStr.Contains(eachStr)) |
| | | // listStr.Add(eachStr); |
| | | // } |
| | | // UserName = ""; |
| | | // if (listStr.Count > 10) |
| | | // { |
| | | // listStr.RemoveAt(10); |
| | | // } |
| | | // foreach (string eachStr in listStr) |
| | | // { |
| | | // UserName = UserName + eachStr + ","; |
| | | // } |
| | | // UserName = UserName.Remove(UserName.LastIndexOf(","), 1); |
| | | // // |
| | | // ClsIni.WriteIni("UserInfo", "UserName", UserName, DBUtility.ClsPub.AppPath + @"/HXERP.ini"); |
| | | // ClsIni.WriteIni("UserInfo", "HOrgName", cmbHOrg.Text.ToString(), DBUtility.ClsPub.AppPath + @"/HXERP.ini"); |
| | | // ClsPub.CurUserName = cmbUser.Text.Trim(); |
| | | // ClsPub.AppPath = System.Environment.CurrentDirectory; |
| | | // ClsPub.HOrgID = ClsPub.get_ORGANIZATIONSIDByName(ClsPub.isStrNull(cmbHOrg.Text)); |
| | | // ClsPub.HOrgNumber = ClsPub.get_ORGANIZATIONSNOByName(ClsPub.isStrNull(cmbHOrg.Text)); |
| | | // ClsPub.HOrgName = ClsPub.isStrNull(cmbHOrg.Text); |
| | | // if (chkRemember.Checked == true) |
| | | // { |
| | | // ClsIni.WriteIni("UserInfo", "UserPsd", "", DBUtility.ClsPub.AppPath + @"/HXERP.ini"); |
| | | // ClsIni.WriteIni("UserInfo", "Remember", "1", DBUtility.ClsPub.AppPath + @"/HXERP.ini"); |
| | | // } |
| | | // else |
| | | // { |
| | | // ClsIni.WriteIni("UserInfo", "UserPsd", "", DBUtility.ClsPub.AppPath + @"/HXERP.ini"); |
| | | // ClsIni.WriteIni("UserInfo", "Remember", "0", DBUtility.ClsPub.AppPath + @"/HXERP.ini"); |
| | | // } |
| | | //} |
| | | |
| | | } |
| | | } |
| | | } |