Example #1
0
        public Dictionary <string, string> AutoCompositeTicket(string areaCity, string orderId, string outOrderId, string pnr)
        {
            PlatSystem                  platSystem  = SystemConsoSwitch.PlatSystems.Where(p => p.PlatfromCode == this.Code).FirstOrDefault();
            _517AccountInfo             accountInfo = GetInfo(platSystem, areaCity);
            Dictionary <string, string> resultDic   = new Dictionary <string, string>();
            PTServiceSoapClient         m_PTService = new PTServiceSoapClient();
            DataSet dsOrderInfo = m_PTService.PT_517GetOrderInfo(accountInfo._517Accout, accountInfo._517Password, accountInfo._517Ag, outOrderId, pnr);

            if (dsOrderInfo != null && dsOrderInfo.Tables.Count > 0 &&
                dsOrderInfo.Tables.Contains("Passenger") &&
                dsOrderInfo.Tables["Passenger"].Columns.Contains("Name") &&
                dsOrderInfo.Tables["Passenger"].Rows.Count > 0 &&
                dsOrderInfo.Tables["OrderInfo"].Rows.Count > 0
                )
            {
                DataRowCollection drs      = dsOrderInfo.Tables["Passenger"].Rows;
                string            ticketNo = "";
                foreach (DataRow dr in drs)
                {
                    ticketNo = dr["TicketNo"].ToString().Trim().Replace("--", "-");
                    if (ticketNo != "")
                    {
                        if (ticketNo.Contains("-") && ticketNo.Split('-').Length == 2 && ticketNo.Split('-')[1].Trim() == "")
                        {
                            continue;
                        }
                        if (!resultDic.ContainsKey(dr["Name"].ToString().ToUpper()))
                        {
                            resultDic.Add(dr["Name"].ToString().ToUpper(), ticketNo);
                        }
                    }
                }
            }
            return(resultDic);
        }
Example #2
0
        public bool IsPaid(string areaCity, string orderId, string outOrderId, string pnr)
        {
            bool                isPaid      = false;
            PlatSystem          platSystem  = SystemConsoSwitch.PlatSystems.Where(p => p.PlatfromCode == this.Code).FirstOrDefault();
            _517AccountInfo     accountInfo = GetInfo(platSystem, areaCity);
            PTServiceSoapClient m_PTService = new PTServiceSoapClient();
            DataSet             dsPayStatus = m_PTService.PT_517GetPayStatus(accountInfo._517Accout, accountInfo._517Password, accountInfo._517Ag, outOrderId, pnr);

            if (dsPayStatus != null && dsPayStatus.Tables.Count > 0 &&
                dsPayStatus.Tables.Contains("Result") &&
                dsPayStatus.Tables["Result"].Columns.Contains("Status") &&
                dsPayStatus.Tables["Result"].Rows.Count > 0
                )
            {
                if (dsPayStatus.Tables["Result"].Rows[0]["Status"].ToString() == "T")
                {
                    isPaid = true;
                }
            }
            else
            {
                throw new OrderCommException("未获取到" + this.Code + "订单代付状态");
            }
            return(isPaid);
        }
Example #3
0
        public void CancelOrder(string areaCity, string outOrderId, string pnr, string CancelRemark, string passengerName)
        {
            string              FailMessage   = string.Empty;
            PlatSystem          platSystem    = SystemConsoSwitch.PlatSystems.Where(p => p.PlatfromCode == this.Code).FirstOrDefault();
            _517AccountInfo     accountInfo   = GetInfo(platSystem, areaCity);
            PTServiceSoapClient m_PTService   = new PTServiceSoapClient();
            DataSet             dsCancelOrder = m_PTService.PT_517CancelOrder(accountInfo._517Accout, accountInfo._517Password, accountInfo._517Ag, outOrderId);

            if (dsCancelOrder != null && dsCancelOrder.Tables.Contains("Result") &&
                dsCancelOrder.Tables["Result"].Rows.Count > 0 &&
                dsCancelOrder.Tables["Result"].Rows[0]["Success"].ToString().ToUpper() == "TRUE" &&
                dsCancelOrder.Tables["Result"].Rows[0]["OrderID"].ToString().Trim() == outOrderId.Trim()
                )
            {
                //取消成功
            }
            else
            {
                FailMessage = "取消订单失败!";
            }
            if (!string.IsNullOrEmpty(FailMessage))
            {
                throw new OrderCommException(ErrToMessage(FailMessage));
            }
        }
