Ejemplo n.º 1
0
 public static new int Insert(Sys_Item model)
 {
     if (model.SIParentId > 0)
     {
         var parent = ItemAccess.Get(model.SIParentId);
         model.SILayer = parent == null ? 0 : (parent.SILayer + 1);
     }
     model.SIIsEnabled  = 1;
     model.SIDeleteMark = 0;
     model.SICreateUser = OperatorProvider.Instance.Current.UserId;
     model.SICreateTime = DateTime.Now;
     model.SIModifyUser = model.SICreateUser;
     model.SIModifyTime = model.SICreateTime;
     return(ItemAccess.Insert(model));
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static new int Update(Sys_Item model)
        {
            if (model.SIParentId > 0)
            {
                var parent = ItemAccess.Get(model.SIParentId);
                model.SILayer = parent == null ? 0 : (parent.SILayer + 1);
            }
            model.SIModifyUser = OperatorProvider.Instance.Current.UserId;
            model.SIModifyTime = DateTime.Now;
            var updateColumns = new List <Sys_ItemFields>()
            {
                Sys_ItemFields.SIParentId, Sys_ItemFields.SILayer, Sys_ItemFields.SIEnCode
                , Sys_ItemFields.SIName, Sys_ItemFields.SISortCode, Sys_ItemFields.SIIsEnabled
                , Sys_ItemFields.SIRemark, Sys_ItemFields.SIModifyUser, Sys_ItemFields.SIModifyTime
            };

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