Example #1
0
    /// <summary>
    /// repCabinList_ItemCommand
    /// </summary>
    /// <param name="source"></param>
    /// <param name="e"></param>
    protected void repOrderList_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        try
        {
            string Id   = e.CommandArgument.ToString();
            string temp = "";

            if (e.CommandName == "NewPolicy") //重新确认订单
            {
                temp = (e.Item.FindControl("Hid_IsChdFlag") as HiddenField).Value;
                if (temp.ToUpper() == "TRUE" || temp.ToUpper() == "1")
                {
                    Response.Redirect("../Buy/Confirmation.aspx?ChildOrderId=" + Id + "&currentuserid=" + this.currentuserid.Value.ToString() + "");
                }
                else
                {
                    Response.Redirect("../Buy/Confirmation.aspx?AdultOrderId=" + Id + "&currentuserid=" + this.currentuserid.Value.ToString() + "");
                }
            }
            else if (e.CommandName == "Detail") //订单详情
            {
                Response.Redirect("OrderDetail.aspx?Id=" + Id + "&Url=" + "OperationingOrderList.aspx" + "&currentuserid=" + this.currentuserid.Value.ToString());
            }
            else if (e.CommandName == "Pay")//支付
            {
                Response.Redirect("../Buy/PayMent.aspx?Id=" + Id + "&Url=OperationingOrderList.aspx" + "&currentuserid=" + this.currentuserid.Value.ToString());
            }
            else if (e.CommandName == "CancelOrder")//取消订单
            {
                temp = (e.Item.FindControl("Hid_PolicySource") as HiddenField).Value;

                #region 判断改编码是否已经支付过

                string PNR = (e.Item.FindControl("Hid_PNR") as HiddenField).Value;


                List <PbProject.Model.Tb_Ticket_Order> OrderList = new PbProject.Logic.Order.Tb_Ticket_OrderBLL().GetListBySqlWhere("PNR='" + PNR + "' and (OrderStatusCode=4 or OrderStatusCode=3)");

                if (OrderList != null && OrderList.Count > 0)
                {
                    temp = "0"; // 该编码已经支付成功 或 出票了。 取消此订单时, 只能取消订单,不能消编码
                }

                #endregion

                ScriptManager.RegisterStartupScript(this, GetType(), DateTime.Now.Ticks.ToString(), "quXiaoOrder('" + Id + "','" + temp + "');", true);
            }
        }
        catch (Exception)
        {
        }
    }
    /// <summary>
    /// repCabinList_ItemCommand
    /// </summary>
    /// <param name="source"></param>
    /// <param name="e"></param>
    protected void repOrderList_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        try
        {
            string Id = e.CommandArgument.ToString();

            //订单收银
            if (e.CommandName == "Cashier")
            {
                string msg = "";

                List <Tb_Ticket_Order> mOrderList = baseDataManage.CallMethod("Tb_Ticket_Order", "GetList", null, new Object[] { " id= '" + Id + "'" }) as List <Tb_Ticket_Order>;
                Tb_Ticket_Order        Order      = null; //订单

                if (mOrderList != null && mOrderList.Count > 0)
                {
                    Order = mOrderList[0];

                    if (Order.PayStatus == 0)
                    {
                        bool reuslt = new PbProject.Logic.Order.Tb_Ticket_OrderBLL().OperOrderCashier(Order, mUser, mCompany);

                        if (reuslt)
                        {
                            msg = "订单收银成功!";
                            OrderListDataBind();
                        }
                        else
                        {
                            msg = "订单收银失败";
                        }
                    }

                    ScriptManager.RegisterStartupScript(this, GetType(), DateTime.Now.Ticks.ToString(), "showdialog('" + msg + "');", true);
                }
            }
            else if (e.CommandName == "Detail")
            {
                //订单详情
                Response.Redirect("OrderDetail.aspx?Id=" + Id + "&Url=OrderList.aspx&currentuserid=" + this.currentuserid.Value.ToString());
            }
        }
        catch (Exception)
        {
        }
    }
Example #3
0
        /// <summary>
        /// 取票
        /// </summary>
        /// <param name="writer"></param>
        /// <param name="parames"></param>
        public override void Query(ResponseWriter writer, System.Collections.Specialized.NameValueCollection parames)
        {
            string json;

            PbProject.Logic.Order.Tb_Ticket_OrderBLL orderBll = new PbProject.Logic.Order.Tb_Ticket_OrderBLL();
            string sqlWhere = " OrderId='" + CommonMethod.GetFomartString(parames["OrderID"]) + "' ";

            List <Tb_Ticket_Order> OrderList = baseDataManage.CallMethod("Tb_Ticket_Order", "GetList", null, new Object[] { sqlWhere }) as List <Tb_Ticket_Order>;
            Tb_Ticket_Order        Order     = OrderList != null && OrderList.Count > 0 ? OrderList[0] : null;

            if (Order == null)
            {
                writer.WriteEx(546, "order num err", "订单编号错误");
            }
            else
            {
                sqlWhere = " OrderId='" + Order.OrderId + "' ";
                List <Tb_Ticket_Passenger> PassengerList = baseDataManage.CallMethod("Tb_Ticket_Passenger", "GetList", null, new Object[] { sqlWhere }) as List <Tb_Ticket_Passenger>;
                json = ListToJSon(PassengerList, Order.OrderId);
                writer.Write(json);
            }
        }
