Esempio n. 1
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();
            _BaiTuoAccountInfo  accountInfo = GetInfo(platSystem, areaCity);
            PTServiceSoapClient m_PTService = new PTServiceSoapClient();
            DataSet             dsPayStatus = m_PTService.PT_BaiTuoPayStatus(accountInfo._baiTuoAccout, accountInfo._baiTuoPassword, accountInfo._baiTuoAg, outOrderId);

            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);
        }
Esempio n. 2
0
        private _BaiTuoAccountInfo GetInfo(PlatSystem platSystem, string areaCity)
        {
            _BaiTuoAccountInfo _BaiTuoAccount = new _BaiTuoAccountInfo();

            if (platSystem == null)
            {
                throw new CreateInterfaceOrderException("平台开关没有设置!");
            }
            string defaultCity = platSystem.SystemBigArea.DefaultCity;
            //获取区域参数
            SystemArea systemArea = platSystem.SystemBigArea.SystemAreas.Where(p => p.City == areaCity).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;

            _BaiTuoAccount._baiTuoAccout   = areaParameterList.Where(p => string.Equals(p.Name, "_baiTuoAccout", StringComparison.OrdinalIgnoreCase)).FirstOrDefault().Value;
            _BaiTuoAccount._baiTuoPassword = areaParameterList.Where(p => string.Equals(p.Name, "_baiTuoPassword", StringComparison.OrdinalIgnoreCase)).FirstOrDefault().Value;
            _BaiTuoAccount._baiTuoAg       = areaParameterList.Where(p => string.Equals(p.Name, "_baiTuoAg", StringComparison.OrdinalIgnoreCase)).FirstOrDefault().Value;
            _BaiTuoAccount._PayWay         = areaParameterList.Where(p => string.Equals(p.Name, "_PayWay", StringComparison.OrdinalIgnoreCase)).FirstOrDefault().Value;
            _BaiTuoAccount._NotifyUrl      = areaParameterList.Where(p => string.Equals(p.Name, "_NotifyUrl", StringComparison.OrdinalIgnoreCase)).FirstOrDefault().Value;
            _BaiTuoAccount._IsChangePNRCP  = areaParameterList.Where(p => string.Equals(p.Name, "_IsChangePNRCP", StringComparison.OrdinalIgnoreCase)).FirstOrDefault().Value;
            _BaiTuoAccount._LinkMan        = areaParameterList.Where(p => string.Equals(p.Name, "_LinkMan", StringComparison.OrdinalIgnoreCase)).FirstOrDefault().Value;
            _BaiTuoAccount._LinkManPhone   = areaParameterList.Where(p => string.Equals(p.Name, "_LinkManPhone", StringComparison.OrdinalIgnoreCase)).FirstOrDefault().Value;
            return(_BaiTuoAccount);
        }
Esempio n. 3
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();
            _BaiTuoAccountInfo          accountInfo = GetInfo(platSystem, areaCity);
            Dictionary <string, string> resultDic   = new Dictionary <string, string>();
            PTServiceSoapClient         m_PTService = new PTServiceSoapClient();
            DataSet dsOrderInfo = m_PTService.PT_BaiTuoGetOrderInfo(accountInfo._baiTuoAccout, accountInfo._baiTuoPassword, accountInfo._baiTuoAg, outOrderId);

            if (dsOrderInfo != null && dsOrderInfo.Tables.Count > 0 &&
                dsOrderInfo.Tables.Contains("TICKETINFO") &&
                dsOrderInfo.Tables["TICKETINFO"].Columns.Contains("personName") &&
                dsOrderInfo.Tables["TICKETINFO"].Rows.Count > 0
                )
            {
                DataRowCollection drs      = dsOrderInfo.Tables["TICKETINFO"].Rows;
                string            ticketNo = "";
                foreach (DataRow dr in drs)
                {
                    ticketNo = dr["TICKETINFO_Text"].ToString().Trim().Replace("--", "-");
                    if (ticketNo != "")
                    {
                        if (ticketNo.Contains("-") && ticketNo.Split('-').Length == 2 && ticketNo.Split('-')[1].Trim() == "")
                        {
                            continue;
                        }
                        if (!resultDic.ContainsKey(dr["personName"].ToString().ToUpper()))
                        {
                            resultDic.Add(dr["personName"].ToString().ToUpper(), ticketNo);
                        }
                    }
                }
            }
            return(resultDic);
        }
