Esempio n. 1
0
        // GET: Graph
        public ActionResult Graph(string name = "", int year = 0)
        {
            IBL          bl = new BLImplement();
            MedicineInfo md = new MedicineInfo();

            try
            {
                md.MedicineList = bl.getAllMedicines().ToList();
            }
            catch (Exception ex)
            {
                ViewBag.Message = String.Format(ex.Message);
                return(View("Graph"));
            }
            if ((year <= 0) || (name == ""))
            {
                md.MedicineName = "";
            }
            else
            {
                //string MedicineName = bl.GetMedicine(id.ToString()).Name.ToString();
                List <int> prescription = bl.info(name, year);
                md.MedicineName  = name;
                md.medicineArray = prescription.ToArray();
            }
            return(View("Graph", md));
        }
        public GraphModel()
        {
            IBL bl = new BLImplement();

            mat   = null;
            month = 3;
            //    AdministratorId = bl.getAdministrator().Id;
            CategoryId = bl.getAllMedicines().Select(x => x.Id).ToArray();
        }
        public static MvcHtmlString DropDownListForUsers(this HtmlHelper htmlHelper, string name)
        {
            IBL    bl      = new BLImplement();
            string options = "";

            foreach (var user in bl.getAllMedicines())
            {
                options += $"<option value ='{user.Name}'> {user.Name} </option>";
            }
            return(new MvcHtmlString($"<select  name={name} id='medId' style='color:black'>{options}</select>"));
        }
        // GET: Medicines
        public ActionResult Index()
        {
            IBL bl = new BLImplement();
            List <MedicineViewModel> lst = new List <MedicineViewModel>();

            foreach (var item in bl.getAllMedicines())
            {
                lst.Add(new MedicineViewModel(item));
            }
            return(View(lst));
        }
Esempio n. 5
0
        public PrescriptionForPatientModel()
        {
            IBL bl = new BLImplement();

            this.prescription = new PrescriptionViewModel();
            var lst = bl.getAllMedicines().ToList();

            this.medicines = new List <string>();
            foreach (var item in lst)
            {
                medicines.Add(item.Name);
            }
        }
        // GET: Medicines/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            IBL      bl       = new BLImplement();
            Medicine medicine = bl.getAllMedicines().ToList().FindAll(x => x.Id == id).FirstOrDefault();

            if (medicine == null)
            {
                return(HttpNotFound());
            }
            return(View(medicine));
        }
 public ActionResult DeleteConfirmed(int id)
 {
     try
     {
         IBL      bl       = new BLImplement();
         Medicine medicine = bl.getAllMedicines().ToList().FindAll(x => x.Id == id).FirstOrDefault();
         bl.deleteMedicine(medicine);
         ViewBag.Message = String.Format("The medicine {0} is successfully deleted", medicine.Name);
         return(RedirectToAction("Index"));
     }
     catch (Exception ex)
     {
         ViewBag.Message = String.Format(ex.Message);
         return(RedirectToAction("Index"));
     }
 }
Esempio n. 8
0
        // GET: Medicine
        public ActionResult Index(string searchString = "")
        {
            IBL bl = new BLImplement();
            List <MedicineViewModel> lst = new List <MedicineViewModel>();
            var temp = bl.getAllMedicines().Where(a => a.Id <= 20).ToList();

            foreach (var item in temp)
            {
                lst.Add(new MedicineViewModel(item));
            }
            if (!String.IsNullOrEmpty(searchString))
            {
                lst = lst.Where(s => s.Name.Contains(searchString) || s.GenericName.Contains(searchString)).ToList();
            }
            return(View(lst));
        }
        // GET: Medicines/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            IBL      bl       = new BLImplement();
            Medicine medicine = bl.getAllMedicines().FirstOrDefault(x => x.Id == id);

            if (medicine == null)
            {
                return(HttpNotFound());
            }
            var mvm = new MedicineViewModel(medicine);

            return(View(mvm));
        }
 public ActionResult prescriptionIssuance(FormCollection collection)///*string medicine*/, DateTime StartDate, DateTime EndDate, string Doctor, string Patient, string Cause)
 {
     try
     {
         IBL          bl           = new BLImplement();
         Prescription prescription = new Prescription()
         {
             medicine  = bl.getAllMedicines().FirstOrDefault(x => x.Name == collection["medicine"]).Id,//change the name to the id
             StartDate = Convert.ToDateTime(collection["StartDate"]),
             EndDate   = Convert.ToDateTime(collection["EndDate"]),
             Doctor    = collection["Doctor"],
             Patient   = collection["Patient"],
             Cause     = collection["prescription.Cause"]
         };
         bl.addPrescription(prescription);
         ViewBag.Message = String.Format("The prescription for {0} is successfully added. You can watch {1}'s medical history for full details. ", collection["medicine"].ToString(), bl.getPatient(prescription.Patient).Name.ToString());
         return(RedirectToAction("DoctorOptions" /*, prescription.Doctor*/));
     }
     catch (Exception ex)
     {
         ViewBag.Message = String.Format(ex.Message);
         return(RedirectToAction("prescriptionIssuance"));
     }
 }