コード例 #1
0
        private LandingsRecord ParseRequest(string htmlReturn, string nNumber)
        {
            HtmlDocument doc = new HtmlDocument();

            doc.LoadHtml(htmlReturn);
            HtmlNodeCollection bTags = doc.DocumentNode.SelectNodes("//b");
            int startIndex           = bTags.IndexOf(bTags.FirstOrDefault(record => record.InnerText.Contains(nNumber.ToUpper())));
            int currentIndex         = startIndex;

            LandingsRecord landingsRecord = new LandingsRecord();

            landingsRecord.N_Number          = bTags[currentIndex++].InnerText;
            landingsRecord.Serial_Number     = bTags[currentIndex++].InnerText;
            landingsRecord.Mfr               = bTags[currentIndex++].InnerText;
            landingsRecord.Model             = bTags[currentIndex++].InnerText;
            landingsRecord.Eng_Mfr           = bTags[currentIndex++].InnerText;
            landingsRecord.Type_Engine       = bTags[currentIndex++].InnerText;
            landingsRecord.Year_Mfr          = bTags[currentIndex++].InnerText;
            landingsRecord.Name              = bTags[currentIndex++].InnerText;
            landingsRecord.Street            = bTags[currentIndex++].InnerText;
            landingsRecord.City              = bTags[currentIndex++].InnerText;
            landingsRecord.Type_Aircraft     = bTags[currentIndex++].InnerText;
            landingsRecord.Cert_Issue_Date   = bTags[currentIndex++].InnerText;
            landingsRecord.Classification    = bTags[currentIndex++].InnerText;
            landingsRecord.Aircraft_Category = bTags[currentIndex++].InnerText;

            landingsRecord = FixAddressFields(landingsRecord);

            return(landingsRecord);
        }
コード例 #2
0
        private LandingsRecord FixAddressFields(LandingsRecord record)
        {
            List <string> cityStateZip;

            cityStateZip    = record.City.Split(',').ToList <string>();
            record.City     = cityStateZip[0].Trim();
            record.State    = cityStateZip[1].Trim();
            record.Zip_Code = cityStateZip[2].Trim();

            return(record);
        }
コード例 #3
0
        public static void WriteToPdf(LandingsRecord record, string inputPathFile, string outputPathFile)
        {
            using (PdfReader rdr = new PdfReader(inputPathFile))
                using (PdfStamper stamper = new PdfStamper(rdr, new System.IO.FileStream(outputPathFile, FileMode.Create)))
                {
                    stamper.AcroFields.SetField("instructions and disposition of this form This report is required by law 49 USC 44701 Failure to report can result in a civil penalty for each",
                                                record.N_Number);
                    stamper.AcroFields.SetField("Serial No", record.Serial_Number);
                    stamper.AcroFields.SetField("Make", record.Mfr);
                    stamper.AcroFields.SetField("Model", record.Model);
                    stamper.AcroFields.SetField("Name As shown on registration certificate", record.Name);
                    stamper.AcroFields.SetField("Address", record.Street);
                    stamper.AcroFields.SetField("City", record.City);
                    stamper.AcroFields.SetField("State", record.State);
                    stamper.AcroFields.SetField("Zip", record.Zip_Code);
                    stamper.AcroFields.SetField("Identify with aircraft nationality and registration mark and date work completed 2", record.N_Number);

                    stamper.Close();
                    rdr.Close();
                }
        }