Beispiel #1
0
        public async Task <bool> DumpOne()
        {
            var info = WorkItemInfos.Pop();

            if (info == null)
            {
                return(false);
            }
            var item = _repository.FirstOrDefault(x => x.SerialNumber == info.SerialNumber);

            if (item != null)
            {
                if (item.State == WorkItemState.Finished)
                {
                    item.FinishTime = info.FinishTime;
                    item.State      = info.StateDescription.GetEnumType <WorkItemState>();
                    item.Cause      = info.CauseDescription.GetEnumType <WorkItemCause>();
                    item.ENodebId   = info.ENodebId;
                    item.SectorId   = info.SectorId;
                    item.Comments   = info.Comments;
                    await _repository.UpdateAsync(item);
                }
            }
            else
            {
                await _repository.InsertAsync(Mapper.Map <WorkItemExcel, WorkItem>(info));
            }
            _repository.SaveChanges();
            return(true);
        }
Beispiel #2
0
        public virtual WorkItem Add(WorkItem workItem)
        {
            workItem.State = string.IsNullOrWhiteSpace(workItem.ExecutorId) ? WorkItemState.New : WorkItemState.Planned;
            var item = _repository.Add(workItem);

            _repository.SaveChanges();
            return(item);
        }