Ejemplo n.º 1
0
        public ActionResult AddEditBatch(BatchListViewModel model)
        {
            FillAllDropdowns();

            string strSuccessMsg = string.Empty;
            string strErrorMsg = string.Empty;

            if (model != null && model.Batch != null)
            {
                if (string.IsNullOrEmpty(model.Batch.BatchID))
                {
                    strSuccessMsg = BatchRes.MsgAddSuccess;
                    strErrorMsg = BatchRes.MsgAddError;
                }
                else
                {
                    strSuccessMsg = BatchRes.MsgEditSuccess;
                    strErrorMsg = BatchRes.MsgEditError;
                }

                int i = _BatchService.AddEdit(model.Batch);

                if (i <= 0)
                {
                    TempData["err"] = strErrorMsg;
                }
                else
                {
                    TempData["msg"] = strSuccessMsg;
                }
            }

            return RedirectToAction("ManageBatch", "Batch");
        }
Ejemplo n.º 2
0
        public ActionResult AddEditBatch(string pBatchID)
        {
            FillAllDropdowns();

            BatchListViewModel model = new BatchListViewModel();
            model.Batch = new Batch();

            if (ModelState.IsValid)
            {
                if (!string.IsNullOrEmpty(pBatchID))
                {
                    model.Batch.BatchID = pBatchID;
                    model.Batch = _BatchService.Get(model.Batch);
                }
            }

            return PartialView("_AddEditBatch", model);
        }
        public IActionResult License()
        {
            var batches = _context.BatchLKs;
            var lic     = _context.Licenses;

            List <BatchListViewModel> blVM = new List <BatchListViewModel>();
            BatchListViewModel        newblVM;

            foreach (var item in batches)
            {
                newblVM = new BatchListViewModel()
                {
                    BatchLK         = item,
                    ConsumedLicense = lic.Where(x => x.BatchLKId == item.Id).Where(x => x.UserEmail == "").Count()
                };

                blVM.Add(newblVM);
            }

            ViewData["LicenseType"] = new SelectList(_context.LicenseTypes, "Id", "LicenseTypeName");

            return(View(blVM));
        }
Ejemplo n.º 4
0
        public ActionResult DeleteBatch(string pBatchID)
        {
            if (!string.IsNullOrEmpty(pBatchID))
            {
                BatchListViewModel model = new BatchListViewModel();
                model.Batch = new Batch();
                model.Batch.BatchID = pBatchID;
                int i = _BatchService.Delete(model.Batch);

                if (i <= 0)
                    TempData["err"] = BatchRes.MsgDeleteError;
                else
                    TempData["msg"] = BatchRes.MsgDeleteSuccess;
            }

            return RedirectToAction("ManageBatch", "Batch");
        }
Ejemplo n.º 5
0
        public ActionResult ManageBatch(BatchListViewModel model)
        {
            if (model.Batch == null)
            {
                model.Batch = new Batch();
            }

            if (!string.IsNullOrEmpty(model.Batch.sort))
            {
                model.Batch.SortExp = model.Batch.sort + " " + model.Batch.sortdir;
            }

            if (model.Batch.PageSize == 0)
            {
                int PageSize = Convert.ToInt32(ConfigurationManager.AppSettings["PageSize"]);
                model.Batch.PageSize = PageSize;
            }

            if (model.Batch.PageIndex == 0)
            {
                model.Batch.PageIndex = 1;
            }
            model.BatchList = new List<Batch>();
            model.Batch.TotalCount = 0;

            model.BatchList = _BatchService.GetAll(model.Batch).ToList();
            Lookup entity = new Lookup();

            if (model.BatchList != null && model.BatchList.Count > 0)
            {
                int TotalCount = model.BatchList[0].TotalCount;
                model.Batch.TotalCount = TotalCount;
            }

            return View(model);
        }