Пример #1
0
        public string SaveRevisitForm(Revisit revisitForm)
        {
            int newFormNumber = 1;

            IQueryable <SerialNumbertrackerRA> queryableSerialNumberTrackerRAData = this.unitOfWork.DbContext.SerialNumbertrackerRA
                                                                                    .Where(x => x.UserCode == revisitForm.CreatedBy && x.FormType == "RV");

            if (queryableSerialNumberTrackerRAData.Any())
            {
                newFormNumber = queryableSerialNumberTrackerRAData.Max(y => y.SerialValue) + 1;;
            }
            string padding = "000";
            string serialNumberComponent = padding.Remove(padding.Length - newFormNumber.ToString().Length) + (newFormNumber).ToString();

            revisitForm.RevisitNumber = "RV-" + revisitForm.CreatedBy + "-" + serialNumberComponent;

            /*Form entry*/
            Revisit revisitObj = this.unitOfWork.DbContext.Revisit.Add(revisitForm);

            /*Serial Number updation*/
            SerialNumbertrackerRA serialNumbertrackerRAObj = new SerialNumbertrackerRA
            {
                FormType      = "RV",
                UserCode      = revisitForm.CreatedBy,
                SerialValue   = newFormNumber,
                GeneratedDate = DateTime.UtcNow.AddHours(5.5)
            };

            serialNumbertrackerRAObj = this.unitOfWork.DbContext.SerialNumbertrackerRA.Add(serialNumbertrackerRAObj);

            this.unitOfWork.DbContext.SaveChanges();
            return(revisitObj.RevisitNumber);
        }
Пример #2
0
        public string SaveRevisitForm(Revisit revisitForm)
        {
            var revisitNumber = this.svpDataAccess.SaveRevisitForm(revisitForm);

            this.SendRevisitFormResponseMail(revisitForm);
            return(revisitNumber);
        }
Пример #3
0
        public IActionResult SaveRevisitForm([FromBody] Revisit revisitForm)
        {
            revisitForm.CreatedDateTime = DateTime.UtcNow.AddHours(5.5);

            var updatedForm = this._svpBusinessAccess.SaveRevisitForm(revisitForm);

            return(Ok(updatedForm));
        }
Пример #4
0
        public void SendRevisitFormResponseMail(Revisit revisitForm)
        {
            var generatedPdfTemplateString = pdfTemplate.RevisitFormMailGenerator(revisitForm);
            var redAlertUser = this.svpDataAccess.GetUserDetails(revisitForm.CreatedBy);

            string subject = $"Team ORA - Confirmation: Revisit Form {revisitForm.RevisitNumber} Received ";
            string body    = $"<img src='https://drive.google.com/uc?id=1Ri4dvgKuyRlK3MYxgqueIDO3OFyBKe5a'/> <br/>Dear {redAlertUser.Organization}, " +
                             $"<br/><br/><br/>We received the Revisit form for the village code {revisitForm.VillageCode}. " +
                             $"Please find the attached PDF for the submitted details.<br/><br/>Wish you all the best for the upcoming programs." +
                             $"<br/><br/>Team ORA";;
            string pdfName = $"{revisitForm.RevisitNumber}.pdf";

            ipPdfMailer.SendMailToUser(generatedPdfTemplateString, redAlertUser.UserName, subject, body, pdfName);
        }