Example #4
0
        /// <summary>
        /// 退废改签
        /// </summary>
        /// <param name="writer"></param>
        /// <param name="parames"></param>
        public override void Update(ResponseWriter writer, System.Collections.Specialized.NameValueCollection parames)
        {
            UserLoginInfo userInfo = AuthLogin.GetUserInfo(Username);

            KongZhiXiTong = BaseParams.getParams(userInfo.SupParameters).KongZhiXiTong;

            PbProject.Logic.Order.Tb_Ticket_OrderBLL orderBll = new PbProject.Logic.Order.Tb_Ticket_OrderBLL();
            string sqlWhere = " OrderID='" + CommonMethod.GetFomartString(parames["OrderID"]) + "' ";

            List <Tb_Ticket_Order> OrderList = baseDataManage.CallMethod("Tb_Ticket_Order", "GetList", null, new Object[] { sqlWhere }) as List <Tb_Ticket_Order>;
            Tb_Ticket_Order        Order     = OrderList != null && OrderList.Count > 0 ? OrderList[0] : null;

            if (Order == null)
            {
                writer.WriteEx(546, "order num err", "订单编号错误");
            }
            else
            {
                sqlWhere = " OrderId='" + Order.OrderId + "' ";
                List <Tb_Ticket_Passenger> PassengerList = baseDataManage.CallMethod("Tb_Ticket_Passenger", "GetList", null, new Object[] { sqlWhere }) as List <Tb_Ticket_Passenger>;
                List <Tb_Ticket_SkyWay>    NewSkyWayList = baseDataManage.CallMethod("Tb_Ticket_SkyWay", "GetList", null, new Object[] { sqlWhere + " order by FromDate " }) as List <Tb_Ticket_SkyWay>;
                //提示信息
                string msg = "";

                try
                {
                    //申请类型3退票申请 4废票申请 5改签申请
                    string ApplayType = CommonMethod.GetFomartString(parames["ApplayType"]);
                    //扩展参数
                    ParamEx pe = new ParamEx();
                    pe.UsePIDChannel = this.KongZhiXiTong != null && this.KongZhiXiTong.Contains("|48|") ? 2 : 0;
                    //发送指令管理类
                    SendInsManage SendIns = new SendInsManage(userInfo.User.LoginName, userInfo.Company.UninCode, pe, userInfo.Configparam);
                    //订单日志
                    StringBuilder orderLog = new StringBuilder();

                    #region

                    //选择的乘客信息
                    List <HashObject> pasList = GetPassengerInfo(Order, PassengerList, CommonMethod.GetFomartString(parames["pasList"]));
                    //选中的 成人 儿童 婴儿
                    int AdultCount = 0, CHDCount = 0, INFCount = 0;
                    //没选中的 成人 儿童 婴儿
                    int NoSelAdultCount = 0, NoSelCHDCount = 0, NoSelINFCount = 0;
                    //选择的乘机人
                    List <HashObject> selList = new List <HashObject>();
                    foreach (HashObject param in pasList)
                    {
                        if (param["pasIsBack"].ToString() == "0") //获取没有提交的用户
                        {
                            //选择的乘客数
                            if (param["IsChecked"].ToString() == "1")
                            {
                                if (param["pasPType"].ToString() == "1")
                                {
                                    AdultCount++;
                                }
                                else if (param["pasPType"].ToString() == "2")
                                {
                                    CHDCount++;
                                }
                                else if (param["pasPType"].ToString() == "3")
                                {
                                    INFCount++;
                                }
                                selList.Add(param);
                            }
                            else
                            {
                                if (param["pasPType"].ToString() == "1")
                                {
                                    NoSelAdultCount++;
                                }
                                else if (param["pasPType"].ToString() == "2")
                                {
                                    NoSelCHDCount++;
                                }
                                else if (param["pasPType"].ToString() == "3")
                                {
                                    NoSelINFCount++;
                                }
                            }
                        }
                    }

                    #endregion

                    //航段信息
                    List <HashObject> skyList = GetSkyInfo(Order, NewSkyWayList, CommonMethod.GetFomartString(parames["skywayList"]));

                    #region
                    if (ApplayType != "5")//退废票
                    {
                        //行程单状态判断
                        if (!KongZhiXiTong.Contains("|68|"))
                        {
                            if (string.IsNullOrEmpty(msg))
                            {
                                //行程单状态判断
                                if (!TripIsVoid(userInfo, pasList, SendIns, out msg))
                                {
                                    msg = (string.IsNullOrEmpty(msg)) ? "不能提交,行程单状态异常!" : msg;
                                }
                            }
                        }
                        if (string.IsNullOrEmpty(msg))
                        {
                            //票号状态判断
                            if (!KongZhiXiTong.Contains("|69|"))
                            {
                                if (string.IsNullOrEmpty(msg))
                                {
                                    //票号状态判断
                                    if (!PassengerTicketIsOpen(pasList, skyList, SendIns, out msg))
                                    {
                                        msg = (string.IsNullOrEmpty(msg)) ? "不能提交,票号状态异常!" : msg;
                                    }
                                }
                            }
                        }
                        if (string.IsNullOrEmpty(msg))
                        {
                            //废票 飞机起飞两个半小时内不能提交废票操作,只能走退票通道
                            if (ApplayType == "4" && skyList.Count > 0)
                            {
                                //是否可以提交废票 1可以 0不可以
                                HashObject strArr = skyList[0] as HashObject;

                                if (strArr.Count == 11 && strArr["IsFP"].ToString() == "0")
                                {
                                    if (KongZhiXiTong != null && !KongZhiXiTong.Contains("|16|"))
                                    {
                                        msg = "飞机起飞两个半小时内不能提交废票操作,只能走退票通道";
                                    }
                                }
                            }
                        }
                    }

                    #endregion

                    if (string.IsNullOrEmpty(msg))
                    {
                        msg = TimeIsCommit(ApplayType, Order);
                    }

                    if (string.IsNullOrEmpty(msg))
                    {
                        //含有没有提交的婴儿并且没有成人时 不可以提交
                        if (NoSelINFCount > 0 && NoSelAdultCount == 0)
                        {
                            msg = "婴儿订单必须有成人陪同!";
                            orderLog.Append("成人带婴儿订单,需要手动处理编码!");
                        }
                    }

                    if (string.IsNullOrEmpty(msg))
                    {
                        string divMsg = "";
                        if (Order.OrderSourceType == 1)//白屏预订
                        {
                            //退费票且没有婴儿
                            if (ApplayType != "5" && (AdultCount > 0 || CHDCount > 0))
                            {
                                //开启退废票(分离、取消)编码
                                if (KongZhiXiTong.Contains("|32|"))
                                {
                                    ////退废处理 判断 分离编码 和 取消编码
                                    divMsg = PnrHandle(Order, SendIns, orderLog, selList, INFCount);
                                }
                            }
                        }
                        if (divMsg != "" && INFCount == 0)
                        {
                        }
                        else
                        {
                            //处理退改签
                            msg = TGQ(userInfo, Order, NewSkyWayList, skyList, PassengerList, pasList,
                                      CommonMethod.GetFomartString(parames["remark"]),
                                      CommonMethod.GetFomartString(parames["quitReasonType"]),
                                      CommonMethod.GetFomartString(parames["reason"]));
                        }
                    }
                    else
                    {
                    }
                }
                catch (Exception)
                {
                }
                finally
                {
                    //解锁
                    orderBll.LockOrder(false, Order.id.ToString(), userInfo.User, userInfo.Company);
                    writer.Write(msg);
                }
            }
        }
