Exemple #1
0
    protected void SubmitButton_Click(object sender, ImageClickEventArgs e)
    {
        if (Page.IsValid)
        {
            try
            {
                if (ValidateScheduleDates() && ValidateSchedule())
                {
                    Doctors objDoc = new Doctors();
                    objDoc.ScheduleType = ScheduleTypeRadio.SelectedItem.Value;
                    DateTime fmDt = Convert.ToDateTime(ScheduleFromTextBox.Text);
                    DateTime toDt = Convert.ToDateTime(ScheduleToDateTextBox.Text);
                    objDoc.ScheduleFromDate = fmDt.AddHours(double.Parse(AvailableFrom.SelectedItem.Text));
                    objDoc.ScheduleToDate   = toDt.AddHours(double.Parse(AvailableTo.SelectedItem.Text)).AddMinutes(59).AddSeconds(59);
                    objDoc.AvailableFrom    = AvailableFrom.SelectedItem.Text + ":00";
                    objDoc.AvailableTo      = AvailableTo.SelectedItem.Text + ":00";
                    objDoc.DoctorId         = 1;
                    objDoc.DoctorCode       = DoctorCodeLabel.Text;

                    int result = objDoc.CreateDoctorsSchedule();

                    switch (result)
                    {
                    case 0:
                        RegisterLabel.Text = "Invalid entry, kindly verify the details and try again !!!";
                        break;

                    case 1:
                        RegisterLabel.Text = "Your schedule has been saved successfully. You can view your saved schedule in below table. !!!";
                        break;

                    case 2:
                        RegisterLabel.Text = "Your schedule cannot be saved. It overlaps with existing schedule. !!!";
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
        BindDoctorSchedule();
    }
    protected void SubmitButton_Click(object sender, ImageClickEventArgs e)
    {
        if (Page.IsValid)
        {
            try
            {
                if (ValidateScheduleDates() && ValidateSchedule())
                {
                    Doctors objDoc = new Doctors();
                    objDoc.ScheduleType = ScheduleTypeRadio.SelectedItem.Value;
                    DateTime fmDt = Convert.ToDateTime(ScheduleFromTextBox.Text);
                    DateTime toDt = Convert.ToDateTime(ScheduleToDateTextBox.Text);
                    objDoc.ScheduleFromDate = fmDt.AddHours(double.Parse(AvailableFrom.SelectedItem.Text));
                    objDoc.ScheduleToDate = toDt.AddHours(double.Parse(AvailableTo.SelectedItem.Text)).AddMinutes(59).AddSeconds(59);
                    objDoc.AvailableFrom = AvailableFrom.SelectedItem.Text + ":00";
                    objDoc.AvailableTo = AvailableTo.SelectedItem.Text + ":00";
                    objDoc.DoctorId = 1;
                    objDoc.DoctorCode = DoctorCodeLabel.Text;

                    int result = objDoc.CreateDoctorsSchedule();

                    switch (result)
                    {
                        case 0:
                            RegisterLabel.Text = "Invalid entry, kindly verify the details and try again !!!";
                            break;
                        case 1:
                            RegisterLabel.Text = "Your schedule has been saved successfully. You can view your saved schedule in below table. !!!";
                            break;
                        case 2:
                            RegisterLabel.Text = "Your schedule cannot be saved. It overlaps with existing schedule. !!!";
                            break;
                    }
                }
            }
            catch(Exception ex)
            {
            }
        }
        BindDoctorSchedule();
    }