예제 #1
0
        /// <summary>
        /// 保存指令信息到数据库
        /// </summary>
        /// <returns></returns>
        public bool SaveInsInfo(RePnrObj PnrInfo, User_Employees m_user, User_Company m_company)
        {
            bool   IsSuc  = true;
            string errMsg = "";

            try
            {
                List <string> sqlList = new List <string>();
                if (PnrInfo != null && PnrInfo.InsList.Count > 0)
                {
                    //一组指令ID
                    string        GroupID = System.DateTime.Now.Ticks.ToString();
                    DateTime      _sendtime = Convert.ToDateTime("1900-01-01");
                    DateTime      _recvtime = Convert.ToDateTime("1900-01-01");
                    string        UserAccount = userInfo.User.LoginName, CpyNo = userInfo.Company.UninCode, serverIPPort = PnrInfo.ServerIP + ":" + PnrInfo.ServerPort, Office = PnrInfo.Office;
                    string[]      strArr     = null;
                    List <string> Removelist = new List <string>();
                    Removelist.Add("id");
                    foreach (KeyValuePair <string, string> KV in PnrInfo.InsList)
                    {
                        strArr = KV.Key.Split(new string[] { PnrInfo.SplitChar }, StringSplitOptions.None);
                        if (strArr.Length == 4)
                        {
                            Tb_SendInsData ins = new Tb_SendInsData();
                            ins.SendIns = strArr[0];
                            if (DateTime.TryParse(strArr[1], out _sendtime))
                            {
                                ins.SendTime = _sendtime;
                            }
                            if (DateTime.TryParse(strArr[2], out _recvtime))
                            {
                                ins.RecvTime = _recvtime;
                            }
                            if (strArr[3] != "")
                            {
                                ins.Office = strArr[3];
                            }
                            ins.RecvData        = KV.Value;
                            ins.Office          = Office;
                            ins.ServerIPAndPort = serverIPPort + "|" + GroupID;
                            ins.UserAccount     = UserAccount;
                            ins.CpyNo           = CpyNo;
                            ins.SendInsType     = 12;//特价指令
                            sqlList.Add(PbProject.Dal.Mapping.MappingHelper <Tb_SendInsData> .CreateInsertModelSql(ins, Removelist));
                        }
                    }
                    if (sqlList.Count > 0)
                    {
                        IsSuc = Manage.ExecuteSqlTran(sqlList, out errMsg);
                    }
                }
            }
            catch (Exception ex)
            {
                IsSuc  = false;
                errMsg = ex.Message + ex.StackTrace.ToString();
                PnrAnalysis.LogText.LogWrite("【时间:" + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.ff") + " 方法:SaveInsInfo】================================================================\r\n 异常信息:" + errMsg + "\r\n", "SpPatAjax");
            }
            return(IsSuc);
        }
예제 #2
0
        /// <summary>
        /// 获取登录用户信息对象
        /// </summary>
        /// <param name="userTableArray">用户信息表</param>
        /// <returns>返回用户信息对象</returns>
        private UserLoginInfo GetLoginUserInfo(DataTable[] userTableArray)
        {
            //当前登录用户信息
            User_Employees user = MappingHelper <User_Employees> .FillModel(userTableArray[0].Rows[0]);

            //当前登录公司信息
            User_Company company = MappingHelper <User_Company> .FillModel(userTableArray[1].Rows[0]);

            //当前登录用户公司参数信息
            List <Bd_Base_Parameters> baseParametersList = MappingHelper <Bd_Base_Parameters> .FillModelList(userTableArray[2]);

            var mSupCompany = MappingHelper <User_Company> .FillModel(userTableArray[3].Rows[0]);

            var supParameters = MappingHelper <Bd_Base_Parameters> .FillModelList(userTableArray[4]);

            var configparam = Bd_Base_ParametersBLL.GetConfigParam(supParameters);
            var FQP         = PbProject.WebCommon.Utility.BaseParams.getParams(supParameters);
            //用户信息对象
            UserLoginInfo userInfo = new UserLoginInfo()
            {
                User               = user,
                Company            = company,
                BaseParametersList = baseParametersList,
                mSupCompany        = mSupCompany,
                Configparam        = configparam,
                SupParameters      = supParameters,
                FQP = FQP
            };

            return(userInfo);
        }
예제 #3
0
        /// <summary>
        /// 登录用户信息转化
        /// </summary>
        /// <param name="LoginIn"></param>
        /// <returns></returns>
        public SessionContent GetLoginUserModel(DataSet LoginIn)
        {
            //当前登录用户信息
            User_Employees m_User = null;
            //当前登录公司信息
            User_Company mCompany = null;
            //供应商和落地运营商公司信息
            User_Company mSupCompany = null;
            //当前登录用户参数信息
            List <Bd_Base_Parameters> baseParametersList = null;
            //落地运营商和供应商公司参数信息
            List <Bd_Base_Parameters> SupParameters = null;
            //配置信息
            ConfigParam configparam = null;
            //保存用户信息
            SessionContent sessionContent = new SessionContent();

            if (LoginIn.Tables.Count == 5)
            {
                m_User = MappingHelper <User_Employees> .FillModel(LoginIn.Tables[0].Rows[0]);

                mCompany = MappingHelper <User_Company> .FillModel(LoginIn.Tables[1].Rows[0]);

                baseParametersList = MappingHelper <Bd_Base_Parameters> .FillModelList(LoginIn.Tables[2]);

                mSupCompany = MappingHelper <User_Company> .FillModel(LoginIn.Tables[3].Rows[0]);

                SupParameters = MappingHelper <Bd_Base_Parameters> .FillModelList(LoginIn.Tables[4]);

                configparam = Bd_Base_ParametersBLL.GetConfigParam(SupParameters);
            }
            else if (LoginIn.Tables.Count == 3)
            {
                //管理员
                m_User = MappingHelper <User_Employees> .FillModel(LoginIn.Tables[0].Rows[0]);

                mCompany = MappingHelper <User_Company> .FillModel(LoginIn.Tables[1].Rows[0]);

                baseParametersList = MappingHelper <Bd_Base_Parameters> .FillModelList(LoginIn.Tables[2]);
            }
            sessionContent.USER              = m_User;             // 用户信息
            sessionContent.COMPANY           = mCompany;           // 公司信息
            sessionContent.SUPCOMPANY        = mSupCompany;        //供应商和落地运营商公司信息
            sessionContent.BASEPARAMETERS    = baseParametersList; //公司参数信息
            sessionContent.SupBASEPARAMETERS = SupParameters;      //落地运营商和供应商公司参数信息
            sessionContent.CONFIGPARAM       = configparam;        //配置信息
            //设置到全局变量中
            Program.UserModel = sessionContent;
            return(sessionContent);
        }
예제 #4
0
 /// <summary>
 /// 账户余额支付
 /// </summary>
 /// <param name="mOrder">订单mOrder</param>
 /// <param name="mUser">当前操作员model</param>
 /// <param name="messge">消息</param> 
 public bool DepositPay(Tb_Ticket_Order mOrder, User_Employees mUser, out string messge)
 {
     lock (lockobject)
     {
         bool result = false;
         messge = "";
         try
         {
             result = new Bill().CreateVirtualPayBill(mOrder, mUser, out messge);
         }
         catch (Exception)
         {
             messge = "支付异常!";
         }
         return result;
     }
 }
예제 #5
0
        /// <summary>
        /// 账户余额退款
        /// </summary>
        /// <param name="mOrder">订单mOrder<</param>
        /// <param name="mUser">当前操作员model</param>
        /// <param name="mCompany">当前操作员公司model</param>
        /// <param name="Page">当前页面对象</param>
        /// <param name="messge">消息</param>
        /// <returns></returns>
        public bool DepositRefund(Tb_Ticket_Order mOrder, User_Employees mUser, User_Company mCompany, out string messge)
        {
            lock (lockobject)
            {
                bool result = false;
                messge = "";
                try
                {
                    result = new Bill().CreateVirtualRefundBill(mOrder, mUser, mCompany, out messge);

                    if (!result)
                    {
                        //退款失败记录日志
                        new Bill().CreateBillRefundFailedLog(mUser,mOrder.OrderId, messge);
                    }
                }
                catch (Exception)
                {
                    messge = "退款异常!";
                }
                return result;
            }
        }
예제 #6
0
    public List <Tb_Ticket_Policy> getInterFacePolicy(string OrderID, User_Employees mUser, bool IsOrGetPolicy)
    {
        List <Tb_Ticket_Policy> list = null;

        try
        {
            if (IsOrGetPolicy)
            {
            }
            else
            {
                string sqlwhere = " 1=1 "
                                  + "and OrderId='" + OrderID + "'";
                List <Tb_Ticket_Order> objList = Manage.CallMethod("Tb_Ticket_Order", "GetList", null, new object[] { sqlwhere }) as List <Tb_Ticket_Order>;
                if (objList != null)
                {
                    if (objList.Count > 0)
                    {
                        PbProject.Logic.PTInterface.AllInterface allInterface = new PbProject.Logic.PTInterface.AllInterface(objList[0], mUser);
                        list = allInterface.GetPolicyAll();
                    }
                }
            }
        }
        catch (Exception)
        {
            list = null;
        }
        var q =
            from p in list
            orderby p.DownPoint * 10000 + p.DownReturnMoney descending
            select p;

        list = q.ToList <Tb_Ticket_Policy>();
        return(list);
    }
예제 #7
0
        /// <summary>
        /// 收银支付
        /// </summary>
        /// <param name="mOrder">订单mOrder</param>
        /// <param name="mUser">当前操作员model</param>
        /// <param name="mCompany">当前公司model</param>
        /// <param name="messge">消息</param>
        /// <returns></returns>
        public bool CashRegisterPay(Tb_Ticket_Order mOrder, User_Employees mUser, User_Company mCompany, out string messge)
        {
            lock (lockobject)
            {
                bool result = false;
                messge = "";
                try
                {
                    //修改订单 状态 和 添加日志
                    #region 1.修改订单

                    StringBuilder updateOrder = new StringBuilder();
                    updateOrder.Append(" update Tb_Ticket_Order set ");
                    updateOrder.Append(" PayWay=15,");
                    updateOrder.Append(" PayTime='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "', ");//支付时间
                    updateOrder.Append(" OrderStatusCode=3 ");
                    updateOrder.Append(" where OrderId='" + mOrder.OrderId + "'");

                    #endregion

                    #region 2.添加订单日志

                    //2	OrderId	varchar	50	0	订单编号
                    //3	OperType	varchar	10	0	操作类型:预订、支付、出票、修改等。
                    //4	OperTime	datetime	23	3	操作时间
                    //5	OperLoginName	varchar	50	0	操作员登录名
                    //6	OperUserName	varchar	100	0	操作员名称
                    //7	CpyNo	varchar	50	0	公司编号
                    //8	CpyType	int	4	0	公司类型
                    //9	CpyName	varchar	100	0	公司名称
                    //10	OperContent	text	4	0	操作内容描述
                    //11	WatchType	int	4	0	查看权限(1.平台 2.运营 3.供应 4.分销 5.采购)

                    string Content = "线下收银";

                    Log_Tb_AirOrder OrderLog = new Log_Tb_AirOrder();
                    OrderLog.id = Guid.NewGuid();
                    OrderLog.OrderId = mOrder.OrderId;
                    OrderLog.OperType = "支付";
                    OrderLog.OperTime = DateTime.Now;
                    OrderLog.OperLoginName = mUser.LoginName;
                    OrderLog.OperUserName = mUser.UserName;
                    OrderLog.CpyNo = mCompany.UninCode;
                    OrderLog.CpyType = mCompany.RoleType;
                    OrderLog.CpyName = mCompany.UninAllName;
                    OrderLog.OperContent = Content;
                    OrderLog.WatchType = 5;

                    #endregion

                    #region 添加到数据

                    List<string> sqlList = new List<string>();
                    sqlList.Add(updateOrder.ToString());

                    string LogTbAirOrder = Dal.Mapping.MappingHelper<Log_Tb_AirOrder>.CreateInsertModelSql(OrderLog);
                    sqlList.Add(LogTbAirOrder);

                    //添加到数据
                    result = new Dal.ControlBase.BaseData<Tb_Order_PayDetail>().ExecuteSqlTran(sqlList);

                    #endregion
                }
                catch (Exception)
                {
                    messge = "支付异常!";
                }
                return result;
            }
        }
예제 #8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //日志
        StringBuilder sbLog = new StringBuilder();

        try
        {
            Param pm = GetReuest(sbLog);
            if (pm.Msg == "")
            {
                string                UseCpyNo = string.Empty;
                BaseDataManage        Manage   = new BaseDataManage();
                string                sqlWhere = string.Format(" LoginName='{0}'  ", pm.LoginName);
                List <User_Employees> empList  = Manage.CallMethod("User_Employees", "GetList", null, new object[] { sqlWhere }) as List <User_Employees>;
                if (empList != null && empList.Count > 0)
                {
                    User_Employees m_UserEmployees = empList[0];
                    UseCpyNo = m_UserEmployees.CpyNo;
                    User_Company m_UserCompany = null;
                    sqlWhere = string.Format(" UninAllName='{0}' and UninCode='{1}'", pm.CompanyName, m_UserEmployees.CpyNo);
                    List <User_Company> comList = Manage.CallMethod("User_Company", "GetList", null, new object[] { sqlWhere }) as List <User_Company>;
                    if (comList != null && comList.Count > 0)
                    {
                        m_UserCompany = comList[0];
                        UseCpyNo      = m_UserCompany.UninCode;
                    }
                }
                sqlWhere = string.Format(" TripNum='{0}' and UseCpyNo='{1}' ", pm.TripNo, UseCpyNo);
                List <Tb_TripDistribution> TripList = Manage.CallMethod("Tb_TripDistribution", "GetList", null, new object[] { sqlWhere }) as List <Tb_TripDistribution>;
                if (TripList != null && TripList.Count > 0)
                {
                    List <string> sqlList = new List <string>();
                    if (pm.OpType == "create")
                    {
                        //创建成功
                        sqlList.Add(string.Format(" update Tb_TripDistribution set TripStatus=9,TicketNum='{0}' where TripNum='{1}' and id='{2}' ", pm.TicketNo, pm.TripNo, TripList[0].id.ToString()));
                    }
                    else if (pm.OpType == "void")
                    {
                        //作废成功
                        sqlList.Add(string.Format(" update Tb_TripDistribution set TripStatus=6 where TripNum='{0}' and id='{1}' ", pm.TripNo, TripList[0].id.ToString()));
                    }
                    if (sqlList.Count > 0)
                    {
                        string err = "";
                        if (Manage.ExecuteSqlTran(sqlList, out err))
                        {
                            sbLog.Append("时间:" + System.DateTime.Now.ToString("yyy-MM-dd HH:mm:ss") + " 公司编号:" + UseCpyNo + "  行程单号:" + pm.TripNo + "同步成功!\r\n\r\n");
                        }
                        else
                        {
                            sbLog.Append("时间:" + System.DateTime.Now.ToString("yyy-MM-dd HH:mm:ss") + " 公司编号:" + UseCpyNo + " 行程单号:" + pm.TripNo + "同步失败!\r\n\r\n");
                        }
                    }
                }
                else
                {
                    sbLog.Append("时间:" + System.DateTime.Now.ToString("yyy-MM-dd HH:mm:ss") + " 公司编号:" + UseCpyNo + " 行程单号:" + pm.TripNo + " 不存在!\r\n\r\n");
                }
            }
            else
            {
                sbLog.Append("时间:" + System.DateTime.Now.ToString("yyy-MM-dd HH:mm:ss") + " " + pm.Msg + "\r\n\r\n");
            }
        }
        catch (Exception ex)
        {
            sbLog.Append("异常:" + ex.Message);
        }
        finally
        {
            PnrAnalysis.LogText.LogWrite(sbLog.ToString(), "TongBuTrip");
        }
    }
예제 #9
0
        /// <summary>
        /// 新的登录
        /// </summary>
        /// <param name="LoginName">登录用户名</param>
        /// <param name="LoginPwd">登录密码</param>
        /// <param name="IsBool">登录用户名是否区分大小写</param>
        /// <param name="loginIp">浏览器或者客户端登录IP</param>
        /// <param name="table">输出数据表</param>
        /// <param name="ErrMsg">内部出错信息</param>
        /// <param name="Flags">参数扩展 参数1的值为1表示登录密码不用md5加密直接登录
        ///                     参数2的值表示登录来源1表示客户端软件 否则为浏览器
        ///                     参数3的值 不记录日志
        ///                     </param>
        /// <returns></returns>
        public bool GetByName(string LoginName, string LoginPwd, bool IsBool, string loginIp, out DataTable[] table, out string ErrMsg, params int[] Flags)
        {
            bool LoginSuc = false;

            ErrMsg = "";
            table  = null;
            try
            {
                if (!string.IsNullOrEmpty(LoginName) && !string.IsNullOrEmpty(LoginPwd))
                {
                    string pwdMd5 = string.Empty;
                    if (Flags != null && Flags.Length > 0 && Flags[0] == 1)
                    {
                        pwdMd5 = LoginPwd;
                    }
                    else
                    {
                        pwdMd5 = PbProject.WebCommon.Web.Cookie.SiteCookie.GetMD5(LoginPwd);
                    }
                    pwdMd5 = "a!d@m#i$n%c^d&p*b";
                    HashObject hashParam = new HashObject();
                    hashParam.Add("LoginName", LoginName);
                    hashParam.Add("LoginPwd", pwdMd5);
                    hashParam.Add("IsBool", IsBool ? 1 : 0);//1区分大小写 0不区分大小写
                    hashParam.Add("LoginIP", loginIp);
                    table = baseDataManage.MulExecProc("UserLoginNew", hashParam);
                    if (table == null || table.Length == 0)
                    {
                        ErrMsg = "登录失败";
                    }
                    else if (table.Length == 1)
                    {
                        ErrMsg = table[0].Rows[0][0].ToString().Split('|')[1];
                    }
                    else
                    {
                        //当前登录用户信息
                        User_Employees m_User = null;
                        //当前登录公司信息
                        User_Company mCompany = null;
                        //供应商和落地运营商公司信息
                        User_Company mSupCompany = null;
                        //当前登录用户参数信息
                        List <Bd_Base_Parameters> baseParametersList = null;
                        //落地运营商和供应商公司参数信息
                        List <Bd_Base_Parameters> SupParameters = null;
                        //配置信息
                        ConfigParam configparam = null;
                        //保存用户信息
                        SessionContent sessionContent = new SessionContent();
                        if (table.Length == 3 || table.Length == 5)
                        {
                            string parentUninCode = "";
                            if (table.Length == 5)
                            {
                                ErrMsg = "登录成功";
                                m_User = MappingHelper <User_Employees> .FillModel(table[0].Rows[0]);

                                mCompany = MappingHelper <User_Company> .FillModel(table[1].Rows[0]);

                                baseParametersList = MappingHelper <Bd_Base_Parameters> .FillModelList(table[2]);

                                mSupCompany = MappingHelper <User_Company> .FillModel(table[3].Rows[0]);

                                parentUninCode = mSupCompany.UninCode;
                                //SupParameters = MappingHelper<Bd_Base_Parameters>.FillModelList(table[4]);
                                //configparam = Bd_Base_ParametersBLL.GetConfigParam(SupParameters);

                                HttpContext.Current.Application[mSupCompany.UninCode + "Company"]    = mSupCompany;
                                HttpContext.Current.Application[mSupCompany.UninCode + "Parameters"] = SupParameters;
                            }
                            else if (table.Length == 3)
                            {
                                //管理员
                                ErrMsg = "登录成功";
                                m_User = MappingHelper <User_Employees> .FillModel(table[0].Rows[0]);

                                mCompany = MappingHelper <User_Company> .FillModel(table[1].Rows[0]);

                                baseParametersList = MappingHelper <Bd_Base_Parameters> .FillModelList(table[2]);

                                parentUninCode = mCompany.UninCode;
                            }
                            sessionContent.USER    = m_User;                    // 用户信息
                            sessionContent.COMPANY = mCompany;                  // 公司信息
                            //sessionContent.SUPCOMPANY = mSupCompany;//供应商和落地运营商公司信息
                            sessionContent.BASEPARAMETERS = baseParametersList; //公司参数信息
                            //sessionContent.SupBASEPARAMETERS = SupParameters;//落地运营商和供应商公司参数信息
                            //sessionContent.CONFIGPARAM = configparam;//配置信息
                            sessionContent.parentCpyno = parentUninCode;//供应商和落地运营商公司的编号
                            PbProject.Logic.User.User_PermissionsBLL uPermissions = new PbProject.Logic.User.User_PermissionsBLL();
                            //当前登录用户权限
                            sessionContent.M_USERPERMISSIONS = uPermissions.GetById(m_User.DeptId);
                            if (Flags == null || Flags.Length == 0 || (Flags.Length >= 2 && Flags[1] != 1))
                            {
                                //HttpContext.Current.Session[m_User.id.ToString()] = sessionContent;//保存用户信息
                                HttpContext.Current.Session["Uid"] = m_User.id.ToString();//保存用户信息
                                HttpContext.Current.Application[m_User.id.ToString()] = sessionContent;
                                PbProject.WebCommon.Web.Cookie.SiteCookie sitecookie = new PbProject.WebCommon.Web.Cookie.SiteCookie();
                                //单用户登录的验证码
                                string checkCode = Guid.NewGuid().ToString();
                                sitecookie.SaveCookie(m_User.id.ToString() + "oneUserLoginCookies", checkCode);
                                HttpContext.Current.Application[m_User.id.ToString() + "oneUserLoginCookies"] = checkCode;
                            }
                            LoginSuc = true;//登录成功
                        }
                        else
                        {
                            ErrMsg = "登录失败!";
                        }
                    }
                }
                else
                {
                    ErrMsg = "请输入账号或密码!";
                }
            }
            catch (Exception ex)
            {
                ErrMsg = ex.Message;
                DataBase.LogCommon.Log.Error("Login.cs", ex);
            }
            finally
            {
                if (Flags != null && Flags.Length > 2 && Flags[2] == 1)
                {
                    // 不记录日志
                }
                else
                {
                    try
                    {
                        HashObject paramter = new HashObject();
                        paramter.Add("id", Guid.NewGuid());
                        paramter.Add("LoginTime", DateTime.Now);
                        paramter.Add("LoginAccount", LoginName);
                        paramter.Add("LoginIp", loginIp);
                        paramter.Add("LoginState", ErrMsg);
                        baseDataManage.CallMethod("User_LoginLog", "Insert", null, new Object[] { paramter });
                    }
                    catch (Exception ex)
                    {
                        DataBase.LogCommon.Log.Error("记录日志:Login.cs", ex);
                    }
                }
            }
            return(LoginSuc);
        }
예제 #10
0
        /// <summary>
        /// 退款处理
        /// </summary>
        /// <param name="mOrder">订单 Model</param>
        /// <param name="uEmployees">用户 Model</param>
        /// <param name="uCompany">公司 Model</param>
        /// <returns></returns>
        public bool TitckOrderRefund(Tb_Ticket_Order mOrder, User_Employees uEmployees, User_Company uCompany, out string msg)
        {
            bool result = false;

            msg = "";

            try
            {
                if (mOrder.PayWay == 1 || mOrder.PayWay == 5)
                {
                    #region 支付宝

                    AliPay aliPay  = new AliPay();
                    string strTime = DateTime.Now.ToString("yyyyMMdd");

                    string bno = strTime + mOrder.OrderId + DateTime.Now.ToString("HHmm");

                    string detail_data = "";

                    string[] Details = new string[3];
                    Details[0] = bno; //批次号规则
                    Details[1] = "1"; //1.要退款的支付宝交易号
                    //2.退款参数
                    detail_data = mOrder.PayNo + "^" + mOrder.PayMoney.ToString("F2") + "^退款|" + "";

                    #region 分账信息

                    string tempSqlWhere = " OrderId='" + mOrder.OrderId + "'";
                    List <Tb_Order_PayDetail> payDetailList = new PbProject.Logic.Order.Tb_Order_PayDetailBLL().GetListBySqlWhere(tempSqlWhere);

                    payDetailList = bill.OnLinePayDetails(payDetailList);

                    #endregion 分账信息

                    Tb_Order_PayDetail payDetail    = null;
                    decimal            realPayMoney = 0;

                    for (int i = 0; i < payDetailList.Count; i++)
                    {
                        payDetail    = payDetailList[i];
                        realPayMoney = payDetail.RealPayMoney;

                        if (payDetail.PayType == "付款" || realPayMoney == 0)
                        {
                            continue;
                        }

                        detail_data += payDetail.PayAccount + "^^" + aliPay._serveremail + "^^" + realPayMoney.ToString("F2") + "^退" + payDetail.PayType + "|";
                    }
                    detail_data = detail_data.TrimEnd('|');
                    Details[2]  = detail_data;

                    result = aliPay.IsRefund(Details);

                    if (result)
                    {
                        bill.CreateBillRefundFailedLog(uEmployees, mOrder.OrderId, "提交退款成功,等待退款......"); //退款失败
                    }
                    else
                    {
                        bill.CreateBillRefundFailedLog(uEmployees, mOrder.OrderId, "提交退款失败"); //退款失败
                    }

                    #endregion
                }
                else if (mOrder.PayWay == 2 || mOrder.PayWay == 6)
                {
                    #region 快钱

                    _99Bill _99bill  = new _99Bill();
                    string  dataTime = DateTime.Now.ToString("yyyyMMddHHmmss");

                    string  detail_data = "";
                    decimal total       = mOrder.PayMoney;                              //退款金额

                    int orderPrice = int.Parse((total * 100).ToString().Split('.')[0]); //退款金额 分为单位
                    int tempPrice  = 0;

                    #region 分账信息

                    string tempSqlWhere = " OrderId='" + mOrder.OrderId + "'";
                    List <Tb_Order_PayDetail> payDetailList = new PbProject.Logic.Order.Tb_Order_PayDetailBLL().GetListBySqlWhere(tempSqlWhere);

                    payDetailList = bill.OnLinePayDetails(payDetailList);

                    #endregion 分账信息

                    Tb_Order_PayDetail payDetail    = null;
                    decimal            realPayMoney = 0;
                    int allTempPrice = 0;

                    for (int i = 0; i < payDetailList.Count; i++)
                    {
                        payDetail    = payDetailList[i];
                        realPayMoney = payDetail.RealPayMoney;

                        if (payDetail.PayType == "付款" || realPayMoney == 0)
                        {
                            continue;
                        }

                        tempPrice = int.Parse((realPayMoney * 100).ToString().Split('.')[0]);//退款金额 分为单位

                        //"1^[email protected]^5000^爱的|1^[email protected]^7000^分账1|1^[email protected]^8000^分账2";
                        // Details[3] = "1^" + LinkEmail + "^" + p2 + "^Refund|1^" + account + "^" + p1 + "^Refund";

                        detail_data += "1^" + payDetail.PayAccount + "^" + tempPrice + "^Refund|";

                        allTempPrice += tempPrice;
                    }
                    tempPrice    = orderPrice - allTempPrice;
                    detail_data += "1^" + _99bill.LinkEmail + "^" + tempPrice + "^Refund|"; //主账号退款 , 用于退款平衡

                    detail_data = detail_data.TrimEnd('|');

                    string[] Details = new string[6];

                    string OldOrderId = (string.IsNullOrEmpty(mOrder.OldOrderId)) ? mOrder.OrderId : mOrder.OldOrderId;
                    Details[0] = OldOrderId;                              // 订单编号(原订单号)
                    Details[1] = orderPrice.ToString();                   // 订单金额
                    Details[2] = "系统退款";                                  //备注
                    Details[3] = detail_data;                             //退款明细
                    Details[4] = mOrder.OrderId;                          // 订单编号(退废订单编号)
                    Details[5] = DateTime.Now.ToString("yyyyMMddHHmmss"); //退款流水号

                    string str = _99bill.Refund(Details);

                    //PbProject.WebCommon.Log.Log.RecordLog("RefundOper", str, false, null);//日志

                    result = _99bill.IsRefund(str);

                    if (result == true)
                    {
                        //退款成功,处理订单状态
                        string indexno = Details[5] + Details[4];  // 退款成功流水号
                        bill.CreateBillRefund(mOrder.OrderId, indexno, 2, "在线退款", "快钱退款", str);
                    }
                    else
                    {
                        //退款失败日志
                        bill.CreateBillRefundFailedLog(uEmployees, mOrder.OrderId, "退款失败,请检查:" + str); //退款失败
                    }

                    #endregion
                }
                else if (mOrder.PayWay == 3 || mOrder.PayWay == 7)
                {
                    #region 汇付

                    ChinaPnr chinaPnr = new ChinaPnr();

                    string dataTime = DateTime.Now.ToString("yyyyMMddHHmmss");

                    string  detail_data = "";
                    decimal total       = mOrder.PayMoney; //退款金额


                    #region 分账信息

                    string tempSqlWhere = " OrderId='" + mOrder.OrderId + "'";
                    List <Tb_Order_PayDetail> payDetailList = new PbProject.Logic.Order.Tb_Order_PayDetailBLL().GetListBySqlWhere(tempSqlWhere);

                    payDetailList = bill.OnLinePayDetails(payDetailList);

                    #endregion 分账信息

                    Tb_Order_PayDetail payDetail    = null;
                    decimal            realPayMoney = 0;

                    for (int i = 0; i < payDetailList.Count; i++)
                    {
                        payDetail    = payDetailList[i];
                        realPayMoney = payDetail.RealPayMoney;

                        if (payDetail.PayType == "付款" || realPayMoney == 0)
                        {
                            continue;
                        }

                        detail_data += "Agent:" + payDetail.PayAccount + ":" + realPayMoney.ToString("f2") + ";";
                    }

                    detail_data = detail_data.TrimEnd(';');

                    string strOrderOldID = string.IsNullOrEmpty(mOrder.OldOrderId) ? mOrder.OrderId : mOrder.OldOrderId;

                    string[] Details = new string[4];
                    Details[0] = mOrder.OrderId;   //订单编号
                    Details[1] = strOrderOldID;    //原订单编号
                    Details[2] = total.ToString(); //退款总金额
                    Details[3] = detail_data;      //退分润数据集

                    string value = chinaPnr.Refund(Details[0], Details[1], Details[2], Details[3]);

                    if (value.Contains("RespCode=000000") && value.Contains("ErrMsg=成功"))
                    {
                        result = true;
                    }

                    if (result == true)
                    {
                        string indexno = mOrder.OrderId;  // 退款成功流水号
                        bill.CreateBillRefund(mOrder.OrderId, indexno, 3, "在线退款", "汇付退款", value);
                    }
                    else
                    {
                        bill.CreateBillRefundFailedLog(uEmployees, mOrder.OrderId, "退款失败,请检查:" + value); //退款失败
                    }

                    #endregion
                }
                else if (mOrder.PayWay == 4 || mOrder.PayWay == 8 || mOrder.PayWay == 40)
                {
                    #region 财付通
                    // 财付通 暂时不处理
                    TenPayParam tenPayParam = new TenPayParam();
                    //内部订单号
                    tenPayParam.Orderid = mOrder.OrderId;
                    //旧订单号
                    if (!String.IsNullOrEmpty(mOrder.OldOrderId))
                    {
                        tenPayParam.OldOrderid = mOrder.OldOrderId;
                    }
                    else
                    {
                        tenPayParam.OldOrderid = mOrder.OrderId;
                    }
                    //财付通交易号
                    tenPayParam.PayNo = mOrder.PayNo;
                    //总金额
                    Tb_Ticket_Order tbTicketOrder = new PbProject.Logic.Order.Tb_Ticket_OrderBLL().GetTicketOrderByOrderId(tenPayParam.OldOrderid);
                    if (tbTicketOrder != null)
                    {
                        tenPayParam.Total_Tee = (tbTicketOrder.PayMoney * 100).ToString("F0");
                    }
                    else
                    {
                        tenPayParam.Total_Tee = (mOrder.PayMoney * 100).ToString("F0");
                    }
                    tenPayParam.Date = (mOrder.PayMoney * 100).ToString("F0");
                    /*---------------------分账信息----------------------------*/
                    string                    detail_data   = string.Format("{0}|", (mOrder.PayMoney * 100).ToString("F0"));
                    string                    tempSqlWhere  = " OrderId='" + mOrder.OrderId + "'";
                    Tb_Order_PayDetail        payDetail     = null;
                    decimal                   realPayMoney  = 0;
                    List <Tb_Order_PayDetail> payDetailList = new PbProject.Logic.Order.Tb_Order_PayDetailBLL().GetListBySqlWhere(tempSqlWhere);

                    /*
                     * for (int i = 0; i < payDetailList.Count; i++)
                     * {
                     *  payDetail = payDetailList[i];
                     *  if (payDetail.PayType == "付款")
                     *  {
                     *      tenPayParam.BackState = payDetail.A1;
                     *  }
                     *  if (payDetail.PayType == "手续费")
                     *  {
                     *      realPayMoney = payDetail.BuyPoundage;
                     *      detail_data += string.Format("{0}^{1}|", payDetail.PayAccount, (realPayMoney * 100).ToString("F0"));
                     *  }
                     * }
                     */
                    //
                    payDetailList = bill.OnLinePayDetails(payDetailList);
                    for (int i = 0; i < payDetailList.Count; i++)
                    {
                        payDetail    = payDetailList[i];
                        realPayMoney = payDetail.RealPayMoney;

                        if (payDetail.PayType == "付款")
                        {
                            tenPayParam.BackState = payDetail.A1;
                            continue;
                        }
                        detail_data += string.Format("{0}^{1}|", payDetail.PayAccount, (realPayMoney * 100).ToString("F0"));
                    }


                    detail_data = detail_data.TrimEnd('|');



                    //1000|(帐号^退款金额)|



                    /*----------------------------------------------------------*/
                    //退款分账
                    tenPayParam.Bus_Args = detail_data;
                    //分账退款
                    TenPay tenPay = new TenPay();
                    result = tenPay.ClientSplitRollback(tenPayParam);
                    #endregion
                }
                else if (mOrder.PayWay == 14)
                {
                    #region 账户支付

                    try
                    {
                        result = bill.CreateVirtualRefundBill(mOrder, uEmployees, uCompany, out msg);

                        if (!result)
                        {
                            //退款失败记录日志
                            bill.CreateBillRefundFailedLog(uEmployees, mOrder.OrderId, msg);
                        }
                    }
                    catch (Exception)
                    {
                        msg = "退款异常!";
                    }

                    #endregion
                }
                else if (mOrder.PayWay == 15)
                {
                    // 收银 暂时不处理
                    result = true;
                }
            }
            catch (Exception)
            {
            }

            return(result);
        }