Ejemplo n.º 1
0
        /// <summary>
        /// 添加套餐购买记录
        /// </summary>
        /// <param name="model">套餐购买记录实体</param>
        /// <returns>true:成功 false:失败</returns>
        public virtual bool Add(EyouSoft.Model.TicketStructure.TicketFreightBuyLog model)
        {
            DbCommand dc = this._database.GetSqlStringCommand(Sql_TicketFreightBuyLog_INSERT);

            model.Id = Guid.NewGuid().ToString();
            this._database.AddInParameter(dc, "Id", DbType.String, model.Id);
            //this._database.AddInParameter(dc, "OrderNo", DbType.String, model.OrderNo);
            this._database.AddInParameter(dc, "CompanyId", DbType.String, model.CompanyId);
            this._database.AddInParameter(dc, "OperatorId", DbType.String, model.OperatorId);
            this._database.AddInParameter(dc, "PackageId", DbType.Int32, model.PackageId);
            this._database.AddInParameter(dc, "PackageName", DbType.String, model.PackageName);
            this._database.AddInParameter(dc, "PackageType", DbType.Int32, (int)model.PackageType);
            this._database.AddInParameter(dc, "RateType", DbType.Int32, (int)model.RateType);
            this._database.AddInParameter(dc, "FlightId", DbType.Int32, model.FlightId);
            this._database.AddInParameter(dc, "FlightName", DbType.String, model.FlightName);
            this._database.AddInParameter(dc, "HomeCityId", DbType.Int32, model.HomeCityId);
            this._database.AddInParameter(dc, "HomeCityName", DbType.String, model.HomeCityName);
            this._database.AddInParameter(dc, "DestCityIds", DbType.String, model.DestCityIds);
            this._database.AddInParameter(dc, "DestCityNames", DbType.String, model.DestCityNames);
            this._database.AddInParameter(dc, "BuyCount", DbType.Int32, model.PackageType == EyouSoft.Model.TicketStructure.PackageTypes.常规 ? model.BuyCount : (model.DestCityIds.TrimEnd(',').Contains(",") ? model.DestCityIds.TrimEnd(',').Split(',').Length : 0));
            this._database.AddInParameter(dc, "StartMonth", DbType.DateTime, model.StartMonth);
            this._database.AddInParameter(dc, "EndMonth", DbType.DateTime, model.EndMonth);
            this._database.AddInParameter(dc, "BuyTime", DbType.DateTime, DateTime.Now);
            this._database.AddInParameter(dc, "SumPrice", DbType.Decimal, model.SumPrice);
            this._database.AddInParameter(dc, "PayState", DbType.String, model.PayState?"1":"0");
            return(DbHelper.ExecuteSql(dc, this._database) > 0 ? true : false);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 页面数据初始化
        /// </summary>
        /// <param name="logId"></param>
        protected void DataInit(string logId)
        {
            EyouSoft.Model.TicketStructure.TicketFreightBuyLog model = EyouSoft.BLL.TicketStructure.FreightBuyLog.CreateInstance().GetModel(logId);
            if (model != null)
            {
                this.msg_hide_logId.Value = logId;
                EyouSoft.Model.TicketStructure.TicketFreightPackageInfo packageModel = EyouSoft.BLL.TicketStructure.FreightPackageInfo.CreateInstance().GetModel(model.PackageId);
                if (packageModel != null)
                {
                    this.lbl_msg_name.Text  = packageModel.PackageName;
                    this.lbl_msg_air.Text   = packageModel.FlightName;
                    this.lbl_msg_count.Text = model.BuyCount.ToString();
                    this.lbl_msg_begin.Text = model.StartMonth.ToString("yyyy-MM-dd");
                    this.lbl_msg_end.Text   = model.EndMonth.ToString("yyyy-MM-dd");
                    this.lbl_msg_price.Text = model.SumPrice.ToString("0.00");
                    switch (model.PackageType)
                    {
                    case EyouSoft.Model.TicketStructure.PackageTypes.常规: this.lbl_msg_type.Text = "常规购买"; break;

                    case EyouSoft.Model.TicketStructure.PackageTypes.套餐: this.lbl_msg_type.Text = "套餐购买"; break;

                    default: this.lbl_msg_type.Text = "促销购买"; break;
                    }

                    if (model.PackageType == EyouSoft.Model.TicketStructure.PackageTypes.常规)
                    {
                        panelHangKong.Visible = false;
                    }
                }
                this.lclMsg.Text = "购买运价航线成功,<a href='" + Domain.UserBackCenter + "/ticketscenter/freightmanage/freightadd.aspx" + "' >点此返回机票供应商后台</a>!";
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 页面数据初始化
        /// </summary>
        /// <param name="logId"></param>
        protected void DataInit(string logId)
        {
            EyouSoft.Model.TicketStructure.TicketFreightBuyLog model = EyouSoft.BLL.TicketStructure.FreightBuyLog.CreateInstance().GetModel(logId);
            if (model != null)
            {
                this.msg_hide_logId.Value = logId;
                EyouSoft.Model.TicketStructure.TicketFreightPackageInfo packageModel = EyouSoft.BLL.TicketStructure.FreightPackageInfo.CreateInstance().GetModel(model.PackageId);
                if (packageModel != null)
                {
                    this.lbl_msg_name.Text  = packageModel.PackageName;
                    this.lbl_msg_air.Text   = packageModel.FlightName;
                    this.lbl_msg_count.Text = model.BuyCount.ToString();
                    this.lbl_msg_begin.Text = model.StartMonth.ToString("yyyy-MM-dd");
                    this.lbl_msg_end.Text   = model.EndMonth.ToString("yyyy-MM-dd");
                    this.lbl_msg_price.Text = model.SumPrice.ToString("0.00");
                    switch (model.PackageType)
                    {
                    case EyouSoft.Model.TicketStructure.PackageTypes.常规: this.lbl_msg_type.Text = "常规购买"; break;

                    case EyouSoft.Model.TicketStructure.PackageTypes.套餐: this.lbl_msg_type.Text = "套餐购买"; break;

                    default: this.lbl_msg_type.Text = "促销购买"; break;
                    }

                    if (model.PackageType == EyouSoft.Model.TicketStructure.PackageTypes.常规)
                    {
                        panelHangKong.Visible = false;
                    }
                }
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 获取套餐购买记录实体
        /// </summary>
        /// <param name="Id">订单编号</param>
        /// <returns>套餐购买记录实体</returns>
        public virtual EyouSoft.Model.TicketStructure.TicketFreightBuyLog GetModelByOrderNo(string OrderNo)
        {
            EyouSoft.Model.TicketStructure.TicketFreightBuyLog model = null;
            DbCommand dc = this._database.GetSqlStringCommand(Sql_TicketFreightBuyLog_GETMODELBYORDERNO);

            this._database.AddInParameter(dc, "OrderNo", DbType.String, OrderNo);
            using (IDataReader dr = DbHelper.ExecuteReader(dc, this._database))
            {
                if (dr.Read())
                {
                    model             = new EyouSoft.Model.TicketStructure.TicketFreightBuyLog();
                    model.Id          = dr.IsDBNull(0) ? string.Empty : dr[0].ToString();
                    model.OrderNo     = dr.IsDBNull(1) ? string.Empty : dr[1].ToString();
                    model.CompanyId   = dr[2].ToString();
                    model.OperatorId  = dr.IsDBNull(3) ? string.Empty : dr[3].ToString();
                    model.PackageId   = dr.IsDBNull(4) ? 0 : dr.GetInt32(4);
                    model.PackageName = dr[5].ToString();
                    if (!dr.IsDBNull(6))
                    {
                        model.PackageType = (EyouSoft.Model.TicketStructure.PackageTypes) int.Parse(dr.GetByte(6).ToString());
                    }
                    if (!dr.IsDBNull(7))
                    {
                        model.RateType = (EyouSoft.Model.TicketStructure.RateType) int.Parse(dr.GetByte(7).ToString());
                    }
                    model.FlightId       = dr.GetInt32(8);
                    model.FlightName     = dr.IsDBNull(9) ? string.Empty : dr[9].ToString();
                    model.HomeCityId     = dr.GetInt32(10);
                    model.HomeCityName   = dr[11].ToString();
                    model.DestCityIds    = dr[12].ToString();
                    model.DestCityNames  = dr[13].ToString();
                    model.BuyCount       = dr.GetInt32(14);
                    model.AvailableCount = dr.GetInt32(15);
                    model.StartMonth     = dr.IsDBNull(16) ? DateTime.MinValue : dr.GetDateTime(16);
                    model.EndMonth       = dr.IsDBNull(17) ? DateTime.MinValue : dr.GetDateTime(17);
                    model.BuyTime        = dr.IsDBNull(18) ? DateTime.MinValue : dr.GetDateTime(18);
                    model.SumPrice       = dr.IsDBNull(19) ? 0 : dr.GetDecimal(19);
                    model.PayState       = dr[20].ToString() == "1" ? true : false;
                    model.PayTime        = dr.IsDBNull(21) ? DateTime.MinValue : dr.GetDateTime(21);
                }
            }
            return(model);
        }
Ejemplo n.º 5
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            string logId = context.Request.QueryString["logId"];

            if (!String.IsNullOrEmpty(logId))
            {
                EyouSoft.Model.TicketStructure.TicketFreightBuyLog model = EyouSoft.BLL.TicketStructure.FreightBuyLog.CreateInstance().GetModel(logId);
                string url = "";

                /*
                 * 常规购买:套餐项目-常规  类型-团队  运价数-19 开始10.1-10.3
                 * 套餐购买:套餐项目-华东区  类型-团队  航空公司-CA 始发地-上海 目的地-所有 开始10.1-10.3
                 * 促销购买:套餐项目-华东区  类型-团队  航空公司-CA 始发地-上海 目的地-北京 开始10.1-10.3
                 */
                string batch_no = "";
                companyModel = EyouSoft.BLL.CompanyStructure.CompanyInfo.CreateInstance().GetModel(model.CompanyId);
                string bankType = context.Request.QueryString["bankType"];
                if (companyModel == null || String.IsNullOrEmpty(context.Request.QueryString["uid"]) || String.IsNullOrEmpty(bankType))
                {
                    context.Response.Write("error");
                    return;
                }
                switch (bankType)
                {
                case "ZFB":
                    switch (model.PackageType)
                    {
                    case EyouSoft.Model.TicketStructure.PackageTypes.常规: url = this.GetPayUrlByZFB(model.OrderNo, string.Format("常规购买:套餐项目-{0}、类型-团队、运价数-{1}、开始{2}-{3}", model.PackageName, model.BuyCount.ToString(), model.StartMonth.ToString("yyyy.MM"), model.EndMonth.ToString("yyyy.MM")), "暂无", Utils.GetDecimal((model.SumPrice * 100).ToString("0")) / 100); break;

                    case EyouSoft.Model.TicketStructure.PackageTypes.套餐: url = this.GetPayUrlByZFB(model.OrderNo, string.Format("套餐购买:套餐项目-{0}、类型-团队、航空公司-{1}、始发地-{2}、目的地-{3}、开始{4}-{5}", model.PackageName, model.FlightName, model.HomeCityName, model.DestCityNames, model.StartMonth.ToString("yyyy.MM"), model.EndMonth.ToString("yyyy.MM")), "暂无", Utils.GetDecimal((model.SumPrice * 100).ToString("0")) / 100); break;

                    default: url = this.GetPayUrlByZFB(model.OrderNo, string.Format("促销购买:套餐项目-{0}、类型-团队  航空公司-{1}、始发地-{2}、目的地-{3}、开始{4}-{5}", model.PackageName, model.FlightName, model.HomeCityName, model.DestCityNames, model.StartMonth.ToString("yyyy.MM"), model.EndMonth.ToString("yyyy.MM")), "暂无", Utils.GetDecimal((model.SumPrice * 100).ToString("0")) / 100); break;
                    }

                    EyouSoft.BLL.TicketStructure.FreightBuyLog.CreateInstance().AddTicketPay(model.Id, model.OrderNo, context.Request.QueryString["uid"], companyModel.ID, Utils.GetDecimal((model.SumPrice * 100).ToString("0")) / 100, EyouSoft.Model.TicketStructure.TicketAccountType.支付宝, out batch_no); break;

                case "CFT":
                    switch (model.PackageType)
                    {
                    case EyouSoft.Model.TicketStructure.PackageTypes.常规: url = this.GetPayUrlByCFT(model.OrderNo, string.Format("常规购买:套餐项目-{0}、类型-团队、运价数-{1}、开始{2}-{3}", model.PackageName, model.BuyCount.ToString(), model.StartMonth.ToString("yyyy.MM"), model.EndMonth.ToString("yyyy.MM")), Utils.GetDecimal((model.SumPrice * 100).ToString("0")), context); break;

                    case EyouSoft.Model.TicketStructure.PackageTypes.套餐: url = this.GetPayUrlByCFT(model.OrderNo, string.Format("套餐购买:套餐项目-{0}、类型-团队、航空公司-{1}、始发地-{2}、目的地-{3}、开始{4}-{5}", model.PackageName, model.FlightName, model.HomeCityName, model.DestCityNames, model.StartMonth.ToString("yyyy.MM"), model.EndMonth.ToString("yyyy.MM")), Utils.GetDecimal((model.SumPrice * 100).ToString("0")), context); break;

                    default: url = this.GetPayUrlByCFT(model.OrderNo, string.Format("促销购买:套餐项目-{0}、类型-团队、航空公司-{1}、始发地-{2}、目的地-{3}、开始{4}-{5}", model.PackageName, model.FlightName, model.HomeCityName, model.DestCityNames, model.StartMonth.ToString("yyyy.MM"), model.EndMonth.ToString("yyyy.MM")), Utils.GetDecimal((model.SumPrice * 100).ToString("0")), context); break;
                    }
                    EyouSoft.BLL.TicketStructure.FreightBuyLog.CreateInstance().AddTicketPay(model.Id, model.OrderNo, context.Request.QueryString["uid"], companyModel.ID, Utils.GetDecimal((model.SumPrice * 100).ToString("0")) / 100, EyouSoft.Model.TicketStructure.TicketAccountType.财付通, out batch_no);
                    break;

                default: context.Response.Write("error"); return;
                }


                if (url != "")
                {
                    context.Response.Write(url);
                }
                else
                {
                    context.Response.Write("error");
                }
                return;
            }

            //购买数
            int buyCount = Utils.GetInt(context.Request.QueryString["buyCount"]);
            //公司ID
            string companyId = context.Request.QueryString["companyId"];
            //开始时间
            DateTime?startMonth = Utils.GetDateTimeNullable(context.Request.QueryString["SartDateTime"]);
            //套餐编号
            int packageId = Utils.GetInt(context.Request.QueryString["packageId"]);
            //购买时间类型
            string type = Utils.GetQueryStringValue("type");
            //购买类型: cg = 常规  cs = 套餐 + 促销
            string p = context.Request.QueryString["p"];
            //购买运价类型 2 = 套餐  3 = 促销
            string packageType = context.Request.QueryString["packageType"];

            if (startMonth == null)
            {
                context.Response.Write("error");
                return;
            }

            if (p != null)
            {
                //获得公司信息
                companyModel = EyouSoft.BLL.CompanyStructure.CompanyInfo.CreateInstance().GetModel(companyId);
                if (companyModel == null)
                {
                    context.Response.Write("error");
                    return;
                }
                //获取购买运价信息
                packageModel = EyouSoft.BLL.TicketStructure.FreightPackageInfo.CreateInstance().GetModel(packageId);
                if (packageModel == null)
                {
                    context.Response.Write("error");
                    return;
                }
                decimal onePrice = 0.00M;
                //结束时间计算
                DateTime endTime   = DateTime.Now;
                DateTime startDate = Convert.ToDateTime(startMonth);
                //如果开始日期是本月
                if (Convert.ToDateTime(startMonth).Month == DateTime.Now.Month)
                {
                    //计算当月的剩余天数的比例
                    int today = Convert.ToDateTime(startMonth).Day;

                    decimal ratio = Decimal.Parse((DateTime.DaysInMonth(startDate.Year, startDate.Month) - today + 1).ToString("0.00")) / Decimal.Parse(Convert.ToDecimal(DateTime.DaysInMonth(startDate.Year, startDate.Month)).ToString("0.00"));
                    switch (type)
                    {
                    case "1":
                        //单价 = 当月剩余天数比率 * 每月价格
                        onePrice = packageModel.MonthPrice * ratio;
                        endTime  = Convert.ToDateTime(startDate.Year + "-" + startDate.Month + "-" + DateTime.DaysInMonth(startDate.Year, startDate.Month));
                        break;

                    case "2":
                        //单价 = 当月剩余天数比率 * 每月价格 + 其它两月的价格
                        onePrice = ratio * packageModel.QuarterPrice / 3 + packageModel.QuarterPrice / 3 * 2;
                        endTime  = Convert.ToDateTime(startDate.AddMonths(2).Year + "-" + startDate.AddMonths(2).Month + "-" + DateTime.DaysInMonth(startDate.AddMonths(2).Year, startDate.AddMonths(2).Month));
                        break;

                    default:
                        //单价 = 当月剩余天数比率 * 每月价格 + 其它五月的价格
                        onePrice = ratio * packageModel.HalfYearPrice / 6 + packageModel.HalfYearPrice / 6 * 5;
                        endTime  = Convert.ToDateTime(startDate.AddMonths(5).Year + "-" + startDate.AddMonths(5).Month + "-" + DateTime.DaysInMonth(startDate.AddMonths(5).Year, startDate.AddMonths(5).Month));
                        break;
                    }
                }
                //如果开始日期是大于本月
                else
                {
                    //设置开始日期为每月 1 号
                    startDate = Convert.ToDateTime(startDate.Year + "-" + startDate.Month + "-01");

                    switch (type)
                    {
                    case "1":
                        //单价 = 当月剩余天数比率 * 每月价格
                        onePrice = packageModel.MonthPrice;
                        endTime  = Convert.ToDateTime(startDate.Year + "-" + startDate.Month + "-" + DateTime.DaysInMonth(startDate.Year, startDate.Month));
                        break;

                    case "2":
                        //单价 = 当月剩余天数比率 * 每月价格 + 其它两月的价格
                        onePrice = packageModel.QuarterPrice;
                        endTime  = Convert.ToDateTime(startDate.AddMonths(2).Year + "-" + startDate.AddMonths(2).Month + "-" + DateTime.DaysInMonth(startDate.AddMonths(2).Year, startDate.AddMonths(2).Month));
                        break;

                    default:
                        //单价 = 当月剩余天数比率 * 每月价格 + 其它五月的价格
                        onePrice = packageModel.HalfYearPrice;
                        endTime  = Convert.ToDateTime(startDate.AddMonths(5).Year + "-" + startDate.AddMonths(5).Month + "-" + DateTime.DaysInMonth(startDate.AddMonths(5).Year, startDate.AddMonths(5).Month));
                        break;
                    }
                }

                if (p == "cg")
                {
                    if (buyCount == 0 || string.IsNullOrEmpty(companyId) || packageId == 0 || type == "" || string.IsNullOrEmpty(p))
                    {
                        context.Response.Write("error");
                        return;
                    }

                    //获得支付总金额
                    decimal sumPrice = onePrice * buyCount;
                    EyouSoft.Model.TicketStructure.TicketFreightBuyLog model = new EyouSoft.Model.TicketStructure.TicketFreightBuyLog();
                    model.BuyCount  = buyCount;
                    model.BuyTime   = DateTime.Now;
                    model.CompanyId = companyId;
                    model.EndMonth  = endTime;
                    model.FlightId  = packageModel.FlightId;

                    EyouSoft.Model.TicketStructure.TicketFlightCompany flightCompanyModel = EyouSoft.BLL.TicketStructure.TicketFlightCompany.CreateInstance().GetTicketFlightCompany(packageModel.FlightId);

                    if (flightCompanyModel != null)
                    {
                        model.FlightName = flightCompanyModel.AirportName;
                    }

                    if (string.IsNullOrEmpty(model.FlightName))
                    {
                        model.FlightName = string.Empty;
                    }

                    model.OperatorId = companyModel.ID;
                    model.PackageId  = packageId;

                    EyouSoft.Model.TicketStructure.TicketFreightPackageInfo ticketFreightModel = EyouSoft.BLL.TicketStructure.FreightPackageInfo.CreateInstance().GetModel(packageId);

                    if (ticketFreightModel != null)
                    {
                        model.PackageName = ticketFreightModel.PackageName;
                    }
                    model.PackageType = EyouSoft.Model.TicketStructure.PackageTypes.常规;

                    model.PayState   = false;
                    model.RateType   = EyouSoft.Model.TicketStructure.RateType.团队散拼;
                    model.StartMonth = Convert.ToDateTime(startMonth);
                    model.SumPrice   = Utils.GetDecimal((sumPrice * 100).ToString("0")) / 100;

                    bool result = EyouSoft.BLL.TicketStructure.FreightBuyLog.CreateInstance().Add(model);
                    if (result)
                    {
                        context.Response.Write(model.Id);
                    }
                    else
                    {
                        context.Response.Write("error");
                    }
                }

                if (p == "cs")
                {
                    if (string.IsNullOrEmpty(companyId) || startMonth == null || packageId == 0 || type == "" || string.IsNullOrEmpty(p))
                    {
                        context.Response.Write("error");
                        return;
                    }

                    //获得支付总金额
                    decimal sumPrice = onePrice;
                    EyouSoft.Model.TicketStructure.TicketFreightBuyLog model = new EyouSoft.Model.TicketStructure.TicketFreightBuyLog();
                    model.BuyCount  = buyCount;
                    model.BuyTime   = DateTime.Now;
                    model.CompanyId = companyId;
                    model.EndMonth  = endTime;
                    model.FlightId  = packageModel.FlightId;
                    if (EyouSoft.BLL.TicketStructure.TicketFlightCompany.CreateInstance().GetTicketFlightCompany(packageModel.FlightId) != null)
                    {
                        model.FlightName = EyouSoft.BLL.TicketStructure.TicketFlightCompany.CreateInstance().GetTicketFlightCompany(packageModel.FlightId).AirportName;
                    }
                    model.OperatorId  = companyModel.ID;
                    model.PackageId   = packageId;
                    model.PackageName = EyouSoft.BLL.TicketStructure.FreightPackageInfo.CreateInstance().GetModel(packageId).PackageName;
                    if (packageType == "2")
                    {
                        model.PackageType = EyouSoft.Model.TicketStructure.PackageTypes.套餐;
                    }
                    else
                    {
                        model.PackageType = EyouSoft.Model.TicketStructure.PackageTypes.促销;
                    }
                    model.PayState      = false;
                    model.RateType      = EyouSoft.Model.TicketStructure.RateType.团队散拼;
                    model.StartMonth    = Convert.ToDateTime(startMonth);
                    model.SumPrice      = Utils.GetDecimal((sumPrice * 100).ToString("0")) / 100;
                    model.HomeCityId    = packageModel.HomeCityId;
                    model.HomeCityName  = GetCityNameById(packageModel.HomeCityId.ToString());
                    model.DestCityIds   = packageModel.DestCityIds;
                    model.DestCityNames = GetCityNameById(packageModel.DestCityIds).Replace('、', ',');

                    bool result = EyouSoft.BLL.TicketStructure.FreightBuyLog.CreateInstance().Add(model);
                    if (result)
                    {
                        context.Response.Write(model.Id);
                    }
                    else
                    {
                        context.Response.Write("error");
                    }
                }
            }
        }
Ejemplo n.º 6
0
 /// <summary>
 /// 购买运价航线记录
 /// </summary>
 /// <param name="model">运价套餐购买记录实体</param>
 /// <returns>true:成功 false:失败</returns>
 public bool Add(EyouSoft.Model.TicketStructure.TicketFreightBuyLog model)
 {
     return(idal.Add(model));
 }
Ejemplo n.º 7
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);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 分页获取套餐购买记录
        /// </summary>
        /// <param name="pageSize">每页显示条数</param>
        /// <param name="pageIndex">当前页码</param>
        /// <param name="recordCount">总记录数</param>
        /// <param name="CompanyId">供应商编号 =""返回全部</param>
        /// <param name="PackageType">套餐类型 =null返回全部</param>
        /// <param name="RateType">业务类型 =null返回全部</param>
        /// <param name="FlightId">航空公司编号 =0返回全部</param>
        /// <param name="HomeCityId">起始地编号 =0返回全部</param>
        /// <param name="DestCityId">目的地编号 =0返回全部</param>
        /// <param name="StartMonth">开始时间 =null返回全部</param>
        /// <param name="EndMonth">结束时间 =null返回全部</param>
        /// <param name="PayState">支付状态 =null返回全部</param>
        /// <returns>套餐购买记录列表</returns>
        public virtual IList <EyouSoft.Model.TicketStructure.TicketFreightBuyLog> GetList(int pageSize, int pageIndex, ref int recordCount, string CompanyId, EyouSoft.Model.TicketStructure.PackageTypes?PackageType, EyouSoft.Model.TicketStructure.RateType?RateType, int FlightId, int HomeCityId, int DestCityId, DateTime?StartMonth, DateTime?EndMonth, bool?PayState)
        {
            IList <EyouSoft.Model.TicketStructure.TicketFreightBuyLog> list = new  List <EyouSoft.Model.TicketStructure.TicketFreightBuyLog>();

            #region 查询参数变量
            StringBuilder strWhere      = new StringBuilder(" 1=1 ");
            string        tableName     = "tbl_TicketFreightBuyLog";
            string        fields        = "[Id],[OrderNo],[CompanyId],[OperatorId],[PackageId],[PackageName],[PackageType],[RateType],[FlightId],[FlightName],[HomeCityId],[HomeCityName],[DestCityIds],[DestCityNames],[BuyCount],[AvailableCount],[StartMonth],[EndMonth],[BuyTime],[SumPrice],[PayState],[PayTime]";
            string        primaryKey    = "Id";
            string        orderByString = " BuyTime Desc ";
            if (!string.IsNullOrEmpty(CompanyId))
            {
                strWhere.AppendFormat(" and CompanyId='{0}' ", CompanyId);
            }
            //套餐类型
            if (PackageType.HasValue)
            {
                strWhere.AppendFormat(" and PackageType={0} ", (int)PackageType.Value);
            }
            //业务类型
            if (RateType.HasValue)
            {
                strWhere.AppendFormat(" and RateType={0} ", (int)RateType.Value);
            }
            //航空公司编号
            if (FlightId > 0)
            {
                strWhere.AppendFormat(" and FlightId={0} ", FlightId);
            }
            //起始地编号
            if (HomeCityId > 0)
            {
                strWhere.AppendFormat(" and charindex('{0}',HomeCityId)>0 ", HomeCityId);
            }
            //开始时间
            if (StartMonth.HasValue)
            {
                strWhere.AppendFormat(" and datediff(dd,'{0}',StartMonth)>-1 ", StartMonth.Value.ToString());
            }
            //结束时间
            if (EndMonth.HasValue)
            {
                strWhere.AppendFormat(" and datediff(dd,EndMonth,'{0}')>-1 ", EndMonth.Value.ToString());
            }
            //支付状态
            if (PayState.HasValue)
            {
                strWhere.AppendFormat(" and PayState='{0}' ", PayState.Value ? "1" : "0");
            }
            #endregion

            #region 列表赋值
            using (IDataReader dr = DbHelper.ExecuteReader(this._database, pageSize, pageIndex, ref recordCount, tableName, primaryKey, fields, strWhere.ToString(), orderByString))
            {
                while (dr.Read())
                {
                    EyouSoft.Model.TicketStructure.TicketFreightBuyLog model = new EyouSoft.Model.TicketStructure.TicketFreightBuyLog();
                    model.Id          = dr.IsDBNull(0) ? string.Empty : dr[0].ToString();
                    model.OrderNo     = dr.IsDBNull(1) ? string.Empty : dr[1].ToString();
                    model.OperatorId  = dr.IsDBNull(2) ? string.Empty : dr[2].ToString();
                    model.PackageId   = dr.IsDBNull(3) ? 0 : int.Parse(dr.GetByte(3).ToString());
                    model.PackageName = dr[4].ToString();
                    if (!dr.IsDBNull(5))
                    {
                        model.PackageType = (EyouSoft.Model.TicketStructure.PackageTypes) int.Parse(dr.GetByte(5).ToString());
                    }
                    if (!dr.IsDBNull(6))
                    {
                        model.RateType = (EyouSoft.Model.TicketStructure.RateType) int.Parse(dr.GetByte(6).ToString());
                    }
                    model.FlightId       = dr.GetInt32(7);
                    model.FlightName     = dr.IsDBNull(8) ? string.Empty : dr[8].ToString();
                    model.HomeCityId     = dr.GetInt32(9);
                    model.HomeCityName   = dr[10].ToString();
                    model.DestCityIds    = dr[11].ToString();
                    model.DestCityNames  = dr[12].ToString();
                    model.BuyCount       = dr.GetInt32(13);
                    model.AvailableCount = dr.GetInt32(14);
                    model.StartMonth     = dr.IsDBNull(15) ? DateTime.MinValue : dr.GetDateTime(15);
                    model.EndMonth       = dr.IsDBNull(16) ? DateTime.MinValue : dr.GetDateTime(16);
                    model.BuyTime        = dr.IsDBNull(17) ? DateTime.MinValue : dr.GetDateTime(17);
                    model.SumPrice       = dr.IsDBNull(18) ? 0 : dr.GetDecimal(18);
                    model.PayState       = dr[19].ToString() == "1" ? true : false;
                    model.PayTime        = dr.IsDBNull(20) ? DateTime.MinValue : dr.GetDateTime(20);
                    list.Add(model);
                    model = null;
                }
            }
            #endregion
            return(list);
        }