Exemple #1
0
        /// <summary>
        /// Read data from file
        /// </summary>
        /// <param name="addBlankLineInEmptyTable"></param>
        /// <returns></returns>
        internal Data_Schema.DepartureWebDataTable DepartureReadHistoryFromFile(bool addBlankLineInEmptyTable)
        {
            string fileName = Utils.CreatePhysicalFileName(Constants.FileName.DepartureShow);

            Data_Schema.DepartureWebDataTable history = Utils.DataTableReadFromFile(fileName, new Data_Schema.DepartureWebDataTable()) as Data_Schema.DepartureWebDataTable;
            if ((history == null) && addBlankLineInEmptyTable)
            {
                history = new Data_Schema.DepartureWebDataTable();
                history.AddDepartureWebRow(0L, DateTime.MaxValue, "", "", "", "", "", "", "", "", "", "", 0L, 0, "", "", "", "", "", DateTime.MaxValue);
            }
            return(history);
        }
Exemple #2
0
        /// <summary>
        /// Convert departure 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.DepartureWebDataTable ConvertToDeparture(string dataReadFromWebInXMLFormat)
        {
            Data_Schema.DepartureWebDataTable tableConvertedFromXML = new Data_Schema.DepartureWebDataTable();
            Data_Schema.DepartureWebRow       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.NewDepartureWebRow();
                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 "CHIN_F":
                        rowCinvertedFromXML.CHIN_F = xOneRecordInContentPartXML.InnerText;
                        break;

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

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

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

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

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

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

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

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

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

                tableConvertedFromXML.AddDepartureWebRow(rowCinvertedFromXML);
            }

            return(tableConvertedFromXML);
        }