protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { //get id from query string if (Request.QueryString[LACESConstant.QueryString.PROVIDER_ID] != null) { int providerID = 0; int.TryParse(Request.QueryString[LACESConstant.QueryString.PROVIDER_ID].ToString(), out providerID); if (providerID > 0) { ApprovedProviderDataAccess providerDA = new ApprovedProviderDataAccess(); currentProvider = providerDA.GetApprovedProviderByID(providerID); // Get provider by id //if provider exists if (currentProvider != null) { PreparePreviewData(currentProvider); } } } } }
/// <summary> /// Page Load Event Handler /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { // uiLnkDistanceLearning.HRef = GetPDFURL(LACESUtilities.GetApplicationConstants("DistanceEducationPDF")); // uiLnkCalculatingPDH.HRef = GetPDFURL(LACESUtilities.GetApplicationConstants("CalculatingPDF")); // uiLnkModelCertificateForm.HRef = GetPDFURL(LACESUtilities.GetApplicationConstants("ModelCertificateForm")); // uiLnkModelEvaluationForm.HRef = GetPDFURL(LACESUtilities.GetApplicationConstants("ModelEvaluationForm")); // uiLnkHSWClassification.HRef = GetPDFURL(LACESUtilities.GetApplicationConstants("HSWClassificationPDF")); if (!Page.IsPostBack) { //get id from query string if (Request.QueryString[LACESConstant.QueryString.PROVIDER_ID] != null) { int providerID = 0; int.TryParse(Request.QueryString[LACESConstant.QueryString.PROVIDER_ID].ToString(), out providerID); if (providerID > 0) { ApprovedProviderDataAccess providerDA = new ApprovedProviderDataAccess(); ApprovedProvider currentProvider = providerDA.GetApprovedProviderByID(providerID); // Get provider by id //if provider exists if (currentProvider != null) { PreparePreviewData(currentProvider); } } } } }
protected void btDelete_Click(object sender, EventArgs e) { if (Request.QueryString[LACESConstant.QueryString.COURSE_ID] != null && Request.QueryString[LACESConstant.QueryString.COURSE_ID].ToString() != "") { CourseDataAccess objCourseDAL = new CourseDataAccess(); long courseId = Convert.ToInt64(Request.QueryString[LACESConstant.QueryString.COURSE_ID].ToString()); Course deletingCourse = objCourseDAL.GetCoursesDetailsByID(courseId); string coursetitle = deletingCourse.Title; string strSubject = coursetitle + " – Course Declined"; ApprovedProviderDataAccess apda = new ApprovedProviderDataAccess(); ApprovedProvider ap = apda.GetApprovedProviderByID(deletingCourse.ProviderID); string strSendEmaiTo = ap.ApplicantEmail; bool deleted = objCourseDAL.Delete(courseId); //call dal method to delete SendDeleteForeverEmail(strSendEmaiTo, strSubject, coursetitle); Response.Redirect("FindCourses.aspx?status=NP"); // redirect after saving course information } }
/// <summary> /// Return string array by spliting the string by a delimiter /// </summary> /// <param name="stringList">string</param> /// <returns>Array of String</returns> /// protected void SendMoreDataNeededEmail(Course c) { string strMessageBody = uiTxtEmailText.Text.Replace("\r\n", "<br />"); ApprovedProviderDataAccess apda = new ApprovedProviderDataAccess(); ApprovedProvider ap = apda.GetApprovedProviderByID(c.ProviderID); string strSendEmaiTo = ap.ApplicantEmail; SmtpClient smtpClient = new SmtpClient(); //Get the SMTP server Address from SMTP Web.conf smtpClient.Host = LACESUtilities.GetApplicationConstants(LACESConstant.SMTPSERVER); //Get the SMTP port 25; smtpClient.Port = Convert.ToInt32(LACESUtilities.GetApplicationConstants(LACESConstant.SMTPPORT)); //create the message body MailMessage message = new MailMessage(); message.From = new MailAddress(LACESUtilities.GetAdminFromEmail()); message.To.Add(new MailAddress(strSendEmaiTo)); message.CC.Add(new MailAddress(LACESUtilities.GetApplicationConstants(LACESConstant.ADMIN_CONTACT_TO_EMAIL))); message.Subject = "LA CES Course Needs More Information"; message.IsBodyHtml = true; message.Body = strMessageBody; if (ConfigurationManager.AppSettings["SendOutgoingEmail"].ToString() == "Y") { try { smtpClient.Send(message); } catch (Exception ex) { Response.Write(ex.Message); } } }
protected void btnApprove_Click(object sender, EventArgs e) { CourseDataAccess objCourseDAL = new CourseDataAccess(); ///Loop all items in data list to check approve checkbox for approve one course foreach (RepeaterItem dl in dlCourseList.Items) { CheckBox chkApp = (CheckBox)dl.FindControl("chkApprove"); ///Get Course Id from hidden field HiddenField hidCourseID = (HiddenField)dl.FindControl("hidCourseID"); if (chkApp.Checked == true) { long courseId = Convert.ToInt64(hidCourseID.Value); if (courseId > 0) { bool approved = objCourseDAL.ApproveCourseByCourseId(courseId); if (approved) { Course approvedCourse = objCourseDAL.GetCoursesDetailsByID(courseId); string strTitle = approvedCourse.Title; string strHyperlink = approvedCourse.Hyperlink; string strStartDate = approvedCourse.StartDate.ToShortDateString(); string strEndDate = approvedCourse.EndDate.ToShortDateString(); string strDesc = approvedCourse.Description; string strCity = approvedCourse.City; string strState = approvedCourse.StateProvince; string strDistanceEd = approvedCourse.DistanceEducation; string strSubjects = approvedCourse.Subjects; string strHours = approvedCourse.Hours; string strLearningOutcomes = approvedCourse.LearningOutcomes; ApprovedProviderDataAccess apda = new ApprovedProviderDataAccess(); ApprovedProvider ap = apda.GetApprovedProviderByID(approvedCourse.ProviderID); string strSendEmaiTo = ap.ApplicantEmail; StringBuilder strbApprovedEmail = new StringBuilder(); string strEmailTitle = "An LA CES Course has been approved"; string strBodyIntro = "Congratulations, a course has been approved by LA CES administrators. Please review the information below carefully as it may have been revised during the approval process. <br />"; string strBodyEnd = "Please contact <a href=\"mailto:[email protected]\"> LA CES administrators </a> with any questions about the course."; strbApprovedEmail.Append(strBodyIntro + "<br />"); strbApprovedEmail.Append("Course Title: " + strTitle + "<br />"); strbApprovedEmail.Append("Course Hyperlink: " + strHyperlink + "<br />"); strbApprovedEmail.Append("Start Date: " + strStartDate + "<br />"); strbApprovedEmail.Append("End Date: " + strEndDate + "<br />"); strbApprovedEmail.Append("Description: " + strDesc + "<br />"); strbApprovedEmail.Append("City: " + strCity + "<br />"); strbApprovedEmail.Append("State: " + strState + "<br />"); strbApprovedEmail.Append("Distance Education: " + strDistanceEd + "<br />"); strbApprovedEmail.Append("Subject: " + strSubjects + "<br />"); strbApprovedEmail.Append("Hours: " + strHours + "<br />"); strbApprovedEmail.Append("Learning Outcomes: " + strLearningOutcomes + "<br /><br />"); strbApprovedEmail.Append(strBodyEnd + "<br />"); SmtpClient smtpClient = new SmtpClient(); //Get the SMTP server Address from SMTP Web.conf smtpClient.Host = LACESUtilities.GetApplicationConstants(LACESConstant.SMTPSERVER); //Get the SMTP port 25; smtpClient.Port = Convert.ToInt32(LACESUtilities.GetApplicationConstants(LACESConstant.SMTPPORT)); //create the message body MailMessage message = new MailMessage(); message.From = new MailAddress(LACESUtilities.GetAdminFromEmail()); message.To.Add(new MailAddress(strSendEmaiTo)); message.Subject = strEmailTitle; message.IsBodyHtml = true; message.Body = strbApprovedEmail.ToString(); if (ConfigurationManager.AppSettings["SendOutgoingEmail"].ToString() == "Y") { try { // smtpClient.Send(message); } catch (Exception ex) { Response.Write(ex.Message); } } } } } } ///Re-load pending courses pendingCourses = objCourseDAL.GetAllPendingCourses(); dlCourseList.DataSource = pendingCourses; dlCourseList.DataBind(); ///Show success message lblMsg.Visible = true; lblMsg.ForeColor = System.Drawing.Color.Green; lblMsg.Text = "Selected course(s) approved successfully."; }
protected void SendApprovedEmail(long courseId) { CourseDataAccess objCourseDAL = new CourseDataAccess(); Course approvedCourse = objCourseDAL.GetCoursesDetailsByID(courseId); string strTitle = approvedCourse.Title; string strHyperlink = approvedCourse.Hyperlink; string strStartDate = approvedCourse.StartDate.ToShortDateString(); string strEndDate = approvedCourse.EndDate.ToShortDateString(); string strDesc = approvedCourse.Description; string strCity = approvedCourse.City; string strState = approvedCourse.StateProvince; string strDistanceEd = approvedCourse.DistanceEducation; string strSubjects = approvedCourse.Subjects; string strHours = approvedCourse.Hours; string strLearningOutcomes = approvedCourse.LearningOutcomes; ApprovedProviderDataAccess apda = new ApprovedProviderDataAccess(); ApprovedProvider ap = apda.GetApprovedProviderByID(approvedCourse.ProviderID); string strSendEmaiTo = ap.ApplicantEmail; StringBuilder strbApprovedEmail = new StringBuilder(); string strEmailTitle = "An LA CES Course has been approved"; string strBodyIntro = "Congratulations, a course has been approved by LA CES administrators. Please review the information below carefully as it may have been revised during the approval process. <br />"; string strBodyEnd = "Please contact <a href=\"mailto:[email protected]\"> LA CES administrators </a> with any questions about the course."; strbApprovedEmail.Append(strBodyIntro + "<br />"); strbApprovedEmail.Append("Course Title: " + strTitle + "<br />"); strbApprovedEmail.Append("Course Hyperlink: " + strHyperlink + "<br />"); strbApprovedEmail.Append("Start Date: " + strStartDate + "<br />"); strbApprovedEmail.Append("End Date: " + strEndDate + "<br />"); strbApprovedEmail.Append("Description: " + strDesc + "<br />"); strbApprovedEmail.Append("City: " + strCity + "<br />"); strbApprovedEmail.Append("State: " + strState + "<br />"); strbApprovedEmail.Append("Distance Education: " + strDistanceEd + "<br />"); strbApprovedEmail.Append("Subject: " + strSubjects + "<br />"); strbApprovedEmail.Append("Hours: " + strHours + "<br />"); strbApprovedEmail.Append("Learning Outcomes: " + strLearningOutcomes + "<br /><br />"); strbApprovedEmail.Append(strBodyEnd + "<br />"); SmtpClient smtpClient = new SmtpClient(); //Get the SMTP server Address from SMTP Web.conf smtpClient.Host = LACESUtilities.GetApplicationConstants(LACESConstant.SMTPSERVER); //Get the SMTP port 25; smtpClient.Port = Convert.ToInt32(LACESUtilities.GetApplicationConstants(LACESConstant.SMTPPORT)); //create the message body MailMessage message = new MailMessage(); message.From = new MailAddress(LACESUtilities.GetAdminFromEmail()); message.To.Add(new MailAddress(strSendEmaiTo)); message.Subject = strEmailTitle; message.IsBodyHtml = true; message.Body = strbApprovedEmail.ToString(); if (ConfigurationManager.AppSettings["SendOutgoingEmail"].ToString() == "Y") { try { smtpClient.Send(message); } catch (Exception ex) { Response.Write(ex.Message); } } }
/// <summary> /// Page load event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { Response.Redirect("FindCourses.aspx?status=NP"); //Debugger.Break(); lblMsg.Visible = false; if (!IsPostBack) { CourseDataAccess objCourseDAL = new CourseDataAccess(); //If having query string of CourseID considering to delete the course item if (Request.QueryString[LACESConstant.QueryString.COURSE_ID] != null && Request.QueryString[LACESConstant.QueryString.COURSE_ID].ToString() != "") { long courseId = Convert.ToInt64(Request.QueryString[LACESConstant.QueryString.COURSE_ID].ToString()); Course deletingCourse = objCourseDAL.GetCoursesDetailsByID(courseId); lblMsg.Visible = true; ///If course deleted by another admin if (deletingCourse == null) { lblMsg.ForeColor = System.Drawing.Color.Red; lblMsg.Text = "Selected course has been deleted by another admin."; } ///If course is not as "New / Pending Approval" status else if (deletingCourse.Status != "New / Pending Approval") { lblMsg.ForeColor = System.Drawing.Color.Red; lblMsg.Text = "Selected course is not \"New / Pending Approval\" status currently."; } else { bool deleted = objCourseDAL.Delete(courseId);//call dal method to delete ApprovedProviderDataAccess objProviderDAL = new ApprovedProviderDataAccess(); ApprovedProvider provider = objProviderDAL.GetApprovedProviderByID(deletingCourse.ProviderID); //If deleted the course item show the message if (deleted) { lblMsg.ForeColor = System.Drawing.Color.Green; lblMsg.Text = "You have rejected " + Server.HtmlEncode(deletingCourse.Title) + " from the " + LACESConstant.LACES_TEXT + " system."; lblMsg.Text += " Please contact <a href='mailto:" + provider.ApplicantEmail + "'>" + Server.HtmlEncode(provider.OrganizationName) + "</a>"; lblMsg.Text += " to explain why the course was rejected."; } } } ///Populate pending course list pendingCourses = objCourseDAL.GetAllPendingCourses(); dlCourseList.DataSource = pendingCourses; dlCourseList.DataBind(); if (pendingCourses == null || pendingCourses.Count == 0) { if (lblMsg.Visible == false) { lblMsg.Visible = true; lblMsg.ForeColor = System.Drawing.Color.Black; lblMsg.Text = "No course found."; } btnApprove.Enabled = false; } } }
/// <summary> /// Update provider info /// </summary> private void SaveProvider() { try { //get id from query string if (Request.QueryString[LACESConstant.QueryString.PROVIDER_ID] != null) { int providerID = 0; int.TryParse(Request.QueryString[LACESConstant.QueryString.PROVIDER_ID].ToString(), out providerID); if (providerID > 0) { ApprovedProviderDataAccess providerDA = new ApprovedProviderDataAccess(); ApprovedProvider currentProvider = providerDA.GetApprovedProviderByID(providerID); // Get provider by id //if provider exists if (currentProvider != null) { //if currently provider status is pending or inactive and admin manually //activates him/her, his/her NextRenewalDate will be set to 1 yr later from today if (currentProvider.Status != LACESConstant.ProviderStatus.ACTIVE && pvStatus.SelectedValue == LACESConstant.ProviderStatus.ACTIVE) { currentProvider.NextRenewalDate = DateTime.Now.AddYears(1); } if (uiLblNextRenewalDate.Text.Length > 0) { DateTime dtNextRen; if (DateTime.TryParse(uiLblNextRenewalDate.Text, out dtNextRen)) { currentProvider.NextRenewalDate = dtNextRen; } } currentProvider.Status = pvStatus.SelectedValue; if (ApprovalDate.Text != "") { currentProvider.ApprovalDate = Convert.ToDateTime(ApprovalDate.Text); } if (DeferralDate.Text != "") { currentProvider.DeferralDate = Convert.ToDateTime(DeferralDate.Text); } //if (DenialDate.Text != "") // currentProvider.DenialDate = Convert.ToDateTime(DenialDate.Text); if (uiTxtApplicationReceiveDate.Text != "") { currentProvider.ApplicationReceivedDate = Convert.ToDateTime(uiTxtApplicationReceiveDate.Text); } if (uiTxtCommitteeReviewDate.Text != "") { currentProvider.CommiteeApprovedDate = Convert.ToDateTime(uiTxtCommitteeReviewDate.Text); } if (uiTxtRenewalDate.Text != "") { currentProvider.RenewalDate = Convert.ToDateTime(uiTxtRenewalDate.Text); } if (uiTxtPayment.Text != "") { currentProvider.Payment = uiTxtPayment.Text; } if (uiTxtYearMonitored.Text != "") { currentProvider.YearMonitored = uiTxtYearMonitored.Text; } if (uiTxtNotes.Text != "") { currentProvider.Notes = uiTxtNotes.Text; } // if (ExpirationDate.Text != "") // currentProvider.ExpirationDate = Convert.ToDateTime(ExpirationDate.Text); if (WithdrawalDate.Text != "") { currentProvider.WithdrawalDate = Convert.ToDateTime(WithdrawalDate.Text); } currentProvider.isPaymentExempt = uiChkIsPaymentExempt.Checked; if (providerDA.UpdateApprovedProvider(currentProvider) != null) { Response.Redirect("../Admin/ProviderUpdatedSuccessfully.aspx?Status=" + currentProvider.Status, true); } else { lblMsg.Text = "Provider information cannot be updated."; lblMsg.ForeColor = System.Drawing.Color.Red; } } } } } catch (Exception ex) { Response.Write(ex.Message); Response.End(); } }