Exemplo n.º 1
0
        //
        // 添加
        //
        private void btn_Add_Click(object sender, RoutedEventArgs e)
        {
            if (_WTT_Workstation != null && txb_Password.Text != "" && txb_JobNum.Text != "" && txb_UserName.Text != "" && cmb_Privilege.Text != "")
            {
                _WTT_User = new Maticsoft.Model.sysUser()
                {
                    Workstation = _WTT_Workstation.Wo_ID.ToString(),
                    UserName    = txb_UserName.Text,
                    UserID      = txb_JobNum.Text,
                    Password    = txb_Password.Text,
                    Privilege   = cmb_Privilege.Text
                };

                if (_M_User.Add(_WTT_User))
                {
                    My_MessageBox.My_MessageBox_Message("添加成功!");
                    dgv_Source.ItemsSource = _M_User.GetModelList("");
                }
                else
                {
                    My_MessageBox.My_MessageBox_Message("添加失败!");
                }
            }
            else
            {
                My_MessageBox.My_MessageBox_Message("信息不完整!不能进行添加!");
            }
        }
Exemplo n.º 2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtUserID.Text.Trim().Length == 0)
            {
                strErr += "UserID不能为空!\\n";
            }
            if (this.txtUserName.Text.Trim().Length == 0)
            {
                strErr += "UserName不能为空!\\n";
            }
            if (this.txtPassword.Text.Trim().Length == 0)
            {
                strErr += "Password不能为空!\\n";
            }
            if (this.txtWorkstation.Text.Trim().Length == 0)
            {
                strErr += "Workstation不能为空!\\n";
            }
            if (this.txtPrivilege.Text.Trim().Length == 0)
            {
                strErr += "Privilege不能为空!\\n";
            }
            if (!PageValidate.IsDecimal(txtID_Key.Text))
            {
                strErr += "ID_Key格式错误!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            string  UserID      = this.txtUserID.Text;
            string  UserName    = this.txtUserName.Text;
            string  Password    = this.txtPassword.Text;
            string  Workstation = this.txtWorkstation.Text;
            string  Privilege   = this.txtPrivilege.Text;
            decimal ID_Key      = decimal.Parse(this.txtID_Key.Text);

            Maticsoft.Model.sysUser model = new Maticsoft.Model.sysUser();
            model.UserID      = UserID;
            model.UserName    = UserName;
            model.Password    = Password;
            model.Workstation = Workstation;
            model.Privilege   = Privilege;
            model.ID_Key      = ID_Key;

            Maticsoft.BLL.sysUser bll = new Maticsoft.BLL.sysUser();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx");
        }