Ejemplo n.º 1
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (nUserId == -1)
         return;
     _initExistFunctions();
     foreach (RepeaterItem oItem in rptItems.Items)
     {
         HtmlInputCheckBox cbSelect = oItem.FindControl("cbSelect") as HtmlInputCheckBox;
         if (null == cbSelect)
             continue;
         int nId = TypeUtil.ParseInt(cbSelect.Value, -1);
         if (nId == -1)
             continue;
         //尽量避免SystemUserFunctionPermission和表SystemRoleFunctionPermission数据产生交集
         if ((!cbSelect.Checked || cbSelect.Disabled) && htExistUserFn.ContainsKey(nId))
         {
             SystemUserFunctionPermission.Delete((int)htExistUserFn[nId]);
         }
         else if (!cbSelect.Disabled && cbSelect.Checked && !htExistUserFn.ContainsKey(nId))
         {
             SystemUserFunctionPermission addItem = new SystemUserFunctionPermission();
             addItem.UserId = nUserId;
             addItem.FunctionId = nId;
             SystemUserFunctionPermission.Save(addItem);
         }
     }
     PageUtil.PageAlert(this.Page, "保存成功!");
     _initForm();
 }
 public static int Save(SystemUserFunctionPermission _Entity)
 {
     int result;
     if (null == _Entity)
     {
         result = -1;
     }
     else
     {
         result = EntityAccess<SystemUserFunctionPermission>.Access.Save(_Entity);
     }
     return result;
 }