Example #4
0
        public PlatformOrder CreateOrder(string pnrContent, bool IsLowPrice, string areaCity, string policyId, string RateId, string localOrderId, decimal policyPoint, decimal ReturnMoney, BPiaoBao.Common.PnrData pnrData)
        {
            PlatformOrder   platformOrder = null;
            string          FailMessage   = string.Empty;
            PlatSystem      platSystem    = SystemConsoSwitch.PlatSystems.Where(p => p.PlatfromCode == this.Code).FirstOrDefault();
            _517AccountInfo accountInfo   = GetInfo(platSystem, areaCity);
            string          _IsLowerPrice = IsLowPrice ? "1" : "0";

            pnrContent = System.Web.HttpUtility.UrlEncode(pnrContent);
            PTServiceSoapClient m_PTService = new PTServiceSoapClient();
            DataSet             dsOrder     = m_PTService.PT_517CreateOrder(accountInfo._517Accout, accountInfo._517Password, accountInfo._517Ag, _IsLowerPrice, pnrContent, policyId, accountInfo._LinkMan, accountInfo._LinkManPhone);

            if (dsOrder != null && dsOrder.Tables.Count > 0 && dsOrder.Tables.Contains(Code))
            {
                DataRow dr = dsOrder.Tables[Code].Rows[0];
                if (dsOrder.Tables[Code].Rows[0]["Status"].ToString() == "T")
                {
                    //成功 获取数据
                    platformOrder = new PlatformOrder();
                    decimal TotlePaidPirce = 0m, TotaSeatlPrice = 0m;
                    decimal.TryParse(dr["PaidTotlePirce"].ToString(), out TotlePaidPirce);
                    decimal.TryParse(dr["SeatTotalPrice"].ToString(), out TotaSeatlPrice);
                    platformOrder.OrderId        = localOrderId;
                    platformOrder.TotlePaidPirce = TotlePaidPirce;
                    platformOrder.TotaSeatlPrice = TotaSeatlPrice;
                    platformOrder.OutOrderId     = dr["OutOrderId"].ToString();
                    platformOrder.PnrCode        = dr["Pnr"].ToString();
                    platformOrder.AreaCity       = areaCity;
                }
                else
                {
                    //失败
                    FailMessage = dr["Message"].ToString() + " 失败";
                    //FailMessage = "生成订单失败!";//dr["Message"].ToString();
                }
            }
            else
            {
                //异常 或超时
                FailMessage = "调用接口超时";
            }
            if (!string.IsNullOrEmpty(FailMessage))
            {
                throw new CreateInterfaceOrderException(ErrToMessage(FailMessage));
            }
            return(platformOrder);
        }
Example #5
0
        public void Pay(string areaCity, PlatformOrder order)
        {
            PlatSystem      platSystem  = SystemConsoSwitch.PlatSystems.Where(p => p.PlatfromCode == this.Code).FirstOrDefault();
            _517AccountInfo accountInfo = GetInfo(platSystem, areaCity);

            if (accountInfo._PayWay == "1")
            {
                order.PaidMethod = EnumPaidMethod.预存款;
            }
            else
            {
                order.PaidMethod = EnumPaidMethod.支付宝;
            }
            string OutOrderId       = order.OutOrderId;
            string OutOrderPayMoney = order.TotlePaidPirce.ToString();
            string PNR = order.PnrCode;
            PTServiceSoapClient m_PTService = new PTServiceSoapClient();
            DataSet             dsPayOrder  = m_PTService.PT_517OrderPay(accountInfo._517Accout, accountInfo._517Password, accountInfo._517Ag, accountInfo._PayAccout517, accountInfo._PayPassword517, OutOrderId, OutOrderPayMoney, accountInfo._NotifyUrl, PNR, accountInfo._PayWay);
            string FailMessage = string.Empty;

            if (dsPayOrder != null && dsPayOrder.Tables.Count > 0 && dsPayOrder.Tables.Contains(Code))
            {
                DataRow dr = dsPayOrder.Tables[Code].Rows[0];
                if (dsPayOrder.Tables[Code].Rows[0]["Status"].ToString() == "T")
                {
                    //成功 获取数据
                    Logger.WriteLog(LogType.INFO, this.Code + "接口订单(" + order.OutOrderId + ")代付成功,订单号:" + order.OrderId);
                }
                else
                {
                    //失败
                    FailMessage = dr["Message"].ToString() + " 失败";
                }
            }
            else
            {
                //异常 或超时
                FailMessage = "调用支付接口超时";
            }
            if (!string.IsNullOrEmpty(FailMessage))
            {
                throw new PayInterfaceOrderException(ErrToMessage(FailMessage));
            }
        }
