Пример #1
0
 public void Update(DbContext DbContext,Advice entity)
 {
     EntityState state = DbContext.Entry(entity).State;
        if (state == EntityState.Detached)
        {
       DbContext.Entry(entity).State = EntityState.Modified;
     }
 }
Пример #2
0
 public virtual OperationResult Create(AdviceInfo info)
 {
     OperationResult result = new OperationResult(OperationResultType.Error, "操作失败,请稍后重试!");
     using (var DbContext = new CmsDbContext())
     {
       Advice entity = new Advice();
       DESwap.AdviceDTE(info, entity);
       AdviceRpt.Insert(DbContext, entity);
       DbContext.SaveChanges();
     }
     result.ResultType = OperationResultType.Success;
     result.Message = "操作成功!";
     return result;
 }
Пример #3
0
 public override OperationResult Create(AdviceInfo info)
 {
     OperationResult result = new OperationResult(OperationResultType.Error, "操作失败,请稍后重试!");
     using (var DbContext = new CmsDbContext())
     {
         Advice entity = new Advice();
         DESwap.AdviceDTE(info, entity);
         /*需要设默认值*/
         entity.HandleTime = DateTime.Now;
         AdviceRpt.Insert(DbContext, entity);
         DbContext.SaveChanges();
     }
     result.ResultType = OperationResultType.Success;
     result.Message = "操作成功!";
     return result;
 }
Пример #4
0
 public virtual OperationResult Create(IEnumerable<AdviceInfo> infoList)
 {
     OperationResult result = new OperationResult(OperationResultType.Error, "操作失败,请稍后重试!");
     List<Advice> eList = new List<Advice>();
     infoList.ForEach(x =>
     {
         Advice entity = new Advice();
         DESwap. AdviceDTE(x, entity);
         eList.Add(entity);
     });
     using (var DbContext = new CmsDbContext())
     {
     AdviceRpt.Insert(DbContext, eList);
     DbContext.SaveChanges();
     }
     result.ResultType = OperationResultType.Success;
     result.Message = "操作成功!";
     return result;
 }
Пример #5
0
 public void Insert(DbContext DbContext,Advice entity)
 {
     DbContext.Entry(entity).State = EntityState.Added;
 }
Пример #6
0
 public void Delete(DbContext DbContext,Advice  entity)
 {
     DbContext.Entry(entity).State = EntityState.Deleted;
 }
Пример #7
0
        public static void AdviceDTE(AdviceInfo info, Advice entity)
        {
            if (info._IdIsDirty == 1)
            {
               entity.Id = info.Id;
               info._IdIsDirty = 0;
            }

               if (info._XIsDirty == 1)
            {
               entity.X = info.X;
               info._XIsDirty = 0;
            }

               if (info._YIsDirty == 1)
            {
               entity.Y = info.Y;
               info._YIsDirty = 0;
            }

               if (info._ScaleIsDirty == 1)
            {
               entity.Scale = info.Scale;
               info._ScaleIsDirty = 0;
            }

               if (info._TitleIsDirty == 1)
            {
               entity.Title = info.Title;
               info._TitleIsDirty = 0;
            }

               if (info._DescIsDirty == 1)
            {
               entity.Desc = info.Desc;
               info._DescIsDirty = 0;
            }

               if (info._ContactIsDirty == 1)
            {
               entity.Contact = info.Contact;
               info._ContactIsDirty = 0;
            }

               if (info._ContactMethodIsDirty == 1)
            {
               entity.ContactMethod = info.ContactMethod;
               info._ContactMethodIsDirty = 0;
            }

               if (info._StateIsDirty == 1)
            {
               entity.State = info.State;
               info._StateIsDirty = 0;
            }

               if (info._ProgressLogIsDirty == 1)
            {
               entity.ProgressLog = info.ProgressLog;
               info._ProgressLogIsDirty = 0;
            }

               if (info._ResultIsDirty == 1)
            {
               entity.Result = info.Result;
               info._ResultIsDirty = 0;
            }

               if (info._HandleStaffIdIsDirty == 1)
            {
               entity.HandleStaffId = info.HandleStaffId;
               info._HandleStaffIdIsDirty = 0;
            }

               if (info._HandleStaffNameIsDirty == 1)
            {
               entity.HandleStaffName = info.HandleStaffName;
               info._HandleStaffNameIsDirty = 0;
            }

               if (info._HandleTimeIsDirty == 1)
            {
               entity.HandleTime = info.HandleTime;
               info._HandleTimeIsDirty = 0;
            }

               if (info._SYS_OrderSeqIsDirty == 1)
            {
               entity.SYS_OrderSeq = info.SYS_OrderSeq;
               info._SYS_OrderSeqIsDirty = 0;
            }

               if (info._SYS_IsValidIsDirty == 1)
            {
               entity.SYS_IsValid = info.SYS_IsValid;
               info._SYS_IsValidIsDirty = 0;
            }

               if (info._SYS_IsDeletedIsDirty == 1)
            {
               entity.SYS_IsDeleted = info.SYS_IsDeleted;
               info._SYS_IsDeletedIsDirty = 0;
            }

               if (info._SYS_RemarkIsDirty == 1)
            {
               entity.SYS_Remark = info.SYS_Remark;
               info._SYS_RemarkIsDirty = 0;
            }

               if (info._SYS_StaffIdIsDirty == 1)
            {
               entity.SYS_StaffId = info.SYS_StaffId;
               info._SYS_StaffIdIsDirty = 0;
            }

               if (info._SYS_StationIdIsDirty == 1)
            {
               entity.SYS_StationId = info.SYS_StationId;
               info._SYS_StationIdIsDirty = 0;
            }

               if (info._SYS_DepartmentIdIsDirty == 1)
            {
               entity.SYS_DepartmentId = info.SYS_DepartmentId;
               info._SYS_DepartmentIdIsDirty = 0;
            }

               if (info._SYS_CompanyIdIsDirty == 1)
            {
               entity.SYS_CompanyId = info.SYS_CompanyId;
               info._SYS_CompanyIdIsDirty = 0;
            }

               if (info._SYS_AppIdIsDirty == 1)
            {
               entity.SYS_AppId = info.SYS_AppId;
               info._SYS_AppIdIsDirty = 0;
            }

               if (info._SYS_CreateTimeIsDirty == 1)
            {
               entity.SYS_CreateTime = info.SYS_CreateTime;
               info._SYS_CreateTimeIsDirty = 0;
            }

               if (info._SYS_ModifyTimeIsDirty == 1)
            {
               entity.SYS_ModifyTime = info.SYS_ModifyTime;
               info._SYS_ModifyTimeIsDirty = 0;
            }

               if (info._SYS_DeleteTimeIsDirty == 1)
            {
               entity.SYS_DeleteTime = info.SYS_DeleteTime;
               info._SYS_DeleteTimeIsDirty = 0;
            }
        }