Пример #1
0
        public JsonResult Update(LimsTmcOutView model)
        {
            // if (ModelState.IsValid)
            // {
            OrderTmcRepository repository = new OrderTmcRepository();

            TmcOut m = repository.GetById(model.TmcOutId);

            m.Note            = model.Note;
            m.OutTypeDicId    = model.OutTypeDicId;
            m.OwnerEmployeeId = model.OwnerEmployeeId;
            repository.Update(m);

            TmcOutCount mcount = repository.TmcOutCountGetAsQuarable(toc => toc.Id == model.Id).FirstOrDefault();

            if (mcount != null)
            {
                mcount.Count = model.Count;
                repository.Update(m);
            }

            repository.Save();
            // }

            return(Json(model, JsonRequestBehavior.AllowGet));
        }
Пример #2
0
        public ActionResult CreateRequest([DataSourceRequest] DataSourceRequest request, TmcOutViewModel dictionary)
        {
            TmcOut tmcOut = new TmcOut()
            {
                Id                = Guid.NewGuid(),
                StateType         = dictionary.StateType,
                Note              = dictionary.Note,
                OutTypeDicId      = dictionary.OutTypeDicId,
                CreatedDate       = DateTime.Now,
                CreatedEmployeeId = UserHelper.GetCurrentEmployee().Id,
                StorageDicId      = dictionary.StorageDicId,
                OwnerEmployeeId   = dictionary.OwnerEmployeeId,
                Safe              = dictionary.Safe,
                Rack              = dictionary.Rack,
            };

            db.TmcOuts.Add(tmcOut);
            db.SaveChanges();
            dictionary.Id = tmcOut.Id;

            var newDictionary = db.TmcOutViews.First(o => o.Id == tmcOut.Id);

            dictionary.OwnerEmployeeValue = newDictionary.OwnerEmployeeValue;
            dictionary.StateTypeValue     = newDictionary.StateTypeValue;
            dictionary.OutTypeDicValue    = newDictionary.OutTypeDicValue;
            dictionary.TmcOutId           = tmcOut.Id;


            return(Json(new[] { dictionary }.ToDataSourceResult(request, ModelState)));
        }
Пример #3
0
        public ActionResult DestroyDelivery([DataSourceRequest] DataSourceRequest request, TmcOutView dictionary)
        {
            if (dictionary != null)
            {
                TmcOut d = db.TmcOuts.First(o => o.Id == dictionary.Id);
                db.TmcOuts.Remove(d);
                db.SaveChanges();
            }

            return(Json(new[] { dictionary }.ToDataSourceResult(request, ModelState)));
        }
Пример #4
0
        public ActionResult UpdateDelivery([DataSourceRequest] DataSourceRequest request, TmcOutView dictionary)
        {
            TmcOut d = db.TmcOuts.First(o => o.Id == dictionary.Id);

            d.StateType       = dictionary.StateType;
            d.Note            = dictionary.Note;
            d.OutTypeDicId    = dictionary.OutTypeDicId;
            d.StorageDicId    = dictionary.StorageDicId;
            d.OwnerEmployeeId = dictionary.OwnerEmployeeId;
            d.Rack            = dictionary.Rack;
            d.Safe            = dictionary.Safe;
            db.SaveChanges();
            return(Json(new[] { dictionary }.ToDataSourceResult(request, ModelState)));
        }
Пример #5
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));
        }
Пример #6
0
        public ActionResult CreateDelivery([DataSourceRequest] DataSourceRequest request, TmcOutView dictionary)
        {
            TmcOut tmc = new TmcOut()
            {
                Id                = Guid.NewGuid(),
                StateType         = dictionary.StateType,
                Note              = dictionary.Note,
                OutTypeDicId      = dictionary.OutTypeDicId,
                CreatedDate       = DateTime.Now,
                CreatedEmployeeId = UserHelper.GetCurrentEmployee().Id,
                StorageDicId      = dictionary.StorageDicId,
                OwnerEmployeeId   = dictionary.OwnerEmployeeId,
                Safe              = dictionary.Safe,
                Rack              = dictionary.Rack,
            };

            db.TmcOuts.Add(tmc);
            db.SaveChanges();
            dictionary.Id = tmc.Id;
            return(Json(new[] { dictionary }.ToDataSourceResult(request, ModelState)));
        }