예제 #1
0
        public FirearmLicenseReporter(string applicant,
                                      bool formB,
                                      DateTime lastCrime,
                                      IEnumerable <object> rejections)
            : base(APPROVED, FLDApproved,
                   BKGNDCHK, FLDBkgndChk,
                   ISONHOLD, FLDIsOnHold,
                   REJECTED, FLDRejected)
        {
            Contract.Requires(rejections != null);
            var worst   = (int)RejectionState.NONE;
            var reasons = new StringBuilder();

            foreach (IRejection rej in rejections)
            {
                worst = Math.Max((int)rej.Type, worst);
                reasons.AppendLine("[*]" + rej.Code + " - " + rej.Reason);
            }
            switch ((RejectionState)worst)
            {
            case RejectionState.NONE:
                parser = DoParser(formB ? BKGNDCHK : APPROVED);
                break;

            case RejectionState.AMENDIT:
                parser = DoParser(ISONHOLD);
                var expiry = DateTime.UtcNow.AddHours(48);
                parser.SetValue("date", expiry.ToString("dd/MM/yyyy HH:mm UTC", enUS));
                break;

            case RejectionState.REAPPLY:
                parser = DoParser(REJECTED);
                expiry = DateTime.Now.AddHours(72).ToUniversalTime();
                parser.SetValue("reapply", retryMsg.Replace("DATE", expiry.ToString("dd/MM/yyyy HH:mm UTC", enUS)));
                break;

            case RejectionState.TMPCRIM:
                parser = DoParser(REJECTED);
                expiry = lastCrime.AddMonths(3);
                parser.SetValue("reapply", tempCrim.Replace("DATE", expiry.ToString("dd/MM/yyyy HH:mm UTC", enUS)));
                break;

            case RejectionState.FOREVER:
                parser = DoParser(REJECTED);
                expiry = DateTime.Now.AddHours(72).ToUniversalTime();
                parser.SetValue("reapply", bannedMsg.Replace("DATE", expiry.ToString("dd/MM/yyyy HH:mm UTC", enUS)));;
                break;
            }
            parser.SetValue("reasons", reasons.ToString());
            parser.SetValue("applicant", applicant);
            parser.SetValue("officerSig", parser.GetPrefill("officerSig"));
            parser.SetValue("officers", parser.GetPrefill("officers"));
        }
예제 #2
0
 public string GetPrefill()
 {
     return(parser.GetPrefill("officers"));
 }
예제 #3
0
 public string GetPrefill() => parser.GetPrefill("notes");