Ejemplo n.º 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);
        }