コード例 #1
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (txtID.Text.Trim().Length < 1)
            {
                txtID.Focus();
                MsgBoxEx.Info("Please input ID");
                return;
            }

            if (txtName.Text.Trim().Length < 1)
            {
                txtName.Focus();
                MsgBoxEx.Info("Please input name");
                return;
            }

            IsysService service = sysService.GetService();
            string      res     = "";

            if (IsAdd)
            {
                res = service.AddUser(Guid.NewGuid().ToString("N").ToUpper(), txtID.Text.Trim(), txtPwd.Text.Trim(),
                                      txtName.Text.Trim(), txtPhone.Text.Trim(), txtEmail.Text.Trim(), txtRemark.Text.Trim(), (cbxRereview.Checked ? "1" : "0"), DataCache.UserInfo.ID);
            }
            else
            {
                res = service.UpdateUser(tbUser.ID, txtID.Text.Trim(), txtPwd.Text.Trim(),
                                         txtName.Text.Trim(), txtPhone.Text.Trim(), txtEmail.Text.Trim(), txtRemark.Text.Trim(), (cbxRereview.Checked ? "1" : "0"), DataCache.UserInfo.ID);
            }

            if (res != "1")
            {
                MsgBoxEx.Info(res);
                return;
            }

            DialogResult = DialogResult.OK;
        }