public D_SaleWithPrescriptionForm(Employee employee, Patient patient, PatientPrescription prescription, Action <SellReceipt> onOK) { InitializeComponent(); Patient = patient; Prescription = prescription; Employee = employee; OnOK = onOK; }
public D_PrescriptionForm(Employee employee, Patient patient, Action <PatientPrescription> onOK, PatientPrescription prescription = null) { InitializeComponent(); Employee = employee; Patient = patient; OnOK = onOK; if (prescription == null) { txtPrescriptionId.Text = "DT" + (PrescriptionDAO.Count() + 1); } else { txtPrescriptionId.Text = prescription.EntityId; txtPrescriptionId.Enabled = false; detailGroup.Visible = false; txtDiesease.Text = prescription.DiseaseName; details = PrescriptionDetailDAO.Select(pd => pd.PatientPrescriptionId == prescription.EntityId); LoadDetails(); } }
private void BtnOk_Click(object sender, EventArgs e) { var prescription = new PatientPrescription() { Id = txtPrescriptionId.Text, DiseaseName = txtDiesease.Text, PatientId = Patient.EntityId }; if (prescription == null) { PrescriptionDAO.Add(prescription); foreach (var detail in details) { PrescriptionDetailDAO.Add(detail); } } else { PrescriptionDAO.Update(prescription); } OnOK(prescription); Close(); }
//[ValidateAntiForgeryToken] public String Create(string JsonData, String tablename) { //PatientPrescription pp = new PatientPrescription(); //pp = JsonConvert.DeserializeObject<PatientPrescription>(JsonData); //String ppJSon = JsonConvert.SerializeObject(pp); //PatientHealthRecord pp = new PatientHealthRecord(); //pp = JsonConvert.DeserializeObject<PatientHealthRecord>(JsonData); //String ppJSon = JsonConvert.SerializeObject(pp); using (var tr = _context.Database.BeginTransaction()) { try { switch (tablename) { case "Prescription": PatientPrescription presc = new PatientPrescription(); presc = JsonConvert.DeserializeObject <PatientPrescription>(JsonData); if (presc.PrescriptionId == 0) { _context.PatientPrescription.Add(presc); } else { _context.PatientPrescription.Update(presc); } _context.SaveChanges(); tr.Commit(); String pj = JsonConvert.SerializeObject(presc); //return presc.PrescriptionId.ToString(); return(pj); default: return("0"); } // int HRid = pp.HealthRecordId; //pp = _context.PatientHealthRecord.Find(HRid); //ppJSon = JsonConvert.SerializeObject(pp); } catch (Exception e) { tr.Rollback(); return(e.ToString()); } } //if (ModelState.IsValid) //{ // _context.Add(patientHealthRecord); // await _context.SaveChangesAsync(); // return RedirectToAction("Index"); //} //ViewData["DoctorEmployeeId"] = new SelectList(_context.Employee, "EmployeeId", "JoinDate", patientHealthRecord.DoctorEmployeeId); //ViewData["HospitalId"] = new SelectList(_context.Hospital, "HospitalId", "Address", patientHealthRecord.HospitalId); //ViewData["PatientId"] = new SelectList(_context.Patient, "PatientId", "RegDate", patientHealthRecord.PatientId); //return View(patientHealthRecord); //return ppJSon; }
public HttpResponseMessage SavePatientPrescription(PatientPrescription obj) { var _prescriptionCreated = _prescriptionRepo.Insert(obj); return(Request.CreateResponse(HttpStatusCode.Accepted, obj.Id)); }