Exemplo n.º 1
0
        public ActionResult Add(Health.Areas.Prescription.Models.Prescription model)
        {
            PrescriptionContext pc = new PrescriptionContext();
            HealthDB.Model.Prescription p = new HealthDB.Model.Prescription();
            p.DoctorId = model.PrescribedByUserId;
            p.Dosage = model.Strength;
            p.DrugName = model.DrugName;
            if (model.GroupName != null)
                p.GroupName = model.GroupName;
            p.Instruction = model.Direction;
            p.Invoice = DateTime.Today.Year.ToString() + DateTime.Today.Month.ToString() + DateTime.Today.Day.ToString() + "_" + model.PatientUserId + "_" + model.PrescribedByUserId;
            p.PatientId = model.PatientUserId;
            p.PharmacistId = model.PharmacistUserId;
            p.PrescriptionTypeId = model.PrescriptionTypeId;
            p.Quantity = model.Quantity;
            p.PrescriptionStatusId = 1;
            pc.Prescriptions.InsertOnSubmit(p);

            IEnumerable<DrugName> DrugNames = from drugs in pc.DrugNames
                                              where drugs.Name == model.DrugName
                                              select drugs;
            if (DrugNames == null)
            {
                DrugName dn = new DrugName();
                dn.Name = model.DrugName;
                pc.DrugNames.InsertOnSubmit(dn);
            }

            pc.SubmitChanges();
            model = GetPrescription(model.PatientUserId, model.PrescribedByUserId, DateTime.Today.Year.ToString() + DateTime.Today.Month.ToString() + DateTime.Today.Day.ToString() + "_" + model.PatientUserId + "_" + model.PrescribedByUserId, model);

            return View(model);
        }
Exemplo n.º 2
0
        public ActionResult Delete (int id, int PatientID, int DoctorID)
        {
            PrescriptionContext pc = new PrescriptionContext();
            HealthDB.Model.Prescription p = (from Prescriptions in pc.Prescriptions
                                            where Prescriptions.Id == id
                                            select Prescriptions).FirstOrDefault();
            pc.Prescriptions.DeleteOnSubmit(p);
            pc.SubmitChanges();
            return RedirectToAction("Add", "Prescription", new { PatientID = PatientID, DoctorID = DoctorID});

        }
Exemplo n.º 3
0
        public ActionResult Order(int PatientID, int DoctorID, string InvoiceId)
        {
            PrescriptionContext pc = new PrescriptionContext();
            IEnumerable<HealthDB.Model.Prescription> ps = from Prescriptions in pc.Prescriptions
                                                          where Prescriptions.Invoice == InvoiceId
                                                          select Prescriptions;
            foreach (var p in ps)
            {
                p.PrescriptionStatusId = 2;
            }
            pc.SubmitChanges();
            Models.Prescription model = new Models.Prescription();
            model = GetPrescription(PatientID, DoctorID, InvoiceId, model);

            return View(model);
        }