Example #5
0
        private void AlipayWork(List <string> CpyNoList, List <ListParam> LPList, B2BShowLog Log)
        {
            try
            {
                List <string> removeList = new List <string>();
                foreach (string CpyNo in CpyNoList)
                {
                    string KonZhiXT = GetGYParameters(CpyNo);
                    if (KonZhiXT != null && !KonZhiXT.Contains("|22|"))//开启B2B自动出票
                    {
                        removeList.Add(CpyNo);
                    }
                }
                //移除掉没有开启的B2B运营商
                if (removeList.Count > 0)
                {
                    foreach (string item in removeList)
                    {
                        if (CpyNoList.Contains(item))
                        {
                            Log(2, string.Format("公司编号:{0} B2B自动出票未开启\r\n", item));
                            CpyNoList.Remove(item);
                        }
                    }
                }

                PbProject.Logic.Order.Tb_Ticket_OrderBLL     orderMange      = new PbProject.Logic.Order.Tb_Ticket_OrderBLL();
                PbProject.Logic.Order.Tb_Ticket_PassengerBLL passengerManage = new PbProject.Logic.Order.Tb_Ticket_PassengerBLL();
                while (true)
                {
                    try//避免异常跳出循环 2013-6-9添加
                    {
                        //王永磊修改语句
                        string sqlWhere = string.Format(" left(CPCpyNo,12) in({0}) and  cast( isnull(AutoPrintTimes,'0') as int) < 3 and PolicyType=1 and AutoPrintFlag=2 and A10<>1  and OrderStatusCode=3 ", string.Join(",", CpyNoList.ToArray()));
                        List <PbProject.Model.Tb_Ticket_Order> orderList = Manage.CallMethod("Tb_Ticket_Order", "GetList", null, new object[] { sqlWhere }) as List <PbProject.Model.Tb_Ticket_Order>;

                        if (orderList == null || orderList.Count == 0)
                        {
                            Thread.Sleep(1);
                            continue;
                        }

                        if (orderList.Count > 0)
                        {
                            Log(2, "支付宝本票通自动出票开始 订单数:" + orderList.Count + "\r\n");
                            for (int i = 0; i < orderList.Count; i++)
                            {
                                PbProject.Model.Tb_Ticket_Order order = orderList[i];
                                ListParam LPM = LPList.Find(delegate(ListParam _pm)
                                {
                                    return(_pm.CpyNo == order.CPCpyNo.Substring(0, 12));
                                });
                                if (LPM != null)
                                {
                                    AlipayTicketWork(passengerManage, order, LPM, Log);
                                }
                                Thread.Sleep(1);
                            }
                            Log(2, "支付宝本票通自动出票结束 订单数:" + orderList.Count + "\r\n");
                        }
                        Thread.Sleep(m_AlipayRefreshTime * 1000);
                    }
                    catch (Exception ex)
                    {
                        Log(2, "AlipayWork  while发生不可预料的异常:" + ex.Message + "" + "\r\n");
                    }
                }
            }
            catch (Exception ex)
            {
                Log(2, "AlipayWork发生不可预料的异常:" + ex.Message + "" + "\r\n");
            }
        }
