private void SaveData()
 {
     if (this.txtNewPassWord.Text == txtOldPassWord.Text)
     {
        SystemClass.MessageBoxShow.ShowMessage("新的用户密码不能与原始密码相同!");
         return;
     }
     if (this.txtNewPassWord.Text.Trim() == "")
     {
        SystemClass.MessageBoxShow.ShowMessage("密码设置不能为空!");
         return;
     }
     ZX.Class.StringOption.Encrypt SE=new ZX.Class.StringOption.Encrypt();
     string strNewPassWord=SE.EncryptString(this.txtNewPassWord.Text);
     string strOldPassWord = SE.EncryptString(this.txtOldPassWord.Text);
     string strSql = "select sUserName,sUserNameByChinese,sLoginPassword from SYS_USER_INFO where sUserNameByChinese='" + FP.pub_sUserNameByChinese + "' and sLoginPassword='******'";
     DataTable DT = ZX.ZXSystem.DBUtility.DbHelperSQL.Query(strSql).Tables[0];
     if (DT.Rows.Count > 0 && DT.Rows[0]["sLoginPassword"].ToString() == strOldPassWord)
     {
         strSql = "update SYS_USER_INFO set sLoginPassword='******' where sUserNameByChinese='" + FP.pub_sUserNameByChinese + "'";
         if (ZX.ZXSystem.DBUtility.DbHelperSQL.ExecuteSql(strSql) == 1)
         {
             SystemClass.MessageBoxShow.ShowMessage("修改用户密码成功!");
             this.Close();
         }
         else
         {
            SystemClass.MessageBoxShow.ShowMessage("修改用户密码失败!");
         }
     }
     else
     {
        SystemClass.MessageBoxShow.ShowMessage("输入原始密码不正确,请重新输入!");
     }
 }
        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();
            }
        }
        /// <summary>
        /// 保存用户信息
        /// </summary>
        private void SaveData()
        {
            if (this.txtUserName.Text.Trim() == "" || this.txtDepartment.Text == "")
            {
               SystemClass.MessageBoxShow.ShowMessage("所输入的信息不全,请录入完整的用户信息!");
                return;
            }
            string strSql;
            if (strUserID.Trim() == "")
            {
                strSql = "insert into SYS_USER_INFO(sUserID,sUserName,sUserNameByChinese,sLoginPassWord,sDepartment,sRole) values (@sUserID,@sUserName,@sUserNameByChinese,@sLoginPassWord,@sDepartment,@sRole)";
            }
            else
            {
                strSql = "update SYS_USER_INFO set sUserID=@sUserID,sUserName=@sUserName,sUserNameByChinese=@sUserNameByChinese,sLoginPassword=@sLoginPassWord,sDepartment=@sDepartment,sRole=@sRole where sUserID='" + this.strUserID + "'";
            }
            System.Data.SqlClient.SqlParameter[] sqlParameterList = new System.Data.SqlClient.SqlParameter[6];
            sqlParameterList[0] = new System.Data.SqlClient.SqlParameter();
            sqlParameterList[0].ParameterName = "@sUserID";
            sqlParameterList[0].Value = this.txtUserID.Text;
            sqlParameterList[0].SqlDbType = System.Data.SqlDbType.VarChar;

            sqlParameterList[1] = new System.Data.SqlClient.SqlParameter();
            sqlParameterList[1].ParameterName = "@sUserName";
            sqlParameterList[1].Value = this.txtUserName.Text;
            sqlParameterList[1].SqlDbType = System.Data.SqlDbType.VarChar;

            sqlParameterList[2] = new System.Data.SqlClient.SqlParameter();
            sqlParameterList[2].ParameterName = "@sUserNameByChinese";
            sqlParameterList[2].Value = this.txt_UserNameByChines.Text;
            sqlParameterList[2].SqlDbType = System.Data.SqlDbType.VarChar;

            ZX.Class.StringOption.Encrypt ET = new ZX.Class.StringOption.Encrypt();
            sqlParameterList[3] = new System.Data.SqlClient.SqlParameter();
            sqlParameterList[3].ParameterName = "@sLoginPassWord";
            sqlParameterList[3].Value = ET.EncryptString(this.txtUserName.Text);
            sqlParameterList[3].SqlDbType = System.Data.SqlDbType.VarChar;

            sqlParameterList[4] = new System.Data.SqlClient.SqlParameter();
            sqlParameterList[4].ParameterName = "@sDepartment";
            sqlParameterList[4].Value = this.txtDepartment.Text;
            sqlParameterList[4].SqlDbType = System.Data.SqlDbType.VarChar;

            sqlParameterList[5] = new System.Data.SqlClient.SqlParameter();
            sqlParameterList[5].ParameterName = "@sRole";
            sqlParameterList[5].Value = this.txtRole.Text;
            sqlParameterList[5].SqlDbType = System.Data.SqlDbType.VarChar;

            if (ZX.ZXSystem.DBUtility.DbHelperSQL.ExecuteSql(strSql, sqlParameterList) == 1)
            {
                ZX.Class.Log.WriteLog.Write("ZXSystem.Function.UserManage.Form_UserInfo", "SaveData", "保存用户信息成功", ZX.Class.Log.NormalLogType.InfoLog);
                this.DialogResult = DialogResult.OK;
            }
            else
            {
               SystemClass.MessageBoxShow.ShowMessage("保存用户信息失败!");
            }
        }
 /// <summary>
 /// 读取被修改的用户信息
 /// </summary>
 private void LoadData()
 {
     string strSql;
     strSql = "select * from SYS_USER_INFO where sUserID='" + strUserID + "'";
     DataTable DT = ZX.ZXSystem.DBUtility.DbHelperSQL.Query(strSql).Tables[0];
     if (DT.Rows.Count > 0)
     {
         this.txtUserID.Text = strUserID;
         this.txtUserName.Text = DT.Rows[0]["sUserName"].ToString();
         this.txt_UserNameByChines.Text = DT.Rows[0]["sUserNameByChinese"].ToString();
         ZX.Class.StringOption.Encrypt ET = new ZX.Class.StringOption.Encrypt();
         //this.txtPassWord.Text = ET.DecryptString(DT.Rows[0]["sLoginPassWord"].ToString());
         //this.CheckTrue.Checked = true;
         this.txtDepartment.Text = DT.Rows[0]["sDepartMent"].ToString();
         this.txtRole.Text = DT.Rows[0]["sRole"].ToString();
     }
 }
        /// <summary>
        /// 读取现有用户列表
        /// </summary>
        private void LoadData()
        {
            string strSql;
            strSql = "select * from SYS_USER_INFO";
            DataTable DT = ZX.ZXSystem.DBUtility.DbHelperSQL.Query(strSql).Tables[0];

            ZX.Class.StringOption.Encrypt ET = new ZX.Class.StringOption.Encrypt();

               // this.dgv_Usermanage.DataSource = DT;
            gc_UserManage.DataSource = DT;
        }