示例#1
0
 public void btnSave_Click(object sender, EventArgs e)
 {
     UserType type = new UserType();
     string s = this.txtUserType.Text.Trim();
     if (Encoding.GetEncoding("gb2312").GetBytes(s).Length > 2)
     {
         MessageBox.ShowFailTip(this, "输入的用户类型不能超过两个字符");
     }
     else
     {
         string str2 = this.txtDescription.Text.Trim();
         if (!string.IsNullOrWhiteSpace(s) && !string.IsNullOrWhiteSpace(str2))
         {
             string msg = "";
             DataSet list = type.GetList("UserType='" + s + "'");
             if ((list != null) && (list.Tables[0].Rows.Count > 0))
             {
                 msg = msg + Site.TooltipUserTypeExist;
             }
             if (msg != "")
             {
                 MessageBox.ShowSuccessTip(this, msg);
             }
             else
             {
                 type.Add(s, str2);
                 LogHelp.AddUserLog(base.CurrentUser.UserName, base.CurrentUser.UserType, string.Format("添加用户类别用户类别:【{0}】", s), this);
                 MessageBox.ResponseScript(this, "parent.location.href='UserTypeAdmin.aspx'");
             }
         }
     }
 }
示例#2
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     Maticsoft.Accounts.Bus.UserType type = new Maticsoft.Accounts.Bus.UserType();
     string str = this.txtUserType.Text.Trim();
     string str2 = this.txtDescription.Text.Trim();
     if (!string.IsNullOrWhiteSpace(str) && !string.IsNullOrWhiteSpace(str2))
     {
         type.Update(str, str2);
         LogHelp.AddUserLog(base.CurrentUser.UserName, base.CurrentUser.UserType, string.Format("编辑用户类别用户类别:【{0}】", str), this);
         this.btnCancle.Enabled = false;
         this.btnSave.Enabled = false;
         MessageBox.ResponseScript(this, "parent.location.href='UserTypeAdmin.aspx'");
     }
 }