Esempio n. 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();
            _BaiTuoAccountInfo accountInfo   = GetInfo(platSystem, areaCity);
            string             _SsrCardType  = "1";
            string             _IsLowerPrice = IsLowPrice ? "1" : "0";

            pnrContent = System.Web.HttpUtility.UrlEncode(pnrContent);
            PTServiceSoapClient m_PTService = new PTServiceSoapClient();
            DataSet             dsOrder     = m_PTService.PT_BaiTuoCreateOrder(accountInfo._baiTuoAccout, accountInfo._baiTuoPassword, accountInfo._baiTuoAg, _IsLowerPrice, policyId, localOrderId, _SsrCardType, policyPoint.ToString(), accountInfo._LinkMan, accountInfo._LinkManPhone, pnrContent);

            //BPiaoBao.DomesticTicket.Platforms._PTService.PnrData PTPnrData = Mapper.DynamicMap<BPiaoBao.Common.PnrData, BPiaoBao.DomesticTicket.Platforms._PTService.PnrData>(pnrData);
            //DataSet dsOrder = m_PTService.PT_NewBaiTuoCreateOrder(_baiTuoAccout, _baiTuoPassword, _baiTuoAg, _IsLowerPrice, policyId, localOrderId, _SsrCardType, policyPoint.ToString(), _LinkMan, _LinkManPhone, pnrContent, PTPnrData);
            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 = "生成订单失败!";
                }
            }
            else
            {
                //异常 或超时
                FailMessage = "调用接口超时";
            }
            if (!string.IsNullOrEmpty(FailMessage))
            {
                throw new CreateInterfaceOrderException(ErrToMessage(FailMessage));
            }
            return(platformOrder);
        }
Esempio n. 5
0
        public void Pay(string areaCity, PlatformOrder order)
        {
            PlatSystem         platSystem  = SystemConsoSwitch.PlatSystems.Where(p => p.PlatfromCode == this.Code).FirstOrDefault();
            _BaiTuoAccountInfo accountInfo = GetInfo(platSystem, areaCity);

            if (accountInfo._PayWay == "1")
            {
                order.PaidMethod = EnumPaidMethod.支付宝;
            }
            else if (accountInfo._PayWay == "2")
            {
                order.PaidMethod = EnumPaidMethod.快钱;
            }
            string OutOrderId               = order.OutOrderId;
            string OrderPMFare              = order.TotaSeatlPrice.ToString();
            string OutOrderPayMoney         = order.TotlePaidPirce.ToString();
            PTServiceSoapClient m_PTService = new PTServiceSoapClient();
            DataSet             dsPayOrder  = m_PTService.PT_BaiTuoOrderPay(accountInfo._baiTuoAccout, accountInfo._baiTuoPassword, accountInfo._baiTuoAg, OutOrderId, OrderPMFare, OutOrderPayMoney, accountInfo._PayWay, accountInfo._NotifyUrl);
            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));
            }
        }
Esempio n. 6
0
        public string GetOrderStatus(string areaCity, string orderId, string outOrderId, string pnr)
        {
            string              result      = string.Empty;
            PlatSystem          platSystem  = SystemConsoSwitch.PlatSystems.Where(p => p.PlatfromCode == this.Code).FirstOrDefault();
            _BaiTuoAccountInfo  accountInfo = GetInfo(platSystem, areaCity);
            PTServiceSoapClient m_PTService = new PTServiceSoapClient();
            DataSet             dsOrderInfo = m_PTService.PT_BaiTuoGetOrderInfo(accountInfo._baiTuoAccout, accountInfo._baiTuoPassword, accountInfo._baiTuoAg, outOrderId);

            if (dsOrderInfo != null && dsOrderInfo.Tables.Count > 0 &&
                dsOrderInfo.Tables.Contains("ORDERINFO") &&
                dsOrderInfo.Tables["ORDERINFO"].Columns.Contains("Status") &&
                dsOrderInfo.Tables["ORDERINFO"].Rows.Count > 0
                )
            {
                result = getOrderStatus(dsOrderInfo.Tables["ORDERINFO"].Rows[0]["Status"].ToString());
            }
            else
            {
                throw new OrderCommException("获取订单状态失败!");
            }
            return(result);
        }
