예제 #1
0
        public OperationResult UpdatePlanTimeJob(PlanTimeJob planTimeJob)
        {
            Console.WriteLine("PlanScheduleService-UpdatePlanTimeJob({0}): {1}", planTimeJob.ToString(), DateTime.Now);
            try
            {
                planTimeJob.ObjectState = Pattern.Infrastructure.ObjectState.Modified;
                //var _OldJobItem = _planJobItemService.FindBy(x => x.EQID == planTimeJob.EQID && x.IsCreated == false);
                //foreach (var jobitem in _OldJobItem)
                //{
                //    jobitem.ObjectState = Pattern.Infrastructure.ObjectState.Deleted;
                //    _planJobItemService.Delete(jobitem);
                //}
                //foreach (var jobitem in planTimeJob.PlanTimeJob_Items)
                //{
                //    jobitem.ObjectState = Pattern.Infrastructure.ObjectState.Added;
                //    _planJobItemService.Add(jobitem);
                //}

                _planJobService.Update(planTimeJob);
                _unitOfWorkAsync.SaveChanges();
                operationResult.Success = true;
                operationResult.Message = "Update Successed!";
                operationResult.Caption = "Successed!";
            }
            catch (Exception ex)
            {
                operationResult.Success = false;
                operationResult.Message = "There are some things wrong: " + ex.ToString();
                operationResult.Caption = "Error!";
                Loger.Error(ex);
            }
            return(operationResult);
        }
예제 #2
0
        public OperationResult UpdatePlanTimeJob(PlanTimeJob planTimeJob)
        {
            Console.WriteLine("PlanScheduleService-UpdatePlanTimeJob({0}): {1}", planTimeJob.ToString(), DateTime.Now);
            try
            {
                planTimeJob.ObjectState = Pattern.Infrastructure.ObjectState.Modified;

                _planJobService.Update(planTimeJob);
                _unitOfWorkAsync.SaveChanges();
                operationResult.Success = true;
                operationResult.Message = "Update Successed!";
                operationResult.Caption = "Successed!";
            }
            catch (Exception ex)
            {
                operationResult.Success = false;
                operationResult.Message = "There are some things wrong: " + ex.ToString();
                operationResult.Caption = "Error!";
                Loger.Error(ex);
            }
            return(operationResult);
        }