Example #1
0
        /// <summary>
        /// 作用:当单击登录界面的登录按钮,响应事件。
        /// 思路:如果用户身份合法,则给予登录,关闭当前界面并打开主界面;否则提示用户名、密码错误。
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>

        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (CheckText())
            {
                if (this.cmb_ImgEquipment.Text.ToString() != GetConfig.ImgEquipment)
                {
                    GetConfig.SetImgEquipment(this.cmb_ImgEquipment.Text.ToString());        //回写配置文件默认的机器名
                    GetConfig.ImgEquipment = this.cmb_ImgEquipment.Text.ToString();
                }
                if (CheckUser())
                {
                    try
                    {
                        BUser buser = new BUser();
                        this.user = buser.GetModel(this.txt_DoctorId.Text.Trim().ToString());    //获取该用户信息
                    }
                    catch (Exception ex)
                    {
                        MessageBoxEx.Show(ex.Message);
                    }
                    this.Visible = false;
                    frmMainForm fp = new frmMainForm(this.user);
                    fp.Show();
                }
                else
                {
                    MessageBoxEx.Show("用户名、密码不正确,请重新输入!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    this.txt_Pwd.Text = "";
                    this.txt_Pwd.Focus();
                }
            }
        }
Example #2
0
        private void txtCompanyCode_Leave(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(this.txtCompanyCode.Text.Trim()))
            {
                BaseMaster baseMaster = bCommon.GetBaseMaster("COMPANY", this.txtCompanyCode.Text.Trim(), "");
                if (baseMaster != null)
                {
                    txtCompanyCode.Text = baseMaster.Code;
                    txtCompanyName.Text = baseMaster.Name;
                }
                else
                {
                    txtCompanyCode.Focus();
                    txtCompanyCode.Text = "";
                    txtCompanyName.Text = "";
                    MessageBox.Show("公司编号不存在,请重新输入!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            else
            {
                txtCompanyName.Text = "";
            }

            if (!string.IsNullOrEmpty(this.txtCode.Text.Trim()) && !string.IsNullOrEmpty(this.txtCompanyCode.Text.Trim()))
            {
                BaseUserTable UserCode = new BaseUserTable();
                UserCode = bUser.GetModel((txtCompanyCode.Text + txtCode.Text), txtCompanyCode.Text);
                if (UserCode != null)
                {
                    txtCode.Focus();
                    txtCode.Text        = "";
                    txtCompanyCode.Text = "";
                    txtCompanyName.Text = "";
                    MessageBox.Show("用户已存在,请重新输入!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }
Example #3
0
        /// <summary>
        /// 获得当前选中的数据
        /// </summary>
        private void GetCurrentSelectedTable()
        {
            try
            {
                string code    = dgvData.SelectedRows[0].Cells["CODE"].Value.ToString();
                string company = bUser.GetCompany(dgvData.SelectedRows[0].Cells[5].Value.ToString());
                if (code != "")
                {
                    _currentUserTable = bUser.GetModel(code, company);
                }
            }
            catch (Exception ex) { }

            if (_currentUserTable == null || _currentUserTable.CODE == null || "".Equals(_currentUserTable.CODE))
            {
                _currentUserTable = null;
            }
        }
Example #4
0
        /// <summary>
        /// 检查新增用户
        /// </summary>
        /// <returns></returns>
        private bool CheckAdd()
        {
            bool   checkAdd = false;
            string str      = "";

            for (int i = rowcount; i <= dgv_UserManage.Rows.Count; i++)
            {
                if (BUse.GetModel(dgv_UserManage.Rows[i - 1].Cells["DOCTOR_ID"].Value.ToString().Trim()) != null)
                {
                    str += dgv_UserManage.Rows[i - 1].Cells["DOCTOR_ID"].Value.ToString().Trim() + " ";
                }
            }
            if (str == "")
            {
                checkAdd = true;
            }
            else
            {
                MessageBoxEx.Show("编号为 " + str + " 的用户已存在!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            return(checkAdd);
        }
Example #5
0
        /// <summary>
        /// 更新放射科的用户信息
        /// </summary>
        private void UpdatePACSUser()
        {
            BUser buser = new BUser();

            PACS_Model.MUser user = (PACS_Model.MUser)buser.GetModel(this.tx_LoginName.Text.Trim());
            if (user == null)
            {
                MessageBoxEx.Show("输入的工号不存在,请检查!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                if (user.USER_PWD != this.tx_OldPwd.Text.Trim())
                {
                    MessageBoxEx.Show("旧密码不正确!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    user.USER_PWD = this.tx_NewPwd.Text.Trim();
                    buser.Update((ILL.IModel)user, " where DB_USER='******'");
                    MessageBoxEx.Show("修改密码成功,请记住您的新密码!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    this.Close();
                }
            }
        }
Example #6
0
        /// <summary>
        /// 登录验证
        /// </summary>
        private void login()
        {
            this.Cursor = Cursors.WaitCursor;
            string strErrorlog = string.Empty;
            string _errorLog   = string.Empty;

            try
            {
                BUser         buser = new BUser();
                BaseUserTable tuser = new BaseUserTable();
                if (string.IsNullOrEmpty(this.txtLoginUserCode.Text.Trim()))
                {
                    strErrorlog = "登录名不能为空!";
                    this.txtLoginUserCode.Focus();
                    this.txtLoginUserCode.Select();
                    MessageBox.Show(strErrorlog, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Cursor = Cursors.Default;
                    return;
                }
                tuser = buser.GetModel(CConvert.ToString(cboCompany.SelectedValue) + this.txtLoginUserCode.Text.Trim(), CConvert.ToString(cboCompany.SelectedValue));
                //用户名验证
                if (null == tuser)
                {
                    strErrorlog = "登录名不存在或密码错误!";
                    _errorLog   = "登录名不存在!";
                    this.txtLoginUserCode.Focus();
                }
                //公司验证
                else if (tuser.COMPANY_CODE != CConvert.ToString(cboCompany.SelectedValue))
                {
                    strErrorlog = "登录名不存在或密码错误!";
                    _errorLog   = "公司与登录名不符合!";
                    this.txtLoginUserCode.Focus();
                }
                else
                {
                    //密码验证
                    if (DESEncrypt.Encrypt(this.txtLoginPassword.Text.Trim()) != tuser.PASSWORD)
                    {
                        strErrorlog = "登录名不存在或密码错误!";
                        _errorLog   = "密码错误!";
                        this.txtLoginPassword.Focus();
                    }
                }
                if (!string.IsNullOrEmpty(strErrorlog))
                {
                    MessageBox.Show(strErrorlog, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    strErrorlog += "  " + this.txtLoginUserCode.Text.Trim();
                }
                else
                {
                    if (null != _mainWin)
                    {
                        _mainWin.Die();
                        if (_mainWin.IsHandleCreated)
                        {
                            this.Hide();
                            return;
                        }
                    }

                    FrmMain mainForm = new FrmMain(tuser);
                    this.Hide();
                    mainForm.Show();
                    _mainWin  = mainForm;
                    _errorLog = "登录成功!";
                }
                //new BBaseLogs().Info(UserConstants.LOG_MODE_LOGIN, strErrorlog, tuser.USERID);
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); //
                Logger.Error("数据库连接失败!", err);
                this.Cursor = Cursors.Default;
                ShowDBConfig();
            }
            this.Cursor = Cursors.Default;
        }