示例#1
0
        public override void Query(ResponseWriter writer, System.Collections.Specialized.NameValueCollection parames)
        {
            UserLoginInfo  userInfo       = AuthLogin.GetUserInfo(Username);
            AirQueryCommon airQueryCommon = new AirQueryCommon();

            try
            {
                #region 参数赋值

                string startCity            = CommonMethod.GetFomartString(parames["startCity"]);
                string midCity              = CommonMethod.GetFomartString(parames["midCity"]);
                string endCity              = CommonMethod.GetFomartString(parames["endCity"]);
                string startDate            = CommonMethod.GetFomartDate(CommonMethod.GetFomartString(parames["startDate"]));
                string midDate              = CommonMethod.GetFomartDate(CommonMethod.GetFomartString(parames["midDate"]));
                string cairry               = CommonMethod.GetFomartString(parames["cairry"]);
                bool   isQueryShareFlight   = CommonMethod.GetFomartString(parames["isQueryShareFlight"]).Equals("1") ? true : false;
                bool   isQuerySpecialFlight = CommonMethod.GetFomartString(parames["isQuerySpecialFlight"]).Equals("1") ? true : false;

                #endregion

                //获取航班JSon
                AirInfoCollectionList list = airQueryCommon.GetAirQueryJSon(
                    userInfo,
                    startCity,
                    midCity,
                    endCity,
                    startDate,
                    midDate,
                    AirTravelType.ConnWay,
                    cairry,
                    isQueryShareFlight,
                    isQuerySpecialFlight
                    );
                writer.Write(list);
            }
            catch (Exception ex)
            {
                writer.WriteEx(547, "params type err", ex.Message);
            }
        }
示例#2
0
        public override void Query(ResponseWriter writer, System.Collections.Specialized.NameValueCollection parames)
        {
            userInfo = AuthLogin.GetUserInfo(Username);

            AirQueryCommon airQuery = new AirQueryCommon();


            string cacheNameGuid = parames["cacheNameGuid"];
            string fullFlightNo  = parames["fullFlightNo"]; //航班号如3U8881
            string cairrGuid     = parames["cairrGuid"];    //航班唯一编号
            string policyGuid    = parames["policyGuid"];   //政策唯一编号

            #region 取基础航班信息
            PbProject.WebCommon.Utility.Cache.CacheByNet pwucc = new PbProject.WebCommon.Utility.Cache.CacheByNet();
            DataSet dsCacheData = pwucc.GetCacheData(cacheNameGuid);
            if (dsCacheData == null)
            {
                writer.WriteEx(541, "cache timeout", "缓存过期");
            }
            var dr = dsCacheData.Tables[fullFlightNo].Select("guid='" + cairrGuid + "'").FirstOrDefault();
            if (dr == null)
            {
                writer.WriteEx(541, "not found filght", "没有找到航班信息");
            }
            string CarrCode      = (string)dr["CarrCode"];      //承运人
            string FlightNo      = (string)dr["FlightNo"];      //航班号
            string StartCityCode = (string)dr["StartCityCode"]; //起飞城市
            string ToCityCode    = (string)dr["ToCityCode"];    //抵达城市
            string StartTime     = (string)dr["StartTime"];     //起飞时间
            string EndTime       = (string)dr["EndTime"];       //抵达时间
            string StartDate     = (string)dr["StartDate"];     //起飞日期
            string Space         = (string)dr["Space"];         //舱位
            string ABFare        = (string)dr["ABFee"];         //机建
            string RQFare        = (string)dr["FuelAdultFee"];  //燃油
            string XSFee         = (string)dr["XSFee"];         //舱位价格

            #endregion
            #region 取政策
            string DownPoint, DownReturnMoney, SpacePrice;
            List <Tb_Ticket_Policy> objList = Manage.CallMethod("Tb_Ticket_Policy", "GetList", null, new object[] { "id='" + policyGuid + "'" }) as List <Tb_Ticket_Policy>;
            if (objList.Count() == 0)
            {
                List <Tb_Ticket_BookPolicy> bList = Manage.CallMethod("Tb_Ticket_BookPolicy", "GetList", null, new object[] { "PolicyId='" + policyGuid + "'" }) as List <Tb_Ticket_BookPolicy>;
                if (bList.Count() == 0)
                {
                    writer.WriteEx(564, "not found policy", "没有找到政策:" + policyGuid);
                    return;
                }
                else
                {
                    var pi = bList[0];
                    DownPoint       = (pi.PReturn * 100).ToString();
                    DownReturnMoney = "0";
                    SpacePrice      = "0";
                }
            }
            else
            {
                var policyInfo = objList[0];
                DownPoint       = policyInfo.DownPoint.ToString();       //政策
                DownReturnMoney = policyInfo.DownReturnMoney.ToString(); //现返
                SpacePrice      = policyInfo.SpacePrice.ToString();      //固定特价
            }
            #endregion
            bool isGuding = false;


            if (airQuery.IsSpecialSpace(userInfo, Space, CarrCode))
            {
                SpecialPrice sp = PlyMatch(userInfo, StartCityCode, ToCityCode, StartTime, EndTime,
                                           StartDate, Space, CarrCode, FlightNo, DownPoint, DownReturnMoney, cairrGuid, SpacePrice,
                                           ABFare, RQFare, isGuding, XSFee);
                if (sp == null)
                {
                    writer.WriteEx(580, "get data error", "未查询到特价");
                }
                else
                {
                    writer.Write(sp);
                }
            }
            else
            {
                writer.WriteEx(570, "not a special space", "该舱位不是特价舱位");
            }
        }