コード例 #1
0
ファイル: RoleAdmin.cs プロジェクト: huaminglee/myyyyshop
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (this.txtRoleName.Text.Trim().Length <= 0)
     {
         MessageBox.ShowFailTip(this, SysManage.ErrorRoleIsNull);
     }
     else
     {
         try
         {
             Role role = new Role();
             if (!role.RoleExists(this.txtRoleName.Text.Trim()))
             {
                 role.Description = this.txtRoleName.Text;
                 role.Create();
                 LogHelp.AddUserLog(base.CurrentUser.UserName, base.CurrentUser.UserType, string.Format("添加角色:【{0}】", this.txtRoleName.Text), this);
                 MessageBox.ShowSuccessTip(this, Site.TooltipSaveOK);
             }
             else
             {
                 MessageBox.ShowFailTip(this, Site.TooltipDataExist);
             }
         }
         catch (Exception exception)
         {
             this.lblToolTip.Text = exception.Message;
             return;
         }
         this.txtRoleName.Text = "";
         this.dataBind();
     }
 }
コード例 #2
0
ファイル: RoleAdmin.aspx.cs プロジェクト: bookxiao/orisoft
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if(txtRoleName.Text.Trim().Length<=0)
     {
         Maticsoft.Common.MessageBox.Show(this,"角色为空不能保存");
         return;
     }
     Role role = new Role();
     role.Description = txtRoleName.Text;
     try
     {
         role.Create();
         Maticsoft.Common.MessageBox.Show(this, Resources.Site.TooltipSaveOK);
     }
     catch(Exception ex)
     {
         lblToolTip.Text = ex.Message;
         return;
     }
     txtRoleName.Text = "";
     dataBind();
 }