Esempio n. 1
0
        /// <summary>
        /// Read data from file
        /// </summary>
        /// <param name="addBlankLineInEmptyTable">if add line in blank data table</param>
        /// <returns></returns>
        internal Data_Schema.ArriveWebDataTable ArriveReadHistoryFromFile(bool addBlankLineInEmptyTable)
        {
            string fileName = Utils.CreatePhysicalFileName(Constants.FileName.ArriveShow);

            Data_Schema.ArriveWebDataTable history = Utils.DataTableReadFromFile(fileName, new Data_Schema.ArriveWebDataTable()) as Data_Schema.ArriveWebDataTable;
            if ((history == null) && addBlankLineInEmptyTable)
            {
                history = new Data_Schema.ArriveWebDataTable();
                history.AddArriveWebRow(0L, DateTime.MaxValue, "", "", "", "", "", "", "", "", 0L, 0, "", DateTime.MaxValue, "", "", DateTime.MaxValue, "");
            }
            return(history);
        }
Esempio n. 2
0
        /// <summary>
        /// Convert arrival string to desired DataTable
        /// </summary>
        /// <param name="dataReadFromWebInXMLFormat">Incoming stream</param>
        /// <returns>DataTable or DataTable.Empty when no data to parse or error ocure</returns>
        internal Data_Schema.ArriveWebDataTable ConvertToArrive(string dataReadFromWebInXMLFormat)
        {
            Data_Schema.ArriveWebDataTable tableConvertedFromXML = new Data_Schema.ArriveWebDataTable();
            Data_Schema.ArriveWebRow       rowCinvertedFromXML;
            XmlDocument xmlDocumentReadFromService = new XmlDocument();

            xmlDocumentReadFromService.LoadXml(dataReadFromWebInXMLFormat);
            XmlNode     xRoot = xmlDocumentReadFromService.DocumentElement;
            XmlNodeList xListContentFromSourceXML = xRoot.SelectNodes("/*/Content");
            string      actualDate = DateTime.Now.ToString("dd.MM.yyyy");

            foreach (XmlNode nodeInContentPartXML in xListContentFromSourceXML)
            {
                rowCinvertedFromXML = tableConvertedFromXML.NewArriveWebRow();
                if (nodeInContentPartXML.SelectNodes("DATE_LT").Count > 0)
                {
                    actualDate = nodeInContentPartXML.SelectSingleNode("DATE_LT").InnerText;
                }
                foreach (XmlNode xOneRecordInContentPartXML in nodeInContentPartXML.ChildNodes)
                {
                    switch (xOneRecordInContentPartXML.Name.ToUpper())
                    {
                    case "FLIGHTID":
                        rowCinvertedFromXML.FLIGHTID = Utils.ConvertStringToLong(xOneRecordInContentPartXML.InnerText, 0L);
                        break;

                    case "TIME_LT":
                        rowCinvertedFromXML.TIME_LT = Utils.ConvertHHMM(xOneRecordInContentPartXML.InnerText, rowCinvertedFromXML.TIME_LT);
                        break;

                    case "DATE_LT":
                        rowCinvertedFromXML.TIME_LT = Utils.ConvertDDMMYYY(xOneRecordInContentPartXML.InnerText, rowCinvertedFromXML.TIME_LT);
                        break;

                    case "ICAO_AIR":
                        rowCinvertedFromXML.ICAO_AIR = xOneRecordInContentPartXML.InnerText;
                        break;

                    case "IATAICAO":
                        rowCinvertedFromXML.IATAICAO = xOneRecordInContentPartXML.InnerText;
                        break;

                    case "FLGTNUM":
                        rowCinvertedFromXML.FLGTNUM = xOneRecordInContentPartXML.InnerText;
                        break;

                    case "ORDER":
                        rowCinvertedFromXML.ORDER = Utils.ConvertStringToInt(xOneRecordInContentPartXML.InnerText, 0);
                        break;

                    case "S1":
                        rowCinvertedFromXML.S1 = xOneRecordInContentPartXML.InnerText;
                        break;

                    case "S1CIT":
                        rowCinvertedFromXML.S1CIT = xOneRecordInContentPartXML.InnerText;
                        break;

                    case "S2":
                        rowCinvertedFromXML.S2 = xOneRecordInContentPartXML.InnerText;
                        break;

                    case "S2CIT":
                        rowCinvertedFromXML.S2CIT = xOneRecordInContentPartXML.InnerText;
                        break;

                    case "HAL":
                        rowCinvertedFromXML.HAL = xOneRecordInContentPartXML.InnerText;
                        break;

                    case "REMARK":
                        rowCinvertedFromXML.REMARK = xOneRecordInContentPartXML.InnerText;
                        break;

                    case "ETA_LT":
                        rowCinvertedFromXML.ETA_LT = Utils.ConvertHHMM(xOneRecordInContentPartXML.InnerText, DateTime.Now);
                        rowCinvertedFromXML.ETA_LT = Utils.ConvertDDMMYYY(actualDate, rowCinvertedFromXML.ETA_LT);
                        break;

                    case "HDG":
                        rowCinvertedFromXML.HDG = xOneRecordInContentPartXML.InnerText;
                        break;

                    case "AIRCRFT":
                        rowCinvertedFromXML.AIRCRFT = xOneRecordInContentPartXML.InnerText;
                        break;

                    case "ATA_LT":
                        rowCinvertedFromXML.ATA_LT = Utils.ConvertHHMM(xOneRecordInContentPartXML.InnerText, DateTime.Now);
                        rowCinvertedFromXML.ATA_LT = Utils.ConvertDDMMYYY(actualDate, rowCinvertedFromXML.ATA_LT);
                        break;

                    case "PARID":
                        rowCinvertedFromXML.PARID = Utils.ConvertStringToLong(xOneRecordInContentPartXML.InnerText, 0L);
                        break;

                    case "STAND":
                        rowCinvertedFromXML.STAND = xOneRecordInContentPartXML.InnerText;
                        break;

                    default:
                        logger.Warn(Constants.LoggerMessages.ProxyXmlNodeName, xOneRecordInContentPartXML.Name, xOneRecordInContentPartXML.InnerText);
                        break;
                    }
                }

                tableConvertedFromXML.AddArriveWebRow(rowCinvertedFromXML);
            }

            return(tableConvertedFromXML);
        }