protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int empId = Convert.ToInt32(Session["doctorId"].ToString()); Common_GetEmployeeScheduleBL objGetEmployeeScheduleBL = new Common_GetEmployeeScheduleBL(); DataSet ds = new DataSet(); ds = objGetEmployeeScheduleBL.Common_GetEmployeeSchedule(empId); Label1.Text = ds.Tables[0].Rows[0]["MON_SESS1_FROM"].ToString(); Label2.Text = ds.Tables[0].Rows[0]["MON_SESS1_TO"].ToString(); Label3.Text = ds.Tables[0].Rows[0]["MON_SESS2_FROM"].ToString(); Label4.Text = ds.Tables[0].Rows[0]["MON_SESS2_TO"].ToString(); Label5.Text = ds.Tables[0].Rows[0]["MON_SESS3_FROM"].ToString(); Label6.Text = ds.Tables[0].Rows[0]["MON_SESS3_TO"].ToString(); Label7.Text = ds.Tables[0].Rows[0]["TUE_SESS1_FROM"].ToString(); Label8.Text = ds.Tables[0].Rows[0]["TUE_SESS1_TO"].ToString(); Label9.Text = ds.Tables[0].Rows[0]["TUE_SESS2_FROM"].ToString(); Label10.Text = ds.Tables[0].Rows[0]["TUE_SESS2_TO"].ToString(); Label11.Text = ds.Tables[0].Rows[0]["TUE_SESS3_FROM"].ToString(); Label12.Text = ds.Tables[0].Rows[0]["TUE_SESS3_TO"].ToString(); Label13.Text = ds.Tables[0].Rows[0]["WED_SESS1_FROM"].ToString(); Label14.Text = ds.Tables[0].Rows[0]["WED_SESS1_TO"].ToString(); Label15.Text = ds.Tables[0].Rows[0]["WED_SESS2_FROM"].ToString(); Label16.Text = ds.Tables[0].Rows[0]["WED_SESS2_TO"].ToString(); Label17.Text = ds.Tables[0].Rows[0]["WED_SESS3_FROM"].ToString(); Label18.Text = ds.Tables[0].Rows[0]["WED_SESS3_TO"].ToString(); Label19.Text = ds.Tables[0].Rows[0]["THU_SESS1_FROM"].ToString(); Label20.Text = ds.Tables[0].Rows[0]["THU_SESS1_TO"].ToString(); Label21.Text = ds.Tables[0].Rows[0]["THU_SESS2_FROM"].ToString(); Label22.Text = ds.Tables[0].Rows[0]["THU_SESS2_TO"].ToString(); Label23.Text = ds.Tables[0].Rows[0]["THU_SESS3_FROM"].ToString(); Label24.Text = ds.Tables[0].Rows[0]["THU_SESS3_TO"].ToString(); Label25.Text = ds.Tables[0].Rows[0]["FRI_SESS1_FROM"].ToString(); Label26.Text = ds.Tables[0].Rows[0]["FRI_SESS1_TO"].ToString(); Label27.Text = ds.Tables[0].Rows[0]["FRI_SESS2_FROM"].ToString(); Label28.Text = ds.Tables[0].Rows[0]["FRI_SESS2_TO"].ToString(); Label29.Text = ds.Tables[0].Rows[0]["FRI_SESS3_FROM"].ToString(); Label30.Text = ds.Tables[0].Rows[0]["FRI_SESS3_TO"].ToString(); Label31.Text = ds.Tables[0].Rows[0]["SAT_SESS1_FROM"].ToString(); Label32.Text = ds.Tables[0].Rows[0]["SAT_SESS1_TO"].ToString(); Label33.Text = ds.Tables[0].Rows[0]["SAT_SESS2_FROM"].ToString(); Label34.Text = ds.Tables[0].Rows[0]["SAT_SESS2_TO"].ToString(); Label35.Text = ds.Tables[0].Rows[0]["SAT_SESS3_FROM"].ToString(); Label36.Text = ds.Tables[0].Rows[0]["SAT_SESS3_TO"].ToString(); Label37.Text = ds.Tables[0].Rows[0]["SUN_SESS1_FROM"].ToString(); Label38.Text = ds.Tables[0].Rows[0]["SUN_SESS1_TO"].ToString(); Label39.Text = ds.Tables[0].Rows[0]["SUN_SESS2_FROM"].ToString(); Label40.Text = ds.Tables[0].Rows[0]["SUN_SESS2_TO"].ToString(); Label41.Text = ds.Tables[0].Rows[0]["SUN_SESS3_FROM"].ToString(); Label42.Text = ds.Tables[0].Rows[0]["SUN_SESS3_TO"].ToString(); Common_GetDoctorAppointmentsByIdBL objGetDoctorAppointmentsByIdBL = new Common_GetDoctorAppointmentsByIdBL(); GridView1.DataSource = objGetDoctorAppointmentsByIdBL.Common_GetDoctorAppointmentsById(Convert.ToInt32(Session["doctorId"].ToString())); GridView1.DataBind(); GetEmployeeLeaveBL objGetEmployeeLeaveBL = new GetEmployeeLeaveBL(); ds = objGetEmployeeLeaveBL.GetEmployeeLeave(empId); if (ds.Tables[0].Rows.Count != 0) { leaveId = Convert.ToInt32(ds.Tables[0].Rows[0]["ID"].ToString()); string leaveFromDate = ds.Tables[0].Rows[0]["FROM_DATE"].ToString(); string leaveToDate = ds.Tables[0].Rows[0]["TO_DATE"].ToString(); string leaveFromTime = ds.Tables[0].Rows[0]["FROM_TIME"].ToString(); string leaveToTime = ds.Tables[0].Rows[0]["TO_TIME"].ToString(); Label43.Text = "On Leave From " + leaveFromTime + " " + leaveFromDate + " to " + leaveToTime + " " + leaveToDate; LinkButton1.Visible = true; } } }
protected void Button2_Click(object sender, EventArgs e) { GetEmployeeLeaveBL objGetEmployeeLeaveBL = new GetEmployeeLeaveBL(); DataSet ds1 = objGetEmployeeLeaveBL.GetEmployeeLeave(Convert.ToInt32(DropDownList2.SelectedValue)); string leaveFromDate = null; string leaveToDate = null; string leaveFromTime = null; string leaveToTime = null; if (ds1.Tables[0].Rows.Count != 0) { leaveFromDate = ds1.Tables[0].Rows[0]["FROM_DATE"].ToString(); leaveToDate = ds1.Tables[0].Rows[0]["TO_DATE"].ToString(); leaveFromTime = ds1.Tables[0].Rows[0]["FROM_TIME"].ToString(); leaveToTime = ds1.Tables[0].Rows[0]["TO_TIME"].ToString(); } string appointmentDate = DateTime.ParseExact(TextBox2.Text, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture).ToString(); string appointmentTime = TextBox3.Text; DateTime appointmentDateDateTime = Convert.ToDateTime(appointmentDate); DateTime appointmentTimeDateTime = Convert.ToDateTime(appointmentTime); if (ds1.Tables[0].Rows.Count != 0) { DateTime leaveFromDateDateTime = Convert.ToDateTime(leaveFromDate); DateTime leaveFromTimeDateTime = DateTime.ParseExact(leaveFromTime, "HH:mm", System.Globalization.CultureInfo.InvariantCulture); DateTime leaveToDateDateTime = Convert.ToDateTime(leaveToDate); DateTime leaveToTimeDateTime = DateTime.ParseExact(leaveToTime, "HH:mm", System.Globalization.CultureInfo.InvariantCulture); if((DateTime.Compare(appointmentDateDateTime, leaveToDateDateTime) < 0) && (DateTime.Compare(leaveFromDateDateTime, appointmentDateDateTime) < 0)) { Label3.Text = "Doctor Unavailable From " + leaveFromTime + " " + leaveFromDate + " To " + leaveToTime + " " + leaveToDate; MultiView1.ActiveViewIndex = 0; } else if ((DateTime.Compare(leaveToDateDateTime, appointmentDateDateTime) == 0) && DateTime.Compare(leaveToTimeDateTime, appointmentTimeDateTime) > 0) { Label3.Text = "Doctor Unavailable From " + leaveFromTime + " " + leaveFromDate + " To " + leaveToTime + " " + leaveToDate; MultiView1.ActiveViewIndex = 0; } else { int doctorId = Convert.ToInt32(DropDownList2.SelectedValue); Common_GetDoctorAppointmentByDateTimeBL objGetDoctorAppointmentDateTimeBL = new Common_GetDoctorAppointmentByDateTimeBL(); ds = objGetDoctorAppointmentDateTimeBL.Common_GetDoctorAppointmentByDateTime(doctorId, appointmentDate, appointmentTime); if (ds.Tables[0].Rows.Count != 0) { Label3.Text = "Doctor Already Has An Appointment On " + appointmentDateDateTime.Date.ToShortDateString() + " " + appointmentTime; MultiView1.ActiveViewIndex = 0; } else { AddPatientAppointmentBL objAddPatientAppointmentBL = new AddPatientAppointmentBL(); doctorId = Convert.ToInt32(DropDownList2.SelectedValue); appointmentDate = DateTime.ParseExact(TextBox2.Text, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture).ToString(); appointmentTime = TextBox3.Text; int bodyPartId = Convert.ToInt32(DropDownList3.SelectedValue); string problemDesciption = TextBox4.Text; string appointmentToken = objAddPatientAppointmentBL.AddPatientAppointment(Convert.ToInt32(Label2.Text), doctorId, appointmentDate, appointmentTime, bodyPartId, problemDesciption); Session["appointmentToken"] = appointmentToken; Label5.Text = "Appointment Created. Appointment token is <b>" + appointmentToken + "</b>"; MultiView1.ActiveViewIndex = 1; TextBox2.Enabled = false; TextBox3.Enabled = false; TextBox4.Enabled = false; DropDownList1.Enabled = false; DropDownList2.Enabled = false; DropDownList3.Enabled = false; } } } else { AddPatientAppointmentBL objAddPatientAppointmentBL = new AddPatientAppointmentBL(); int doctorId = Convert.ToInt32(DropDownList2.SelectedValue); appointmentDate = DateTime.ParseExact(TextBox2.Text, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture).ToString(); appointmentTime = TextBox3.Text; int bodyPartId = Convert.ToInt32(DropDownList3.SelectedValue); string problemDesciption = TextBox4.Text; string appointmentToken = objAddPatientAppointmentBL.AddPatientAppointment(Convert.ToInt32(Label2.Text), doctorId, appointmentDate, appointmentTime, bodyPartId, problemDesciption); Session["appointmentToken"] = appointmentToken; Label5.Text = "Appointment Created. Appointment token is <b>" + appointmentToken + "</b>"; MultiView1.ActiveViewIndex = 1; TextBox2.Enabled = false; TextBox3.Enabled = false; TextBox4.Enabled = false; DropDownList1.Enabled = false; DropDownList2.Enabled = false; DropDownList3.Enabled = false; } }
protected void Page_Load(object sender, EventArgs e) { if(!IsPostBack) { int empId = Convert.ToInt32(Session["doctorId"].ToString()); Common_GetEmployeeScheduleBL objGetEmployeeScheduleBL = new Common_GetEmployeeScheduleBL(); DataSet ds = new DataSet(); ds = objGetEmployeeScheduleBL.Common_GetEmployeeSchedule(empId); Label1.Text = ds.Tables[0].Rows[0]["MON_SESS1_FROM"].ToString(); Label2.Text = ds.Tables[0].Rows[0]["MON_SESS1_TO"].ToString(); Label3.Text = ds.Tables[0].Rows[0]["MON_SESS2_FROM"].ToString(); Label4.Text = ds.Tables[0].Rows[0]["MON_SESS2_TO"].ToString(); Label5.Text = ds.Tables[0].Rows[0]["MON_SESS3_FROM"].ToString(); Label6.Text = ds.Tables[0].Rows[0]["MON_SESS3_TO"].ToString(); Label7.Text = ds.Tables[0].Rows[0]["TUE_SESS1_FROM"].ToString(); Label8.Text = ds.Tables[0].Rows[0]["TUE_SESS1_TO"].ToString(); Label9.Text = ds.Tables[0].Rows[0]["TUE_SESS2_FROM"].ToString(); Label10.Text = ds.Tables[0].Rows[0]["TUE_SESS2_TO"].ToString(); Label11.Text = ds.Tables[0].Rows[0]["TUE_SESS3_FROM"].ToString(); Label12.Text = ds.Tables[0].Rows[0]["TUE_SESS3_TO"].ToString(); Label13.Text = ds.Tables[0].Rows[0]["WED_SESS1_FROM"].ToString(); Label14.Text = ds.Tables[0].Rows[0]["WED_SESS1_TO"].ToString(); Label15.Text = ds.Tables[0].Rows[0]["WED_SESS2_FROM"].ToString(); Label16.Text = ds.Tables[0].Rows[0]["WED_SESS2_TO"].ToString(); Label17.Text = ds.Tables[0].Rows[0]["WED_SESS3_FROM"].ToString(); Label18.Text = ds.Tables[0].Rows[0]["WED_SESS3_TO"].ToString(); Label19.Text = ds.Tables[0].Rows[0]["THU_SESS1_FROM"].ToString(); Label20.Text = ds.Tables[0].Rows[0]["THU_SESS1_TO"].ToString(); Label21.Text = ds.Tables[0].Rows[0]["THU_SESS2_FROM"].ToString(); Label22.Text = ds.Tables[0].Rows[0]["THU_SESS2_TO"].ToString(); Label23.Text = ds.Tables[0].Rows[0]["THU_SESS3_FROM"].ToString(); Label24.Text = ds.Tables[0].Rows[0]["THU_SESS3_TO"].ToString(); Label25.Text = ds.Tables[0].Rows[0]["FRI_SESS1_FROM"].ToString(); Label26.Text = ds.Tables[0].Rows[0]["FRI_SESS1_TO"].ToString(); Label27.Text = ds.Tables[0].Rows[0]["FRI_SESS2_FROM"].ToString(); Label28.Text = ds.Tables[0].Rows[0]["FRI_SESS2_TO"].ToString(); Label29.Text = ds.Tables[0].Rows[0]["FRI_SESS3_FROM"].ToString(); Label30.Text = ds.Tables[0].Rows[0]["FRI_SESS3_TO"].ToString(); Label31.Text = ds.Tables[0].Rows[0]["SAT_SESS1_FROM"].ToString(); Label32.Text = ds.Tables[0].Rows[0]["SAT_SESS1_TO"].ToString(); Label33.Text = ds.Tables[0].Rows[0]["SAT_SESS2_FROM"].ToString(); Label34.Text = ds.Tables[0].Rows[0]["SAT_SESS2_TO"].ToString(); Label35.Text = ds.Tables[0].Rows[0]["SAT_SESS3_FROM"].ToString(); Label36.Text = ds.Tables[0].Rows[0]["SAT_SESS3_TO"].ToString(); Label37.Text = ds.Tables[0].Rows[0]["SUN_SESS1_FROM"].ToString(); Label38.Text = ds.Tables[0].Rows[0]["SUN_SESS1_TO"].ToString(); Label39.Text = ds.Tables[0].Rows[0]["SUN_SESS2_FROM"].ToString(); Label40.Text = ds.Tables[0].Rows[0]["SUN_SESS2_TO"].ToString(); Label41.Text = ds.Tables[0].Rows[0]["SUN_SESS3_FROM"].ToString(); Label42.Text = ds.Tables[0].Rows[0]["SUN_SESS3_TO"].ToString(); Common_GetDoctorAppointmentsByIdBL objGetDoctorAppointmentsByIdBL = new Common_GetDoctorAppointmentsByIdBL(); GridView1.DataSource = objGetDoctorAppointmentsByIdBL.Common_GetDoctorAppointmentsById(Convert.ToInt32(Session["doctorId"].ToString())); GridView1.DataBind(); GetEmployeeLeaveBL objGetEmployeeLeaveBL = new GetEmployeeLeaveBL(); ds = objGetEmployeeLeaveBL.GetEmployeeLeave(empId); if(ds.Tables[0].Rows.Count != 0) { leaveId = Convert.ToInt32(ds.Tables[0].Rows[0]["ID"].ToString()); string leaveFromDate = ds.Tables[0].Rows[0]["FROM_DATE"].ToString(); string leaveToDate = ds.Tables[0].Rows[0]["TO_DATE"].ToString(); string leaveFromTime = ds.Tables[0].Rows[0]["FROM_TIME"].ToString(); string leaveToTime = ds.Tables[0].Rows[0]["TO_TIME"].ToString(); Label43.Text = "On Leave From " + leaveFromTime + " " + leaveFromDate + " to " + leaveToTime + " " + leaveToDate; LinkButton1.Visible = true; } } }
protected void Button2_Click(object sender, EventArgs e) { GetEmployeeLeaveBL objGetEmployeeLeaveBL = new GetEmployeeLeaveBL(); DataSet ds1 = objGetEmployeeLeaveBL.GetEmployeeLeave(Convert.ToInt32(DropDownList2.SelectedValue)); string leaveFromDate = null; string leaveToDate = null; string leaveFromTime = null; string leaveToTime = null; if (ds1.Tables[0].Rows.Count != 0) { leaveFromDate = ds1.Tables[0].Rows[0]["FROM_DATE"].ToString(); leaveToDate = ds1.Tables[0].Rows[0]["TO_DATE"].ToString(); leaveFromTime = ds1.Tables[0].Rows[0]["FROM_TIME"].ToString(); leaveToTime = ds1.Tables[0].Rows[0]["TO_TIME"].ToString(); } string appointmentDate = DateTime.ParseExact(TextBox2.Text, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture).ToString(); string appointmentTime = TextBox3.Text; DateTime appointmentDateDateTime = Convert.ToDateTime(appointmentDate); DateTime appointmentTimeDateTime = Convert.ToDateTime(appointmentTime); if (ds1.Tables[0].Rows.Count != 0) { DateTime leaveFromDateDateTime = Convert.ToDateTime(leaveFromDate); DateTime leaveFromTimeDateTime = DateTime.ParseExact(leaveFromTime, "HH:mm", System.Globalization.CultureInfo.InvariantCulture); DateTime leaveToDateDateTime = Convert.ToDateTime(leaveToDate); DateTime leaveToTimeDateTime = DateTime.ParseExact(leaveToTime, "HH:mm", System.Globalization.CultureInfo.InvariantCulture); if ((DateTime.Compare(appointmentDateDateTime, leaveToDateDateTime) < 0) && (DateTime.Compare(leaveFromDateDateTime, appointmentDateDateTime) < 0)) { Label3.Text = "Doctor Unavailable From " + leaveFromTime + " " + leaveFromDate + " To " + leaveToTime + " " + leaveToDate; MultiView1.ActiveViewIndex = 0; } else if ((DateTime.Compare(leaveToDateDateTime, appointmentDateDateTime) == 0) && DateTime.Compare(leaveToTimeDateTime, appointmentTimeDateTime) > 0) { Label3.Text = "Doctor Unavailable From " + leaveFromTime + " " + leaveFromDate + " To " + leaveToTime + " " + leaveToDate; MultiView1.ActiveViewIndex = 0; } else { int doctorId = Convert.ToInt32(DropDownList2.SelectedValue); Common_GetDoctorAppointmentByDateTimeBL objGetDoctorAppointmentDateTimeBL = new Common_GetDoctorAppointmentByDateTimeBL(); ds = objGetDoctorAppointmentDateTimeBL.Common_GetDoctorAppointmentByDateTime(doctorId, appointmentDate, appointmentTime); if (ds.Tables[0].Rows.Count != 0) { Label3.Text = "Doctor Already Has An Appointment On " + appointmentDateDateTime.Date.ToShortDateString() + " " + appointmentTime; MultiView1.ActiveViewIndex = 0; } else { AddPatientAppointmentBL objAddPatientAppointmentBL = new AddPatientAppointmentBL(); doctorId = Convert.ToInt32(DropDownList2.SelectedValue); appointmentDate = DateTime.ParseExact(TextBox2.Text, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture).ToString(); appointmentTime = TextBox3.Text; int bodyPartId = Convert.ToInt32(DropDownList3.SelectedValue); string problemDesciption = TextBox4.Text; string appointmentToken = objAddPatientAppointmentBL.AddPatientAppointment(Convert.ToInt32(Label2.Text), doctorId, appointmentDate, appointmentTime, bodyPartId, problemDesciption); Session["appointmentToken"] = appointmentToken; Label5.Text = "Appointment Created. Appointment token is <b>" + appointmentToken + "</b>"; MultiView1.ActiveViewIndex = 1; TextBox2.Enabled = false; TextBox3.Enabled = false; TextBox4.Enabled = false; DropDownList1.Enabled = false; DropDownList2.Enabled = false; DropDownList3.Enabled = false; } } } else { AddPatientAppointmentBL objAddPatientAppointmentBL = new AddPatientAppointmentBL(); int doctorId = Convert.ToInt32(DropDownList2.SelectedValue); appointmentDate = DateTime.ParseExact(TextBox2.Text, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture).ToString(); appointmentTime = TextBox3.Text; int bodyPartId = Convert.ToInt32(DropDownList3.SelectedValue); string problemDesciption = TextBox4.Text; string appointmentToken = objAddPatientAppointmentBL.AddPatientAppointment(Convert.ToInt32(Label2.Text), doctorId, appointmentDate, appointmentTime, bodyPartId, problemDesciption); Session["appointmentToken"] = appointmentToken; Label5.Text = "Appointment Created. Appointment token is <b>" + appointmentToken + "</b>"; MultiView1.ActiveViewIndex = 1; TextBox2.Enabled = false; TextBox3.Enabled = false; TextBox4.Enabled = false; DropDownList1.Enabled = false; DropDownList2.Enabled = false; DropDownList3.Enabled = false; } }