예제 #1
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("修改失败", "软件提示");
            }
        }
예제 #2
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("保存失败", "软件提示");
            }
        }