Пример #1
0
 protected void btnSave_ServerClick(object sender, EventArgs e)
 {
     string strRoleName = txt_Name.Value.Trim();
     string strRemark = txt_Description.Value.Trim();
     if (SystemRole.Exist(strRoleName))
     {
         if (nId <= 0)
         {
             PageUtil.PageAlert(this.Page, string.Format("角色“{0}”已存在!", strRoleName));
             return;
         }
         else
         {
             SystemRole oExist = SystemRole.Get(nId);
             if (strRoleName != oExist.Name)
             {
                 PageUtil.PageAlert(this.Page, string.Format("角色“{0}”已存在!", strRoleName));
                 return;
             }
         }
     }
     SystemRole addItem = SystemRole.Get(nId);
     if (null == addItem)
     {
         addItem = new SystemRole();
     }
     addItem.Name = strRoleName;
     addItem.Description = strRemark;
     int nNewId = SystemRole.Save(addItem);
     PageUtil.PageAlert(this.Page, nNewId > 0 ? "保存成功!" : "保存失败!");
     PageUtil.PageClosePopupWindow(this.Page, true);
 }
Пример #2
0
 public static int Save(SystemRole _Entity)
 {
     int result;
     if (null == _Entity)
     {
         result = -1;
     }
     else
     {
         result = EntityAccess<SystemRole>.Access.Save(_Entity);
     }
     return result;
 }