Ejemplo n.º 1
0
        public ActionResult Save(FormCollection collection)
        {
            TempData["id"] = TempData["id"];
            AppointmentId  = (int)TempData["id"];
            var           check     = collection["test"].Split(',');
            List <string> checkList = check.ToList();
            List <int>    quant     = collection["quantity"].Split(',').Select(int.Parse).ToList();
            List <int>    Ids       = collection["medicineId"].Split(',').Select(int.Parse).ToList();

            float sum = 0;

            for (int i = 0; i < Ids.Count; i++)
            {
                medicine = new MedicinesQuantity();
                if (quant[i] != 0)
                {
                    int MedicineID = Ids[i];
                    medicine.Medicine_Id    = MedicineID;
                    medicine.MedicineRate   = patientBusinessLayer.GetMedicineCost(MedicineID);
                    medicine.Appointment_Id = AppointmentId;
                    medicine.quantity       = quant[i];
                    sum = sum + medicine.MedicineRate * quant[i];

                    medicinelist.Add(medicine);
                }
            }
            int fees = patientBusinessLayer.GetDoctorFeesByAppointmentId(AppointmentId);

            Total             = Convert.ToInt32(sum + fees);
            ViewData["fees"]  = fees;
            TempData["total"] = sum + fees;
            CreateInvoice();
            patientBusinessLayer.SaveData(medicinelist);
            return(RedirectToAction("InvoiceList", "Invoice", new { AppointmentId = AppointmentId }));
        }
 public List <AppointmentListViewModel> GetAppointmentListView(int?id)
 {
     try
     {
         if (id == null)
         {
             id = -1;
         }
         List <Appointment> appointmentList = patientBusinessLayer.GetPatientAppointments((int)id);
         appointmentListViewModelList = new List <AppointmentListViewModel>();
         appointmentDataLayer         = new AppointmentDataLayer();
         foreach (var appointment in appointmentList)
         {
             MedicinesQuantity invoice = appointmentDataLayer.GetInvoiceByAppointmentId(appointment.Id);
             appointmentListViewModel             = new AppointmentListViewModel();
             appointmentListViewModel.Id          = appointment.Id;
             appointmentListViewModel.PatientName = patientBusinessLayer.GetPatientNameById(appointment.PatientId);
             appointmentListViewModel.DoctorName  = doctorBusinessLayer.GetDoctorNameById(appointment.DoctorId);
             appointmentListViewModel.Date        = appointment.Date.ToString().Split(' ')[0];
             if (appointment.Time == -1)
             {
                 appointmentListViewModel.Time = "---";
             }
             else
             {
                 appointmentListViewModel.Time = TimeSlots.Timings[appointment.Time];
             }
             appointmentListViewModel.Status = appointment.Status;
             if (invoice != null)
             {
                 appointmentListViewModel.showMedicineButton = false;
                 //appointmentListViewModelList.Add(appointmentListViewModel);
             }
             else if (invoice == null)
             {
                 appointmentListViewModel.showMedicineButton = true;
             }
             appointmentListViewModelList.Add(appointmentListViewModel);
         }
         return(appointmentListViewModelList);
     }catch (Exception e)
     {
         ExceptionHandler.PrintException(e, new StackTrace(true));
         throw e;
     }
 }
Ejemplo n.º 3
0
        public ActionResult AddMedicines(int id)
        {
            AppointmentId  = id;
            TempData["id"] = AppointmentId;
            medicine       = new MedicinesQuantity();
            medicine       = patientBusinessLayer.CheckIdInList(AppointmentId);

            if (medicine == null)
            {
                return(View(db.Medicines.ToList()));
            }

            else
            {
                return(RedirectToAction("InvoiceList", "Invoice", new { AppointmentId = AppointmentId }));
            }
        }