private void GetEditForm(Appointment editedAppointment) { Appointment appointmentToEdit = ExamScheduler.PrepareToEdit(editedAppointment, ExamScheduler.EditingRecurringSeries); if (editedAppointment.ID == null) { StartTime.SelectedDate = ExamScheduler.UtcToDisplay(appointmentToEdit.Start); } else { string[] str = appointmentToEdit.Subject.Split('['); lblCourse.Text = str[0].ToString(); string[] str1 = str[1].Split(']'); lblExam.Text = str[1].Substring(0, str[1].Length - 1).ToString(); lblExam.Text = str1[0].ToString(); // lblSubjectValue.Text = str[0].ToString() + " [ " + str1[0].ToString() + " ] "; BEStudent obj = new BEStudent(); obj.IntExamID = 0; obj.IntTransID = Convert.ToInt64(appointmentToEdit.ID.ToString()); BStudent obj1 = new BStudent(); obj1.BGetExamStartEndDates(obj); if (obj.DtResult != null && obj.DtResult.Rows.Count > 0) { lblSubjectValue.Text = obj.DtResult.Rows[0]["ExamMins"].ToString() + " minutes"; } lblExamIDValue.Text = appointmentToEdit.ID.ToString(); //txtDescription.Text = appointmentToEdit.Description; StartTime.SelectedDate = ExamScheduler.UtcToDisplay(appointmentToEdit.Start); } }
protected void Schedule_Reschedule_Click(object sender, EventArgs e) { if (Session["update"].ToString() == ViewState["update"].ToString()) { if (EditedAppointment == null) { Appointment aptToInsert = GetBasicAppointmentFromForm(); BEStudent objBEStudent = new BEStudent() { IntUserID = Convert.ToInt32(Session[EnumPageSessions.USERID]), IntCourseID = int.Parse(drpCourse.SelectedValue), IntExamID = int.Parse(drpExam.SelectedValue), dtExam = aptToInsert.Start }; TimeSpan ts = objBEStudent.dtExam - DateTime.Now; int hours = ts.Hours; objBEStudent.intHours = hours; new BStudent().BStudent_GetAmountForDemandSchedule(objBEStudent); decimal amount = objBEStudent.decAmount; Session["StudentExamDetails"] = objBEStudent; Response.Redirect("NewPayment.aspx?Type=F&" + "ExamFeeAmount=" + amount, false); new BStudent().BStudent_OnDemandScheduleExam(objBEStudent); if (objBEStudent.DsResult != null) { if (Convert.ToInt32(objBEStudent.DsResult.Tables[0].Rows[0]["Result"]) == 1) { BEStudent obj = new BEStudent(); obj.IntExamID = Convert.ToInt32(drpExam.SelectedValue); obj.IntTransID = 0; BStudent obj1 = new BStudent(); obj1.BGetExamStartEndDates(obj); string StartDate = string.Empty; string EndDate = string.Empty; if (obj.DtResult != null && obj.DtResult.Rows.Count > 0) { StartDate = obj.DtResult.Rows[0]["ExamStartDate"].ToString(); EndDate = obj.DtResult.Rows[0]["ExamEndDate"].ToString(); } lblMsg.Text = "<img src='../Images/no.png'align='middle'/> <font color='red'>" + "\"" + drpCourse.SelectedItem.Text.ToString() + "- " + drpExam.SelectedItem.Text.ToString() + "\"" + Resources.ResMessages.Schedule_ExamStartEndDateValidation + " " + StartDate + " and " + EndDate + "</font>"; } else if (Convert.ToInt32(objBEStudent.DsResult.Tables[0].Rows[0]["Result"]) == 2) { lblMsg.Text = "<img src='../Images/no.png'align='middle'/> <font color='red'>" + Resources.ResMessages.Schedule_24hoursValidation + "</font>"; } else if (Convert.ToInt32(objBEStudent.DsResult.Tables[0].Rows[0]["Result"]) == 3) { lblMsg.Text = "<img src='../Images/no.png'align='middle'/> <font color='red'>" + Resources.ResMessages.Schedule_PriorDateValidation + "</font>"; } else if (Convert.ToInt32(objBEStudent.DsResult.Tables[0].Rows[0]["Result"]) == 4) { lblMsg.Text = "<img src='../Images/yes.png' align='middle'/> <font color='#00C000'>" + Resources.ResMessages.Schedule_Confirmation + " " + objBEStudent.DsResult.Tables[0].Rows[0]["ID"] + Resources.ResMessages.Schedule_Confirmation1 + "</font>"; } else if (Convert.ToInt32(objBEStudent.DsResult.Tables[0].Rows[0]["Result"]) == 5) { lblMsg.Text = "<img src='../Images/no.png'align='middle'/> <font color='red'>" + Resources.ResMessages.Schedule_TimeWindowValidation + "</font>"; } else if (Convert.ToInt32(objBEStudent.DsResult.Tables[0].Rows[0]["Result"]) == 6) { objBEStudent.IntExamID = Convert.ToInt32(drpExam.SelectedValue); objBEStudent.IntUserID = Convert.ToInt32(Session[EnumPageSessions.USERID]); objBEStudent.IntCourseID = Convert.ToInt32(drpCourse.SelectedValue); new BStudent().BGetExamScheduledDate(objBEStudent); if (objBEStudent.DtResult != null && objBEStudent.DtResult.Rows.Count > 0) { lblMsg.Text = "<img src='../Images/no.png'align='middle'/> <font color='red'>" + "\"" + drpCourse.SelectedItem.Text.ToString() + "- " + drpExam.SelectedItem.Text.ToString() + "\" " + Resources.ResMessages.Student_ExamAlreadyExists + " " + objBEStudent.DtResult.Rows[0]["ExamDate"].ToString() + " at " + objBEStudent.DtResult.Rows[0]["Time"].ToString() + "</font>"; } else { lblMsg.Text = "<img src='../Images/no.png'align='middle'/> <font color='red'>" + "\"" + drpCourse.SelectedItem.Text.ToString() + "- " + drpExam.SelectedItem.Text.ToString() + "\"" + Resources.ResMessages.Student_ExamAlreadyExistsElse + "</font>"; } } } try { BEMail objBEMail = new BEMail(); BMail objBMail = new BMail(); objBEMail.IntUserID = 0; objBEMail.IntTransID = Convert.ToInt64(objBEStudent.DsResult.Tables[0].Rows[0]["ID"]); objBEMail.StrTemplateName = BaseClass.EnumEmails.StudentExamReceipt.ToString(); //objBMail.BSendEmail(objBEMail); //objBEMail.StrTemplateName = BaseClass.EnumEmails.ExamConfirmationProctorFYI.ToString(); // objBMail.BSendEmail(objBEMail); } catch (Exception ex) { throw ex; } } else { Appointment aptOriginal = EditedAppointment; Appointment aptToUpdate = GetAppointmentFromForm(aptOriginal.Clone()); BEStudent objBEStudent = new BEStudent() { IntUserID = Convert.ToInt32(Session[EnumPageSessions.USERID]), IntScheduleID = Convert.ToInt32(aptToUpdate.ID.ToString()), dtExam = aptToUpdate.Start, strDescription = aptToUpdate.Description }; new BStudent().BStudent_UpdateScheduleExam(objBEStudent); if (objBEStudent.DsResult != null) { if (Convert.ToInt32(objBEStudent.DsResult.Tables[0].Rows[0]["Result"]) == 1) { BEStudent obj = new BEStudent(); obj.IntExamID = 0; obj.IntTransID = Convert.ToInt64(aptToUpdate.ID.ToString()); BStudent obj1 = new BStudent(); obj1.BGetExamStartEndDates(obj); string StartDate = string.Empty; string EndDate = string.Empty; if (obj.DtResult != null && obj.DtResult.Rows.Count > 0) { StartDate = obj.DtResult.Rows[0]["ExamStartDate"].ToString(); EndDate = obj.DtResult.Rows[0]["ExamEndDate"].ToString(); } lblMsg.Text = "<img src='../Images/no.png'align='middle'/> <font color='red'>" + Resources.ResMessages.Reschedule_ExamStartEndDateValidation + " " + StartDate + " and " + EndDate + "</font>"; //lblMsg.Text = "<img src='../Images/no.png'align='middle'/> <font color='red'><b>" + Resources.ResMessages.Reschedule_ExamStartEndDateValidation + "</b></font>"; } else if (Convert.ToInt32(objBEStudent.DsResult.Tables[0].Rows[0]["Result"]) == 2) { lblMsg.Text = "<img src='../Images/no.png'align='middle'/> <font color='red'>" + Resources.ResMessages.Reschedule_24hoursValidation + "</font>"; } else if (Convert.ToInt32(objBEStudent.DsResult.Tables[0].Rows[0]["Result"]) == 3) { lblMsg.Text = "<img src='../Images/no.png'align='middle'/> <font color='red'>" + Resources.ResMessages.Reschedule_PriorDateValidation + "</font>"; } else if (Convert.ToInt32(objBEStudent.DsResult.Tables[0].Rows[0]["Result"]) == 4) { // lblMsg.Text = "<img src='../Images/yes.png' align='middle'/> <font color='#00C000'><b>" + Resources.ResMessages.Reschedule_Confirmation + "</b></font>"; lblMsg.Text = "<img src='../Images/yes.png' align='middle'/> <font color='#00C000'>" + Resources.ResMessages.Reschedule_Confirmation + " " + aptToUpdate.ID.ToString() + Resources.ResMessages.Reschedule_Confirmation1 + "</font>"; } else if (Convert.ToInt32(objBEStudent.DsResult.Tables[0].Rows[0]["Result"]) == 5) { lblMsg.Text = "<img src='../Images/no.png'align='middle'/> <font color='red'>" + Resources.ResMessages.Reschedule_TimeWindowValidation + "</font>"; } else if (Convert.ToInt32(objBEStudent.DsResult.Tables[0].Rows[0]["Result"]) == 6) { lblMsg.Text = "<img src='../Images/no.png'align='middle'/> <font color='red'>" + Resources.ResMessages.Reschedule_ExamProgressValidation + "</font>"; } } try { BEMail objBEMail = new BEMail(); BMail objBMail = new BMail(); objBEMail.IntUserID = 0; objBEMail.IntTransID = Convert.ToInt64(aptToUpdate.ID.ToString()); objBEMail.StrTemplateName = BaseClass.EnumEmails.ReScheduleConfirmation.ToString(); //objBMail.BSendEmail(objBEMail); //objBEMail.StrTemplateName = BaseClass.EnumEmails.ReScheduleConfirmationProctorFYI.ToString(); objBMail.BSendEmail(objBEMail); } catch (Exception ex) { throw ex; } } lblCourse.Text = string.Empty; //lblExam.Text = string.Empty; EditedAppointmentID = ""; Bind_GetBookedExamSlots(); Session["update"] = Server.UrlEncode(System.DateTime.Now.ToString()); } else { lblMsg.Text = string.Empty; } }