Example #6
0
        /// <summary>
        /// 出票Socket调用
        /// </summary>
        /// <param name="orderMange"></param>
        /// <param name="client"></param>
        /// <param name="order"></param>
        /// <param name="comModel"></param>
        /// <param name="data"></param>
        private void ChinapnrTicketWork(PbProject.Logic.Order.Tb_Ticket_OrderBLL orderMange, ChinaPnrClient client, PbProject.Model.Tb_Ticket_Order order, string data, int AutoCount, ListParam Pm, B2BShowLog Log)
        {
            int times = AutoCount;          //至少一次

            for (int i = 0; i < times; i++) //调用次数
            {
                //调用ChinaPnrClient对象的Send方法,获取发送结果
                string result = client.Send(data);//合法请求:0011QUERY_VALID;非法请求:0021QUERY_INVALID 错误描述。
                if (result.Contains("0011QUERY_VALID"))
                {
                    order.A10 = "1";//标识出票成功
                    string SQL = " update Tb_Ticket_Order set A10=1 where OrderId='" + order.OrderId + "'";

                    PbProject.Logic.SQLEXBLL.SQLEXBLL_Base ss = new PbProject.Logic.SQLEXBLL.SQLEXBLL_Base();
                    ss.ExecuteNonQuerySQLInfo(SQL);

                    //ShowChinapnrMsg("出票请求成功,订单ID:" + order.OrderId);
                    //infoLog.Info("出票请求成功,订单ID:" + order.OrderId);
                    Log(3, "出票请求成功,订单ID:" + order.OrderId);
                    break;
                }
                else
                {
                    string logDbMsg = "";
                    if (string.IsNullOrEmpty(result))
                    {
                        logDbMsg = "出票请求失败。原因:服务器响应超时";
                        string msg = string.Format("出票请求失败。原因:服务器响应超时,订单ID:{0}", order.OrderId);
                        //ShowChinapnrMsg(msg);
                        //infoLog.Info(msg);
                        Log(3, msg);
                    }
                    else
                    {
                        string errorStr = result.Substring(17, result.Length - 17).Trim();
                        if (errorStr.ToLower().IndexOf("airlines") > 0)
                        {
                            logDbMsg = string.Format("出票请求失败。原因:{0},航空公司二字码:{1}", errorStr, order.CarryCode);
                            string msg = string.Format("出票请求失败。原因:{0},航空公司二字码:{1},订单ID:{2}", errorStr, order.CarryCode, order.OrderId);
                            //ShowChinapnrMsg(msg);
                            //infoLog.Info(msg);
                            Log(3, msg);
                        }
                        else
                        {
                            logDbMsg = string.Format("出票请求失败。原因:{0}", errorStr);
                            string msg = string.Format("出票请求失败。原因:{0},订单ID:{1}", errorStr, order.OrderId);
                            //ShowChinapnrMsg(msg);
                            //infoLog.Info(msg);
                            Log(3, msg);
                        }
                    }
                    if (i == times - 1)
                    {
                        string msg = string.Format("已达到最大失败次数,已改为手动出票,订单ID:{0}", order.OrderId);
                        ChinapnrAutofailed(order, msg, Pm, Log);
                        //FailedLogToDb(order, logDbMsg + ",已改为手动出票");
                        OrderLog(order.OrderId, logDbMsg + ",已改为手动出票", Pm, "2");
                    }
                }
                Thread.Sleep(3000);
            }
        }
