Esempio n. 1
0
        /// <summary>
        /// 支付回调函数
        /// </summary>
        /// <param name="PayNumber">支付接口返回的交易号</param>
        /// <param name="PayState">交易状态</param>
        /// <param name="Remark">备注(更新后的备注=原来的+现在的)</param>
        /// <param name="TradeNo">提交到支付接口的交易号</param>
        /// <param name="BatchNo">批次号(没有批次号null)</param>
        /// <param name="PayType">支付接口类型</param>
        /// <param name="ItemId">记录项的ID</param>
        /// <param name="ItemType">记录项的类型</param>
        /// <param name="CurrCompanyId">当前操作公司编号</param>
        /// <param name="CurrUserId">当前操作用户编号</param>
        /// <returns>返回true表示成功</returns>
        public virtual bool PayCallback(string PayNumber, EyouSoft.Model.TicketStructure.PayState PayState, string Remark,
                                        string TradeNo, string BatchNo, EyouSoft.Model.TicketStructure.TicketAccountType PayType,
                                        out string ItemId, out EyouSoft.Model.TicketStructure.ItemType?ItemType, out string CurrCompanyId, out string CurrUserId)
        {
            ItemId        = string.Empty;
            ItemType      = null;
            CurrCompanyId = string.Empty;
            CurrUserId    = string.Empty;

            if (string.IsNullOrEmpty(PayNumber) || string.IsNullOrEmpty(TradeNo))
            {
                return(false);
            }

            bool      IsResult = false;
            DbCommand dc       = this._dataBase.GetStoredProcCommand("proc_TicketPay_PayCallback");

            this._dataBase.AddInParameter(dc, "PayNumber", DbType.String, PayNumber);
            this._dataBase.AddInParameter(dc, "PayState", DbType.Byte, (int)PayState);
            this._dataBase.AddInParameter(dc, "Remark", DbType.String, Remark);
            this._dataBase.AddInParameter(dc, "TradeNo", DbType.String, TradeNo);
            this._dataBase.AddInParameter(dc, "BatchNo", DbType.String, BatchNo);
            this._dataBase.AddInParameter(dc, "PayType", DbType.Byte, (int)PayType);

            using (IDataReader dr = DbHelper.RunReaderProcedure(dc, this._dataBase))
            {
                if (dr.Read())
                {
                    ItemId = dr["ItemId"].ToString();
                    if (!dr.IsDBNull(dr.GetOrdinal("ItemType")))
                    {
                        ItemType = (EyouSoft.Model.TicketStructure.ItemType) int.Parse(dr["ItemType"].ToString());
                    }
                    CurrCompanyId = dr["CurrCompanyId"].ToString();
                    CurrUserId    = dr["CurrUserId"].ToString();

                    IsResult = true;
                }
            }

            return(IsResult);
        }
Esempio n. 2
0
        /// <summary>
        /// 支付回调
        /// </summary>
        /// <param name="payNumber">支付接口返回的交易流水号</param>
        /// <param name="payprice">支付金额</param>
        /// <param name="paystate">支付状态</param>
        /// <param name="paytype">支付接口类型</param>
        /// <param name="payaccount">支付账号</param>
        /// <param name="paytradeno">提交到支付接口的交易号</param>
        /// <param name="paytime">支付时间</param>
        /// <param name="batchno">批次号</param>
        /// <returns></returns>
        public bool PayAfter(string payNumber, decimal?payprice, EyouSoft.Model.TicketStructure.PayState paystate, EyouSoft.Model.TicketStructure.TicketAccountType paytype, string payaccount, string paytradeno, DateTime?paytime, string batchno)
        {
            bool   result        = false;
            string itemId        = string.Empty;                     //项目编号
            string currCompanyId = string.Empty;                     //当前公司ID
            string currUserId    = string.Empty;                     //当前用户ID

            EyouSoft.Model.TicketStructure.ItemType?itemType = null; //流水明细记录项类型
            //回调后修改支付明细
            idalTicketPayList.PayCallback(payNumber, paystate, string.Empty, paytradeno, batchno, paytype, out itemId, out itemType, out currCompanyId, out currUserId);
            if (paystate == EyouSoft.Model.TicketStructure.PayState.交易完成 && itemType.Value == EyouSoft.Model.TicketStructure.ItemType.供应商付款到平台_购买运价)
            {
                result = idal.SetPayInfo(itemId, true, DateTime.Now);
            }

            #region 回写运价信息
            EyouSoft.Model.TicketStructure.TicketFreightBuyLog LogModel = idal.GetModelByOrderNo(paytradeno);
            if (LogModel != null)
            {
                if (LogModel.PackageType != EyouSoft.Model.TicketStructure.PackageTypes.常规 && !String.IsNullOrEmpty(LogModel.DestCityIds.Trim()))
                {
                    string[] tmpDestCityIdList   = LogModel.DestCityIds.Split(',');
                    string[] tmpDestCityNameList = LogModel.DestCityNames.Split(',');

                    IList <EyouSoft.Model.TicketStructure.TicketFreightInfo> FList = new List <EyouSoft.Model.TicketStructure.TicketFreightInfo>();
                    if (tmpDestCityIdList.Length > 0)
                    {
                        for (int i = 0; i < tmpDestCityIdList.Length; i++)
                        {
                            EyouSoft.Model.TicketStructure.TicketSeattle seattlemodel = EyouSoft.BLL.TicketStructure.TicketSeattle.CreateInstance().GetTicketSeattleById(Convert.ToInt32(tmpDestCityIdList[i]));
                            if (seattlemodel != null)
                            {
                                EyouSoft.Model.TicketStructure.TicketFreightInfo FModel = new EyouSoft.Model.TicketStructure.TicketFreightInfo();
                                FModel.Id = Guid.NewGuid().ToString();
                                EyouSoft.Model.CompanyStructure.Company CompanyModel = new EyouSoft.Model.CompanyStructure.Company();
                                CompanyModel.ID            = LogModel.CompanyId;
                                FModel.Company             = CompanyModel;
                                CompanyModel               = null;
                                FModel.FlightId            = LogModel.FlightId;
                                FModel.FlightName          = LogModel.FlightName;
                                FModel.RateType            = LogModel.RateType;
                                FModel.NoGadHomeCityId     = LogModel.HomeCityId;
                                FModel.NoGadHomeCityIdName = LogModel.HomeCityName;
                                FModel.NoGadDestCityId     = int.Parse(tmpDestCityIdList[i]);
                                FModel.NoGadDestCityName   = seattlemodel.Seattle;
                                FModel.BuyType             = LogModel.PackageType;
                                FModel.LastUpdateDate      = DateTime.Now;
                                FModel.IsEnabled           = false;
                                FModel.FreightBuyId        = LogModel.Id;
                                //FModel.FreightStartDate = LogModel.StartMonth;
                                //FModel.FreightEndDate = LogModel.EndMonth;
                                FList.Add(FModel);
                                FModel = null;
                            }
                        }
                        result = ifdal.AddFreightInfo(FList) > 0 ? true : false;
                        FList  = null;
                    }
                }
                LogModel = null;
            }
            #endregion

            return(result);
        }