protected void addClinic_Click(object sender, EventArgs e) { if (IsGroupValid("valc")) { ClinicDAO dao = new ClinicDAO(); string result = dao.insert(new Clinic(labelIDC.Text, labelType.Text, Convert.ToInt16(labelPrice.Text))); Response.Write("<script>alert('" + result + "');</script>"); if (result.Equals("done")) { Response.Redirect("EmployeeDashboard.aspx"); } } }
protected void Page_Load(object sender, EventArgs e) { if (Session["User"] == null) { Response.Redirect("Index.aspx"); } ClinicDAO dao = new ClinicDAO(); Clinics = dao.getClinics(); if (!IsPostBack) { ClinicList.Items.Clear(); ClinicList.Items.Add(new ListItem("--")); for (int i = 0; i < Clinics.Count; i++) { ClinicList.Items.Add(new ListItem(Clinics[i].getType())); } } myCash = Convert.ToInt16(Session["Cash"]); cashLabel.Text = "Cash: " + Session["Cash"] + " L.E"; discount = (1.0d - Convert.ToDouble(Session["fraction"])) * 100; discountLabel.Text = "discount: " + discount + "%"; }
string getDoctorID() { ClinicDAO daoz = new ClinicDAO(); doctors = daoz.getClinicDoctors(Clinics[ClinicList.SelectedIndex - 1].getCode()); string did = ""; if (PeriodList.SelectedIndex == 0) { if (doctors[0].getShift().ToLower().StartsWith("morn")) { Session["DoctorName"] = doctors[0].getName(); did = doctors[0].getID(); } else { Session["DoctorName"] = doctors[1].getName(); did = doctors[1].getID(); } } else { if (doctors[1].getShift().ToLower().StartsWith("even")) { Session["DoctorName"] = doctors[1].getName(); did = doctors[1].getID(); } else { Session["DoctorName"] = doctors[0].getName(); did = doctors[0].getID(); } } return(did); }