private void btnpOK_Click(object sender, EventArgs e) { Prescript p; if (plist.SelectedIndex < 0) { p = new Prescript(); p.id = -1; setPrescript(p); DBParser.addPrescript(Database.prescriptDB, p); if (p.id > 0) { Database.prescriptDB.Add(p); } plist.Items.Add(p.name); //plist.SelectedIndex = plist.Items.Count - 1; btnpNew_Click(sender, e); } else { p = Database.prescriptDB[plist.SelectedIndex]; setPrescript(p); DBParser.updatePrescript(p); plist.Items[plist.SelectedIndex] = p.name; plist_SelectedIndexChanged(sender, e); } txtpName.Focus(); }
public frmLibrary() { InitializeComponent(); memM = new Medicine(); memP = new Prescript(); mlist.Items.Clear(); plist.Items.Clear(); pmlist.Items.Clear(); pplist.Items.Clear(); bmpPicpVal = new Bitmap(picpVal.Width, picpVal.Height); drawPrescriptValue(); foreach (Medicine x in Database.medicineDB) { mlist.Items.Add(x.name); pmlist.Items.Add(x.name); } foreach (Prescript x in Database.prescriptDB) { plist.Items.Add(x.name); } }
protected void add_drug_Click(object sender, EventArgs e) { int i = 0; String s = patient_ID.Value.ToString(); if (int.TryParse(s, out i) == false) { Response.Write("<script language=javascript>window.alert('病人ID输入格式不正确!');</script>"); } else { if (Patient_C.isExit(s) == false) { Response.Write("<script language=javascript>window.alert('该病人ID不存在!');</script>"); } else { patient1 = Patient_C.GetPatientinformation(s); name1.Value = " 姓名:" + patient1[0].P_Name + ""; sex1.Value = " 性别:" + patient1[0].P_Sex + ""; age1.Value = " 年龄:" + Convert.ToString(patient1[0].P_Age) + ""; phone1.Value = " 手机号:" + Convert.ToString(patient1[0].P_Phone) + ""; prescript = new Prescript(); if (int.TryParse(drug_ID.Value, out i) == false) { Response.Write("<script language=javascript>window.alert('药品ID输入格式不正确!');</script>"); } else { if (Drug_C.ExistDrug(Convert.ToInt32(drug_ID.Value)) == false) { Response.Write("<script language=javascript>window.alert('该药品ID不存在!');</script>"); } else { prescript.D_ID = Convert.ToInt32(drug_ID.Value); prescript.C_ID = Convert.ToInt32(Case_C.GetCaseID(Convert.ToInt32(patient_ID.Value))); prescript.D_Name = Drug_C.GetDrugname(Convert.ToInt32(drug_ID.Value)); if (int.TryParse(drug_number.Value, out i) == false) { Response.Write("<script language=javascript>window.alert('药品数量输入格式不正确!');</script>"); } else { prescript.D_Number = Convert.ToInt32(drug_number.Value); prescript.D_Totalprice = (float)Convert.ToDouble(((Drug_C.GetSellingPrice(Convert.ToInt32(drug_ID.Value))) * (Convert.ToInt32(drug_number.Value)))); prescript.P_Notes = drug_note.Value; prescripts.Add(prescript); drug_ID.Value = ""; drug_name.Value = ""; drug_number.Value = ""; drug_note.Value = ""; Text_ID.Value = ""; Text_Name.Value = ""; } } } } } }
public ActionResult DeleteConfirmed(int id) { Prescript prescript = db.Prescripts.Find(id); db.Prescripts.Remove(prescript); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Create(int?id) { Prescript prescript = db.Prescripts.Find(id); POrder model = new POrder(); ViewBag.PharmacyId = new SelectList(db.Pharmacies, "PharmacyId", "Name"); model.PrescriptId = prescript.PrescriptId; return(View(model)); }
public ActionResult Edit([Bind(Include = "PrescriptId,PatientId,ItemId,Date,Disp,DispType,Sig,Sub,Refill")] Prescript prescript) { if (ModelState.IsValid) { db.Entry(prescript).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ItemId = new SelectList(db.items, "ItemId", "Name", prescript.ItemId); ViewBag.PatientId = new SelectList(db.Patients, "PatientId", "FirstName", prescript.PatientId); return(View(prescript)); }
private void setPrescript(Prescript p) { if (p == null) { return; } p.name = txtpName.Text; p.clear(); foreach (PrescriptNode x in memP.getPrescriptMedicines()) { p.add(x.med, x.weight, x.state); } }
public ActionResult Create(int?id) { Patient patient = db.Patients.Find(id); Prescript model = new Prescript(); ViewData["Patient"] = patient; ViewBag.ItemId = new SelectList(db.items, "ItemId", "Name"); ViewBag.PatientId = new SelectList(db.Patients, "PatientId", "FirstName"); model.PatientId = patient.PatientId; return(View(model)); }
// GET: Prescripts/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Prescript prescript = db.Prescripts.Find(id); if (prescript == null) { return(HttpNotFound()); } return(View(prescript)); }
// GET: Prescripts/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Prescript prescript = db.Prescripts.Find(id); if (prescript == null) { return(HttpNotFound()); } ViewBag.ItemId = new SelectList(db.items, "ItemId", "Name", prescript.ItemId); ViewBag.PatientId = new SelectList(db.Patients, "PatientId", "FirstName", prescript.PatientId); return(View(prescript)); }
private void plist_SelectedIndexChanged(object sender, EventArgs e) { if (plist.SelectedIndex < 0) { return; } Prescript p = Database.prescriptDB[plist.SelectedIndex]; txtpName.Text = p.name; pplist.Items.Clear(); memP.clear(); foreach (PrescriptNode pn in p.getPrescriptMedicines()) { pplist.Items.Add(string.Format("{0:F}g\t", pn.weight) + pn.med.name); memP.add(pn.med, pn.weight, pn.state); } drawPrescriptValue(); }
public ActionResult Create([Bind(Include = "PrescriptId,PatientId,ItemId,Date,Disp,DispType,Sig,Sub,Refill")] Prescript prescript) { prescript.Date = System.DateTime.Now; if (prescript.Refill == null) { prescript.Refill = 0; } prescript.RefillsUsed = 0; prescript.Ordered = false; if (ModelState.IsValid) { db.Prescripts.Add(prescript); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ItemId = new SelectList(db.items, "ItemId", "Name", prescript.ItemId); ViewBag.PatientId = new SelectList(db.Patients, "PatientId", "FirstName", prescript.PatientId); return(View(prescript)); }
public ActionResult Create([Bind(Include = "PrescriptId,PatientId,ItemId,Date,Disp,DispType,Sig,Sub,Refill")] Prescript prescript) { var manager = new UserManager <ApplicationUser>(new UserStore <ApplicationUser>(new ApplicationDbContext())); var currentUser = manager.FindById(User.Identity.GetUserId()); prescript.Date = System.DateTime.Now; prescript.DoctorId = currentUser.DoctorId; if (ModelState.IsValid) { db.Prescripts.Add(prescript); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ItemId = new SelectList(db.items, "ItemId", "Name", prescript.ItemId); ViewBag.PatientId = new SelectList(db.Patients, "PatientId", "FirstName", prescript.PatientId); return(View(prescript)); }
// GET: POrders/PorderCreateRefill public ActionResult PorderCreateRefill(int?id) { Prescript prescript = db.Prescripts.Find(id); POrder model = new POrder(); var pharmacies = db.Pharmacies.ToList(); IEnumerable <SelectListItem> selectList = from p in pharmacies select new SelectListItem { Value = p.PharmacyId.ToString(), Text = string.Format("{0} - {1}, {2}", p.Name, p.Address, p.City) }; ViewBag.PharmacyId = new SelectList(selectList, "Value", "Text"); ViewData["Prescript"] = prescript; model.PrescriptId = prescript.PrescriptId; return(View(model)); }
public static List <Prescript> SelectPrescript(String info) { string sql = "SELECT * FROM `hospital`.`prescript` WHERE`D_Name` LIKE '%" + info + "%'"; OdbcConnection odbcConnection = DB.DBManager.GetOdbcConnection(); odbcConnection.Open(); OdbcCommand odbcCommand = new OdbcCommand(sql, odbcConnection); OdbcDataReader odbcDataReader = odbcCommand.ExecuteReader(CommandBehavior.CloseConnection); if (odbcDataReader.HasRows) { List <Prescript> list = Prescript.getList(odbcDataReader); odbcConnection.Close(); return(list); } else { odbcConnection.Close(); } return(null); }
//已知病人id查询药方信息 public static List <Prescript> SelectPrescript(int patientid) { string cid = Case_C.GetCaseID(patientid); string sql = "SELECT * FROM `hospital`.`prescript` WHERE `C_ID` = '" + cid + "'"; OdbcConnection odbcConnection = DB.DBManager.GetOdbcConnection(); odbcConnection.Open(); OdbcCommand odbcCommand = new OdbcCommand(sql, odbcConnection); OdbcDataReader odbcDataReader = odbcCommand.ExecuteReader(CommandBehavior.CloseConnection); if (odbcDataReader.HasRows) { List <Prescript> list = Prescript.getList(odbcDataReader); odbcConnection.Close(); return(list); } else { odbcConnection.Close(); } return(null); }
public ActionResult Edit([Bind(Include = "POrderId,PrescriptId,PharmacyId,DateOrdered,Note,Fill,Deny,Accept")] POrder pOrder) { pOrder.Accept = false; pOrder.Deny = true; Prescript prescript = new Prescript(); prescript = db.Prescripts.Find(pOrder.PrescriptId); prescript.Sent = false; if (ModelState.IsValid) { db.Entry(prescript).State = EntityState.Modified; db.Entry(pOrder).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("PharmacyIndex")); } ViewBag.PharmacyId = new SelectList(db.Pharmacies, "PharmacyId", "Name", pOrder.PharmacyId); ViewBag.PrescriptId = new SelectList(db.Prescripts, "PrescriptId", "DispType", pOrder.PrescriptId); return(View(pOrder)); }