From 5b7184598c83f56080eb0a336f28d06b202a151f Mon Sep 17 00:00:00 2001
From: zzr99 <1940172413@qq.com>
Date: 星期五, 17 六月 2022 11:23:49 +0800
Subject: [PATCH] nothing

---
 BLL/公用模块/FrmLogin.cs |  212 ++++++++++++++++++++++++++++------------------------
 1 files changed, 114 insertions(+), 98 deletions(-)

diff --git "a/BLL/\345\205\254\347\224\250\346\250\241\345\235\227/FrmLogin.cs" "b/BLL/\345\205\254\347\224\250\346\250\241\345\235\227/FrmLogin.cs"
index af3aed1..03207e5 100644
--- "a/BLL/\345\205\254\347\224\250\346\250\241\345\235\227/FrmLogin.cs"
+++ "b/BLL/\345\205\254\347\224\250\346\250\241\345\235\227/FrmLogin.cs"
@@ -271,6 +271,7 @@
             {
                 textBox1.Visible = true;
                 button1.Visible = true;
+                textBox1.Focus();
             }
             else
             {
@@ -455,107 +456,122 @@
 
         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");
-            //    }
-            //}
+        private void textBox1_KeyDown(object sender, KeyEventArgs e)
+        {
+            string HPassWord = textBox1.Text.Trim().ToString();
+            if (HPassWord.Length < 10)
+            {
+                return;
+            }
+            //MessageBox.Show(HPassWord);
+            //婕旂ず瑙嗛鐢紝骞虫椂灞忚斀鎺�
+            if (HPassWord.Trim() == "3012460306-1" || HPassWord.Contains("3012460306-1") == true)
+            {
+                MessageBox.Show("鎮ㄥ埛鐨勫憳宸ュ崱锛屾病鏈夌粡杩囨妧鑳界殑鍩硅锛屼笉鑳藉湪鏈伐绔欎笂宀楋紒");
+                return;
+            }
+            //
+            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 = DSet.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");
+                }
+            }
         }
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1