コード例 #1
0
        private void ButtonOK_Click(object sender, EventArgs e)
        {
            //程序启动时,将数据联结串设置好
            ZX.ZXSystem.DBUtility.DbHelperSQL.connectionString = SystemClass.ConnectString.GetConnectionString();

            string strUserName = this.TxtUserName.Text;
            string strPassWord = this.TxtPassword.Text;
            ZX.Class.StringOption.Encrypt ET = new ZX.Class.StringOption.Encrypt();
            strPassWord = ET.EncryptString(strPassWord);
            if (GenCode.CheckSN() == false)
            {
                return;
            }
            string strSql = "select sUSERID,sUserName,sUserNameByChinese,sLoginPassword,sRole,sDepartMent,sEMail,sMemo from SYS_USER_INFO  where sUserName='******' and sLoginPassword='******'";
               // MessageBox.Show(strSql);

            try
            {
                DataTable DT = ZX.ZXSystem.DBUtility.DbHelperSQL.Query(strSql).Tables[0];
                if (DT.Rows.Count != 0 && DT.Rows[0]["sLoginPassword"].ToString() == strPassWord && DT.Rows[0]["sUserName"].ToString() == strUserName)
                {
                    ZX.Class.Log.WriteLog.Write("ZXSystem.Form_Login", "ButtonOK_Click", "用户登录成功:" + strUserName, ZX.Class.Log.NormalLogType.InfoLog);

                    FP = new ZX.Win.FunctionParameter();
                    FP.functionFormID = "-1";
                    FP.toolStripItemDisplayStyle = ToolStripItemDisplayStyle.ImageAndText;

                    FP.pub_CnnDest = SystemClass.ConnectString.GetConnectionString();
                    FP.pub_ComputerName = SystemClass.ConnectString.GetComputerName();
                    FP.pub_DbPassWord = SystemClass.ConnectString.GetPassWord();
                    FP.pub_DBUsername = SystemClass.ConnectString.GetUserName();
                    FP.pub_DbName = SystemClass.ConnectString.GetDatabase();
                    FP.pub_sUserName = DT.Rows[0]["sUserName"].ToString();
                   //用户类型
                    FP.pub_YHLX = DT.Rows[0]["sDepartMent"].ToString();
                    FP.pub_sUserNameByChinese = DT.Rows[0]["sUserNameByChinese"].ToString();
                    FP.Pub_sRole = DT.Rows[0]["sRole"].ToString();
                    //FP.pub_SJDWBH = DT.Rows[0]["SJDWBH"].ToString();

                    this.Tag = FP;
                    IsTrue = true;
                    this.Close();
                }
                else
                {
                    SystemClass.MessageBoxShow.ShowMessage("输入的用户名与密码不正确,请确认后重试!");
                    ZX.Class.Log.WriteLog.Write("ZXSystem.Form_Login", "ButtonOK_Click", "输入的用户名与密码不正确,请确认后重试", ZX.Class.Log.NormalLogType.InfoLog);
                }
            }
            catch
            {
                FP = new ZX.Win.FunctionParameter();
                FP.ToolStripitemDisplayStyle = ToolStripItemDisplayStyle.ImageAndText;
                FP.functionFormID = "-1";
                ZX.Win.ReflectionFunction RF = new ZX.Win.ReflectionFunction();
                RF.LoadMdiForm("ZXSystem.Function.SetServerComputer.dll", "ZXSystem.Function.SetServerComputer.Form_Main_SetServerComputer",null, FP);
                GC.Collect();
            }
        }
コード例 #2
0
 private void Form_Main_KeyUp(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.F11)
     {
         ZX.Win.FunctionParameter FP = new ZX.Win.FunctionParameter();
         FP.ToolStripitemDisplayStyle = ToolStripItemDisplayStyle.ImageAndText;
         FP.functionFormID = "-1";
         ZX.Win.ReflectionFunction RF = new ZX.Win.ReflectionFunction();
         Form frm = RF.LoadMdiForm("ZXSystem.Function.FunManage.dll", "ZXSystem.Function.FunManage.Form_Main_FunManage", this, FP);
         System.Windows.Forms.TabPage TP = new System.Windows.Forms.TabPage(frm.Text);
         TP.Tag = frm;
         this.TabControFormList.TabPages.Add(TP);
         this.TabControFormList.SelectedTab = TP;
         TP.Select();
         this.zxPanel1.Visible = false;
     }
     ///F12重新加载菜单
     if (e.KeyCode == Keys.F12)
     {
         AddMenu();
         AddToolStripMain();
         ZX.Win.SetToolBarIcon SBI1 = new ZX.Win.SetToolBarIcon();
         SBI1.SetImage(Application.StartupPath + @"\Images\TooBarIco\", this.ToolStripMain, ToolStripItemDisplayStyle.ImageAndText);
     }
 }