Example #7
0
        /// <summary>
        /// 出票流程
        /// </summary>
        private void ChinapnrWork(List <string> CpyNoList, List <ListParam> LPList, B2BShowLog Log)
        {
            try
            {
                List <string> removeList = new List <string>();
                foreach (string CpyNo in CpyNoList)
                {
                    string KonZhiXT = GetGYParameters(CpyNo);
                    if (KonZhiXT != null && !KonZhiXT.Contains("|22|"))//开启B2B自动出票
                    {
                        removeList.Add(CpyNo);
                    }
                }
                if (removeList.Count > 0)
                {
                    foreach (string item in removeList)
                    {
                        if (CpyNoList.Contains(item))
                        {
                            Log(3, string.Format("公司编号:{0} B2B自动出票未开启\r\n", item));
                            CpyNoList.Remove(item);
                        }
                    }
                }
                PbProject.Logic.Order.Tb_Ticket_OrderBLL     orderMange      = new PbProject.Logic.Order.Tb_Ticket_OrderBLL();
                PbProject.Logic.Order.Tb_Ticket_PassengerBLL passengerManage = new PbProject.Logic.Order.Tb_Ticket_PassengerBLL();

                ChinaPnrClient client = new ChinaPnrClient(System.Configuration.ConfigurationManager.AppSettings["HuifuAutoIP"]);
                while (true)
                {
                    try
                    {
                        PbProject.Model.definitionParam.BaseSwitch BS = new PbProject.Model.definitionParam.BaseSwitch();

                        string sqlWhere = string.Format(" left(CPCpyNo,12) in({0}) and  cast( isnull(AutoPrintTimes,'0') as int) < 3 and PolicyType=1 and AutoPrintFlag=2  and OrderStatusCode=3 and A10<>1 ", string.Join(",", CpyNoList.ToArray()));
                        List <PbProject.Model.Tb_Ticket_Order> orderList = Manage.CallMethod("Tb_Ticket_Order", "GetList", null, new object[] { sqlWhere }) as List <PbProject.Model.Tb_Ticket_Order>;


                        if (orderList.Count == 0)
                        {
                            Thread.Sleep(m_ChinapnrRefreshTime * 1000);
                            continue;
                        }

                        foreach (PbProject.Model.Tb_Ticket_Order order in orderList)
                        {
                            if (order.CPCpyNo.Length >= 12)
                            {
                                PbProject.Model.User_Company mTopcom = new PbProject.Logic.User.User_CompanyBLL().GetCompany(order.CPCpyNo.Substring(0, 12));
                                PbProject.Logic.ControlBase.Bd_Base_ParametersBLL Bp      = new PbProject.Logic.ControlBase.Bd_Base_ParametersBLL();
                                List <PbProject.Model.Bd_Base_Parameters>         ParList = Bp.GetParametersListByCpyNo(mTopcom.UninCode.ToString());
                                BS = PbProject.WebCommon.Utility.BaseParams.getParams(ParList);
                            }
                            else
                            {
                                continue;
                            }

                            ListParam LPM = LPList.Find(delegate(ListParam _pm)
                            {
                                return(_pm.CpyNo == order.CPCpyNo.Substring(0, 12));
                            });

                            IList <PbProject.Model.Tb_Ticket_Passenger> orderPassenger = passengerManage.GetPasListByOrderID(order.OrderId);
                            decimal faceValue = 0;
                            foreach (PbProject.Model.Tb_Ticket_Passenger passenger in orderPassenger)
                            {
                                faceValue += passenger.PMFee;
                            }

                            //格式:自动出票方式(1,支付宝本票通;2,汇付天下出票窗)^帐号|是否签约(1,已签约;2,未签)^帐号|密码|支付方式(1,信用账户;2,付款账户)
                            if (string.IsNullOrEmpty(BS.AutoPayAccount.Split('^')[3]) || BS.AutoPayAccount.Split('^')[3].Split('|').Length < 3)
                            {
                                string msg = "未绑定汇付天下账号,不能自动出票,该共功能已停止!,订单ID:" + order.OrderId;
                                //StopChinapnrThread(msg);
                                Log(3, msg);
                                continue;
                            }

                            //格式:CA:xxx//xxx^^^CZ:xxx//xxx^^^MU:xxx//xxx
                            string   Acc      = "";
                            string   pwd      = "";
                            string[] CarrList = BS.AutoAccount.Split(new string[] { "^^^" }, StringSplitOptions.RemoveEmptyEntries);//Regex.Split(BS.AutoAccount, "^^^", RegexOptions.IgnoreCase);
                            for (int i = 0; i < CarrList.Length; i++)
                            {
                                if (CarrList[i].Contains(order.CarryCode))
                                {
                                    Acc = CarrList[i].Split(new string[] { "//" }, StringSplitOptions.None)[0].Split(':')[1]; //Regex.Split(CarrList[i].Split(':')[1], "//", RegexOptions.IgnoreCase)[0];
                                    pwd = CarrList[i].Split(new string[] { "//" }, StringSplitOptions.None)[1];               //Regex.Split(CarrList[i].Split(':')[1], "//", RegexOptions.IgnoreCase)[1];
                                    break;
                                }
                            }
                            if (string.IsNullOrEmpty(Acc) || string.IsNullOrEmpty(pwd))
                            {
                                string msg = "航空公司帐号和密码为空,不能自动出票,改为手动出票,订单ID:" + order.OrderId;
                                ChinapnrAutofailed(order, msg, LPM, Log);
                                continue;
                            }

                            //根据订单信息,构造参数实体类ChinaPnrParams,参数构造见接口文档
                            ChinaPnrParams chinaPnrParams = new ChinaPnrParams();
                            chinaPnrParams.PNRNo       = order.BigCode;
                            chinaPnrParams.GUID        = order.OrderId;
                            chinaPnrParams.Airlines    = order.CarryCode.Split('/')[0];
                            chinaPnrParams.FaceValue   = faceValue.ToString();
                            chinaPnrParams.Username    = Acc;
                            chinaPnrParams.B2BPswd     = pwd;
                            chinaPnrParams.CPNROper    = BS.AutoPayAccount.Split('^')[3].Split('|')[0];
                            chinaPnrParams.CPNRPswd    = StringUtils.GetMd5(BS.AutoPayAccount.Split('^')[3].Split('|')[1]);
                            chinaPnrParams.PayType     = BS.AutoPayAccount.Split('^')[3].Split('|')[2];
                            chinaPnrParams.PartnerCode = "63";

                            string data = ChinaPnrParams.ChinaPnrParamsToString(chinaPnrParams);


                            ChinapnrTicketWork(orderMange, client, order, data, Convert.ToInt32(BS.AutoPayAccount.Split('^')[1]), LPM, Log);
                        }

                        //在出票结果会出现在ChinaPnrParams中配置的RetURL链接中,在对应的RetURL里执行返回操作,这里业务逻辑结束
                        Thread.Sleep(m_ChinapnrRefreshTime * 1000);
                    }
                    catch (Exception e)
                    {
                        try
                        {
                            if (e is ThreadAbortException)
                            {
                                return;
                            }
                            // errorLog.Error(e.Message, e);
                            Log(3, e.Message);
                            //ShowChinapnrMsg(string.Format("发生不可预料的异常:{0}该功能暂停,1分钟后重新开始!", e.Message));
                            Log(3, string.Format("发生不可预料的异常:{0}该功能暂停,1分钟后重新开始!", e.Message));
                            Thread.Sleep(60000);
                        }
                        catch (Exception)
                        {
                        }
                    }
                }
            }
            catch (Exception e)
            {
                try
                {
                    if (e is ThreadAbortException)
                    {
                        return;
                    }
                    // errorLog.Error(e.Message, e);
                    // ShowChinapnrMsg(string.Format("发生不可预料的异常:{0}该功能停止,如果继续发生请联系开发人员解决,谢谢!", e.Message));
                    Log(3, "发生不可预料的异常:" + e.Message + "该功能停止,如果继续发生请联系开发人员解决,谢谢!");
                }
                catch (Exception)
                {
                }
            }
        }
