示例#1
0
        private void btn_Ok_Click(object sender, EventArgs e)
        {
            if(_viewType=="Add")
            {
                if(dxValidationProvider1.Validate())
                {
                    var userBll = new BLL.User();
                    _user=new User
                              {
                                  Department = txt_Department.Text.Trim(),
                                  Name = txt_Name.Text.Trim(),
                                  Password = Common.DEncrypt.DESEncrypt.Encrypt(txt_Password.Text.Trim()),
                                  Phone = txt_Phone.Text.Trim(),
                                  Remark = txt_Remark.Text,
                                  Tel = txt_Remark.Text.Trim(),
                                  Type = commbox_UserRole.SelectedIndex,
                                  Username = txt_Username.Text.Trim()
                              };
                    var userId = userBll.Add(_user);
                    if(userId>0)
                    {
                        _user.Id = userId;
                        XtraMessageBox.Show("添加成功!", "提示");
                        DialogResult = DialogResult.OK;
                    }
                    }
                    else
                    {
                        XtraMessageBox.Show("添加失败!", "提示");
                    }

            }
            else if(_viewType=="Edit")
            {
                if (dxValidationProvider1.Validate())
                {
                    var userBll = new BLL.User();
                    _user.Department = txt_Department.Text.Trim();
                    if(txt_Password.Text.Trim()!="")
                    {
                        _user.Password = Common.DEncrypt.DESEncrypt.Encrypt(txt_Password.Text.Trim());
                    }
                    _user.Phone = txt_Phone.Text.Trim();
                    _user.Remark = txt_Remark.Text;
                    _user.Tel = txt_Remark.Text.Trim();
                    _user.Type = commbox_UserRole.SelectedIndex;
                    _user.Username = txt_Username.Text.Trim();
                    if(userBll.Update(_user))
                    {
                        XtraMessageBox.Show("编辑成功!", "提示");
                        DialogResult = DialogResult.OK;
                    }
                    else
                    {
                        XtraMessageBox.Show("编辑失败!", "提示");
                    }

                }
            }
        }
示例#2
0
文件: MainForm.cs 项目: zfc317/mscd
 public MainForm(Workspace workspace,User user)
 {
     this.Visible = false;
     InitializeComponent();
     _workspace = workspace;
     _user = user;
 }
示例#3
0
 public DlgUserInfo(User user,string viewType)
 {
     InitializeComponent();
     _user = user;
     _viewType = viewType;
     InitForm();
 }