Beispiel #1
0
 public bool EditCorporation(SysCorp syscorp)
 {
     try
     {
         if (syscorp == null)
         {
             return(false);
         }
         if (db.Entry(syscorp).GetValidationResult().IsValid)
         {
             db.Set <SysCorp>().Attach(syscorp);
             db.Entry(syscorp).State = EntityState.Modified;
             if (db.SaveChanges() == 1)
             {
                 return(true);
             }
         }
         return(false);
     }
     catch (Exception ex)
     {
         LogUtil.Exception("ExceptionLogger", ex);
         return(false);
     }
 }
Beispiel #2
0
 public SysPrivilege addPrivilege(SysPrivilege model)
 {
     try
     {
         db.SysPrivilege.Add(model);
         db.SaveChanges();
         return(model);
     }
     catch (Exception ex)
     {
         LogUtil.Exception("ExceptionLogger", ex);
         return(null);
     }
 }
Beispiel #3
0
        public ProcResult Add(TableDownLoad model)
        {
            ProcResult result = new ProcResult();

            try
            {
                db.TableDownLoad.Add(model);
                result.IsSuccess = db.SaveChanges() > 0;
            }
            catch (Exception ex)
            {
                result.ProcMsg = ex.InnerException.Message;
                LogUtil.Exception("ExceptionLogger", ex);
            }
            return(result);
        }
Beispiel #4
0
        public int Add(SysOperator model)
        {
            int result;

            try
            {
                db.SysOperator.Add(model);
                result = db.SaveChanges();
            }
            catch (Exception ex)
            {
                LogUtil.Exception("ExceptionLogger", ex);
                result = 0;
            }
            return(result);
        }
        public bool Add(SysCorpType model)
        {
            int result;

            try
            {
                db.SysCorpType.Add(model);
                result = db.SaveChanges();
            }
            catch (Exception ex)
            {
                result = 0;
                LogUtil.Exception("ExceptionLogger", ex);
            }
            return(result > 0 ? true : false);
        }
Beispiel #6
0
 public bool CancelOrActionRole(long roleId, long @operator)
 {
     try
     {
         var role = _db.SysRole.FirstOrDefault(x => x.ID == roleId);
         if (role == null)
         {
             return(false);
         }
         if (role.Canceler == null && role.CancelTime == null)
         {
             role.Canceler   = @operator;
             role.CancelTime = DateTime.Now;
         }
         else
         {
             role.Canceler   = null;
             role.CancelTime = null;
             role.Creator    = @operator;
             role.CreateTime = DateTime.Now;
         }
         return(_db.SaveChanges() > 0);
     }
     catch (Exception ex)
     {
         LogUtil.Exception("ExceptionLogger", ex);
         return(false);
     }
 }
        public bool AddUserInfo(UserInfo modelList)
        {
            var result = usp.UserInfo.Add(modelList);

            if (usp.SaveChanges() == 1)
            {
                return(true);
            }
            return(false);
        }
 public void create(SysArea area)
 {
     try
     {
         db.SysArea.Add(area);
         db.SaveChanges();
     }
     catch (Exception ex)
     {
         LogUtil.Exception("ExceptionLogger", ex);
     }
 }
 public bool DeleteUserInfo(string GongHao)
 {
     try
     {
         using (USPEntities usp = new USPEntities())
         {
             var models = usp.UserInfo.Where(c => c.员工工号 == GongHao).ToList();
             usp.UserInfo.RemoveRange(models);
             usp.SaveChanges();
         }
         return(true);
     }
     catch (Exception ex)
     {
         LogUtil.Exception("ExceptionLogger", ex);
         return(false);
     }
 }
Beispiel #10
0
        /// <summary>
        /// 审核菜单
        /// </summary>
        /// <param name="id">菜单主键Id</param>
        /// <param name="auditor">操作员Id</param>
        /// <returns>int</returns>
        public int Audit(SysMenu model)
        {
            int result;

            try
            {
                var entity = GetModel(model.ID);
                if (entity != null)
                {
                    entity.Auditor   = model.Auditor;
                    entity.AuditTime = DateTime.Now;
                }
                db.Entry <SysMenu>((SysMenu)entity).State = System.Data.Entity.EntityState.Modified;
                result = db.SaveChanges();
            }
            catch (Exception ex)
            {
                LogUtil.Exception("ExceptionLogger", ex);
                result = 0;
            }
            return(result);
        }