Esempio n. 7
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._BaiTuo.ToString().Replace("_", "")).FirstOrDefault();
            List <PlatformPolicy> PolicyList = new List <PlatformPolicy>();

            if (pnrModel == null || pnrModel._LegList.Count == 0 || !platSystem.State)
            {
                return(PolicyList);
            }
            PnrAnalysis.Model.LegInfo leg = pnrModel._LegList[0];
            //离起飞时间2小时内屏蔽获取政策接口
            DateTime t = DateTime.Parse(leg.FlyDate1 + " " + leg.FlyStartTime.Insert(2, ":") + ":00");

            t = t.AddHours(-2);
            if (DateTime.Compare(t, System.DateTime.Now) <= 0)
            {
                return(PolicyList);
            }
            string             area        = pnrModel._LegList[0].FromCode;
            _BaiTuoAccountInfo accountInfo = GetInfo(platSystem, area);
            //是否换编码出票 1:是
            string _IsChangePNRCP = accountInfo._IsChangePNRCP;
            string _IsLowerPrice  = IsLowPrice ? "1" : "0";
            string Message        = string.Empty;
            string CarryCode      = pnrModel._CarryCode;

            if (pnrModel._LegList.Count > 0)
            {
                int       Index     = 0;
                DayOfWeek dayOfWeek = System.DateTime.Now.DayOfWeek;
                switch (dayOfWeek)
                {
                case DayOfWeek.Monday:
                    Index = 0;
                    break;

                case DayOfWeek.Tuesday:
                    Index = 1;
                    break;

                case DayOfWeek.Wednesday:
                    Index = 2;
                    break;

                case DayOfWeek.Thursday:
                    Index = 3;
                    break;

                case DayOfWeek.Friday:
                    Index = 4;
                    break;

                case DayOfWeek.Saturday:
                    Index = 5;
                    break;

                case DayOfWeek.Sunday:
                    Index = 6;
                    break;

                default:
                    break;
                }
                DataSet dsPolicy = new DataSet();
                PTMange ptMange  = new PTMange();
                Logger.WriteLog(LogType.DEBUG, "百拓获取政策开始时间:" + System.DateTime.Now.ToString("yyy-MM-dd HH:mm:ss.fff") + "\r\n");
                //PTServiceSoapClient m_PTService = new PTServiceSoapClient();
                //BPiaoBao.DomesticTicket.Platforms._PTService.PnrData PTPnrData = Mapper.DynamicMap<BPiaoBao.Common.PnrData, BPiaoBao.DomesticTicket.Platforms._PTService.PnrData>(pnrData);
                //System.Data.DataSet dsPolicy = m_PTService.PT_BaiTuoGetPolicy(_baiTuoAccout, _baiTuoPassword, baiTuoAg, _IsLowerPrice, pnrContent);
                //System.Data.DataSet dsPolicy = m_PTService.PT_NewBaiTuoGetPolicy(_baiTuoAccout, _baiTuoPassword, baiTuoAg, _IsLowerPrice, pnrContent, PTPnrData);
                dsPolicy = ptMange._BaiTuoGetPolicy(accountInfo._baiTuoAccout, accountInfo._baiTuoPassword, accountInfo._baiTuoAg, _IsLowerPrice, pnrContent, pnrData);
                Logger.WriteLog(LogType.DEBUG, "百拓获取政策结束时间:" + 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;

                            string            StartTime = "00:00", EndTime = "00:00";
                            decimal           PolicyPoint = 0m;
                            string[]          strTimeArr  = null;
                            DataRowCollection drs         = dsPolicy.Tables[0].Rows;
                            foreach (DataRow dr in drs)
                            {
                                PlatformPolicy policy = new PlatformPolicy();
                                StartTime           = "00:00";
                                EndTime             = "00:00";
                                policy.Id           = dr["Id"] != DBNull.Value ? dr["Id"].ToString() : "";
                                policy.PlatformCode = this.Code;
                                policy.AreaCity     = area;
                                if (!string.IsNullOrEmpty(policy.Id))
                                {
                                    policy.IsChangePNRCP = dr["ChangePnr"].ToString() == "1" ? true : false;
                                    policy.IsSp          = false;
                                    policy.PolicyType    = dr["PolicyType"].ToString() == "2" ? "2" : "1";
                                    policy.PolicyType    = policy.PolicyType == "1" ? "BSP" : "B2B";
                                    policy.CarryCode     = CarryCode;
                                    if (dr["ProviderWorkTime"].ToString().Split(',').Length == 7 && Index > -1 && Index < 7)
                                    {
                                        strTimeArr = dr["ProviderWorkTime"].ToString().Split(',');
                                        if (strTimeArr[Index].Split('-').Length == 2)
                                        {
                                            StartTime = strTimeArr[Index].Split('-')[0];
                                            EndTime   = strTimeArr[Index].Split('-')[1];
                                        }
                                    }
                                    policy.WorkTime = new StartAndEndTime()
                                    {
                                        StartTime = StartTime, EndTime = EndTime
                                    };
                                    if (dr["VoidWorkTime"].ToString().Split(',').Length == 7 && Index > -1 && Index < 7)
                                    {
                                        strTimeArr = dr["VoidWorkTime"].ToString().Split(',');
                                        if (strTimeArr[Index].Split('-').Length == 2)
                                        {
                                            StartTime = strTimeArr[Index].Split('-')[0];
                                            EndTime   = strTimeArr[Index].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();
                                    decimal.TryParse(dr["Rate"].ToString(), out PolicyPoint);
                                    policy.PolicyPoint = PolicyPoint * 100;
                                    policy.IssueSpeed  = platSystem != null ? platSystem.IssueTicketSpeed : "";
                                    if (_IsChangePNRCP != "1" && policy.IsChangePNRCP)
                                    {
                                        continue;
                                    }

                                    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
                        {
                            //失败信息
                            Message = dr_Price["Message"].ToString();
                        }
                    }
                    else
                    {
                        if (dsPolicy.Tables.Contains("Error"))
                        {
                            //失败信息
                            Message = dsPolicy.Tables["Error"].Rows[0]["Error_Text"].ToString();
                        }
                    }
                }
            }
            else
            {
                Message = string.Format("PNR内容解析航段失败:{0}", pnrContent);
            }
            if (!string.IsNullOrEmpty(Message))
            {
                throw new PnrAnalysisFailException(Message);
            }
            return(PolicyList);
        }
Esempio n. 8
0
        public _BaiTuoPlatform()
        {
            PlatSystem platSystem = SystemConsoSwitch.PlatSystems.Where(p => p.PlatfromCode == EnumPlatform._BaiTuo.ToString().Replace("_", "")).FirstOrDefault();

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