public string SaveSvpQCForm(SvpQC svpQCForm)
        {
            int newFormNumber = 1;

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

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

            svpQCForm.SvpQCNumber = "SQ-" + svpQCForm.CreatedBy + "-" + serialNumberComponent;

            /*Form entry*/
            SvpQC SvpQCObj = this.unitOfWork.DbContext.SvpQC.Add(svpQCForm);

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

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

            this.unitOfWork.DbContext.SaveChanges();

            return(SvpQCObj.SvpQCNumber);
        }
Example #2
0
        public IActionResult SaveSvpQCForm([FromBody] SvpQC svpQCForm)
        {
            svpQCForm.CreatedDateTime = DateTime.UtcNow.AddHours(5.5);

            var updatedForm = this._svpBusinessAccess.SaveSvpQCForm(svpQCForm);

            return(Ok(updatedForm));
        }
Example #3
0
        public string SaveSvpQCForm(SvpQC svpQCForm)
        {
            svpQCForm.TotalParticipationCount = (short)(svpQCForm.GirlsParticipationCount
                                                        + svpQCForm.BoysParticipationCount
                                                        + svpQCForm.MothersParticipationCount
                                                        + svpQCForm.FathersParticipationCount);
            var svpQCNumber = this.svpDataAccess.SaveSvpQCForm(svpQCForm);

            this.SendSvpQCFormResponseMail(svpQCForm);
            return(svpQCNumber);
        }
Example #4
0
        public void SendSvpQCFormResponseMail(SvpQC svpQCForm)
        {
            var generatedPdfTemplateString = pdfTemplate.SvpQCFormMailGenerator(svpQCForm);
            var redAlertQCUser             = this.svpDataAccess.GetUserDetails(svpQCForm.CreatedBy);

            string subject = $"Team ORA - Confirmation: SVP QC Form {svpQCForm.SvpQCNumber} Received ";
            string body    = $"<img src='https://drive.google.com/uc?id=1Ri4dvgKuyRlK3MYxgqueIDO3OFyBKe5a'/> <br/>Dear {redAlertQCUser.PrimaryContact}, " +
                             $"<br/><br/><br/>We acknowledge the receipt of your SVP QC Visit report for the village code {svpQCForm.VillageCode}." +
                             $" Please find the attached PDF for the submitted details.<br/><br/>Let's strive to make our programs better and better and our impact bigger and bigger !" +
                             $"<br/><br/>Team ORA";
            string pdfName = $"{svpQCForm.SvpQCNumber}.pdf";

            qcPdfMailer.SendMailToUser(generatedPdfTemplateString, redAlertQCUser.UserName, subject, body, pdfName);
        }
Example #5
0
        public string SvpQCFormMailGenerator(SvpQC svpQCForm)
        {
            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 QC Number :</td><td>");
            sb.Append(svpQCForm.SvpQCNumber);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Village Code :</td><td>");
            sb.Append(svpQCForm.VillageCode);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Are Stakeholders aware of upcoming two day events :</td><td>");
            sb.Append(svpQCForm.AreStakeholdersAware);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Were Stickers put up in the village ? :</td><td>");
            sb.Append(svpQCForm.WasStickersPutUp);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Was the SVP done in line with the protocol and guidelines? :</td><td>");
            sb.Append(svpQCForm.WasProtocolFollowed);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Was the public addressing system and projector working?:</td><td>");
            sb.Append(svpQCForm.WereEquipmentsWorkingProperly);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Did all the programs start on time ? :</td><td>");
            sb.Append(svpQCForm.WereAllProgramStartedInTime);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Was the Guardian Girl's program conducted ? :</td><td>");
            sb.Append(svpQCForm.WasGuardianGirlConducted);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Did the girls take the Guardian Girl's oath and sign it ? :</td><td>");
            sb.Append(svpQCForm.DidGirlsTakeOath);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>How many girls attended the program ? :</td><td>");
            sb.Append(svpQCForm.GirlsParticipationCount);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Was the Cool Boy's program conducted ? :</td><td>");
            sb.Append(svpQCForm.WasCoolBoysConducted);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Did the boys take the Cool Boy's oath and sign it ? :</td><td>");
            sb.Append(svpQCForm.DidBoysTakeOath);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>How many boys attended the program ? :</td><td>");
            sb.Append(svpQCForm.BoysParticipationCount);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Was the Skit conducted during the school program ? :</td><td>");
            sb.Append(svpQCForm.WasSkitConducted);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Were the films used during the school program ? :</td><td>");
            sb.Append(svpQCForm.WereFilmsUsedInSchoolProgram);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Was MyRights mentioned during the school program ? :</td><td>");
            sb.Append(svpQCForm.WasMyRightsMentioned);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Was the informed Mother program conducted ? :</td><td>");
            sb.Append(svpQCForm.WasMotherProgramConducted);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>How many Mothers attended the program ? :</td><td>");
            sb.Append(svpQCForm.MothersParticipationCount);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Were the films used during the Mothers program ? :</td><td>");
            sb.Append(svpQCForm.WereFilmsUsedInMothersProgram);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Was the Good Father program conducted ? :</td><td>");
            sb.Append(svpQCForm.WasFathersProgramConducted);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>How many Fathers attended the program ? :</td><td>");
            sb.Append(svpQCForm.FathersParticipationCount);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Were the films used during the Father's program ? :</td><td>");
            sb.Append(svpQCForm.WereFilmsUsedInFathersProgram);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>How many people totally attended the program ? :</td><td>");
            sb.Append(svpQCForm.TotalParticipationCount);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Did the team meet with the village Sarpanch ? :</td><td>");
            sb.Append(svpQCForm.DidTeamMeetSarpanch);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Did the team meet Police Officials ? :</td><td>");
            sb.Append(svpQCForm.DidTeamMeetPolice);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Did the team meet with the teachers/Head Master of the school ? :</td><td>");
            sb.Append(svpQCForm.DidTeamMeetSchoolStaff);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Did the team meet with the Anganwadi incharge of the village ? :</td><td>");
            sb.Append(svpQCForm.DidTeamMeetAnganwadiHead);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Did the team visit the school again on second day ? :</td><td>");
            sb.Append(svpQCForm.DidTeamVisitedSchoolOnSecondDay);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Feedback from School children :</td><td>");
            sb.Append(svpQCForm.SchoolChildrenFeedback);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Feedback from other stakeholders:</td><td>");
            sb.Append(svpQCForm.StakeholdersFeedback);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Was Rakshak appointed / identified ? :</td><td>");
            sb.Append(svpQCForm.WasRakshakIdentified);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>If appointed, was registration form filled ? :</td><td>");
            sb.Append(svpQCForm.WasRakshakRegistrationDone);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Details of any other awareness program conducted :</td><td>");
            sb.Append(svpQCForm.PreviousAwarenessDesc);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Was the CVC formed/strengthened (if already existed) :</td><td>");
            sb.Append(svpQCForm.CVCStatus);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Was the certificate given by ORA to School ? :</td><td>");
            sb.Append(svpQCForm.WasCertificateGivenToSchool);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Field Worker Names :</td><td>");
            sb.Append(svpQCForm.FieldWorkerNames);
            sb.Append("</td></tr>");
            sb.Append("<tr><td style = 'width:350px; word-wrap: break-word;'>Summary :</td><td>");
            sb.Append(svpQCForm.Summary);
            sb.Append("</td></tr>");
            sb.Append("</table><br/><br/><hr size='5' style='background-color:#E00'/><br/>");

            return(sb.ToString());
        }