Пример #5
0
        public string RevisitFormMailGenerator(Revisit revisitForm)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("<br/><br/> <hr size='5' style='background-color:#E00'/><br/>" +
                      "<table cellpadding='10' style='border-spacing:15px 0rem; font-family:'Times New Roman', Times, serif; font-size:16px;'>" +
                      "<tr><td style='width:350px;word-wrap:break-word;'>Planning Number :</td><td>");
            sb.Append(revisitForm.RevisitNumber);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Village Code :</td><td>");
            sb.Append(revisitForm.VillageCode);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Revisit Date :</td><td>");
            sb.Append(revisitForm.RevisitDate.ToShortDateString());
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Traffic count before SVP :</td><td>");
            sb.Append(revisitForm.TrafficCountBeforeSVP);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Traffic count after SVP :</td><td>");
            sb.Append(revisitForm.TrafficCountAfterSVP);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Child marriage count before SVP :</td><td>");
            sb.Append(revisitForm.ChildMarriageCountBeforeSVP);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Child marriage count after SVP :</td><td>");
            sb.Append(revisitForm.ChildMarriageCountAfterSVP);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Is village safe ? Give reasons :</td><td>");
            sb.Append(revisitForm.IsVillageSafeForGirlsDesc);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Is Strategic Networking Helpful ? :</td><td>");
            sb.Append(revisitForm.IsStrategicNetworkingHelpful);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Is Village/School leadership helpful in anti-trafficking efforts ? :</td><td>");
            sb.Append(revisitForm.IsVillageLeadershipHelpful);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Is CVC active in Anti-Trafficking efforts ? :</td><td>");
            sb.Append(revisitForm.IsCVCActive);
            sb.Append("</td></tr>");
            sb.Append("<tr><td><br/></td><td><br/></td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'> Do Fathers remember SVP and message ? :</td><td>");
            sb.Append(revisitForm.DoFathersRememberSVP);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Feedback from Fathers :</td><td>");
            sb.Append(revisitForm.FathersFeedback);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'> Do Mothers remember SVP and message ? :</td><td>");
            sb.Append(revisitForm.DoMothersRememberSVP);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Feedback from Mothers :</td><td>");
            sb.Append(revisitForm.MothersFeedback);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'> Do Girls remember SVP and message ? :</td><td>");
            sb.Append(revisitForm.DoGirlsRememberSVP);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Feedback from Girls :</td><td>");
            sb.Append(revisitForm.GirlsFeedback);
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'> Do Boys remember SVP and message ? :</td><td>");
            sb.Append(revisitForm.DoBoysRememberSVP);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Feedback from Boys :</td><td>");
            sb.Append(revisitForm.BoysFeedback);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'> Do Village leaders remember SVP and message ? :</td><td>");
            sb.Append(revisitForm.DoVillageEldersRememberSVP);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Feedback from Village Elders :</td><td>");
            sb.Append(revisitForm.VillageEldersFeedback);
            sb.Append("</td></tr>");
            sb.Append("<tr><td><br/></td><td><br/></td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'> Do police remember SVP and message ? :</td><td>");
            sb.Append(revisitForm.DoPoliceRememberSVP);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Feedback from police :</td><td>");
            sb.Append(revisitForm.PoliceFeedback);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Contact number of responsible Village Elders :</td><td>");
            sb.Append(revisitForm.VillageElderContactNumber);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Contact number of responsible police official :</td><td>");
            sb.Append(revisitForm.PoliceContactNumber);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'> Do School staff remember SVP and message ? :</td><td>");
            sb.Append(revisitForm.DoSchoolStaffRememberSVP);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Feedback from School Staff :</td><td>");
            sb.Append(revisitForm.SchoolStaffFeedback);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Contact number of school Headmaster/Principal :</td><td>");
            sb.Append(revisitForm.SchoolPrincipalContactNumber);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Was skit conducted ? :</td><td>");
            sb.Append(revisitForm.WasSkitConducted);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Success story about SVP :</td><td>");
            sb.Append(revisitForm.SVPSuccessStory);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Summary of Feedback about the Program :</td><td>");
            sb.Append(revisitForm.ProgrammeFeedbackSummary);
            sb.Append("</td></tr>");
            sb.Append("<tr><td><br/></td><td><br/></td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Challenges that caused ineffective implementation of SVP :</td><td>");
            sb.Append(revisitForm.SVPImplementationChallenges);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Were any calls made to ORA helpline ? :</td><td>");
            sb.Append(revisitForm.WereCallsMadeToORAHelpline);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Is the village highly trafficking prone to conduct another SVP ?:</td><td>");
            sb.Append(revisitForm.IsAnotherSVPRequired);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Recommendations for next steps :</td><td>");
            sb.Append(revisitForm.NextStepsRecommendations);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Comic book count :</td><td>");
            sb.Append(revisitForm.ComicBooksCount);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Students participation count :</td><td>");
            sb.Append(revisitForm.StudentsParticipationCount);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Was Rakshak identified ?.Details :</td><td>");
            sb.Append(revisitForm.RakshakDesc);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Was helpline number mentioned to all stakeholders ? :</td><td>");
            sb.Append(revisitForm.WasHelplineNumberMentioned);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Summary of Revisit activity :</td><td>");
            sb.Append(revisitForm.RevisitSummary);
            sb.Append("</td></tr>");
            sb.Append("</table><br/><br/><hr size='5' style='background-color:#E00'/><br/>");

            return(sb.ToString());
        }