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 = ""; } } } } } }
protected void Search_Drug_Click(object sender, EventArgs e) { bool l; int i; if (int.TryParse(drug_ID.Value, out i) == false) { Response.Write("<script language=javascript>window.alert('药品ID输入格式不正确!');</script>"); } else { l = Drug_C.ExistDrug(Convert.ToInt32(drug_ID.Value)); if (l == true) { drugs = Drug_C.Select(drug_ID.Value); drug_Name.Value = drugs[0].D_Name; drug_Standard.Value = drugs[0].D_Standard; drug_PurchasingPrice.Value = Convert.ToString(drugs[0].D_PurchasingPrice); drug_SellingPrice.Value = Convert.ToString(drugs[0].D_SellingPrice); } else { Response.Write("<script language=javascript>window.alert('该药品不存在,请先登记!');</script>"); } } }
protected void register_Click(object sender, EventArgs e) { bool s, l; int i; float j; if (int.TryParse(drug_ID.Value, out i) == false) { Response.Write("<script language=javascript>window.alert('药品ID输入格式不正确!');</script>"); } else { s = Drug_C.ExistDrug(Convert.ToInt32(drug_ID.Value)); if (s == true) { Response.Write("<script language=javascript>window.alert('该药品已存在!');</script>"); } else { if (float.TryParse(drug_PurchasingPrice.Value, out j) == false) { Response.Write("<script language=javascript>window.alert('该药品进价输入格式不正确!');</script>"); } else { if (float.TryParse(drug_SellingPrice.Value, out j) == false) { Response.Write("<script language=javascript>window.alert('该药品售价输入格式不正确!');</script>"); } else { l = Drug_C.Insert(Convert.ToInt32(drug_ID.Value), drug_Name.Value, drug_Standard.Value, Convert.ToSingle(drug_PurchasingPrice.Value), Convert.ToSingle(drug_SellingPrice.Value)); if (l == true) { Response.Write("<script language=javascript>window.alert('登记成功!');</script>"); } else { Response.Write("<script language=javascript>window.alert('登记失败!');</script>"); } } } } } }