Example #1
0
        private bool CheckSubmission(CNTR_CovidForm_Rec covid_Form_Submission)
        {
            List <bool> form_Questions = new List <bool>()
            {
                //Possible Symptoms
                covid_Form_Submission.Temp,
                covid_Form_Submission.Chills,
                covid_Form_Submission.Cough,
                covid_Form_Submission.ShortnessOfBreath,
                covid_Form_Submission.Fatigue,
                covid_Form_Submission.MusclePain,
                covid_Form_Submission.Headache,
                covid_Form_Submission.SmellOrTaste,
                covid_Form_Submission.SoreThroat,
                covid_Form_Submission.Congestion,
                covid_Form_Submission.Nausea,
                covid_Form_Submission.Diarrhea
            };

            foreach (bool form_Question in form_Questions)
            {
                if (form_Question)
                {
                    return(true);
                }
            }
            return(false);
        }
Example #2
0
 protected void Submit_Click(object sender, EventArgs e)
 {
     //EventLog.WriteEntry("ICSNET", "Clicked Submit", EventLogEntryType.Information);
     if (hf_Saveable.Value != "false")
     {
         CNTR_CovidForm_Rec        covid_Form_Submission = CreateSubmission();
         CNTR_CovidForm_Rec_Facade covidForm_Rec_Facade  = new CNTR_CovidForm_Rec_Facade();
         covidForm_Rec_Facade.Add(covid_Form_Submission);
         SetLabels(covid_Form_Submission);
         if (covid_Form_Submission.Symptomatic)
         {
             blocked();
         }
         else if (covid_Form_Submission.Quarantined)
         {
             quarantined();
         }
         else
         {
             //EventLog.WriteEntry("ICSNET", "Cleared user", EventLogEntryType.Information);
             cleared();
         }
     }
     else
     {
         div_Warning.Visible = true;
     }
 }
Example #3
0
        public CNTR_CovidForm_Rec CreateSubmission()
        {
            CNTR_CovidForm_Rec covid_Form_Submission = new CNTR_CovidForm_Rec();

            try
            {
                covid_Form_Submission.SubmissionID      = Guid.NewGuid();
                covid_Form_Submission.UserID            = PortalUser.Current.ID;
                covid_Form_Submission.CentreID          = PortalUser.Current.HostID.TrimStart('0');
                covid_Form_Submission.SubmittedDate     = DateTime.Now;
                covid_Form_Submission.Temp              = bool.Parse(hf_Temp.Value);
                covid_Form_Submission.Chills            = bool.Parse(hf_Chills.Value);
                covid_Form_Submission.Cough             = bool.Parse(hf_Cough.Value);
                covid_Form_Submission.ShortnessOfBreath = bool.Parse(hf_Breath.Value);
                covid_Form_Submission.Fatigue           = bool.Parse(hf_Fatigue.Value);
                covid_Form_Submission.MusclePain        = bool.Parse(hf_MusclePain.Value);
                covid_Form_Submission.Headache          = bool.Parse(hf_Headache.Value);
                covid_Form_Submission.SmellOrTaste      = bool.Parse(hf_SmellOrTaste.Value);
                covid_Form_Submission.SoreThroat        = bool.Parse(hf_Throat.Value);
                covid_Form_Submission.Congestion        = bool.Parse(hf_Congestion.Value);
                covid_Form_Submission.Nausea            = bool.Parse(hf_Nausea.Value);
                covid_Form_Submission.Diarrhea          = bool.Parse(hf_Diarrhea.Value);
                covid_Form_Submission.OnCampus          = bool.Parse(hf_OnCampus.Value);
                covid_Form_Submission.Quarantined       = bool.Parse(hf_Quarantined.Value);
                covid_Form_Submission.Symptomatic       = CheckSubmission(covid_Form_Submission);
            }
            catch (Exception e)
            {
                EventLog.WriteEntry("ICSNET", "Error: " + e, EventLogEntryType.Information);
            }
            return(covid_Form_Submission);
        }
Example #4
0
 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();
             }
         }
     }
 }
Example #5
0
 public Covid_Formable()
 {
     Name                = "Covid Reporting and Assesment Form";
     review_Items        = new List <Guid> {
     };                                 // HousingRequest
     list_View_Items     = new List <Guid> {
     };                                 // HousingRequest
     facade              = new CNTR_CovidForm_Rec();
     list_Column_Headers = new List <string>()
     {
         "UserID", "SubmittedDate", "OnCampus", "Symptomatic"
     };
     list_Header_Items = new Dictionary <string, object>()
     {
         { "Current Year:", DateTime.Today.Year }
     };
     Index       = new List <string> {
     };
     Index_Value = new List <object> {
     };
 }
Example #6
0
 public void SetLabels(CNTR_CovidForm_Rec covid_Form_Submission)
 {
     lbl_completion_Date.Text = covid_Form_Submission.SubmittedDate.ToString("dddd, dd MMMM yyyy");
     lbl_completion_Name.Text = GetUserName();
 }
Example #7
0
        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();
        }