Example #6
0
        public string GetOrderStatus(string areaCity, string orderId, string outOrderId, string pnr)
        {
            PlatSystem          platSystem  = SystemConsoSwitch.PlatSystems.Where(p => p.PlatfromCode == this.Code).FirstOrDefault();
            _517AccountInfo     accountInfo = GetInfo(platSystem, areaCity);
            string              result      = string.Empty;
            PTServiceSoapClient m_PTService = new PTServiceSoapClient();
            DataSet             dsOrderInfo = m_PTService.PT_517GetOrderInfo(accountInfo._517Accout, accountInfo._517Password, accountInfo._517Ag, outOrderId, pnr);

            if (dsOrderInfo != null && dsOrderInfo.Tables.Count > 0 &&
                dsOrderInfo.Tables.Contains("OrderInfo") &&
                dsOrderInfo.Tables["OrderInfo"].Columns.Contains("OrderStatus") &&
                dsOrderInfo.Tables["OrderInfo"].Rows.Count > 0
                )
            {
                result = dsOrderInfo.Tables["OrderInfo"].Rows[0]["OrderStatus"].ToString();
            }
            else
            {
                throw new OrderCommException("获取订单状态失败!");
            }
            return(result);
        }
Example #7
0
        private _517AccountInfo GetInfo(PlatSystem platSystem, string areaCity)
        {
            _517AccountInfo _517Account = new _517AccountInfo();

            if (platSystem == null)
            {
                throw new CreateInterfaceOrderException("平台开关没有设置!");
            }
            string defaultCity = platSystem.SystemBigArea.DefaultCity;
            //获取区域参数
            SystemArea systemArea = platSystem.SystemBigArea.SystemAreas.Where(p => string.Equals(p.City, areaCity, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();

            if (systemArea == null)
            {
                systemArea = platSystem.SystemBigArea.SystemAreas.Where(p => p.City == defaultCity).FirstOrDefault();
            }
            if (systemArea == null)
            {
                throw new CreateInterfaceOrderException(string.Format("没有找到区域为:{0}或默认区域{1}的接口配置项", areaCity, defaultCity));
            }
            //参数集合
            List <AreaParameter> areaParameterList = systemArea.Parameters;

            _517Account._517Accout      = areaParameterList.Where(p => string.Equals(p.Name, "_517Accout", StringComparison.OrdinalIgnoreCase)).FirstOrDefault().Value;
            _517Account._517Password    = areaParameterList.Where(p => string.Equals(p.Name, "_517Password", StringComparison.OrdinalIgnoreCase)).FirstOrDefault().Value;
            _517Account._517Ag          = areaParameterList.Where(p => string.Equals(p.Name, "_517Ag", StringComparison.OrdinalIgnoreCase)).FirstOrDefault().Value;
            _517Account._PayAccout517   = areaParameterList.Where(p => string.Equals(p.Name, "_PayAccout517", StringComparison.OrdinalIgnoreCase)).FirstOrDefault().Value;
            _517Account._PayPassword517 = areaParameterList.Where(p => string.Equals(p.Name, "_PayPassword517", StringComparison.OrdinalIgnoreCase)).FirstOrDefault().Value;
            _517Account._PayWay         = areaParameterList.Where(p => string.Equals(p.Name, "_PayWay", StringComparison.OrdinalIgnoreCase)).FirstOrDefault().Value;
            _517Account._NotifyUrl      = areaParameterList.Where(p => string.Equals(p.Name, "_NotifyUrl", StringComparison.OrdinalIgnoreCase)).FirstOrDefault().Value;
            _517Account._LinkMan        = areaParameterList.Where(p => string.Equals(p.Name, "_LinkMan", StringComparison.OrdinalIgnoreCase)).FirstOrDefault().Value;
            _517Account._LinkManPhone   = areaParameterList.Where(p => string.Equals(p.Name, "_LinkManPhone", StringComparison.OrdinalIgnoreCase)).FirstOrDefault().Value;
            //是否换编码出票 1:是
            _517Account._IsChangePNRCP = areaParameterList.Where(p => string.Equals(p.Name, "_IsChangePNRCP", StringComparison.OrdinalIgnoreCase)).FirstOrDefault().Value;
            return(_517Account);
        }
Example #8
0
        public List <PlatformPolicy> GetPoliciesByPnrContent(string pnrContent, bool IsLowPrice, BPiaoBao.Common.PnrData pnrData)
        {
            PnrAnalysis.PnrModel  pnrModel   = pnrData.PnrMode;
            PlatSystem            platSystem = SystemConsoSwitch.PlatSystems.Where(p => p.PlatfromCode == EnumPlatform._517.ToString().Replace("_", "")).FirstOrDefault();
            List <PlatformPolicy> PolicyList = new List <PlatformPolicy>();

            if (pnrModel == null || pnrModel._LegList.Count == 0 || platSystem == null || !platSystem.State)
            {
                return(PolicyList);
            }
            string          area        = pnrModel._LegList[0].FromCode;
            _517AccountInfo accountInfo = GetInfo(platSystem, area);
            //是否换编码出票 1:是
            string  _IsChangePNRCP = accountInfo._IsChangePNRCP;
            string  _IsLowerPrice  = IsLowPrice ? "1" : "0";
            PTMange ptMange        = new PTMange();
            DataSet dsPolicy       = new DataSet();

            Logger.WriteLog(LogType.DEBUG, "517开始时间:" + System.DateTime.Now.ToString("yyy-MM-dd HH:mm:ss.fff") + "\r\n");
            //PTServiceSoapClient m_PTService = new PTServiceSoapClient();
            //System.Data.DataSet dsPolicy = m_PTService.PT_517GetPolicy(_517Accout, _517Password, _517Ag, _IsLowerPrice, pnrContent);
            //BPiaoBao.DomesticTicket.Platforms._PTService.PnrData PTPnrData = Mapper.DynamicMap<BPiaoBao.Common.PnrData, BPiaoBao.DomesticTicket.Platforms._PTService.PnrData>(pnrData);
            //dsPolicy= m_PTService.PT_New517GetPolicy(_517Accout, _517Password, _517Ag, _IsLowerPrice, pnrContent, PTPnrData);
            dsPolicy = ptMange._517GetPolicy(accountInfo._517Accout, accountInfo._517Password, accountInfo._517Ag, _IsLowerPrice, pnrContent, pnrData);
            Logger.WriteLog(LogType.DEBUG, "517结束时间:" + System.DateTime.Now.ToString("yyy-MM-dd HH:mm:ss.fff") + "\r\n");
            if (dsPolicy != null && dsPolicy.Tables.Count > 0)
            {
                if (dsPolicy.Tables.Contains(this.Code) && dsPolicy.Tables.Contains("Policy") && dsPolicy.Tables[this.Code].Rows.Count > 0)
                {
                    DataRow dr_Price = dsPolicy.Tables[this.Code].Rows[0];
                    if (dr_Price["Status"].ToString() == "T")
                    {
                        decimal SeatPrice = 0m, TaxFare = 0m, RQFare = 0m;
                        decimal.TryParse(dr_Price["SeatPrice"].ToString(), out SeatPrice);
                        decimal.TryParse(dr_Price["ABFare"].ToString(), out TaxFare);
                        decimal.TryParse(dr_Price["RQFare"].ToString(), out RQFare);
                        bool IsLow = _IsLowerPrice == "1" ? true : false;
                        DataRowCollection drs = dsPolicy.Tables[0].Rows;
                        string            StartTime = "00:00", EndTime = "00:00";
                        decimal           PolicyPoint = 0m;
                        foreach (DataRow dr in drs)
                        {
                            PlatformPolicy policy = new PlatformPolicy();
                            policy.AreaCity     = area;
                            StartTime           = "00:00";
                            EndTime             = "00:00";
                            policy.PlatformCode = this.Code;
                            policy.Id           = dr["PolicyID"].ToString() + "~" + dr["PolicyChildID"].ToString();
                            if (policy.Id != "~")
                            {
                                //IsChangePNRCP         //是否换编码出票
                                //IsSp                  //是否是特殊政策
                                //CarryCode             //航空格式二字码
                                //TravelType            //1单程  2单程/往返  3往返 4联程
                                //PolicyType            //政策类型1.BSP 2.B2B
                                //FromCity              //出发城市二字码
                                //ToCity                //到达城市二字码
                                //FlightType            //航班适用类型 0.适用全部 1.适用航班 2.不适用航班
                                //ScheduleConstraints   //班期限制
                                //Space                 //舱位
                                //EffectDate            //政策开始生效期
                                //ExpirationDate         //政策结束生效期
                                //Remark                //政策备注
                                //Policy                //政策点数
                                //GYOnlineTime          //供应工作时间
                                //GYFPTime              //退废票时间
                                //Office                //Office号
                                bool IsChangePNRCP = false;
                                policy.CarryCode = dr["CarryCode"].ToString();
                                bool.TryParse(dr["IsChangePNRCP"].ToString(), out IsChangePNRCP);
                                policy.IsChangePNRCP = IsChangePNRCP;
                                policy.IsSp          = dr["IsSp"].ToString() == "1" ? true : false;
                                policy.PolicyType    = dr["PolicyType"].ToString() == "1" ? "BSP" : "B2B";
                                if (dr["GYOnlineTime"].ToString().Split('-').Length == 2)
                                {
                                    StartTime = dr["GYOnlineTime"].ToString().Split('-')[0];
                                    EndTime   = dr["GYOnlineTime"].ToString().Split('-')[1];
                                }
                                policy.WorkTime = new StartAndEndTime()
                                {
                                    StartTime = StartTime, EndTime = EndTime
                                };

                                var    now      = DateTime.Now;
                                string GYFPTime = "";
                                if (now.DayOfWeek == DayOfWeek.Sunday || now.DayOfWeek == DayOfWeek.Saturday)
                                {
                                    GYFPTime = dr["GYFPTimeNew"].ToString();
                                }
                                else
                                {
                                    GYFPTime = dr["GYFPTime"].ToString();
                                }
                                if (GYFPTime.Split('-').Length == 2)
                                {
                                    StartTime = GYFPTime.ToString().Split('-')[0];
                                    EndTime   = GYFPTime.ToString().Split('-')[1];
                                }
                                policy.ReturnTicketTime = new StartAndEndTime()
                                {
                                    StartTime = StartTime, EndTime = EndTime
                                };
                                policy.AnnulTicketTime = new StartAndEndTime()
                                {
                                    StartTime = StartTime, EndTime = EndTime
                                };
                                policy.ReturnMoney = 0m;
                                policy.CPOffice    = dr["Office"].ToString();
                                policy.Remark      = dr["Remark"].ToString().Contains("改期收回代理费") ? dr["Remark"].ToString() : dr["Remark"].ToString() + ",改期收回代理费";
                                decimal.TryParse(dr["Policy"].ToString(), out PolicyPoint);
                                policy.PolicyPoint = PolicyPoint;
                                if (_IsChangePNRCP != "1" && policy.IsChangePNRCP)
                                {
                                    continue;
                                }
                                string IssueSpeed  = dr["ChupPiaoXiaolu"] == DBNull.Value ? "" : dr["ChupPiaoXiaolu"].ToString();
                                int    _IssueSpeed = 0;
                                if (!string.IsNullOrEmpty(IssueSpeed) && int.TryParse(IssueSpeed, out _IssueSpeed))
                                {
                                    policy.IssueSpeed = _IssueSpeed <= 20 ? "极速" : _IssueSpeed + "秒";
                                }
                                else
                                {
                                    policy.IssueSpeed = platSystem != null ? platSystem.IssueTicketSpeed : "";
                                }
                                policy.IsLow     = IsLow;
                                policy.SeatPrice = SeatPrice;
                                policy.ABFee     = TaxFare;
                                policy.RQFee     = RQFare;
                                //过滤不符合的政策点数
                                if (PolicyPoint > 0 && PolicyPoint < 100)
                                {
                                    PolicyList.Add(policy);
                                }
                            }
                        }//foreach
                        //取前几条政策
                        if (platSystem != null)
                        {
                            PolicyList = PolicyList.OrderByDescending(pp => pp.PolicyPoint).Take(platSystem.GetPolicyCount).ToList();
                        }
                    }
                    else
                    {
                        //失败信息
                        string Message = dr_Price["Message"].ToString();
                    }
                }
            }
            return(PolicyList);
        }
Example #9
0
        public _517Platform()
        {
            PlatSystem platSystem = SystemConsoSwitch.PlatSystems.Where(p => p.PlatfromCode == this.Code).FirstOrDefault();

            this._517param = GetInfo(platSystem, string.Empty);
        }