Beispiel #1
0
        public JsonResult SavePrescription(PrescriptionVM P)
        {
            bool status = false;

            if (ModelState.IsValid)
            {
                using (ERP1DataContext dc = new ERP1DataContext())
                {
                    Prescription pres = new Prescription {
                        AppointmentID = P.AppointmentID, DoctorID = P.DoctorID, PatientID = P.PatientID
                    };
                    foreach (var i in P.MedDetails)
                    {
                        //
                        // i.TotalAmount =
                        pres.Medications.Add(i);
                    }
                    dc.Prescriptions.InsertOnSubmit(pres);
                    dc.SubmitChanges();
                    var data = dc.Appointments.Where(a => a.AppointmentID == P.AppointmentID).ToList();
                    foreach (Appointment A in data)
                    {
                        //
                        // i.TotalAmount =
                        A.Status = "Prescribed";
                        dc.SubmitChanges();
                    }
                    dc.SubmitChanges();
                    status = true;
                }
            }
            else
            {
                status = false;
            }
            return(new JsonResult {
                Data = new { status = status }
            });
        }
 public ActionResult Create(PrescriptionVM prescription)
 {
     try
     {
         if (ModelState.IsValid)
         {
             IBL bL = new BlClass();
             prescription.DoctorId = RouteConfig.doctor != null ? RouteConfig.doctor.Id : -1;
             bL.AddPrescription(prescription.Current);
             ViewBag.TitlePopUp = "עבר בהצלחה";
             ViewBag.Message    = "המרשם נוסף בהצלחה";
             var prescriptions = bL.GetPrescriptions(pre => pre.PatientId == prescription.PatientId).Select(pr => new PrescriptionVM(pr));
             ViewBag.Patient = prescription.PatientId;
             return(View("Index", prescriptions));
         }
         return(View(prescription));
     }
     catch (System.Exception ex)
     {
         ViewBag.TitlePopUp = "שגיאה";
         ViewBag.Message    = ex.Message;
         return(View(prescription));
     }
 }
Beispiel #3
0
        public static DoctorVM GetDoctorForPrescription(this PrescriptionVM pre)
        {
            IBL bl = new BlClass();

            return(new DoctorVM(bl.GetDoctor(pre.DoctorId)));
        }
Beispiel #4
0
        public static BE.Medicine GetMedicineForPrescription(this PrescriptionVM pre)
        {
            IBL bl = new BlClass();

            return(bl.GetMedicine(pre.MedicineId));
        }