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;
        }
    }
Пример #2
0
    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;
        }
    }
 public void CreateAppointment(string patientId, string doctorId, string appointmentDate, string appointmentTime, string problemBodyPartId, string problemDescription)
 {
     AddPatientAppointmentBL objAddPatientAppointmentBL = new AddPatientAppointmentBL();
     objAddPatientAppointmentBL.AddPatientAppointment(Convert.ToInt32(patientId), Convert.ToInt32(doctorId), DateTime.ParseExact(appointmentDate, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture).ToString(), appointmentTime, Convert.ToInt32(problemBodyPartId), problemDescription);
 }
    public void CreateAppointment(string patientId, string doctorId, string appointmentDate, string appointmentTime, string problemBodyPartId, string problemDescription)
    {
        AddPatientAppointmentBL objAddPatientAppointmentBL = new AddPatientAppointmentBL();

        objAddPatientAppointmentBL.AddPatientAppointment(Convert.ToInt32(patientId), Convert.ToInt32(doctorId), DateTime.ParseExact(appointmentDate, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture).ToString(), appointmentTime, Convert.ToInt32(problemBodyPartId), problemDescription);
    }