コード例 #1
0
        public ActionResult _AddNewStock()
        {
            var mdl = new StockEditVM
            {
                ManufacturerAndModel = "No Model Selected!!",
                ProductLifeCycleId   = (int)ProductLifeCycleStatus.InStock,
                InvoiceStatusId      = (int)InvoiceStatusEnum.Pending,
                ProductLifeCycles    = _svc.GetProductLifeCycles().Where(m => m.NotAttachedStatus).ToList()
            };

            return(PartialView("_Edit", mdl));
        }
コード例 #2
0
        public ActionResult _AddStockForModel(int id)
        {
            var mdl = _svc.GetModel(id);
            var vm  = new StockEditVM
            {
                ModelId = id,
                ManufacturerAndModel = mdl.Manufacturer.Name + " " + mdl.ModelCode,
                ProductLifeCycleId   = (int)ProductLifeCycleStatus.InStock,
                InvoiceStatusId      = (int)InvoiceStatusEnum.Pending
            };

            return(PartialView("_EditStockForModel", vm));
        }
コード例 #3
0
 public ActionResult _EditStockForModel(StockEditVM mStockEditVm)
 {
     if (ModelState.IsValid && TryValidateModel(mStockEditVm))
     {
         var stk = _svc.GetStock(mStockEditVm.StockId);
         if (TryUpdateModel(stk))
         {
             if (ExecuteRepositoryAction(() => { _svc.UpdateStock(stk); _svc.CommitChanges(); }))
             {
                 return(ReturnJsonFormSuccess());
             }
         }
     }
     return(PartialView("_EditStockForModel", mStockEditVm));
 }
コード例 #4
0
 private void PopulateProductLifeCycles(StockEditVM mdl, Stock stock)
 {
     if (!stock.ProductLifeCycleStatus.NotAttachedStatus)
     {
         mdl.ProductLifeCycles = new List <ProductLifeCycle>()
         {
             stock.ProductLifeCycleStatus
         }
     }
     ;
     else
     {
         mdl.ProductLifeCycles = _svc.GetProductLifeCycles().Where(m => m.NotAttachedStatus).ToList();
     }
 }
コード例 #5
0
 public ActionResult _AddStockForModel(StockEditVM mStockEditVm)
 {
     if (ModelState.IsValid && TryValidateModel(mStockEditVm))
     {
         var stk = new Stock {
             History = new List <StockHistory>()
         };
         if (TryUpdateModel(stk))
         {
             if (ExecuteRepositoryAction(() => { _svc.AddStock(stk); _svc.CommitChanges(); }))
             {
                 return(ReturnJsonFormSuccess());
             }
         }
     }
     return(PartialView("_EditStockForModel", mStockEditVm));
 }
コード例 #6
0
        public ActionResult _AddNewStock(StockEditVM mStockEditVm)
        {
            if (ModelState.IsValid)
            {
                var stk = new Stock();
                if (TryUpdateModel(stk))
                {
                    if (ExecuteRepositoryAction(() => { _svc.AddStock(stk); _svc.CommitChanges(); }))
                    {
                        return(ReturnJsonFormSuccess());
                    }
                }
            }
            mStockEditVm.ProductLifeCycles = _svc.GetProductLifeCycles().Where(m => m.NotAttachedStatus).ToList();
            if (mStockEditVm.ModelId != 0)
            {
                var mdl = _svc.GetModel(mStockEditVm.ModelId);
                mStockEditVm.ManufacturerAndModel = mdl.Manufacturer.Name + " " + mdl.ModelCode;
            }

            return(PartialView("_Edit", mStockEditVm));
        }