protected void Page_Load(object sender, EventArgs e) { if (IsFirstLoad) { List <CNTR_CovidForm_Rec> user_Daily_Forms = new JICSBaseFacade <CNTR_CovidForm_Rec>().GetQuery().Where(x => x.UserID == PortalUser.Current.ID && x.SubmittedDate.Date == DateTime.Today).ToList(); if (user_Daily_Forms.Count == 0) { InitializeForm(); } else { CNTR_CovidForm_Rec covid_Form_Submission = user_Daily_Forms[0]; SetLabels(covid_Form_Submission); if (covid_Form_Submission.Symptomatic) { blocked(); } else if (covid_Form_Submission.Quarantined) { quarantined(); } else { cleared(); } } } }
private string GetFormHeader(JCF_Submission submission) { string return_String = ""; JCF_Form jcf_Form = new JICSBaseFacade <JCF_Form>().GetQuery().Where(x => x.FormID == submission.FormID).SingleOrDefault(); return_String += "Form Name:" + jcf_Form.Name + "\n"; if (submission.UserID != new Guid()) { ICS_Portal_User user = new JICSBaseFacade <ICS_Portal_User>().GetQuery().Where(x => x.ID == submission.UserID).SingleOrDefault(); return_String += "Submitter Name:" + user.LastName + "," + user.FirstName + "\n"; return_String += "Submitter ID:" + user.ID + "\n"; return_String += "Submitted Date:" + submission.SubmittedDate.ToString("dddd, dd MMMM yyyy"); } else { External_Submitter external_User = new JICSBaseFacade <External_Submitter>().GetQuery().Where(x => x.Submission_ID == submission.SubmissionID).SingleOrDefault(); if (external_User != null) { return_String += "External Submitter Email:" + external_User.User_Email + "\n"; return_String += "Submitted Date:" + submission.SubmittedDate.ToString("dddd, dd MMMM yyyy"); } else { return_String += "Error Loading Submission:" + submission.SubmissionID; } } return(return_String); }
protected void ResubmitButton_Click(object sender, EventArgs e) { CNTR_CovidForm_Rec_Facade covidForm_Rec_Facade = new CNTR_CovidForm_Rec_Facade(); List <CNTR_CovidForm_Rec> user_Daily_Forms = new JICSBaseFacade <CNTR_CovidForm_Rec>().GetQuery().Where(x => x.UserID == PortalUser.Current.ID && x.SubmittedDate.Date == DateTime.Today).OrderBy(x => x.SubmittedDate).ToList(); //EventLog.WriteEntry("ICSNET", "Made it to resubmit!", EventLogEntryType.Information); if (user_Daily_Forms.Count > 0) { //EventLog.WriteEntry("ICSNET", "About to Delete Submission:" + user_Daily_Forms[0].SubmissionID, EventLogEntryType.Information); covidForm_Rec_Facade.Remove(user_Daily_Forms[0]); } InitializeForm(); }
public void saveObjectable(List <Save_Object> saveObjects) { EventLog.WriteEntry("ICSNET", "Entered Save Objectable"); JICSBaseFacade <JCF_Answer> facade = new JICSBaseFacade <JCF_Answer>(); foreach (Save_Object obj in saveObjects) { JCF_Answer answer = (JCF_Answer)facade.GetQuery().Where(x => x.AnswerID.ToString() == obj.ID).FirstOrDefault(); answer.AnswerValue = (string)obj.Value; EventLog.WriteEntry("ICSNET", "Answer Value: " + answer.AnswerValue); facade.Save(answer); facade.Flush(); } EventLog.WriteEntry("ICSNET", "Exited Save Objectable"); }
private string GetSubmissionFileName(JCF_Submission submission) { string return_String; if (submission.UserID != new Guid()) { ICS_Portal_User user = new JICSBaseFacade <ICS_Portal_User>().GetQuery().Where(x => x.ID == submission.UserID).SingleOrDefault(); //return_String = user.HostID.TrimStart('0')+"_"+user.LastName+"_"+user.FirstName+ "_JCF_" + ".pdf"; return_String = user.HostID.TrimStart('0') + "_JCF.pdf"; } else { External_Submitter external_User = new JICSBaseFacade <External_Submitter>().GetQuery().Where(x => x.Submission_ID == submission.SubmissionID).SingleOrDefault(); if (external_User != null) { return_String = "External_JCF.pdf"; } else { return_String = "ERROR_JCF.pdf"; } } return(return_String); }
private void print_Form(CNTR_CovidForm_Rec submission) { string filename = string.Empty; Document document = new Document(); Section section; Paragraph answer_Paragraph = new Paragraph(); Paragraph question_Pragraph = new Paragraph(); Paragraph header_Paragaraph = new Paragraph(); List <Color> color_List = new List <Color>() { Colors.Goldenrod, Colors.Orange, Colors.Yellow, Colors.Green, Colors.Blue, Colors.Indigo, Colors.Violet }; int i = 0; section = document.AddSection(); MigraDoc.DocumentObjectModel.Shapes.Image centre_Logo = section.Headers.Primary.AddImage("E:/ICSFileServer/Themes/Centre_College_Theme/images/stacked_logo_RGB.jpg"); ICS_Portal_User user = new JICSBaseFacade <ICS_Portal_User>().GetQuery().Where(x => x.ID == submission.UserID).SingleOrDefault(); Paragraph centre_Header = section.Headers.Primary.AddParagraph(); centre_Header.AddText("COVID-19 Self Reporting Form"); centre_Header.Format.Font.Size = 12; centre_Header.Format.Alignment = ParagraphAlignment.Left; Paragraph centre_Header_Line2 = section.Headers.Primary.AddParagraph(); if (user != null) { centre_Header_Line2.AddText(user.LastName + ", " + user.FirstName + " - " + user.HostID.TrimStart('0')); } else { centre_Header_Line2.AddText("Error: User Not Found"); } centre_Header_Line2.Format.Font.Size = 12; centre_Header_Line2.Format.Alignment = ParagraphAlignment.Left; Paragraph centre_Header_Line3 = section.Headers.Primary.AddParagraph(); centre_Header_Line3.AddText("Completed: " + submission.SubmittedDate.ToString("dddd, dd MMMM yyyy")); centre_Header_Line3.Format.Font.Size = 12; centre_Header_Line3.Format.Alignment = ParagraphAlignment.Left; centre_Logo.Height = "2.5cm"; centre_Logo.LockAspectRatio = true; centre_Logo.RelativeVertical = RelativeVertical.Line; centre_Logo.RelativeHorizontal = RelativeHorizontal.Margin; centre_Logo.Top = ShapePosition.Top; centre_Logo.Left = ShapePosition.Right; centre_Logo.WrapFormat.Style = WrapStyle.Through; Paragraph centre_Footer = section.Footers.Primary.AddParagraph(); centre_Footer.AddText("Centre College · 600 West Walnut St · Danville, KY · USA"); centre_Footer.Format.Font.Size = 9; centre_Footer.Format.Alignment = ParagraphAlignment.Center; header_Paragaraph = section.AddParagraph("COVID-19 Self Reporting Form"); header_Paragaraph.Format.Alignment = ParagraphAlignment.Left; header_Paragaraph.Format.Font.Name = "Times New Roman"; header_Paragaraph.Format.Font.Color = Colors.Black; header_Paragaraph.Format.Borders.Distance = "5pt"; header_Paragaraph.Format.Borders.Color = color_List[i % 7]; header_Paragaraph.Format.Shading.Color = color_List[i % 7]; header_Paragaraph.Format.SpaceBefore = "2cm"; header_Paragaraph.Format.Font.Size = 16; Dictionary <string, object> questions = new Dictionary <string, object>() { { "SubmissionID", submission.SubmissionID }, { "SubmittedDate:", submission.SubmittedDate }, { "Temperature over 100.4:", submission.Temp }, { "ShortnessOfBreath:", submission.ShortnessOfBreath }, { "Chills:", submission.Chills }, { "MusclePain:", submission.MusclePain }, { "SoreThroat:", submission.SoreThroat }, { "SmellOrTaste:", submission.SmellOrTaste }, { "CentreID:", submission.CentreID } }; foreach (KeyValuePair <string, object> question in questions) { question_Pragraph = section.AddParagraph(StripHTML(current_Viewable.nullCheck(question.Key).ToString())); question_Pragraph.Format.Alignment = ParagraphAlignment.Left; question_Pragraph.Format.Font.Name = "Times New Roman"; question_Pragraph.Format.Font.Color = Colors.Black; question_Pragraph.Format.Font.Size = 12; question_Pragraph.Format.Borders.Distance = "5pt"; answer_Paragraph = section.AddParagraph(StripHTML(current_Viewable.nullCheck(question.Value).ToString())); answer_Paragraph.Format.Alignment = ParagraphAlignment.Justify; answer_Paragraph.Format.Font.Name = "Times New Roman"; answer_Paragraph.Format.Font.Color = Colors.DarkGray; answer_Paragraph.Format.Font.Size = 12; answer_Paragraph.Format.LeftIndent = "2cm"; } PdfDocumentRenderer pdfRenderer = new PdfDocumentRenderer(false); pdfRenderer.Document = document; pdfRenderer.RenderDocument(); filename = "default.pdf"; EventLog.WriteEntry("ICSNET", "FILENAME:" + filename, EventLogEntryType.Information); Response.Clear(); Response.ContentType = "application/pdf"; MemoryStream stream = new MemoryStream(); pdfRenderer.PdfDocument.Save(stream, false); Response.AddHeader("Content-Disposition", "attachment; filename=" + filename); Response.AddHeader("content-length", stream.Length.ToString()); Response.BinaryWrite(stream.ToArray()); Response.Flush(); stream.Close(); Response.End(); }
private void print_Form(JCF_Submission submission) { string filename = string.Empty; Document document = new Document(); Section section; JCF_Submission_Facade submission_Facade = new JCF_Submission_Facade(); Flow_Rec_Facade flow_Rec_Facade = new Flow_Rec_Facade(); Flow_Rec parent_Flow; List <Abstract_Iter_able> form_List = new List <Abstract_Iter_able>(); List <Abstract_Iter_able> flow_List = flow_Rec_Facade.GetByIdWhere(submission.SubmissionID, "Submission_ID"); if (flow_List.Count > 0) { parent_Flow = (Flow_Rec)flow_Rec_Facade.GetByIdWhere(submission.SubmissionID, "Submission_ID")[0]; List <Abstract_Iter_able> flow_objs = flow_Rec_Facade.GetByIdWhere(parent_Flow.ID, "Parrent_Flow"); List <Abstract_Iter_able> submissions; form_List.Add(submission); foreach (Flow_Rec flow_obj in flow_objs) { submissions = submission_Facade.GetByIdWhere(flow_obj.Submission_ID, "SubmissionID"); if (submissions.Count > 0) { form_List.Add(submissions[0]); } } } else { form_List.Add(submission); } Paragraph answer_Paragraph = new Paragraph(); Paragraph question_Pragraph = new Paragraph(); Paragraph header_Paragaraph = new Paragraph(); List <Color> color_List = new List <Color>() { Colors.Red, Colors.Orange, Colors.Yellow, Colors.Green, Colors.Blue, Colors.Indigo, Colors.Violet }; int i = 0; foreach (JCF_Submission submissionForm in form_List) { section = document.AddSection(); header_Paragaraph = section.AddParagraph(GetFormHeader(submissionForm)); header_Paragaraph.Format.Alignment = ParagraphAlignment.Left; header_Paragaraph.Format.Font.Name = "Times New Roman"; header_Paragaraph.Format.Font.Color = Colors.Black; header_Paragaraph.Format.Borders.Distance = "5pt"; header_Paragaraph.Format.Borders.Color = color_List[i % 7]; header_Paragaraph.Format.Font.Size = 16; List <JCF_FormItem> questions = new JICSBaseFacade <JCF_FormItem>().GetQuery().Where(x => x.FormID == submissionForm.FormID).OrderBy(x => x.QuestionNum).ThenBy(x => x.RowNum).ToList(); foreach (JCF_FormItem question in questions) { question_Pragraph = section.AddParagraph(StripHTML(current_Viewable.nullCheck(question.Text).ToString())); question_Pragraph.Format.Alignment = ParagraphAlignment.Left; question_Pragraph.Format.Font.Name = "Times New Roman"; question_Pragraph.Format.Font.Color = Colors.Black; question_Pragraph.Format.Font.Size = 12; question_Pragraph.Format.Borders.Distance = "5pt"; question_Pragraph.Format.Borders.Color = color_List[i % 7]; List <JCF_Answer> answers = new JICSBaseFacade <JCF_Answer>().GetQuery().Where(x => x.ItemID == question.ID && x.SubmissionID == submissionForm.SubmissionID).ToList(); if (answers.Count > 0) { foreach (JCF_Answer answer in answers) { answer_Paragraph = section.AddParagraph(StripHTML(current_Viewable.nullCheck(answer.AnswerValue).ToString())); answer_Paragraph.Format.Alignment = ParagraphAlignment.Justify; answer_Paragraph.Format.Font.Name = "Times New Roman"; answer_Paragraph.Format.Font.Color = Colors.DarkGray; answer_Paragraph.Format.Font.Size = 12; } } else { answer_Paragraph = section.AddParagraph(" "); answer_Paragraph.Format.Alignment = ParagraphAlignment.Justify; answer_Paragraph.Format.Font.Size = 12; } } i++; } PdfDocumentRenderer pdfRenderer = new PdfDocumentRenderer(false); pdfRenderer.Document = document; pdfRenderer.RenderDocument(); filename = GetSubmissionFileName(submission); EventLog.WriteEntry("ICSNET", "FILENAME:" + filename, EventLogEntryType.Information); Response.Clear(); Response.ContentType = "application/pdf"; MemoryStream stream = new MemoryStream(); pdfRenderer.PdfDocument.Save(stream, false); Response.AddHeader("Content-Disposition", "attachment; filename=" + filename); Response.AddHeader("content-length", stream.Length.ToString()); Response.BinaryWrite(stream.ToArray()); Response.Flush(); stream.Close(); Response.End(); }
public void ChangeView(Object sender, EventArgs e) { Guid submission_Guid = new Guid(hf_Submission.Value); CNTR_CovidForm_Rec flow = new JICSBaseFacade <CNTR_CovidForm_Rec>().GetQuery().Where(x => x.SubmissionID == submission_Guid).SingleOrDefault(); int data = Convert.ToInt32(hf_Selected_Object.Value); switch (hf_isButtonClicked.Value) { case "edit": Session["viewDesired"] = "edit"; Session["form_Obj"] = flow; Session["formable"] = master_Forms_List[data]; Session["viewableType"] = master_Forms_List[data].Name; ParentPortlet.NextScreen("Objectable_View"); break; case "review": Session["viewDesired"] = "edit"; Session["form_Obj"] = flow; Session["formable"] = master_Forms_List[data]; Session["viewableType"] = master_Forms_List[data].Name; ParentPortlet.NextScreen("Objectable_View"); break; case "delete": new CNTR_CovidForm_Rec_Facade().Remove(flow); break; case "print": List_able listObj = current_Viewable.returnListable(); Abstract_Iter_able form_obj = listObj.get_iterable_List()[data]; EventLog.WriteEntry("ICSNET", "ListObject:" + listObj.getType(), EventLogEntryType.Information); switch (listObj.getType()) { case "ICS_NHibernate.JCF_Submission": JCF_Submission obj = (JCF_Submission)listObj.get_iterable_List()[data]; this.print_Form(obj); break; case "ICS_NHibernate.Flow_Rec": Flow_Rec flow_Obj = (Flow_Rec)listObj.get_iterable_List()[data]; JCF_Submission submission_Object = new JICSBaseFacade <JCF_Submission>().GetQuery().Where(x => x.SubmissionID == flow_Obj.Submission_ID).SingleOrDefault(); if (submission_Object != null) { this.print_Form(submission_Object); } break; case "ICS_NHibernate.CNTR_CovidForm_Rec": this.print_Form(flow); break; default: break; } break; } }
private void readyViewObject(List <JCF_Submission> view_Objects, List <Guid> answer_Guids, Dictionary <Guid, object> question_Dictionary_List, Dictionary <Guid, string> question_Answer_Dictionary_List, Dictionary <Guid, string> question_Options_Dictionary_List) { JICSBaseFacade <JCF_FormItem> facade = new JICSBaseFacade <JCF_FormItem>(); JICSBaseFacade <JCF_Answer> answer_Facade = new JICSBaseFacade <JCF_Answer>(); int i = 0; Dictionary <int, string> type_Dictionary = new Dictionary <int, string> { { 0, "primary" }, { 1, "warning" }, { 2, "success" }, { 3, "danger" }, { 4, "info" } }; foreach (JCF_Submission view_Obj in view_Objects) { List <JCF_FormItem> questions = facade.GetQuery().Where(x => x.FormID == view_Obj.FormID).ToList(); //List<Abstract_Iter_able> results_Objects; //results_Objects = answer_Facade.GetByIdWhere(view_Obj.SubmissionID, "SubmissionID"); //List<JCF_FormItem> questions = new List<JCF_FormItem>(); /*foreach (JCF_FormItem question in form_items) * { * questions.Add(question); * * }*/ var ordered_form_items = questions.OrderBy(o => o.RowNum).ThenBy(o => o.QuestionNum); foreach (JCF_FormItem item in ordered_form_items) { if (item.IsActive) { //object_Options.Add(type_Dictionary[i % 5]); //question_Objects.Add(item); //List<string> query_Strings = new List<string>() { "SubmissionID", "ItemID" }; //List<object> query_Objects = new List<object>() { view_Obj.SubmissionID, item.ID }; List <JCF_Answer> items = answer_Facade.GetQuery().Where(x => x.SubmissionID == view_Obj.SubmissionID && x.ItemID == item.ID).ToList(); if (items.Count > 0) { //answer_Objects.Add(items[0]); JCF_Answer jCF_Answer = items[0]; question_Answer_Dictionary_List.Add(jCF_Answer.AnswerID, jCF_Answer.AnswerValue); question_Options_Dictionary_List.Add(jCF_Answer.AnswerID, type_Dictionary[i % 5]); question_Dictionary_List.Add(jCF_Answer.AnswerID, item); answer_Guids.Add(jCF_Answer.AnswerID); //question_Types.Add(item.Type.ToString()); } else { JCF_Answer new_Answer = new JCF_Answer(); new_Answer.SubmissionID = view_Obj.SubmissionID; new_Answer.ItemID = item.ID; new_Answer.AnswerValue = ""; new_Answer.AnswerID = Guid.NewGuid(); answer_Facade.Save(new_Answer); answer_Facade.Flush(); //answer_Objects.Add(new_Answer); question_Answer_Dictionary_List.Add(new_Answer.AnswerID, new_Answer.AnswerValue); question_Options_Dictionary_List.Add(new_Answer.AnswerID, type_Dictionary[i % 5]); question_Dictionary_List.Add(new_Answer.AnswerID, item); answer_Guids.Add(new_Answer.AnswerID); //question_Types.Add(item.Type.ToString()); } } } i++; } }