protected void SubmitLinkButton_Click(object sender, EventArgs e) { int employee_id = MarshFormsFunctions.GetEmployeeIDFromGuid(guid_HiddenField.Value); String payroll_id = MarshFormsFunctions.GetPayrollIDFromGuid(guid_HiddenField.Value); String employee_name = MarshFormsFunctions.GetEmployeeNameFromGuid(guid_HiddenField.Value); String phone_number = PhoneTextBox.Text; if (phone_number != "") { if (MarshFormsFunctions.SubmitPhone(employee_id, phone_number)) { //TODO : Send an email to the employee’s supervisor and the clinic if the employee answers yes to any of the questions. try { MarshFormsFunctions.sendEmail(guid_HiddenField.Value.ToString(), employee_name, phone_number, false, payroll_id); } catch (Exception ex) { } Response.Redirect("~\\FormSubmitted.aspx"); } else { } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { form_id_HiddenField.Value = "1"; LangDropDownList.SelectedValue = "1"; if (Session["tablet_mode"] != null) { if (Session["tablet_mode"].ToString() == "1") { if (Session["id"] != null) { form_id_HiddenField.Value = Session["id"].ToString(); LangDropDownList.SelectedValue = Session["id"].ToString(); } if (Session["badge_id"] != null) { BadgeTextBox.Text = Session["badge_id"].ToString(); // byte[] bytes = MarshFormsFunctions.GetEmployeeBadgeImage(Session["badge_id"]); // BitmapImage bmpImage = new BitmapImage(); // MemoryStream msImageStream = new MemoryStream(); // msImageStream.Write(bytes, 0, bytes.Length); // bmpCardImage.BeginInit(); // bmpCardImage.StreamSource = new MemoryStream(msImageStream.ToArray()); // bmpCardImage.EndInit(); //// image.Source = bmpCardImage; // BadgeImage.ImageUrl = MarshFormsFunctions.GetEmployeeBadgeImage(Session["badge_id"].ToString()); TemperatureTextBox.Text = MarshFormsFunctions.GetLastTemp(Session["badge_id"].ToString()); } if (Session["employee_name"] != null) { EmployeeNameTextBox.Text = Session["employee_name"].ToString(); } if (Session["max_dt"] != null) { LastSurveyedLabel.Text = Session["max_dt"].ToString(); } } else if (Session["tablet_mode"].ToString() == "0") { } } else { } EmployeeNameTextBox.Focus(); } //EmployeeNameTextBox.Focus(); }
public static void sendEmail(String guid, String employee_name, String phone_number, bool monitor, String payroll_id) { String strReportUser = "******"; String strReportUserPW = "MarshCred2016"; String strReportUserDomain = "Marsh_PDC"; String sendto = MarshFormsFunctions.wellness_email(); String subject; String body; if (monitor) { subject = "Follow up : Coronavirus Workplace Health Screening " + employee_name; } else { subject = "Symptomatic : Coronavirus Workplace Health Screening " + employee_name; } body = "phone number : " + phone_number + " | payroll id : " + payroll_id; String MMREmail = "*****@*****.**"; String sTargetURL = "http://marshsql5/ReportServer?%2fMarshFormsReports%2fCoronavirus%20Workplace%20Health%20Screening&rs:Command=Render&rs:format=PDF&guid=" + guid; using (WebClient web_client = new WebClient()) { web_client.Credentials = new NetworkCredential(strReportUser, strReportUserPW, strReportUserDomain); byte[] bytes = web_client.DownloadData(sTargetURL); MemoryStream ms = new MemoryStream(bytes); using (SmtpClient smtp_client = new SmtpClient()) { smtp_client.Port = 465; smtp_client.Host = "exchange.marshfurniture.com"; smtp_client.EnableSsl = false; smtp_client.Timeout = 10000; smtp_client.DeliveryMethod = SmtpDeliveryMethod.Network; smtp_client.UseDefaultCredentials = false; smtp_client.Credentials = new NetworkCredential("marshhealth", "M@rsh!1234"); MailMessage mm = new MailMessage(MMREmail, sendto, subject, body); var hr_email = MarshFormsFunctions.hr_email(); foreach (String a in hr_email) { mm.To.Add(a); } mm.Attachments.Add(new Attachment(ms, employee_name + "_Health_Survey.pdf")); mm.IsBodyHtml = true; mm.BodyEncoding = UTF8Encoding.UTF8; mm.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure; smtp_client.Send(mm); } } }
public static void set_session(String badge_id) { HttpContext.Current.Session["badge_id"] = badge_id; int badge; if (Int32.TryParse(badge_id, out badge)) { HttpContext.Current.Session["id"] = MarshFormsFunctions.GetFormID(badge); HttpContext.Current.Session["employee_name"] = MarshFormsFunctions.GetEmployeeName(badge); String max_dt = MarshFormsFunctions.GetLastWorkplaceSurveyDate(badge); if (max_dt == "1900-01-01") { HttpContext.Current.Session["max_dt"] = ""; } else { HttpContext.Current.Session["max_dt"] = "Last Surveyed " + max_dt.Replace(" 12:00:00 AM", ""); } } }
protected void SubmitLinkButton_Click(object sender, EventArgs e) { String employee_name = EmployeeNameTextBox.Text; String employee_badge_id = BadgeTextBox.Text; String temperature = TemperatureTextBox.Text; String additional_comments = AdditionalCommentsTextBox.Text; bool NoBlanks = true; if (employee_name == "") { NoBlanks = false; EmployeeNameTextBox.Focus(); MessageLabel.Text = "Employee name field must be filled in."; } else if (employee_badge_id == "") { NoBlanks = false; BadgeTextBox.Focus(); } //REMOVED 10/5/2020 /*else if (temperature == "") * { * NoBlanks = false; * TemperatureTextBox.Focus(); * }*/ else { int employee_id = MarshFormsFunctions.GetEmployeeID(Convert.ToInt32(employee_badge_id)); int payroll_id = MarshFormsFunctions.GetEmployeePayrollIDFromBadge(employee_badge_id); String g = Guid.NewGuid().ToString(); //IDictionary<int, string> answers = new Dictionary<int, string>(); List <List <string> > answers = new List <List <string> >(); bool answeredTrue = false; int critical_count = 0; int non_critical_count = 0; foreach (ListViewItem lvi1 in question_headings_ListView.Items) { ListView questions_ListView = (ListView)lvi1.FindControl("questions_ListView"); foreach (ListViewItem lvi2 in questions_ListView.Items) { int question_id; if (Int32.TryParse(questions_ListView.DataKeys[lvi2.DataItemIndex].Values["id"].ToString(), out question_id)) { CheckBox answer1bit = (CheckBox)lvi2.FindControl("answer1bit"); CheckBox answer2bit = (CheckBox)lvi2.FindControl("answer2bit"); CheckBox answer3bit = (CheckBox)lvi2.FindControl("answer3bit"); String critical_question = questions_ListView.DataKeys[lvi2.DataItemIndex].Values["critical"].ToString(); answers.Add(new List <string> { question_id.ToString(), answer1bit.Checked.ToString(), answer2bit.Checked.ToString(), answer3bit.Checked.ToString() }); if (answer1bit.Checked || answer2bit.Checked) { //answers.Add(question_id, "True"); answeredTrue = true; if (critical_question == "True") { critical_count++; } else { non_critical_count++; } } else if (answer3bit.Checked) { //answers.Add(question_id, "False"); } else { //answers.Add(question_id, "Blank"); NoBlanks = false; } } } } ////ERROR CHECKING if (NoBlanks) { if (!MarshFormsFunctions.SubmitTemp(employee_id, employee_name, employee_badge_id, temperature, g, additional_comments)) { //ERROR database exception MessageLabel.Text = "An unexpected error occurred when trying to submit the form. Please try again."; } else { foreach (List <string> subList in answers) { int question_id; String answer1 = ""; String answer2 = ""; String answer3 = ""; if (Int32.TryParse(subList[0], out question_id)) { answer1 = subList[1]; answer2 = subList[2]; answer3 = subList[3]; } if (!MarshFormsFunctions.SubmitAnswer1(question_id, employee_id, employee_name, employee_badge_id, answer1, answer2, answer3, g)) { //ERROR database exception MessageLabel.Text = "An unexpected error occurred when trying to submit the form. Please try again."; break; } } //IF THERE TEMP IS HIGH THEN GRAB A PHONE # AND GO TO YOUR CAR if (temperature != "") { if (double.Parse(temperature, System.Globalization.CultureInfo.InvariantCulture) >= 100.4) { HttpContext.Current.Session["guid"] = g; Response.Redirect("~\\FormSubmittedTrue.aspx"); } } //IF THEY ARE IN THE PROGRAM THEN BUSINESS AS USUAL if (MarshFormsFunctions.get_monitor(employee_badge_id)) { //MarshFormsFunctions.sendEmail(g, employee_name, "", true, payroll_id.ToString()); Response.Redirect("~\\FormSubmitted.aspx"); } //ANY AMOUNT OF YES -- GO TO CAR //else if (answeredTrue) //{ // HttpContext.Current.Session["guid"] = g; // Response.Redirect("~\\FormSubmittedTrue.aspx"); //} //IF YOU ANSWER 1 OR MORE CRITICAL QUESTIONS TRUE THEN GO TO YOUR CAR else if (critical_count > 0) { HttpContext.Current.Session["guid"] = g; Response.Redirect("~\\FormSubmittedTrue.aspx"); } //IF YOU ANSWER 2 OR MORE SOFT QUESTIONS TRUE THEN GO TO YOUR CAR else if (non_critical_count > 1) { HttpContext.Current.Session["guid"] = g; Response.Redirect("~\\FormSubmittedTrue.aspx"); } //OTHERWISE YOUR GOOD TO STAY IN THE FACILITY else { //SEND FOLLOW UP EMAIL IF THERE IS ONE SOFT YES if (non_critical_count > 0) { MarshFormsFunctions.sendEmail(g, employee_name, "", true, payroll_id.ToString()); } Response.Redirect("~\\FormSubmitted.aspx"); } } } else { // MessageLabel.Text = "Please be sure to fill out each field on the form."; //ERROR blank value } } }