Esempio n. 1
0
        private void sbtnOk_Click(object sender, System.EventArgs e)
        {
            CMSMStruct.OperStruct opsnew = new CMSMData.CMSMStruct.OperStruct();
            opsnew.strLimit = SysInitial.CurOps.strLimit;
            string strpwdCon = "";

            if (txtPwd.Text.Trim() == "" || txtPwd.Text.Trim().Length > 6)
            {
                MessageBox.Show("密码小于等于6位字符!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                txtPwd.Focus();
                return;
            }
            else
            {
                opsnew.strPwd = txtPwd.Text.Trim();
            }
            if (txtPwdConf.Text.Trim() == "" || txtPwdConf.Text.Trim().Length > 6)
            {
                MessageBox.Show("密码小于等于6位字符!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                txtPwdConf.Focus();
                return;
            }
            else
            {
                strpwdCon = txtPwdConf.Text.Trim();
            }
            if (opsnew.strPwd != strpwdCon)
            {
                MessageBox.Show("两次输入的密码不一致,请重新输入!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                this.txtPwd.Text     = "";
                this.txtPwdConf.Text = "";
                this.txtPwd.Focus();
                return;
            }
            CommAccess cs  = new CommAccess(SysInitial.ConString);
            Exception  err = null;

            cs.UpdateOper(SysInitial.CurOps, opsnew, out err);
            if (err != null)
            {
                MessageBox.Show("修改密码失败,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                clog.WriteLine(err);
                this.Close();
            }
            else
            {
                MessageBox.Show("修改密码成功,新密码将于下次登录时生效!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
                this.txtPwd.Text     = "";
                this.txtPwdConf.Text = "";
                this.txtPwd.Focus();
            }
        }
Esempio n. 2
0
 private void sbtnCancel_Click(object sender, System.EventArgs e)
 {
     opsold = null;
     if (txtOperID.Text.Trim() == "")
     {
         this.Close();
     }
     else
     {
         this.ClearText();
         txtOperID.ReadOnly   = false;
         txtOperName.ReadOnly = false;
     }
 }
Esempio n. 3
0
        private void sbtnAdd_Click(object sender, System.EventArgs e)
        {
            if (cmbLimit.Items.Count == 0)
            {
                MessageBox.Show("权限参数有误,请与管理员联系!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                return;
            }

            err = null;
            CMSMData.CMSMStruct.OperStruct ops1 = new CMSMData.CMSMStruct.OperStruct();
            if (txtOperID.Text.Trim() == "" || txtOperID.Text.Trim().Length > 10)
            {
                MessageBox.Show("操作员编号不能为空且小于10位!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                txtOperID.Focus();
                return;
            }
            else if (!cs.ChkOperIDDup(txtOperID.Text.Trim(), out err))
            {
                ops1.strOperID = txtOperID.Text.Trim();
            }
            else
            {
                MessageBox.Show("该操作员编号已经存在!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                if (err != null)
                {
                    clog.WriteLine(err);
                }
                return;
            }

            err = null;
            if (txtOperName.Text.Trim() == "" || txtOperName.Text.Trim().Length > 5)
            {
                MessageBox.Show("操作员名称不能为空且小于5个字!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                txtOperName.Focus();
                return;
            }
            else if (!cs.ChkOperNameDup(txtOperName.Text.Trim(), out err))
            {
                ops1.strOperName = txtOperName.Text.Trim();
            }
            else
            {
                MessageBox.Show("该操作员名称已经存在!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                if (err != null)
                {
                    clog.WriteLine(err);
                }
                return;
            }

            if (txtPwd.Text.Trim() == "" || txtPwd.Text.Trim().Length > 6)
            {
                MessageBox.Show("密码小于等于6位字符!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                txtPwd.Focus();
                return;
            }
            else
            {
                ops1.strPwd = txtPwd.Text.Trim();
            }
            ops1.strLimit  = this.GetColEn(cmbLimit.Text.Trim(), "LM");
            ops1.strDeptID = SysInitial.LocalDept;
            err            = null;
            cs.InsertOper(ops1, out err);
            if (err != null)
            {
                MessageBox.Show("添加操作员失败,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                clog.WriteLine(err);
            }
            else
            {
                DataRow dr = SysInitial.dsSys.Tables["Oper"].NewRow();
                dr["vcOperID"]   = ops1.strOperID;
                dr["vcOperName"] = ops1.strOperName;
                dr["vcLimit"]    = ops1.strLimit;
                dr["vcPwd"]      = ops1.strPwd;
                dr["vcDeptID"]   = ops1.strDeptID;
                SysInitial.dsSys.Tables["Oper"].Rows.Add(dr);

                MessageBox.Show("添加操作员成功!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
                this.Close();
            }
        }