protected void addDoctor_Click(object sender, EventArgs e) { if (IsGroupValid("valb")) { DoctorDAO dao = new DoctorDAO(); string result = dao.insert(new Doctor(labelID.Text, labelName.Text, labelPhone.Text, Convert.ToInt16(labelSalary.Text), Utils.GenerateId(DropClinic.SelectedIndex + 1, "Clinic"), DropShif.SelectedValue)); Response.Write("<script>alert('" + result + "');</script>"); if (result.Equals("done")) { Response.Redirect("EmployeeDashboard.aspx"); } } }
protected void logIn_Click(object sender, EventArgs e) { if (DropDownList1.SelectedIndex == 0) { PatientDAO dao = new PatientDAO(); string result = dao.login(TextBox1.Text); if (result.StartsWith("found")) { //found .. redirect and start session Session["User"] = TextBox1.Text; Response.Redirect("PatientDashboard.aspx"); } else { ClientScript.RegisterStartupScript(GetType(), "Javascript", "javascript:showErrorDialogue(); ", true); } } else if (DropDownList1.SelectedIndex == 1) { //doctor DoctorDAO dao = new DoctorDAO(); string result = dao.login(TextBox1.Text); if (result.StartsWith("found")) { //found .. redirect and start session Session["User"] = TextBox1.Text; Response.Redirect("DoctorDashboard.aspx"); } else { ClientScript.RegisterStartupScript(GetType(), "Javascript", "javascript:showErrorDialogue(); ", true); } } else if (DropDownList1.SelectedIndex == 2) { //employee EmployeeDAO dao = new EmployeeDAO(); string result = dao.login(TextBox1.Text); if (result.StartsWith("found")) { //found .. redirect and start session Session["User"] = TextBox1.Text; Response.Redirect("EmployeeDashboard.aspx"); } else { ClientScript.RegisterStartupScript(GetType(), "Javascript", "javascript:showErrorDialogue(); ", true); } } }