public string SaveSvpForm(Svp svpForm)
        {
            int newFormNumber = 1;

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

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

            svpForm.SvpNumber = "SV-" + svpForm.CreatedBy + "-" + serialNumberComponent;

            /*Form entry*/
            Svp svpObj = this.unitOfWork.DbContext.Svp.Add(svpForm);

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

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

            this.unitOfWork.DbContext.SaveChanges();

            return(svpObj.SvpNumber);
        }
Exemple #2
0
        public IActionResult SaveSvpForm([FromBody] Svp postSvpForm)
        {
            postSvpForm.CreatedDateTime = DateTime.UtcNow.AddHours(5.5);

            var updatedForm = this._svpBusinessAccess.SaveSvpForm(postSvpForm);

            return(Ok(updatedForm));
        }
Exemple #3
0
        public string SaveSvpForm(Svp svpForm)
        {
            svpForm.TotalParticipationCount = (short)(svpForm.MothersParticipationCount
                                                      + svpForm.FathersParticipationCount
                                                      + svpForm.SchoolParticipationCount
                                                      + svpForm.EldersParticipationCount
                                                      + svpForm.MovieParticipationCount);
            var svpNumber = this.svpDataAccess.SaveSvpForm(svpForm);

            this.SendSVPFormResponseMail(svpForm);
            return(svpNumber);
        }
Exemple #4
0
        public void SendSVPFormResponseMail(Svp svpForm)
        {
            var generatedPdfTemplateString = pdfTemplate.SVPMailGenerator(svpForm);
            var redAlertUser = this.svpDataAccess.GetUserDetails(svpForm.CreatedBy);

            string subject = $"Team ORA - Confirmation: SVP Form {svpForm.SvpNumber} Received ";
            string body    = $"<img src='https://drive.google.com/uc?id=1Ri4dvgKuyRlK3MYxgqueIDO3OFyBKe5a'/> <br/>Dear {redAlertUser.Organization}, " +
                             $"<br/><br/><br/>We received the SVP form for the village code {svpForm.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 = $"{svpForm.SvpNumber}.pdf";

            ipPdfMailer.SendMailToUser(generatedPdfTemplateString, redAlertUser.UserName, subject, body, pdfName);
        }
Exemple #5
0
        public string SVPMailGenerator(Svp svpForm)
        {
            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;'>SVP Number :</td><td>");
            sb.Append(svpForm.SvpNumber);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Village Code :</td><td>");
            sb.Append(svpForm.VillageCode);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>SVP Date :</td><td>");
            sb.Append(svpForm.SvpDate.ToShortDateString());
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Travel Hours :</td><td>");
            sb.Append(svpForm.TravelHours);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Total Campaign hours :</td><td>");
            sb.Append(svpForm.TotalCampaignHours);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Field Workers :</td><td>");
            sb.Append(svpForm.FieldWorkerNames);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>ORA/QC visited the program :</td><td>");
            sb.Append(svpForm.ORAVisited);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Confiremed Domestic Violence count :</td><td>");
            sb.Append(svpForm.ConfirmedDomesticViolenceCasesCount);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Confirmed Trafficking cases count :</td><td>");
            sb.Append(svpForm.ConfirmedTraffickingCasesCount);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Confirmed Child Abuse cases count:</td><td>");
            sb.Append(svpForm.ConfirmedChildAbuseCount);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Confirmed Missing cases count :</td><td>");
            sb.Append(svpForm.ConfirmedMissingCasesCount);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Confirmed School Dropouts count :</td><td>");
            sb.Append(svpForm.ConfirmedSchoolDropoutsCount);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'> Details of any neighbourhood trafficking prone villages :</td><td>");
            sb.Append(svpForm.NeighbouringTrafficProneDesc);
            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;'>Mothers participation count :</td><td>");
            sb.Append(svpForm.MothersParticipationCount);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Mothers Feedback :</td><td>");
            sb.Append(svpForm.MothersFeedback);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Fathers participation count :</td><td>");
            sb.Append(svpForm.FathersParticipationCount);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Fathers Feedback :</td><td>");
            sb.Append(svpForm.FathersFeedback);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Name of the School where program was conducted :</td><td>");
            sb.Append(svpForm.SchoolName);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>School participation count :</td><td>");
            sb.Append(svpForm.SchoolParticipationCount);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>School program Feedback :</td><td>");
            sb.Append(svpForm.SchoolFeedback);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Village Leaders and Elders participation count :</td><td>");
            sb.Append(svpForm.EldersParticipationCount);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Village Elders Feeedback :</td><td>");
            sb.Append(svpForm.EldersFeedback);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Movie participation count :</td><td>");
            sb.Append(svpForm.MovieParticipationCount);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Total participants :</td><td>");
            sb.Append(svpForm.TotalParticipationCount);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Has Rakshak been instituted/identified ? :</td><td>");
            sb.Append(svpForm.IsRakshakInstituted);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Distributed comic books count :</td><td>");
            sb.Append(svpForm.ComicBooksCount);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Total SVP cost :</td><td>");
            sb.Append(svpForm.TotalSvpCost);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Village Elder name :</td><td>");
            sb.Append(svpForm.ElderName);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Village Elder designation :</td><td>");
            sb.Append(svpForm.ElderDesignation);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Village Elder phone number :</td><td>");
            sb.Append(svpForm.ElderContactNumber);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Name of Police personnel :</td><td>");
            sb.Append(svpForm.PoliceName);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Police designation :</td><td>");
            sb.Append(svpForm.PoliceDesignation);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Police phone number :</td><td>");
            sb.Append(svpForm.PoliceContactNumber);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Summary  :</td><td>");
            sb.Append(svpForm.Summary);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Positive feedback about program from participants :</td><td>");
            sb.Append(svpForm.PositiveFeedback);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Challenges faced throughout the program :</td><td>");
            sb.Append(svpForm.ChallengesDesc);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Is Follow up program required description :</td><td>");
            sb.Append(svpForm.IsFollowUpRequiredDesc);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Recommendations for next steps :</td><td>");
            sb.Append(svpForm.Recommendations);
            sb.Append("</td></tr>");
            sb.Append("</table><br/><br/><hr size='5' style='background-color:#E00'/><br/>");

            return(sb.ToString());
        }