// GET: Prescription/Prescription public ActionResult Add(int PatientID, int DoctorID) { Models.Prescription model = new Models.Prescription(); model = GetPrescription(PatientID, DoctorID, DateTime.Today.Year.ToString() + DateTime.Today.Month.ToString() + DateTime.Today.Day.ToString() + "_" + PatientID + "_" + DoctorID, model); return View(model); }
public PrescriptionsController(Prescription view) { this.view = view; this.reservationModel = new Models.Reservation(); this.doctorModel = new Models.Doctor(); this.allergenModel = new Models.Allergen(); this.medicamentModel = new Models.Medicament(); this.prescriptionModel = new Models.Prescription(); this.prescriptionMedicamentModel = new Models.PrescriptionMedicament(); }
/// <summary> /// Add a prescription to the database /// </summary> /// <param name="prescription">The prescition to be added to the databse</param> public Models.Prescription AddPrescription(Models.Prescription prescription) { var newPrescription = new DataModel.Prescription { Information = prescription.Info, Drug = prescription.DrugName, PatientId = prescription.PatientId, DoctorId = prescription.DoctorId }; _context.Add(newPrescription); _context.SaveChanges(); prescription.Id = newPrescription.Id; return(prescription); }
/// <summary> /// Add a prescription to the database /// </summary> /// <param name="prescription">The prescition to be added to the databse</param> public async Task <Models.Prescription> AddPrescriptionAsync(Models.Prescription prescription) { var newPrescription = new DataModel.Prescription { Information = prescription.Info, Drug = prescription.DrugName, PatientId = prescription.PatientId, DoctorId = prescription.DoctorId, }; await _context.AddAsync(newPrescription); await _context.SaveChangesAsync(); prescription.Id = newPrescription.Id; return(prescription); }
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); }
/** * Controller to handle selection of a table row */ public void handleTableRowSelection() { try { Cursor.Current = Cursors.WaitCursor; this.handleResetButton(); var selectedRow = this.view.ReservationsTable.DataGrid.SelectedRows.Count > 0 ? this.view.ReservationsTable.DataGrid.SelectedRows[0] : null; if (selectedRow != null) { int id = (int)selectedRow.Cells[0].Value; this.reservations.ForEach(async(item) => { if (item.Id == id) { this.selectedReservation = item; this.view.SelectedReservationLabel.Text = this.selectedReservation.Id.ToString(); // Populate list box with medicaments this.view.MedicamentsListBox.Items.Clear(); this.view.MedicamentsListBox.Refresh(); if (this.medicaments != null && this.medicaments.Count > 0) { this.medicaments.ForEach((medicament) => { this.view.MedicamentsListBox.Items.Add(medicament); }); } // Read prescription for selected reservation this.selectedPrescription = await prescriptionModel.readPrescriptionForReservation( this.selectedReservation.Id ); // If there is an existing prescription, show its content if (this.selectedPrescription != null) { List <Models.PrescriptionMedicament> pm = await prescriptionMedicamentModel.readMedicamentsForPrescription( this.selectedPrescription.Id ); this.selectedPrescriptionMedicaments = pm; this.view.DescriptionTxtBox.ReadOnly = true; this.view.MedicamentsListBox.Enabled = false; this.view.SubmitBtn.Enabled = false; this.view.DescriptionTxtBox.Text = this.selectedPrescription.Description; for (int i = 0; i < this.view.MedicamentsListBox.Items.Count; i += 1) { Models.Medicament m = (Models.Medicament) this.view.MedicamentsListBox.Items[i]; pm.ForEach((pmItem) => { if (pmItem.Medicament == m.Id) { this.view.MedicamentsListBox.SetSelected(i, true); } }); } } } }); } Cursor.Current = Cursors.Arrow; } catch (Exception e) { string caption = "Problem në lexim"; MessageBox.Show(e.Message, caption, MessageBoxButtons.OK, MessageBoxIcon.Error); } }