Example #1
0
 public static new int Insert(Sys_Permission model)
 {
     if (model.SPParentId > 0)
     {
         var parent = PermissionAccess.Get(model.SPParentId);
         model.SPLayer = parent == null ? 0 : (parent.SPLayer + 1);
     }
     model.SPIsEnabled  = 1;
     model.SPDeleteMark = 0;
     model.SPCreateUser = OperatorProvider.Instance.Current.UserId;
     model.SPCreateTime = DateTime.Now;
     model.SPModifyUser = model.SPCreateUser;
     model.SPModifyTime = model.SPCreateTime;
     return(PermissionAccess.Insert(model));
 }
Example #2
0
        public static new int Update(Sys_Permission model)
        {
            if (model.SPParentId > 0)
            {
                var parent = PermissionAccess.Get(model.SPParentId);
                model.SPLayer = parent == null ? 0 : (parent.SPLayer + 1);
            }
            model.SPModifyUser = OperatorProvider.Instance.Current.UserId;
            model.SPModifyTime = DateTime.Now;
            var updateColumns = new List <Sys_PermissionFields>()
            {
                Sys_PermissionFields.SPParentId, Sys_PermissionFields.SPLayer, Sys_PermissionFields.SPEnCode
                , Sys_PermissionFields.SPName, Sys_PermissionFields.SPJsEvent, Sys_PermissionFields.SPIcon
                , Sys_PermissionFields.SPUrl, Sys_PermissionFields.SPRemark, Sys_PermissionFields.SPType
                , Sys_PermissionFields.SPSortCode, Sys_PermissionFields.SPIsPublic, Sys_PermissionFields.SPIsEnabled
                , Sys_PermissionFields.SPIsEdit, Sys_PermissionFields.SPModifyUser, Sys_PermissionFields.SPModifyTime
            };

            return(PermissionAccess.Update(model, updateColumns));
        }