Example #8
0
    /// <summary>
    /// 取消订单
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnCancelOrder_Click(object sender, EventArgs e)
    {
        string showMsg = "";


        try
        {
            //扩展参数
            ParamEx pe = new ParamEx();
            pe.UsePIDChannel = this.KongZhiXiTong != null && this.KongZhiXiTong.Contains("|48|") ? 2 : 0;
            //发送指令管理类
            SendInsManage SendIns = new SendInsManage(mUser.LoginName, mCompany.UninCode, pe, configparam);

            string          id    = Hid_id.Value; //订单id
            Tb_Ticket_Order Order = new Tb_Ticket_OrderBLL().GetTicketOrderById(id);

            if (Order != null)  ////判断订单状态
            {
                bool restult = true;
                //白屏预订 新订单等待支付 并且开启退废票(分离、取消)编码的权限 才取消编码
                if (Order.OrderSourceType == 1 && Order.OrderStatusCode == 1 && KongZhiXiTong.Contains("|32|"))
                {
                    #region 1.白屏预订2.新订单等待支付3.开启退废票(分离、取消)编码的权限  判断是否需要取消编码

                    if (Hid_isCancelPnr.Value == "1") // 取消编码
                    {
                        Hid_isCancelPnr.Value = "0";

                        if (Order.PNR != "")
                        {
                            string ErrMsg = "";
                            PnrAnalysis.PnrModel pnrModel = SendIns.GetPnr(Order.PNR, out ErrMsg);
                            //编码状态不是已经出票的PNR
                            if (pnrModel != null && !pnrModel.PnrStatus.Contains("RR"))
                            {
                                //调用取消编码的方法
                                restult = SendIns.CancelPnr(Order.PNR, Order.Office);
                            }
                        }
                        showMsg = restult == true ? "取消编码成功!" : showMsg;
                    }
                    else
                    {
                        showMsg = "取消订单,用户需要保留编码!";
                    }

                    #endregion
                }
                else
                {
                    showMsg = "取消订单";
                }



                //取消订单
                restult = new PbProject.Logic.Order.Tb_Ticket_OrderBLL().CancelOrder(Order, mUser, mCompany, showMsg);

                if (restult)
                {
                    OrderListDataBind();

                    showMsg = "取消订单成功!";
                }
                else
                {
                    showMsg = "取消订单失败!";
                }
            }
            else
            {
                showMsg = "该订单不能取消!!!";
            }
        }
        catch (Exception ex)
        {
            showMsg = "操作失败";
        }

        ScriptManager.RegisterStartupScript(this, GetType(), DateTime.Now.Ticks.ToString(), "showdialog('" + showMsg + "');", true);
    }
