예제 #1
0
        public JsonResult ConfirmOrderTmc(LimsTmcOutView outCount)
        {
            OrderTmcRepository repository = new OrderTmcRepository(false);

            // берем у ТМЦ
            var ownerId = outCount.OwnerEmployeeId;

            if (outCount.OwnerEmployeeId == null)
            {
                var tmcRepo = new TmcRepository(false);
                ownerId = tmcRepo.GetAsQuarable(t => t.Id == outCount.TmcId).Select(t => t.OwnerEmployeeId).FirstOrDefault();
            }


            TmcOut tmcOut = new TmcOut()
            {
                Id                = Guid.NewGuid(),
                Note              = outCount.Note,
                CreatedDate       = DateTime.Now,
                CreatedEmployeeId = UserHelper.GetCurrentEmployee().Id,
                StateType         = TmcOut.TmcOutStatuses.Ordered,
                OwnerEmployeeId   = ownerId,
                OutTypeDicId      = outCount.OutTypeDicId
            };

            repository.Insert(tmcOut);

            TmcOutCount tmcOutCount = new TmcOutCount()
            {
                Id       = Guid.NewGuid(),
                TmcId    = outCount.TmcId,
                Count    = outCount.Count,
                Note     = outCount.Note,
                TmcOutId = tmcOut.Id
            };

            repository.TocInsert(tmcOutCount);

            repository.Save();
            return(Json(outCount.TmcId, JsonRequestBehavior.AllowGet));
        }
예제 #2
0
        public ActionResult CreateRequestChildrens([DataSourceRequest] DataSourceRequest request, TmcOutCountViewModel dictionary)
        {
            TmcOutCount tmc = new TmcOutCount()
            {
                Id        = Guid.NewGuid(),
                StateType = dictionary.StateType,
                Note      = dictionary.Note,
                CountFact = dictionary.CountFact,
                Count     = dictionary.Count,
                TmcOutId  = Guid.Parse(dictionary.TmcOutIdString)
            };

            if (dictionary.TmcId != null)
            {
                tmc.TmcId = dictionary.TmcId.Value;
            }

            db.TmcOutCounts.Add(tmc);
            db.SaveChanges();
            dictionary.Id = tmc.Id;


            return(Json(new[] { dictionary }.ToDataSourceResult(request, ModelState)));
        }
예제 #3
0
 public void TocUpdate(TmcOutCount entityToUpdate)
 {
     TmcOutCountSet.Attach(entityToUpdate);
     AppContext.Entry(entityToUpdate).State = EntityState.Modified;
 }
예제 #4
0
        public void TocDelete(object id)
        {
            TmcOutCount entityToDelete = TmcOutCountSet.Find(id);

            TocUpdate(entityToDelete);
        }
예제 #5
0
 public void TocInsert(TmcOutCount entity)
 {
     TmcOutCountSet.Add(entity);
 }