Esempio n. 1
0
        /// <summary>
        /// 修改密码
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnOk_Click(object sender, EventArgs e)
        {
            String usercode = textBox1.Text.Trim();
            String password = textBox2.Text.Trim();

            if (String.IsNullOrEmpty(usercode))
            {
                MessageBox.Show("用户名不能为空!", "系统提示");
                textBox1.Focus();
                return;
            }
            if (String.IsNullOrEmpty(password))
            {
                MessageBox.Show("密码不能为空!", "系统提示");
                textBox2.Focus();
                return;
            }
            //连接后台数据库判断本用户是否存在!
            //连接后台数据库判断本用户是否存在!
            SYS_USERS users = userbll.Get(usercode);

            try
            {
                if (users == null)
                {
                    MessageBox.Show("用户名或者密码错误!", "系统提示");
                    textBox2.Focus();
                    return;
                }
                else
                {
                    if (password != users.PASSWORD)
                    {
                        MessageBox.Show("用户名或者密码错误!", "系统提示");
                        textBox2.Focus();
                        return;
                    }
                    else
                    {
                        globalInfoClass.PassWord  = users.PASSWORD;     //赋值用户密码
                        globalInfoClass.UserCode  = users.USER_CODE;    //赋值用户编码
                        globalInfoClass.UserName  = users.USER_NAME;    //赋值用户姓名
                        globalInfoClass.UserType  = users.USER_TYPE;    //赋值用户类型,判断权限
                        globalInfoClass.Pre_Max   = (int)users.PRE_MAX; //赋值用户类型,判断权限
                        globalInfoClass.User_Role = users.ROLE_CODE;    //赋值用户类型,判断权限
                        this.DialogResult         = DialogResult.OK;    //跳转到主窗体控件
                        this.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
            }
            this.DialogResult = DialogResult.OK;//跳转到主窗体控件
            this.Close();
        }
Esempio n. 2
0
        //删除数据
        private void button2_Click(object sender, EventArgs e)
        {
            if (dgvConditionTreatRecordList.SelectedRows.Count >= 1)
            {
                SYS_USERS userobj = dgvConditionTreatRecordList.SelectedRows[0].Tag as SYS_USERS;

                if (MessageBox.Show("删除所选的记录?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
                {
                    Cursor.Current = Cursors.WaitCursor;
                    try
                    {
                        if (bll.Delete(userobj))
                        {
                            jiazaiList();
                        }
                        else
                        {
                            MessageBox.Show("删除失败!", "请联系管理员");
                        }
                    }
                    finally
                    {
                        Cursor.Current = Cursors.Default;
                    }
                }
            }
            else
            {
                MessageBox.Show("请选择要的删除的行!", "系统提示");
            }
        }
Esempio n. 3
0
 //重置密码,123
 private void button3_Click(object sender, EventArgs e)
 {
     if (dgvConditionTreatRecordList.SelectedRows.Count >= 1)
     {
         SYS_USERS userobj = dgvConditionTreatRecordList.SelectedRows[0].Tag as SYS_USERS;
         if (MessageBox.Show("是否重置所选的记录?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
         {
             Cursor.Current = Cursors.WaitCursor;
             try
             {
                 userobj.PASSWORD = "******";
                 if (bll.Update(userobj))
                 {
                     MessageBox.Show("重置成功", "软件提示");
                     jiazaiList();
                 }
                 else
                 {
                     MessageBox.Show("重置失败", "软件提示");
                 }
             }
             finally
             {
                 Cursor.Current = Cursors.Default;
             }
         }
     }
 }
Esempio n. 4
0
 //双击记录数据
 private void dgvConditionTreatRecordList_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex >= 0)
     {
         SYS_USERS     userobj  = dgvConditionTreatRecordList.Rows[0].Tag as SYS_USERS;
         sys_user_edit useredit = new sys_user_edit(-1, userobj, this);
         useredit.ShowDialog();
     }
 }
Esempio n. 5
0
 public sys_user_edit(int rowindex, SYS_USERS userobj, sys_user_list yonghuguanli)
 {
     InitializeComponent();
     userlist = yonghuguanli;
     _userobj = userobj;
     if (rowindex != -1)
     {
         DataGridViewRow row = userlist.dgvConditionTreatRecordList.Rows[rowindex];
         _userobj = (SYS_USERS)row.Tag;
     }
 }
Esempio n. 6
0
 //修改数据
 private void button1_Click(object sender, EventArgs e)
 {
     if (dgvConditionTreatRecordList.SelectedRows.Count >= 1)
     {
         SYS_USERS     userobj  = dgvConditionTreatRecordList.SelectedRows[0].Tag as SYS_USERS;
         sys_user_edit useredit = new sys_user_edit(-1, userobj, this);
         useredit.ShowDialog();
     }
     else
     {
         MessageBox.Show("请选择要修改的行!", "系统提示");
     }
 }
Esempio n. 7
0
        //批量修改角色
        private void button4_Click(object sender, EventArgs e)
        {
            IList <int> list = new List <int>();

            for (int i = 0; i < dgvConditionTreatRecordList.Rows.Count; i++)
            {
                SYS_USERS userobj      = dgvConditionTreatRecordList.Rows[i].Tag as SYS_USERS;
                string    _selectValue = dgvConditionTreatRecordList.Rows[i].Cells["Column6"].EditedFormattedValue.ToString();
                if (_selectValue == "True")
                {
                    list.Add((int)userobj.ID);
                }
            }
            int[] ids = new int[list.Count];
            list.CopyTo(ids, 0);
            sys_user_roles upusersrole = new sys_user_roles(ids, this);

            upusersrole.ShowDialog();
        }
Esempio n. 8
0
        //批量修改角色
        private void button1_Click(object sender, EventArgs e)
        {
            SYS_USERS userobj = new SYS_USERS();

            userobj.ROLE_CODE = comboBox1.SelectedValue.ToString();
            foreach (var id in _ids)
            {
                idList.Add(id);
            }
            if (bll.UpdateByIds(userobj, idList))
            {
                MessageBox.Show("修改成功", "软件提示");
                _yonghuguanli.jiazaiList();
                this.Close();//本窗口关闭
            }
            else
            {
                MessageBox.Show("修改失败", "软件提示");
            }
        }
Esempio n. 9
0
        /// <summary>
        /// 验证登录方法
        /// </summary>
        private void Login()
        {
            String usercode = textBox1.Text.Trim();
            String password = textBox2.Text.Trim();
            string hospital = this.hospital.Text.Trim();

            if (String.IsNullOrEmpty(usercode))
            {
                MessageBox.Show("用户名不能为空!", "系统提示");
                textBox1.Focus();
                return;
            }
            if (String.IsNullOrEmpty(password))
            {
                MessageBox.Show("密码不能为空!", "系统提示");
                textBox2.Focus();
                return;
            }
            //if (string.IsNullOrEmpty(hospital))
            //{
            //    MessageBox.Show("请选择院区!", "系统提示");
            //    this.hospital.Focus();
            //    return;
            //}
            //连接后台数据库判断本用户是否存在!
            SYS_USERS users = userbll.Get(usercode);

            try
            {
                if (users == null)
                {
                    MessageBox.Show("用户名或者密码错误!", "系统提示");
                    textBox2.Focus();
                    return;
                }
                else
                {
                    if (password != users.PASSWORD)
                    {
                        MessageBox.Show("用户名或者密码错误!", "系统提示");
                        textBox2.Focus();
                        return;
                    }
                    else
                    {
                        globalInfoClass.PassWord  = users.PASSWORD;     //赋值用户密码
                        globalInfoClass.UserCode  = users.USER_CODE;    //赋值用户编码
                        globalInfoClass.UserName  = users.USER_NAME;    //赋值用户姓名
                        globalInfoClass.UserType  = users.USER_TYPE;    //赋值用户类型,判断权限
                        globalInfoClass.Pre_Max   = (int)users.PRE_MAX; //赋值用户类型,判断权限
                        globalInfoClass.User_Role = users.ROLE_CODE;    //赋值用户类型,判断权限
                        globalInfoClass.Ward_name = users.WARD_NAME;
                        globalInfoClass.Zhicheng  = users.ZHICHENG;
                        globalInfoClass.Zhiwu     = users.ZHIWU;
                        //globalInfoClass.Hospital = "礼嘉分院";//this.hospital.Text.Trim();
                        textBox1.Text = OperatFile.SetIniFileString("HospitalInfo", "hospital_name", hospital, Application.StartupPath + "\\hospitalinfo.ini");

                        this.DialogResult = DialogResult.OK;//跳转到主窗体控件
                        this.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
            }
            this.DialogResult = DialogResult.OK;//跳转到主窗体控件
            this.Close();
        }
Esempio n. 10
0
        //保存按钮
        private void button1_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(user_code.Text.Trim()))
            {
                MessageBox.Show("账户不能为空!", "系统提示");
                user_code.Focus();
                return;
            }
            else if (String.IsNullOrEmpty(user_name.Text.Trim()))
            {
                MessageBox.Show("姓名不能为空!", "系统提示");
                user_code.Focus();
                return;
            }
            else if (String.IsNullOrEmpty(role_code.Text.Trim()))
            {
                MessageBox.Show("角色不能为空!", "系统提示");
                user_code.Focus();
                return;
            }
            else if (String.IsNullOrEmpty(dept_name.Text.Trim()))
            {
                MessageBox.Show("科室不能为空!", "系统提示");
                user_code.Focus();
                return;
            }
            else if (String.IsNullOrEmpty(zhiwu.Text.Trim()))
            {
                MessageBox.Show("职务不能为空!", "系统提示");
                zhiwu.Focus();
                return;
            }
            else if (String.IsNullOrEmpty(ward_name.Text.Trim()))
            {
                MessageBox.Show("地点不能为空!", "系统提示");
                ward_name.Focus();
                return;
            }

            SYS_USERS userobj = CommonHelper.GetObj <SYS_USERS>(this.Controls);

            userobj.ROLE_CODE = role_code.SelectedValue.ToString();

            if (_userobj == null)
            {
                userobj.PASSWORD  = "******";
                userobj.PRE_MAX   = 20;
                userobj.USER_TYPE = "2";
                SYS_USERS obj = bll.Get(user_code.Text.Trim());
                if (obj != null)
                {
                    MessageBox.Show("该账户已存在!", "系统提示");
                    user_code.Focus();
                    return;
                }
            }
            else
            {
                userobj.ID        = _userobj.ID;
                userobj.PASSWORD  = _userobj.PASSWORD;
                userobj.USER_TYPE = _userobj.USER_TYPE;
                userobj.PRE_MAX   = _userobj.PRE_MAX;
                userobj.WARD_ID   = _userobj.WARD_ID;
            }

            if (bll.SaveOrUpdate(userobj))
            {
                MessageBox.Show("保存成功", "软件提示");
                userlist.jiazaiList();
                this.Close();//本窗口关闭
            }
            else
            {
                MessageBox.Show("保存失败", "软件提示");
            }
        }