Example #9
0
    /// <summary>
    /// 机票支付
    /// </summary>
    /// <param name="id">订单</param>
    /// <param name="payWay">支付方式</param>
    /// <param name="code">网银银行代码</param>
    private void TicketOrderPay(string id, string payWay, string code)
    {
        string msgShow = "";
        string url     = string.Empty;

        try
        {
            bool   result     = false;
            string payDetails = "";//分账明细

            #region 获取订单信息

            //PayWay 支付方式:1支付宝、2快钱、3汇付、4财付通、5支付宝网银、6快钱网银 、7汇付网银、8财付通网银、
            //9支付宝pos、10快钱pos、11汇付pos、12财付通pos、13易宝pos、14账户支付、15收银
            //string tempSqlWhere = " OrderId='" + id + "'";

            string tempSqlWhere = " id='" + id + "'";
            List <Tb_Ticket_Order> bParametersList = new PbProject.Logic.Order.Tb_Ticket_OrderBLL().GetListBySqlWhere(tempSqlWhere);
            Tb_Ticket_Order        mOrder          = null;

            if (bParametersList != null && bParametersList.Count == 1)
            {
                mOrder = bParametersList[0];

                #region 判断PNR状态是否取消等,取消就不能支付
                if (mOrder.OrderStatusCode != 1 && mOrder.OrderStatusCode != 9)
                {
                    msgShow = "订单异常,不能支付!";
                }
                #endregion

                if (this.KongZhiXiTong.Contains("|101|"))
                {
                    //超过 1 小时后的订单能支付
                }
                else
                {
                    #region  超过1个小时不能支付
                    if (mOrder.OrderStatusCode == 1)
                    {
                        DateTime dtTime = DateTime.Now;
                        if (dtTime.CompareTo(mOrder.CreateTime.AddHours(1)) > 0)
                        {
                            // 超过1个小时不能支付
                            msgShow = "超过1个小时的订单不能支付,请重新生成订单进行支付!";
                        }
                    }
                    #endregion
                }

                #region 判断PNR状态是否取消等,取消就不能支付

                //扩展参数
                ParamEx pe = new ParamEx();
                pe.UsePIDChannel = this.KongZhiXiTong != null && this.KongZhiXiTong.Contains("|48|") ? 2 : 0;
                SendInsManage sendins = new SendInsManage(mUser.LoginName, mCompany.UninCode, pe, this.configparam);
                string        ErrMsg;

                if (mOrder.OrderSourceType == 1 && mOrder.A9 != "1")
                {
                    PnrAnalysis.PnrModel PnrModel = sendins.GetPnr(mOrder.PNR, mOrder.Office, out ErrMsg);

                    if (ErrMsg.IndexOf("已被取消") != -1)
                    {
                        msgShow = "此PNR(" + mOrder.PNR + ")状态为异常,请检查PNR状态后再试!";
                    }
                    else if (PnrModel != null && ErrMsg == "")
                    {
                        if (PnrModel.PassengerNameIsCorrent)
                        {
                            if (KongZhiXiTong != null && KongZhiXiTong.Contains("|23|"))
                            {
                                if ((PnrModel._OldPnrContent.Contains("THIS PNR WAS ENTIRELY CANCELLED") && PnrModel._OldPnrContent.ToUpper().Contains(mOrder.PNR.ToUpper())))
                                {
                                    msgShow = "此PNR(" + mOrder.PNR + ")状态为异常,请检查PNR状态后再试!";
                                }
                                else
                                {
                                    string PnrStatus = PnrModel.PnrStatus;
                                    if (string.IsNullOrEmpty(PnrStatus))
                                    {
                                        msgShow = "此PNR(" + mOrder.PNR + ")数据异常,请检查PNR状态后再试!";
                                    }
                                    else
                                    {
                                        if (!PnrStatus.Contains("HK") && !PnrStatus.Contains("DK") && !PnrStatus.Contains("RR") && !PnrStatus.Contains("KK"))
                                        {
                                            msgShow = "此PNR(" + mOrder.PNR + ")状态为:" + PnrStatus + ",请检查PNR状态后再试!";
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            msgShow = "此PNR(" + mOrder.PNR + ")中乘机人名字:" + string.Join(",", PnrModel.ErrorPassengerNameList.ToArray()) + " 不正确!";
                        }
                    }
                }

                #endregion 判断PNR状态是否取消等,取消就不能支付

                if (msgShow == "")
                {
                    mOrder.PayWay = int.Parse(payWay);

                    // 切换支付方式:修改订单账单明细数据
                    result = new PbProject.Logic.Pay.Bill().UpdateOrderAndTicketPayDetail(mOrder);

                    if (result == true)
                    {
                        //获取分账明细
                        payDetails = new PbProject.Logic.Pay.Bill().PayDetails(payWay, mOrder.OrderId);
                        result     = string.IsNullOrEmpty(payDetails) ? false : result;
                    }
                }
            }

            #endregion

            if (result)
            {
                #region 支付

                if (payWay == "1" || payWay == "5")//支付宝
                {
                    #region 支付参数赋值

                    AliPayParam aliPayParam = new AliPayParam();

                    aliPayParam.Body               = "机票订单";
                    aliPayParam.DefaultBank        = code;
                    aliPayParam.Extra_common_param = mUser.id.ToString(); //自定义:操作人id
                    aliPayParam.Out_trade_no       = mOrder.OrderId;
                    aliPayParam.Royalty_parameters = payDetails;          //分账明细
                    aliPayParam.Subject            = "机票订单";
                    aliPayParam.Total_fee          = mOrder.PayMoney.ToString("f2");


                    if ((!string.IsNullOrEmpty(mOrder.A9) && mOrder.A9 == "1") || string.IsNullOrEmpty(mOrder.PNR))
                    {
                        //不检查编码

                        OnErrorNew("不检查编码,PNR:" + mOrder.PNR, false);
                    }
                    else
                    {
                        //需要检查编码
                        #region 判断PNR

                        tempSqlWhere = " PNR='" + mOrder.PNR + "' and OrderStatusCode=4 and (PayWay=1 or PayWay=5)";
                        List <Tb_Ticket_Order> orderListNew = new PbProject.Logic.Order.Tb_Ticket_OrderBLL().GetListBySqlWhere(tempSqlWhere);

                        if (orderListNew == null || orderListNew.Count == 0)
                        {
                            //先看该订单支付已经支付过
                            aliPayParam.Extend_param = "PNR^" + mOrder.PNR;
                        }
                        else
                        {
                            OnErrorNew("该编码已经有支付记录,PNR:" + mOrder.PNR, false);
                        }

                        #endregion
                    }

                    #endregion

                    msgShow = new PbProject.Logic.Pay.AliPay().GetPay(aliPayParam);
                }
                else if (payWay == "2" || payWay == "6")//快钱
                {
                    PbProject.Logic.Pay.DataAction d = new PbProject.Logic.Pay.DataAction();
                    decimal tempMoney = d.FourToFiveNum(mOrder.PayMoney * 0.001M, 2) * 100; //手续费

                    #region 支付参数赋值
                    _99BillParam billParam = new _99BillParam();
                    billParam.Bankcode = code;
                    billParam.Detail   = payDetails;               //分账明细
                    billParam.Ext      = mUser.id.ToString();      //操作人id
                    billParam.Money    = tempMoney.ToString("f0"); //供应商收款
                    billParam.Orderid  = mOrder.OrderId;
                    //billParam.Payid = "*****@*****.**";
                    billParam.Payid   = "";
                    billParam.Paytype = (string.IsNullOrEmpty(code)) ? "00" : "10";
                    billParam.Pname   = "机票订单";
                    billParam.Price   = (mOrder.PayMoney * 100).ToString("f0"); //供应商收款
                    billParam.Ptype   = "1";

                    #endregion

                    msgShow = new PbProject.Logic.Pay._99Bill().GetPay(billParam);
                }
                else if (payWay == "3" || payWay == "7")//汇付天下
                {
                    #region 支付参数赋值

                    ChinaPnrParam chinaPnrParam = new ChinaPnrParam();
                    chinaPnrParam.Orderid = mOrder.OrderId;                 //订单号
                    chinaPnrParam.Price   = mOrder.PayMoney.ToString("f2"); //订单总价
                    chinaPnrParam.Merpriv = mUser.id.ToString();            //自定义字段
                    chinaPnrParam.Details = payDetails;                     //分账明细
                    chinaPnrParam.Pnr     = mOrder.PNR;

                    #endregion

                    msgShow = new PbProject.Logic.Pay.ChinaPnr().Buy(chinaPnrParam);
                }
                else if (payWay == "4" || payWay == "8" || payWay == "40")// 财付通
                {
                    string queryParam = string.Format("orderid={0}&total_tee={1}&userhostaddress={2}&attach={3}&busargs={4}&busdesc={5}&banktype={6}",
                                                      mOrder.OrderId, (mOrder.PayMoney * 100).ToString("F0"), Request.UserHostAddress, mUser.id.ToString(), payDetails, string.Format("{0}^{1}^{2}^{3}^{4}^{5}", mOrder.PNR, mOrder.Travel, mOrder.PassengerNumber, mUser.id.ToString(), mOrder.CreateUserName, "13800000000"), code);
                    url = string.Format("http://lzh.mypb.cn/Pay/TenPay.aspx?{0}", queryParam);
                    // url = string.Format("TenPay.aspx?{0}", queryParam);
                }

                #endregion
            }
            else
            {
                OnErrorNew("支付错误:" + payDetails, false);

                msgShow = string.IsNullOrEmpty(msgShow) ? "支付错误" : msgShow;
            }
        }
        catch (Exception ex)
        {
            msgShow = "支付异常";

            OnErrorNew(msgShow + ex.ToString(), false);
        }
        if (!string.IsNullOrEmpty(url))
        {
            Response.Redirect(url);
        }
        else
        {
            OnErrorNew(msgShow, false);
            Response.Write(msgShow);
        }
    }