示例#1
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (nFunctionId <= 0 || nRoleId <= 0)
         return;
     _InitExistPermission();
     foreach (ListItem cbSel in cbl_Actions.Items)
     {
         int nId = TypeUtil.ParseInt(cbSel.Value, 0);
         if (!cbSel.Selected && htAction.ContainsKey(nId))
         {
             SystemRoleActionPermission.Delete(((SystemRoleActionPermission)htAction[nId]).Id);
         }
         else if (cbSel.Selected && !htAction.ContainsKey(nId))
         {
             SystemRoleActionPermission oAdd = new SystemRoleActionPermission();
             oAdd.ActionId = nId;
             oAdd.RoleId = nRoleId;
             oAdd.FunctionId = nFunctionId;
             SystemRoleActionPermission.Save(oAdd);
         }
     }
     _InitAction();
     PageUtil.PageAlert(this.Page, "保存成功!");
 }
 public static SystemRoleActionPermission[] GetRoleActions(int _nRoleId, int _nFunctionId)
 {
     SystemRoleActionPermission[] result;
     if (_nRoleId <= 0 || _nFunctionId <= 0)
     {
         result = null;
     }
     else
     {
         SystemRoleActionPermission oGet = new SystemRoleActionPermission();
         oGet.RoleId = _nRoleId;
         oGet.FunctionId = _nFunctionId;
         result = EntityAccess<SystemRoleActionPermission>.Access.List(oGet);
     }
     return result;
 }
 public static int Save(SystemRoleActionPermission _Entity)
 {
     int result;
     if (null == _Entity)
     {
         result = -1;
     }
     else
     {
         result = EntityAccess<SystemRoleActionPermission>.Access.Save(_Entity);
     }
     return result;
 }