/// <summary> /// 获取机场信息集合 /// </summary> /// <param name="InputString">输入的字符串</param> /// <param name="SeattleId">与运价关联的始发地编号</param> /// <param name="IsFreight">是否与运价关联</param> /// <returns>返回符合条件的机场信息集合</returns> public virtual IList <EyouSoft.Model.TicketStructure.TicketSeattle> GetList(string InputString, int SeattleId, bool IsFreight) { IList <EyouSoft.Model.TicketStructure.TicketSeattle> ResultList = new List <EyouSoft.Model.TicketStructure.TicketSeattle>(); string StrSql = " SELECT [SeattleId],[LKE],[LongName],[Seattle],[ShortName],[IsHot] FROM tbl_TicketSeattle "; DbCommand dc = base.TourStore.GetSqlStringCommand(StrSql);; if (!string.IsNullOrEmpty(InputString)) { StrSql += " WHERE [Seattle] LIKE @Seattle "; InputString = "%" + InputString + "%"; dc = base.TourStore.GetSqlStringCommand(StrSql); base.TicketStore.AddInParameter(dc, "Seattle", DbType.String, InputString); } else if (IsFreight) { StrSql += " WHERE 1=1 "; if (SeattleId == 0) { StrSql += " AND SeattleId IN (SELECT NoGadHomeCityId from dbo.tbl_TicketFreightInfo WHERE IsEnabled=1)"; dc = base.TicketStore.GetSqlStringCommand(StrSql); } else { StrSql += " AND SeattleId IN (SELECT NoGadDestCityId from dbo.tbl_TicketFreightInfo WHERE NoGadHomeCityId = @SeattleId AND IsEnabled=1)"; dc = base.TicketStore.GetSqlStringCommand(StrSql); base.TicketStore.AddInParameter(dc, "SeattleId", DbType.Int32, SeattleId); } } using (IDataReader dr = DbHelper.ExecuteReader(dc, base.TicketStore)) { EyouSoft.Model.TicketStructure.TicketSeattle model = null; while (dr.Read()) { model = new EyouSoft.Model.TicketStructure.TicketSeattle(); model.SeattleId = dr.GetInt32(dr.GetOrdinal("SeattleId")); model.LKE = dr.IsDBNull(dr.GetOrdinal("LKE")) ? string.Empty : dr.GetString(dr.GetOrdinal("LKE")); model.LongName = dr.IsDBNull(dr.GetOrdinal("LongName")) ? string.Empty : dr.GetString(dr.GetOrdinal("LongName")); model.Seattle = dr.IsDBNull(dr.GetOrdinal("Seattle")) ? string.Empty : dr.GetString(dr.GetOrdinal("Seattle")); model.ShortName = dr.IsDBNull(dr.GetOrdinal("ShortName")) ? string.Empty : dr.GetString(dr.GetOrdinal("ShortName")); model.IsHot = dr.GetString(dr.GetOrdinal("IsHot")) != "1" ? false : true; ResultList.Add(model); } model = null; } return(ResultList); }
/// <summary> /// /// </summary> /// <param name="id"></param> /// <returns></returns> protected string GetCityNameById(string id) { string str = ""; string[] list = id.Split(','); EyouSoft.IBLL.TicketStructure.ITicketSeattle cityIbll = EyouSoft.BLL.TicketStructure.TicketSeattle.CreateInstance(); if (list.Length > 0) { for (int i = 0; i < list.Length; i++) { EyouSoft.Model.TicketStructure.TicketSeattle model = cityIbll.GetTicketSeattleById(Convert.ToInt32(list[i])); if (model != null) { str += model.Seattle + "、"; } } } str = str.TrimEnd('、'); return(str); }
/// <summary> /// 获取机场信息实体 /// </summary> /// <param name="SeattleId">机场信息Id</param> /// <returns></returns> public virtual EyouSoft.Model.TicketStructure.TicketSeattle GetModel(int SeattleId) { string StrSql = " SELECT [SeattleId],[LKE],[LongName],[Seattle],[ShortName],[IsHot] FROM tbl_TicketSeattle WHERE [SeattleId]=@SeattleId "; DbCommand dc = null; dc = base.TourStore.GetSqlStringCommand(StrSql); base.TicketStore.AddInParameter(dc, "SeattleId", DbType.Int32, SeattleId); EyouSoft.Model.TicketStructure.TicketSeattle model = null; using (IDataReader dr = DbHelper.ExecuteReader(dc, base.TicketStore)) { while (dr.Read()) { model = new EyouSoft.Model.TicketStructure.TicketSeattle(); model.SeattleId = dr.GetInt32(dr.GetOrdinal("SeattleId")); model.LKE = dr.IsDBNull(dr.GetOrdinal("LKE")) ? string.Empty : dr.GetString(dr.GetOrdinal("LKE")); model.LongName = dr.IsDBNull(dr.GetOrdinal("LongName")) ? string.Empty : dr.GetString(dr.GetOrdinal("LongName")); model.Seattle = dr.IsDBNull(dr.GetOrdinal("Seattle")) ? string.Empty : dr.GetString(dr.GetOrdinal("Seattle")); model.ShortName = dr.IsDBNull(dr.GetOrdinal("ShortName")) ? string.Empty : dr.GetString(dr.GetOrdinal("ShortName")); model.IsHot = dr.GetString(dr.GetOrdinal("IsHot")) != "1" ? false : true; } } return(model); }
/// <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); }
/// <summary> /// 添加或修改运价信息 /// </summary> /// <param name="type">操作类型</param> /// <param name="InfoId">修改的运价ID</param> /// <returns></returns> protected string AddOrUpdateFreight(string type, string InfoId) { EyouSoft.IBLL.TicketStructure.ITicketFreightInfo IBll = EyouSoft.BLL.TicketStructure.TicketFreightInfo.CreateInstance(); #region 获得表单数据 //运价类型 string rdoSingle = Utils.GetFormValue("ctl00$ContentPlaceHolder1$freightType"); //产品类型 string rdoInteger = Utils.GetFormValue("ctl00$ContentPlaceHolder1$proType"); //航空公司ID string companyId = Utils.GetFormValue(this.fre_AirCompanyList.UniqueID); //航空公司名称 string companyName = ""; if (!string.IsNullOrEmpty(companyId.Trim())) { if (EyouSoft.BLL.TicketStructure.TicketFlightCompany.CreateInstance().GetTicketFlightCompany(Convert.ToInt32(companyId)) != null) { companyName = EyouSoft.BLL.TicketStructure.TicketFlightCompany.CreateInstance().GetTicketFlightCompany(Convert.ToInt32(companyId)).AirportName; } } //起始地Id int StartId = Utils.GetInt(Utils.GetFormValue(this.fre_StartDdl.UniqueID), 0); //起始地名称 string startCityName = ""; EyouSoft.Model.TicketStructure.TicketSeattle StartCityModel = EyouSoft.BLL.TicketStructure.TicketSeattle.CreateInstance().GetTicketSeattleById(StartId); if (StartCityModel != null) { startCityName = StartCityModel.Seattle; } //是否启用运价 string riceEnable = Utils.GetFormValue("ctl00$ContentPlaceHolder1$fre_Price"); //是否需要更换PNR string PnrYes = Utils.GetFormValue("ctl00$ContentPlaceHolder1$fre_pnr"); //运价开始日 DateTime?PriceBeginTime = Utils.GetDateTimeNullable(Utils.GetFormValue(this.fre_txtPriceBegin.UniqueID)); //运价结束日 DateTime?PriceEndTime = Utils.GetDateTimeNullable(Utils.GetFormValue(this.fre_OfferEnd.UniqueID)); //去程适用 string fromForDay = Utils.GetFormValue(this.fre_FromForDay.UniqueID).TrimEnd(','); //去程独立日期 DateTime?indeDateTo = Utils.GetDateTimeNullable(Utils.GetFormValue(this.fre_txtIndeDate.UniqueID)); //去程参考面价 decimal refePriceTo = Utils.GetDecimal(Utils.GetFormValue(this.fre_txtRefePrice.UniqueID)); //去程参考扣率 decimal deductionTo = Utils.GetDecimal(Utils.GetFormValue(this.fre_txtDeduction.UniqueID)); //去程燃油费 decimal fuelPriceTo = Utils.GetDecimal(Utils.GetFormValue(this.fre_txtFuelPrice.UniqueID), -1); //机建费 decimal machPriceTo = Utils.GetDecimal(Utils.GetFormValue(this.fre_txtMachPrice.UniqueID), -1); //回程适用 string toForDay = Utils.GetFormValue(this.fre_hideToForDay.UniqueID).TrimEnd(','); //回程独立日期 DateTime?toSelfDate = Utils.GetDateTimeNullable(Utils.GetFormValue(this.fre_txtIndeDateBack.UniqueID)); //回程参考面价 decimal toReferPrice = Utils.GetDecimal(Utils.GetFormValue(this.fre_txtRefePriceBack.UniqueID)); //回程参考扣率 decimal toReferRate = Utils.GetDecimal(Utils.GetFormValue(this.fre_txtDeductionBack.UniqueID)); //回程燃油费 decimal toFuelPrice = Utils.GetDecimal(Utils.GetFormValue(this.fre_txtFuelPriceBack.UniqueID), -1); //回程机建费 decimal toBuildPrice = Utils.GetDecimal(Utils.GetFormValue(this.fre_txtMachPriceBack.UniqueID), -1); //人数上限 int peopleCount = Utils.GetInt(Utils.GetFormValue(this.fre_txtPeopleCount.UniqueID)); //上班时间 string toWorkDate = Utils.GetFormValue(this.fre_txtToWork.UniqueID); //下班时间 string backHomeDate = Utils.GetFormValue(this.fre_txtBackHome.UniqueID); //备注 string remark = Utils.GetFormValue(this.fre_txtRemark.UniqueID, 250); #endregion #region 数据验证 if (PriceBeginTime == null || PriceEndTime == null) { if (String.IsNullOrEmpty(fromForDay) && indeDateTo == null) { return("请选择一个去程日期"); } } if (refePriceTo == 0) { return("请正确输入去程参考面价!"); } if (deductionTo == 0) { return("请正确输入去程参考扣率!"); } if (deductionTo >= 100 || deductionTo <= 0) { return("去程参考扣率必须在0-100之间!"); } if (fuelPriceTo < 0) { return("请输入去程燃油费!"); } if (machPriceTo < 0) { return("请输入去程机建费!"); } if (rdoSingle != "1") { if (PriceBeginTime == null || PriceEndTime == null) { if (String.IsNullOrEmpty(toForDay) && toSelfDate == null) { return("请选择一个回程日期"); } } if (toReferPrice == 0) { return("请正确输入回程参考面价!"); } if (toReferRate == 0) { return("请正确输入回程参考扣率!"); } if (toReferRate >= 100 || toReferRate <= 0) { return("回程参考扣率必须在0-100之间!"); } if (toFuelPrice < 0) { return("请输入回程燃油费!"); } if (toBuildPrice < 0) { return("请输入回程机建费!"); } } #endregion int count = EyouSoft.BLL.TicketStructure.FreightBuyLog.CreateInstance().GetAvailableCount(SiteUserInfo.CompanyID, EyouSoft.Model.TicketStructure.RateType.团队散拼); #region 添加新的运价 if (type == "Add") { string hideToLb = Utils.GetFormValue(this.fre_hideToLb.UniqueID); if (String.IsNullOrEmpty(hideToLb)) { return("请选择至少一个目的地"); } string[] toList = hideToLb.TrimEnd(',').Split(','); //如果新增运价 状态是关闭的 那么不算入启用数 if (riceEnable == "1") { if (toList.Length > count) { //判断添加条数是否大于启用数 return("Count"); } } if (toList.Length > 0) { IList <EyouSoft.Model.TicketStructure.TicketFreightInfo> list = new List <EyouSoft.Model.TicketStructure.TicketFreightInfo>(); for (int i = 0; i < toList.Length; i++) { string cityId = toList[i].Split('|')[0]; string cityName = toList[i].Split('|')[1].Split('-')[1]; EyouSoft.Model.TicketStructure.TicketFreightInfo model = new EyouSoft.Model.TicketStructure.TicketFreightInfo(); model.Company.ID = SiteUserInfo.CompanyID; model.Company.CompanyName = SiteUserInfo.CompanyName; model.OperatorId = SiteUserInfo.ID; if (rdoSingle == "1") { model.FreightType = EyouSoft.Model.TicketStructure.FreightType.单程; } else { model.FreightType = EyouSoft.Model.TicketStructure.FreightType.来回程; } if (rdoInteger == "1") { model.ProductType = EyouSoft.Model.TicketStructure.ProductType.整团; } else { model.ProductType = EyouSoft.Model.TicketStructure.ProductType.散拼; } model.FlightId = Convert.ToInt32(companyId); model.FlightName = companyName; model.NoGadHomeCityId = Convert.ToInt32(StartId); model.NoGadHomeCityIdName = startCityName; model.NoGadDestCityId = Convert.ToInt32(cityId); model.NoGadDestCityName = cityName; if (riceEnable == "1") { model.IsEnabled = true; } else if (riceEnable == "0") { model.IsEnabled = false; } else if (riceEnable == "2") { model.IsEnabled = false; model.IsExpired = true; } if (PnrYes == "1") { model.IsCheckPNR = true; } else { model.IsCheckPNR = false; } model.FreightStartDate = PriceBeginTime; model.FreightEndDate = PriceEndTime; //去程开始 model.FromForDay = fromForDay; model.FromSelfDate = indeDateTo; model.FromReferPrice = Convert.ToDecimal(refePriceTo.ToString("0.00")); model.FromReferRate = Convert.ToDecimal(deductionTo.ToString("0.00")); //计算去程结算价格 model.FromSetPrice = Convert.ToDecimal((model.FromReferPrice * (1 - model.FromReferRate / 100)).ToString("0.00")); model.FromFuelPrice = Convert.ToDecimal(fuelPriceTo.ToString("0.00")); model.FromBuildPrice = Convert.ToDecimal(machPriceTo.ToString("0.00")); //回程开始 if (rdoSingle == "0") { model.ToForDay = toForDay; model.ToSelfDate = toSelfDate; model.ToReferPrice = toReferPrice; model.ToReferRate = toReferRate; //计算回程结算价格 model.ToSetPrice = Convert.ToDecimal((toReferPrice * (1 - model.ToReferRate / 100)).ToString("0.00")); model.ToFuelPrice = toFuelPrice; model.ToBuildPrice = toBuildPrice; } model.MaxPCount = peopleCount; model.WorkStartTime = toWorkDate; model.WorkEndTime = backHomeDate; model.SupplierRemark = remark; //添加运价日期 model.IssueTime = DateTime.Now; //最后修改日期 model.LastUpdateDate = DateTime.Now; model.RateType = EyouSoft.Model.TicketStructure.RateType.团队散拼; model.BuyType = EyouSoft.Model.TicketStructure.PackageTypes.常规; //添加到集合 list.Add(model); } bool result = IBll.Add(list); if (result) { return("AddOk"); } } } #endregion #region 修改原来运价 if (type == "Update") { string id = Utils.GetFormValue(this.fre_hideId.UniqueID); EyouSoft.Model.TicketStructure.TicketFreightInfo model = EyouSoft.BLL.TicketStructure.TicketFreightInfo.CreateInstance().GetModel(id); if (model != null) { ////如果新增运价 状态是关闭的 那么不算入启用数 //bool isGq = true; //if (riceEnable == "1" && model.IsEnabled == false) //{ // if (1 > count && Convert.ToInt32(model.BuyType) == 1) // { // //判断添加条数是否大于启用数 // return "Count"; // } // else // { // //是否过期 // if (model.FreightBuyId.Trim() != "") // { // isGq = EyouSoft.BLL.TicketStructure.FreightBuyLog.CreateInstance().SetAvailableByFreightState(model.FreightBuyId, true); // } // } //} //else //{ // if (model.FreightBuyId.Trim() != "") // { // isGq = EyouSoft.BLL.TicketStructure.FreightBuyLog.CreateInstance().SetAvailableByFreightState(model.FreightBuyId, false); // } //} //if (!isGq) //{ // return "该运价已过期!"; //} if (rdoSingle == "1") { model.FreightType = EyouSoft.Model.TicketStructure.FreightType.单程; } else { model.FreightType = EyouSoft.Model.TicketStructure.FreightType.来回程; } if (rdoInteger == "1") { model.ProductType = EyouSoft.Model.TicketStructure.ProductType.整团; } else { model.ProductType = EyouSoft.Model.TicketStructure.ProductType.散拼; } if (Convert.ToInt32(model.BuyType) == 1) { model.FlightId = Convert.ToInt32(companyId); model.FlightName = companyName; model.NoGadHomeCityId = Convert.ToInt32(StartId); model.NoGadHomeCityIdName = startCityName; model.NoGadDestCityId = Utils.GetInt(Utils.GetFormValue(this.fre_ToLbByUpdate.UniqueID)); //获得城市名称 EyouSoft.Model.TicketStructure.TicketSeattle DestCityModel = EyouSoft.BLL.TicketStructure.TicketSeattle.CreateInstance().GetTicketSeattleById(model.NoGadDestCityId); if (DestCityModel != null) { model.NoGadDestCityName = DestCityModel.Seattle; } } if (riceEnable == "1") { model.IsEnabled = true; } else if (riceEnable == "0") { model.IsEnabled = false; } else if (riceEnable == "2") { model.IsEnabled = false; model.IsExpired = true; } if (PnrYes == "1") { model.IsCheckPNR = true; } else { model.IsCheckPNR = false; } model.FreightStartDate = PriceBeginTime; model.FreightEndDate = PriceEndTime; //去程开始 model.FromForDay = fromForDay; model.FromSelfDate = indeDateTo; model.FromReferPrice = refePriceTo; model.FromReferRate = deductionTo; //扣率价格 decimal fromRatePrice = Convert.ToDecimal((model.FromReferPrice * model.FromReferRate / 100).ToString("0.00")); if (fromRatePrice < 0.01M) { fromRatePrice = 0; } //计算去程结算价格 model.FromSetPrice = Convert.ToDecimal((model.FromReferPrice - fromRatePrice).ToString("0.00")); model.FromFuelPrice = fuelPriceTo; model.FromBuildPrice = machPriceTo; //回程开始 if (rdoSingle == "0") { model.ToForDay = toForDay; model.ToSelfDate = toSelfDate; model.ToReferPrice = toReferPrice; model.ToReferRate = toReferRate; //扣率价格 decimal toRatePrice = Convert.ToDecimal((toReferPrice * toReferRate / 100).ToString("0.00")); if (toRatePrice < 0.01M) { toRatePrice = 0; } //计算回程结算价格 model.ToSetPrice = Convert.ToDecimal((toReferPrice - toRatePrice).ToString("0.00")); model.ToFuelPrice = toFuelPrice; model.ToBuildPrice = toBuildPrice; } model.MaxPCount = peopleCount; model.WorkStartTime = toWorkDate; model.WorkEndTime = backHomeDate; model.SupplierRemark = remark; //最后修改日期 model.LastUpdateDate = DateTime.Now; bool result = EyouSoft.BLL.TicketStructure.TicketFreightInfo.CreateInstance().Update(model); if (result) { return("UpdateOk"); } } } #endregion return("error"); }