public DRUG getdrugByID(int id) { var temp = basedao.getDrug(id, null, null, null, null, null, null); DRUG result = null; try { result = temp.First(); } catch (System.InvalidOperationException e) { Console.WriteLine(e); return(null); } catch (System.ArgumentNullException e) { Console.WriteLine(e); return(null); } catch (Exception e) { Console.WriteLine(e); return(null); } return(result); }
public ActionResult DrugDetails(DRUG dRUG) { OVODEntities5 _context = new OVODEntities5(); var model = _context.DRUGs .Where(x => x.ID == dRUG.ID) .FirstOrDefault(); return(View(model)); }
public ActionResult Drugs(DRUG dRUG) { OVODEntities5 db = new OVODEntities5(); var model = db.DRUGs .Where(x => x.ID.Equals(dRUG.ID)).ToList(); DRUG di = new DRUG() { DRUG1 = dRUG.DRUG1 }; di.ID.Equals(dRUG.ID); db.SaveChanges(); return(RedirectToAction("GetDrug")); }
public JArray getInventExampleByID(int id) { ArrayList allInventExample = dao.getInventoryExample(null, id, null, null); JArray result = new JArray(allInventExample.Count); for (int i = 0; i < allInventExample.Count; i++) { DRUG drug = dao.getdrugByID((int)((INVENTORY_EXAMPLE)allInventExample[i]).ID); JObject temp = new JObject(); temp.Add(new JProperty("ID", ((INVENTORY_EXAMPLE)allInventExample[i]).ID.ToString())); temp.Add(new JProperty("code", drug.CODE)); temp.Add(new JProperty("name", drug.NAME)); temp.Add(new JProperty("time", drug.PRIME.ToString())); temp.Add(new JProperty("recordNumber", ((INVENTORY_EXAMPLE)allInventExample[i]).QUANTITY_OLD)); temp.Add(new JProperty("realNumber", ((INVENTORY_EXAMPLE)allInventExample[i]).QUANTITY_NEW)); result.Add(temp); } return(result); }
public JArray getAllDrug() { ArrayList allDrugss = dao.getAllDrugs(); JArray result = new JArray(allDrugss.Count); for (int i = 0; i < allDrugss.Count; i++) { DRUG drug = dao.getdrugByID((int)((DRUG_INVENTORY)allDrugss[i]).DRUG_ID); JObject temp = new JObject(); temp.Add(new JProperty("ID", ((DRUG_INVENTORY)allDrugss[i]).ID.ToString())); temp.Add(new JProperty("name", drug.NAME)); temp.Add(new JProperty("code", drug.CODE)); temp.Add(new JProperty("specification", drug.STANDARD)); temp.Add(new JProperty("factory", drug.MANUFACTOR)); temp.Add(new JProperty("price_in", drug.PAURCH_PRICE.ToString())); temp.Add(new JProperty("price_out", ((DRUG_INVENTORY)allDrugss[i]).PRICE.ToString())); temp.Add(new JProperty("number", ((DRUG_INVENTORY)allDrugss[i]).SURPLUS.ToString())); temp.Add(new JProperty("time", drug.PRIME.ToString())); result.Add(temp); } return(result); }
public JArray getPatientDrug(int id) { ArrayList list = dao.getMedicalRecordByPat(id); MEDICAL_RECORD record = null; foreach (MEDICAL_RECORD temp in list) { if (temp.DRUG_STATE == "取药中") { record = temp; } } if (record != null) { ArrayList allDrugss = dao.getPrescribeByMedicalRecord((int)record.ID); JArray result = new JArray(allDrugss.Count); for (int i = 0; i < allDrugss.Count; i++) { DRUG drug = dao.getdrugByID((int)((PRESCRIBE)allDrugss[i]).DRUG_ID); DRUG_INVENTORY druginventory = ((PRESCRIBE)allDrugss[i]).DRUG_INVENTORY; JObject temp = new JObject(); temp.Add(new JProperty("ID", drug.ID.ToString())); temp.Add(new JProperty("name", drug.NAME)); temp.Add(new JProperty("code", drug.CODE)); temp.Add(new JProperty("specification", drug.STANDARD)); temp.Add(new JProperty("factory", drug.MANUFACTOR)); temp.Add(new JProperty("price_in", drug.PAURCH_PRICE.ToString())); temp.Add(new JProperty("price_out", druginventory.PRICE.ToString())); temp.Add(new JProperty("number", ((int)((PRESCRIBE)allDrugss[i]).QUANTITY).ToString())); temp.Add(new JProperty("time", drug.PRIME.ToString())); result.Add(temp); } return(result); } else { return(null); } }