Ejemplo n.º 1
0
 private void _scanBarcode(AuditViewModels model)
 {
     try
     {
         if (model.Barcode != null)
         {
             MedicationPackageBLL.CheckAndUpdatePackage(model.MedicationTypeId, model.Barcode);
             _storeScannedPackageInSession(model);
         }
     }
     catch (ENETCareException ex)
     {
         ModelState.AddModelError("", ex.Message.ToString());
     }
     catch (DbEntityValidationException ex)
     {
         foreach (var error in ex.EntityValidationErrors)
         {
             foreach (var validationError in error.ValidationErrors)
             {
                 ModelState.AddModelError("", validationError.ErrorMessage.ToString());
             }
         }
     }
 }
Ejemplo n.º 2
0
        //[OutputCache(NoStore = true, Duration = 0, VaryByParam = "None")]
        public ActionResult AgentDoctorAuditPackageScan(string submitAction, AuditViewModels model)
        {
            _fetchMedicationTypeIdAndNameFromSession(model);

            if (submitAction == "Cancel")
            {
                _emptySessionStore();
                return(View("AgentDoctorHomePackages"));
            }
            else
            {
                if (submitAction == "Scan")
                {
                    if (!ModelState.IsValid)
                    {
                        return(View(model));
                    }
                    _scanBarcode(model);
                    _clearInputField(model);
                }
                else if (submitAction == "Submit")
                {
                    _submitAudit(model);
                    _emptySessionStore();
                }
                return(View(model));
            }
        }
Ejemplo n.º 3
0
 private void _fetchMedicationTypeIdAndNameFromSession(AuditViewModels model)
 {
     if (Session["auditMedicationTypeId"] != null && Session["auditMedicationTypeName"] != null)
     {
         model.MedicationTypeId   = (int)Session["auditMedicationTypeId"];
         model.MedicationTypeName = Session["auditMedicationTypeName"] as string;
     }
 }
Ejemplo n.º 4
0
        // [OutputCache(NoStore = true, Duration = 0, VaryByParam = "None")]
        public ActionResult AgentDoctorAuditPackageScan(int medicationTypeId, string medicationTypeName)
        {
            var model = new AuditViewModels();

            Session["auditMedicationTypeId"]   = model.MedicationTypeId = medicationTypeId;
            Session["auditMedicationTypeName"] = model.MedicationTypeName = medicationTypeName;

            return(View(model));
        }
Ejemplo n.º 5
0
        private void _storeScannedPackageInSession(AuditViewModels model)
        {
            List <string> medicationPackageList;

            if (Session["medicationPackageList"] == null)
            {
                medicationPackageList = new List <string>();
            }
            else
            {
                medicationPackageList = Session["medicationPackageList"] as List <string>;
            }

            medicationPackageList.Add(model.Barcode);
            Session["medicationPackageList"] = medicationPackageList;
        }
Ejemplo n.º 6
0
 private void _submitAudit(AuditViewModels model)
 {
     try
     {
         var scannedList  = Session["medicationPackageList"] as List <string>;
         var lostPackages = MedicationPackageBLL.AuditPackages(model.MedicationTypeId, scannedList);
         if (lostPackages != null)
         {
             model.LostPackages = lostPackages;
         }
         else
         {
             model.LostPackages = new List <MedicationPackage>();
         }
     }
     catch (ENETCareException ex)
     {
         ModelState.AddModelError("", ex.Message.ToString());
     }
 }
Ejemplo n.º 7
0
 private void _clearInputField(AuditViewModels model)
 {
     ModelState.Remove("Barcode");
     model.Barcode = null;
 }