コード例 #1
0
        public ActionResult BatchGridViewPartialAddNew([ModelBinder(typeof(DevExpressEditorsBinder))]
                                                       Models.BatchNumbers item)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    // Insert here a code to insert the new item in your model
                    item.BatchNumber = new Random().Next(1, 1000000).ToString("D6");
                    item.CreatedAt   = DateTime.Now;
                    item.CreatedBy   = User.Identity.GetUserId();
                    unitOfWork.BatchNumbersRepo.Insert(item);
                    unitOfWork.Save();
                }
                catch (Exception e)
                {
                    ViewData["EditError"] = e.Message;
                }
            }
            else
            {
                ViewData["EditError"] = "Please, correct all errors.";
            }

            var model = unitOfWork.BatchNumbersRepo.Get(includeProperties: "CreatedByUser");

            return(PartialView("_BatchGridViewPartial", model));
        }
コード例 #2
0
        public ActionResult PatientsGridViewPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))]
                                                          Models.Patients item, [ModelBinder(typeof(DevExpressEditorsBinder))]
                                                          Models.BatchNumbers batchNumbers)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    // Insert here a code to update the item in your model
                }
                catch (Exception e)
                {
                    ViewData["EditError"] = e.Message;
                }
            }
            else
            {
                ViewData["EditError"] = "Please, correct all errors.";
            }

            var model = unitOfWork.PatientsRepo.Get(x => x.BatchId == batchNumbers.Id);

            ViewBag.batchNumbers = batchNumbers;
            return(PartialView("_PatientsGridViewPartial", model));
        }
コード例 #3
0
        public ActionResult PatientsGridViewPartial([ModelBinder(typeof(DevExpressEditorsBinder))]
                                                    Models.BatchNumbers batchNumbers)
        {
            var model = unitOfWork.PatientsRepo.Get(x => x.BatchNumbers.BatchNumber == batchNumbers.BatchNumber);

            ViewBag.batchNumbers = batchNumbers;
            return(PartialView("_PatientsGridViewPartial", model));
        }
コード例 #4
0
 public JsonResult SearchCasePartial([ModelBinder(typeof(DevExpressEditorsBinder))]
                                     Models.BatchNumbers batchNumbers)
 {
     return(Json(new
     {
         //PartialView("_SearchPatientGridViewPartial")
         view = this.RenderViewToString("SearchCasePartial", partial: true)
     }, JsonRequestBehavior.AllowGet));
 }
コード例 #5
0
        public ActionResult PatientsGridViewPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))]
                                                          System.Int32 Id, [ModelBinder(typeof(DevExpressEditorsBinder))]
                                                          Models.BatchNumbers batchNumbers)
        {
            if (Id >= 0)
            {
                try
                {
                    // Insert here a code to delete the item from your model
                }
                catch (Exception e)
                {
                    ViewData["EditError"] = e.Message;
                }
            }

            var model = unitOfWork.PatientsRepo.Get(x => x.BatchId == batchNumbers.Id);

            ViewBag.batchNumbers = batchNumbers;
            return(PartialView("_PatientsGridViewPartial", model));
        }
コード例 #6
0
        public ActionResult BatchGridViewPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))]
                                                       Models.BatchNumbers item)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    // Insert here a code to update the item in your model
                }
                catch (Exception e)
                {
                    ViewData["EditError"] = e.Message;
                }
            }
            else
            {
                ViewData["EditError"] = "Please, correct all errors.";
            }

            var model = unitOfWork.BatchNumbersRepo.Get(includeProperties: "CreatedByUser");

            return(PartialView("_BatchGridViewPartial", model));
        }