Example #1
0
        private static FlightOtherPrice CreateElongOtherPrice(RouteInformation routeInformation)
        {
            FlightOtherPrice otherPrice = new FlightOtherPrice();

            otherPrice.Airliner    = routeInformation.AirLine;
            otherPrice.Arrival     = routeInformation.DestinationAirport;
            otherPrice.Cabin       = routeInformation.Cabin;
            otherPrice.CreateDate  = DateTime.Now;
            otherPrice.Departure   = routeInformation.OriginalAirport;
            otherPrice.Flight      = routeInformation.FlightNO;
            otherPrice.LowestPrice = routeInformation.TicketPrice;
            otherPrice.Sourcetype  = (int)EnumDef.ETicketPriceOrigin.艺龙;

            return(otherPrice);
        }
Example #2
0
        private static FlightOtherPrice CreateCtripOtherPrice(RouteInformation routeInformation, int sourceType)
        {
            FlightOtherPrice otherPrice = new FlightOtherPrice();

            otherPrice.Airliner    = routeInformation.AirLine;
            otherPrice.Arrival     = routeInformation.DestinationAirport;
            otherPrice.Cabin       = routeInformation.Cabin;
            otherPrice.CreateDate  = DateTime.Now;
            otherPrice.Departure   = routeInformation.OriginalAirport;
            otherPrice.Flight      = routeInformation.FlightNO;
            otherPrice.LowestPrice = routeInformation.TicketPrice;
            otherPrice.Sourcetype  = sourceType;

            return(otherPrice);
        }
Example #3
0
        /// <summary>
        /// 添加其它价格并返回主键ID
        /// </summary>
        public int AddOtherPrice(FlightOtherPrice otherPrice)
        {
            //创建命令对象
            OracleCommand oracleCommand = DSCRM.DBA.GetOraCommand();

            //构建sql插入语句
            StringBuilder sbInsertSql = new StringBuilder();

            sbInsertSql.Append(" insert into T_TP_OTHER_PRICE( OTHERPRICEID,SOURCETYPE,DEPARTURE,ARRIVAL,CREATE_DATE,LOWEST_PRICE,AIRLINER,FLIGHT,CABIN) ");
            sbInsertSql.Append(" values (:OTHERPRICEID,:SOURCETYPE,:DEPARTURE,:ARRIVAL,:CREATE_DATE,:LOWEST_PRICE,:AIRLINER,:FLIGHT,:CABIN) ");

            oracleCommand.CommandText = sbInsertSql.ToString();

            int recordIndex = (Int32)CommonDBFunction.GenerateIdentity("T_TP_OTHER_PRICE");

            // 装载参数
            DBUtil.AddParameter(oracleCommand, "OTHERPRICEID", recordIndex);
            DBUtil.AddParameter(oracleCommand, "SOURCETYPE", otherPrice.Sourcetype);
            DBUtil.AddParameter(oracleCommand, "DEPARTURE", otherPrice.Departure);
            DBUtil.AddParameter(oracleCommand, "ARRIVAL", otherPrice.Arrival);
            DBUtil.AddParameter(oracleCommand, "CREATE_DATE", otherPrice.CreateDate);
            DBUtil.AddParameter(oracleCommand, "LOWEST_PRICE", otherPrice.LowestPrice);
            DBUtil.AddParameter(oracleCommand, "AIRLINER", otherPrice.Airliner);
            DBUtil.AddParameter(oracleCommand, "FLIGHT", otherPrice.Flight);
            DBUtil.AddParameter(oracleCommand, "CABIN", otherPrice.Cabin);



            //捕获异常
            try
            {
                DSCRM.DBA.ExecuteNonQuery(oracleCommand);

                return(recordIndex);
            }
            catch
            {
                return(0);
            }
        }
Example #4
0
        private static void CompareElongLowestPrice(IList <RouteInformation> routeInformationList)
        {
            if (lowestPrice == null || routeInformationList == null)
            {
                return;
            }

            List <RouteInformation> routeInformationListConverted = (List <RouteInformation>)routeInformationList;
            RouteInformation        routeInformationFinded        = routeInformationListConverted.Find(delegate(RouteInformation routeInformation)
            {
                return(routeInformation.FlightNO.Trim() == lowestPrice.Flight.Trim());
            });

            AirLineOperation operation = new AirLineOperation();
            int otherPriceId           = 0;
            int autoCompare            = (int)EnumDef.EFlightAutoCompare.差异;

            if (routeInformationFinded != null)
            {
                FlightOtherPrice otherPrice = CreateElongOtherPrice(routeInformationFinded);
                otherPriceId = operation.AddOtherPrice(otherPrice);
                if (otherPriceId > 0)
                {
                    otherPrice.Otherpriceid = otherPriceId;

                    if (routeInformationFinded.TicketPrice.Equals(lowestPrice.LowestPrice))
                    {
                        autoCompare = (int)EnumDef.EFlightAutoCompare.无差异;
                    }
                }
            }

            FlightPriceCompare priceCompare = new FlightPriceCompare();

            priceCompare.LowestPriceId = lowestPrice.LowestPriceId;
            priceCompare.Otherpriceid  = otherPriceId;
            priceCompare.Autoresult    = autoCompare;
            priceCompare.Handresult    = (int)EnumDef.EFlightCompare.未核实;
            operation.AddPriceCompare(priceCompare);
        }