/// <summary> /// 添加运价信息 /// </summary> /// <param name="model">运价信息实体</param> /// <returns>返回1:添加成功</returns> public virtual int AddFreightInfo(EyouSoft.Model.TicketStructure.TicketFreightInfo model) { if (model == null) { return(0); } model.Id = Guid.NewGuid().ToString(); StringBuilder strSql = new StringBuilder(); strSql.Append(Sql_FreightInfo_Insert); if (model.FreightType == EyouSoft.Model.TicketStructure.FreightType.单程) { strSql.AppendFormat(Sql_TicketFreightAddition_Insert, 0, model.FromSelfDate.HasValue ? "'" + model.FromSelfDate.Value.ToString("yyyy-MM-dd hh:mm:ss") + "'" : "null", model.FromForDay, model.FromReferPrice, model.FromReferRate, model.FromSetPrice, model.FromFuelPrice, model.FromBuildPrice); } else if (model.FreightType == EyouSoft.Model.TicketStructure.FreightType.来回程) { strSql.AppendFormat(Sql_TicketFreightAddition_Insert, 0, model.FromSelfDate.HasValue ? "'" + model.FromSelfDate.Value.ToString("yyyy-MM-dd hh:mm:ss") + "'" : "null", model.FromForDay, model.FromReferPrice, model.FromReferRate, model.FromSetPrice, model.FromFuelPrice, model.FromBuildPrice); strSql.AppendFormat(Sql_TicketFreightAddition_Insert, 1, model.ToSelfDate.HasValue ? "'" + model.ToSelfDate.Value.ToString("yyyy-MM-dd hh:mm:ss") + "'" : "null", model.ToForDay, model.ToReferPrice, model.ToReferRate, model.ToSetPrice, model.ToFuelPrice, model.ToBuildPrice); } DbCommand dc = this._dataBase.GetSqlStringCommand(strSql.ToString()); #region 参数赋值 this._dataBase.AddInParameter(dc, "Id", DbType.AnsiStringFixedLength, model.Id); this._dataBase.AddInParameter(dc, "CompanyId", DbType.AnsiStringFixedLength, model.Company.ID); this._dataBase.AddInParameter(dc, "RateType", DbType.Byte, (int)model.RateType); this._dataBase.AddInParameter(dc, "FreightType", DbType.Byte, (int)model.FreightType); this._dataBase.AddInParameter(dc, "ProductType", DbType.Byte, (int)model.ProductType); this._dataBase.AddInParameter(dc, "BuyType", DbType.Byte, (int)model.BuyType); this._dataBase.AddInParameter(dc, "FlightId", DbType.Int32, model.FlightId); this._dataBase.AddInParameter(dc, "FlightName", DbType.String, model.FlightName); this._dataBase.AddInParameter(dc, "NoGadHomeCityId", DbType.Int32, model.NoGadHomeCityId); this._dataBase.AddInParameter(dc, "NoGadHomeCityIdName", DbType.String, model.NoGadHomeCityIdName); this._dataBase.AddInParameter(dc, "NoGadDestCityId", DbType.Int32, model.NoGadDestCityId); this._dataBase.AddInParameter(dc, "NoGadDestCityName", DbType.String, model.NoGadDestCityName); this._dataBase.AddInParameter(dc, "GadHomeCityId", DbType.Int32, model.GadHomeCityId); this._dataBase.AddInParameter(dc, "GadHomeCityName", DbType.String, model.GadHomeCityName); this._dataBase.AddInParameter(dc, "GadDestCityId", DbType.Int32, model.GadDestCityId); this._dataBase.AddInParameter(dc, "GadDestCityName", DbType.String, model.GadDestCityName); this._dataBase.AddInParameter(dc, "IsEnabled", DbType.AnsiStringFixedLength, model.IsEnabled ? "1" : "0"); this._dataBase.AddInParameter(dc, "IsCheckPNR", DbType.AnsiStringFixedLength, model.IsCheckPNR ? "1" : "0"); this._dataBase.AddInParameter(dc, "IsExpired", DbType.AnsiStringFixedLength, model.IsExpired ? "1" : "0"); this._dataBase.AddInParameter(dc, "FreightStartDate", DbType.DateTime, model.FreightStartDate); this._dataBase.AddInParameter(dc, "FreightEndDate", DbType.DateTime, model.FreightEndDate); this._dataBase.AddInParameter(dc, "MaxPCount", DbType.Int32, model.MaxPCount); this._dataBase.AddInParameter(dc, "WorkStartTime", DbType.String, model.WorkStartTime); this._dataBase.AddInParameter(dc, "WorkEndTime", DbType.String, model.WorkEndTime); this._dataBase.AddInParameter(dc, "SupplierRemark", DbType.String, model.SupplierRemark); this._dataBase.AddInParameter(dc, "LastUpdateDate", DbType.DateTime, model.LastUpdateDate); this._dataBase.AddInParameter(dc, "FreightBuyId", DbType.AnsiStringFixedLength, model.FreightBuyId); this._dataBase.AddInParameter(dc, "OperatorId", DbType.AnsiStringFixedLength, model.OperatorId); this._dataBase.AddInParameter(dc, "IssueTime", DbType.DateTime, DateTime.Now); #endregion return(DbHelper.ExecuteSql(dc, this._dataBase) > 0 ? 1 : 0); }
/// <summary> /// 计算回程程运价有效期 /// </summary> /// <param name="info"></param> /// <returns></returns> protected string GetBackDate(EyouSoft.Model.TicketStructure.TicketFreightInfo info) { if (info.ToSelfDate.HasValue) { return(info.ToSelfDate.Value.ToString("yyyy-MM-dd")); } else if (info.ToForDay != string.Empty) { return(info.ToForDay); } else { string thedate = ""; if (info.FreightStartDate.HasValue) { thedate = info.FreightStartDate.Value.ToString("yyyy-MM-dd"); } if (info.FreightEndDate.HasValue) { thedate += "至" + info.FreightEndDate.Value.ToString("yyyy-MM-dd"); } if (thedate == "") { thedate = "无有效期"; } return(thedate); } }
public void ProcessRequest(HttpContext context) { string id = context.Request.QueryString["id"]; string state = context.Request.QueryString["state"]; string companyId = context.Request.QueryString["cid"]; string buyId = context.Request.QueryString["BuyId"]; if (id != null) { bool isEnabled = false; //是否过期 bool isGq = false; if (state != null && companyId != null && companyId.ToString() != "") { int count = EyouSoft.BLL.TicketStructure.FreightBuyLog.CreateInstance().GetAvailableCount(companyId, EyouSoft.Model.TicketStructure.RateType.团队散拼); EyouSoft.Model.TicketStructure.TicketFreightInfo model = EyouSoft.BLL.TicketStructure.TicketFreightInfo.CreateInstance().GetModel(id); if (state == "1") { isEnabled = true; if (1 > count && model != null && Convert.ToInt32(model.BuyType) == 1) { context.Response.Write("当月无可用运价数!"); return; } isGq = EyouSoft.BLL.TicketStructure.TicketFreightInfo.CreateInstance().SetIsEnabled(model.Id, isEnabled); } else { isGq = EyouSoft.BLL.TicketStructure.TicketFreightInfo.CreateInstance().SetIsEnabled(model.Id, isEnabled); } } else { context.Response.Write("ERROR"); return; } if (!isGq) { context.Response.Write("该运价已过期,不能启用!"); return; } bool result = EyouSoft.BLL.TicketStructure.TicketFreightInfo.CreateInstance().SetIsEnabled(id, isEnabled); if (result) { context.Response.Write("OK"); } else { context.Response.Write("ERROR"); } } }
/// <summary> /// 批量添加运价信息 /// </summary> /// <param name="FreightInfoList">运价信息实体集合</param> /// <returns>返回1:添加成功</returns> public bool Add(IList <Model.TicketStructure.TicketFreightInfo> FreightInfoList) { bool IsResult = false; if (FreightInfoList != null && FreightInfoList.Count > 0) { EyouSoft.Model.TicketStructure.TicketFreightInfo tmpModel = (Model.TicketStructure.TicketFreightInfo)FreightInfoList[0]; IList <EyouSoft.Model.TicketStructure.AvailablePackInfo> list = iBuyDal.GetAvailableInfo(DateTime.Now, tmpModel.Company.ID, tmpModel.RateType, tmpModel.NoGadHomeCityId).Where(item => (item.PackType == EyouSoft.Model.TicketStructure.PackageTypes.常规)).ToList(); tmpModel = null; if (list != null && list.Count > 0) { IList <EyouSoft.Model.TicketStructure.AvailablePackInfo> list1 = new List <EyouSoft.Model.TicketStructure.AvailablePackInfo>(); int count = 0; foreach (EyouSoft.Model.TicketStructure.AvailablePackInfo AvailModel in list) { int AvailableNum = 0; for (int i = count; i < FreightInfoList.Count; i++) { if (AvailableNum < AvailModel.AvailableNum) { EyouSoft.Model.TicketStructure.TicketFreightInfo FreightModel = FreightInfoList[i]; FreightModel.FreightBuyId = FreightModel.IsEnabled ? AvailModel.BuyId : string.Empty; if (FreightModel.IsEnabled) { AvailableNum++; } count++; } else { break; } } EyouSoft.Model.TicketStructure.AvailablePackInfo AvailModel1 = new EyouSoft.Model.TicketStructure.AvailablePackInfo(); AvailModel1.BuyId = AvailModel.BuyId; AvailModel1.AvailableNum = AvailableNum; AvailModel1.PackType = AvailModel.PackType; list1.Add(AvailModel1); AvailModel1 = null; } IsResult = idal.AddFreightInfo(FreightInfoList) > 0 ? true : false; if (IsResult) { IsResult = iBuyDal.SetAvailableNum(list1); } list1 = null; } list = null; } return(IsResult); }
/// <summary> /// 设置运价启用状态 /// </summary> /// <param name="FreightInfoId">运价ID</param> /// <param name="IsEnabled">是否启用</param> /// <returns>true:成功 false:失败</returns> public bool SetIsEnabled(string FreightInfoId, bool IsEnabled) { #region 注释掉的代码块 //if (string.IsNullOrEmpty(FreightInfoId)) // return false; //#region 购买记录变量 //IList<EyouSoft.Model.TicketStructure.AvailablePackInfo> AvailableList = new List<EyouSoft.Model.TicketStructure.AvailablePackInfo>();//设置购买记录集合列表 //EyouSoft.Model.TicketStructure.AvailablePackInfo AvaiModel1 = null; //#endregion //bool IsResult = false; //EyouSoft.Model.TicketStructure.TicketFreightInfo model = GetModel(FreightInfoId); //if (String.IsNullOrEmpty(model.FreightBuyId.Trim()) && IsEnabled) //{ // #region 可用的套餐购买集合 // IList<EyouSoft.Model.TicketStructure.AvailablePackInfo> list = iBuyDal.GetAvailableInfo(DateTime.Now, model.Company.ID, model.RateType, model.NoGadHomeCityId); // #endregion // if (AvailableList != null && AvailableList.Count > 0) // { // AvailModel = (EyouSoft.Model.TicketStructure.AvailablePackInfo)list[0]; // model.FreightBuyId = AvailModel.BuyId; // AvailableList = new List<EyouSoft.Model.TicketStructure.AvailablePackInfo>(); // EyouSoft.Model.TicketStructure.AvailablePackInfo AvaiModel1 = new EyouSoft.Model.TicketStructure.AvailablePackInfo(); // AvaiModel1.BuyId = AvailModel.BuyId; // AvaiModel1.PackType = AvailModel.PackType; // AvaiModel1.AvailableNum = 1; // AvailableList.Add(AvaiModel1); // AvaiModel1 = null; // AvailModel = null; // model.IsEnabled = IsEnabled; // list = null; // } // else // return false; //当前没有可用套餐 //} //else if (!IsEnabled && model.FreightBuyId.Trim().Length>0) //{ // AvaiModel1 = new EyouSoft.Model.TicketStructure.AvailablePackInfo(); // AvaiModel1.BuyId = model.FreightBuyId; // AvaiModel1.PackType = model.BuyType; // AvaiModel1.AvailableNum = -1;//注:[此处设置为-1在数据层处理为+1] // AvailableList.Add(AvaiModel1); // AvaiModel1 = null; // model.FreightBuyId = string.Empty; //} //IsResult = idal.SetIsEnabled(FreightInfoId, IsEnabled); //return IsResult; #endregion if (string.IsNullOrEmpty(FreightInfoId)) { return(false); } EyouSoft.Model.TicketStructure.TicketFreightInfo model = GetModel(FreightInfoId); if (model == null) { return(false); } model.IsEnabled = IsEnabled; return(Update(model)); }
/// <summary> /// 复制运价信息 /// </summary> /// <param name="FreightInfoId">运价ID</param> /// <returns>true:成功 false:失败</returns> public bool Copy(string FreightInfoId) { EyouSoft.Model.TicketStructure.TicketFreightInfo model = GetModel(FreightInfoId); return(Add(model)); }
protected EyouSoft.Model.TicketStructure.TicketWholesalersAllInfo supplierInfo; //供应商信息 protected void Page_Load(object sender, EventArgs e) { this.Master.Naviagtion = AirTicketNavigation.团队预定散拼; this.Title = "预定-组团预定/散拼-机票"; string method = Utils.GetFormValue("method"); //当前操作 if (method == "") //初次进来显示运价信息 { startDate = Utils.GetQueryStringValue("startDate"); backDate = Utils.GetQueryStringValue("backDate"); startCity = Utils.GetQueryStringValue("startCity"); toCity = Utils.GetQueryStringValue("toCity"); airType = Utils.GetQueryStringValue("airType"); peopleTypeInt = Utils.GetInt(Utils.GetQueryStringValue("peopleType")); peopleType = (EyouSoft.Model.TicketStructure.TravellerType)peopleTypeInt; id = Utils.GetQueryStringValue("id"); info = EyouSoft.BLL.TicketStructure.TicketFreightInfo.CreateInstance().GetModel(id);//获取运价信息实体 if (info != null) { freightDate = GetDate(info); freightDateBack = GetBackDate(info); startCityName = info.NoGadHomeCityIdName; toCityName = info.NoGadDestCityName; supplierInfo = EyouSoft.BLL.TicketStructure.TicketSupplierInfo.CreateInstance().GetSupplierInfo(info.Company.ID); //touristCount = info.MaxPCount; touristCount = 100; companyId = SiteUserInfo.CompanyID; } } if (method == "save") //下订单 { id = Utils.GetFormValue("id"); info = EyouSoft.BLL.TicketStructure.TicketFreightInfo.CreateInstance().GetModel(id); supplierInfo = EyouSoft.BLL.TicketStructure.TicketSupplierInfo.CreateInstance().GetSupplierInfo(info.Company.ID); string[] touristNames = Utils.GetFormValues("tb_tourName1"); string[] tourTypes = Utils.GetFormValues("tb_tourType1"); string[] tourSex = Utils.GetFormValues("tb_tourSex1"); string[] cerTypes = Utils.GetFormValues("tb_cerType1"); string[] cerNos = Utils.GetFormValues("tb_cerNo1"); int length = touristNames.Length; List <EyouSoft.Model.TicketStructure.TicketVistorInfo> visitorList = new List <EyouSoft.Model.TicketStructure.TicketVistorInfo>(); List <EyouSoft.Model.TicketStructure.OrderTravellerInfo> orderVisitorList = new List <EyouSoft.Model.TicketStructure.OrderTravellerInfo>(); int isTableNum = 0;//是否购买行程单的人数 EyouSoft.IBLL.TicketStructure.ITicketVisitor visitorBll = EyouSoft.BLL.TicketStructure.TicketVisitor.CreateInstance(); for (int i = 0; i < length; i++) { EyouSoft.Model.TicketStructure.TicketVistorInfo visitorInfo = new EyouSoft.Model.TicketStructure.TicketVistorInfo(); EyouSoft.Model.TicketStructure.OrderTravellerInfo orderVisitorInfo = new EyouSoft.Model.TicketStructure.OrderTravellerInfo(); //添加订单旅客 orderVisitorInfo.TravellerName = touristNames[i]; orderVisitorInfo.CertNo = cerNos[i]; orderVisitorInfo.TravellerId = Guid.NewGuid().ToString(); orderVisitorInfo.CertType = (EyouSoft.Model.TicketStructure.TicketCardType)Utils.GetInt(cerTypes[i]); orderVisitorInfo.Gender = (EyouSoft.Model.CompanyStructure.Sex)Utils.GetInt(tourSex[i]); orderVisitorInfo.InsPrice = 0; orderVisitorInfo.TravellerType = (EyouSoft.Model.TicketStructure.TicketVistorType)Utils.GetInt(tourTypes[i]); orderVisitorInfo.IsBuyIns = Utils.GetFormValue("tb_isInsure1_" + (i + 1)) == "1"; orderVisitorInfo.IsBuyItinerary = Utils.GetFormValue("tb_isTable1_" + (i + 1)) == "1"; if (orderVisitorInfo.IsBuyItinerary) { isTableNum++; } orderVisitorInfo.TravellerState = EyouSoft.Model.TicketStructure.TravellerState.正常; orderVisitorList.Add(orderVisitorInfo); if (Utils.GetFormValue("tb_isOften1_" + (i + 1)) == "1") { //添加常旅客 if (IsLetter(touristNames[i])) { visitorInfo.EnglishName = touristNames[i]; } else { visitorInfo.ChinaName = touristNames[i]; } visitorInfo.Id = orderVisitorInfo.TravellerId; visitorInfo.CardType = (EyouSoft.Model.TicketStructure.TicketCardType)Utils.GetInt(cerTypes[i]); visitorInfo.CardNo = cerNos[i]; visitorInfo.VistorType = (EyouSoft.Model.TicketStructure.TicketVistorType)Utils.GetInt(tourTypes[i]); visitorInfo.IssueTime = DateTime.Now; visitorInfo.ContactSex = orderVisitorInfo.Gender; visitorInfo.CompanyId = SiteUserInfo.CompanyID; if (!visitorBll.VisitorIsExists(visitorInfo.CardNo, SiteUserInfo.CompanyID, "")) { visitorList.Add(visitorInfo); } } } //添加常旅客到数据库 visitorBll.AddTicketVisitorList(visitorList); //构造订单信息 EyouSoft.IBLL.TicketStructure.ITicketOrder orderBll = EyouSoft.BLL.TicketStructure.TicketOrder.CreateInstance(); EyouSoft.Model.TicketStructure.OrderInfo orderInfo = new EyouSoft.Model.TicketStructure.OrderInfo(); orderInfo.Travellers = orderVisitorList; orderInfo.TravellerType = (EyouSoft.Model.TicketStructure.TravellerType)Utils.GetInt(Utils.GetFormValue("peopleType")); if (info.FreightType == EyouSoft.Model.TicketStructure.FreightType.来回程) { orderInfo.TotalAmount = (info.FromSetPrice + info.ToSetPrice + info.FromFuelPrice + info.ToFuelPrice + info.ToBuildPrice + info.FromBuildPrice) * length + supplierInfo.ServicePrice * isTableNum; } else { orderInfo.TotalAmount = (info.FromSetPrice + info.FromFuelPrice + info.FromBuildPrice) * length + supplierInfo.ServicePrice * isTableNum; } if (isTableNum > 0) { orderInfo.TotalAmount += supplierInfo.DeliveryPrice; } orderInfo.BuyerCId = SiteUserInfo.CompanyID; orderInfo.BuyerCName = SiteUserInfo.CompanyName; orderInfo.BuyerContactAddress = EyouSoft.BLL.CompanyStructure.CompanyInfo.CreateInstance().GetModel(SiteUserInfo.CompanyID).CompanyAddress; orderInfo.BuyerContactMobile = SiteUserInfo.ContactInfo.Mobile; orderInfo.BuyerContactMQ = SiteUserInfo.ContactInfo.MQ; orderInfo.BuyerContactName = SiteUserInfo.ContactInfo.ContactName; orderInfo.BuyerRemark = Utils.InputText(Utils.GetFormValue("tb_remark"), 250);//特殊要求备注 orderInfo.BuyerUId = SiteUserInfo.ID; orderInfo.DestCityId = info.NoGadDestCityId; orderInfo.DestCityName = info.NoGadDestCityName; orderInfo.EMSPrice = supplierInfo.DeliveryPrice; orderInfo.FlightId = info.FlightId; orderInfo.FreightType = info.FreightType; orderInfo.HomeCityId = info.NoGadHomeCityId; orderInfo.HomeCityName = info.NoGadHomeCityIdName; orderInfo.ItineraryPrice = supplierInfo.ServicePrice; orderInfo.LeaveTime = DateTime.Parse(Utils.GetFormValue("startDate")); EyouSoft.Model.TicketStructure.OrderRateInfo rateInfo = new EyouSoft.Model.TicketStructure.OrderRateInfo(); rateInfo.DestCityId = info.NoGadDestCityId; rateInfo.DestCityName = info.NoGadDestCityName; rateInfo.FlightId = info.FlightId; rateInfo.FreightType = info.FreightType; rateInfo.HomeCityId = info.NoGadHomeCityId; rateInfo.HomeCityName = info.NoGadHomeCityIdName; rateInfo.LBuildPrice = info.FromBuildPrice; rateInfo.LeaveDiscount = info.FromReferRate; rateInfo.LeaveFacePrice = info.FromReferPrice; rateInfo.LeavePrice = info.FromSetPrice; //计算去程运价有效期 rateInfo.LeaveTimeLimit = GetDate(info); rateInfo.LFuelPrice = info.FromFuelPrice; rateInfo.MaxPCount = info.MaxPCount; rateInfo.RBuildPrice = info.ToBuildPrice; rateInfo.ReturnDiscount = info.ToReferRate; rateInfo.ReturnFacePrice = info.ToReferPrice; rateInfo.ReturnPrice = info.ToSetPrice; //计算回程运价有效期 rateInfo.ReturnTimeLimit = GetBackDate(info); rateInfo.RFuelPrice = info.ToFuelPrice; rateInfo.SupplierRemark = info.SupplierRemark; orderInfo.OrderRateInfo = rateInfo; string act = Utils.GetFormValue("act"); if (act == "0") { orderInfo.OrderState = EyouSoft.Model.TicketStructure.OrderState.等待审核; } else { orderInfo.OrderState = EyouSoft.Model.TicketStructure.OrderState.审核通过; } orderInfo.OrderTime = DateTime.Now; orderInfo.PCount = length; orderInfo.RateType = info.RateType; orderInfo.ReturnTime = Utils.GetDateTime(Utils.GetFormValue("backDate"), DateTime.Now); orderInfo.SupplierCId = info.Company.ID; orderInfo.SupplierCName = info.Company.CompanyName; orderInfo.OrderId = Guid.NewGuid().ToString(); if (orderBll.CreateOrder(orderInfo)) { Utils.ResponseMeg(true, orderInfo.OrderId); } else { Utils.ResponseMegError(); } } }
/// <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="dr">IDataReader</param> /// <returns>返回运价信息实体</returns> private IList <EyouSoft.Model.TicketStructure.TicketFreightInfo> GetSelectModel(IDataReader dr) { if (dr == null) { return(null); } IList <EyouSoft.Model.TicketStructure.TicketFreightInfo> list = new List <EyouSoft.Model.TicketStructure.TicketFreightInfo>(); EyouSoft.Model.TicketStructure.TicketFreightInfo model = null; while (dr.Read()) { model = new EyouSoft.Model.TicketStructure.TicketFreightInfo(); model.Id = dr.GetString(dr.GetOrdinal("Id")); if (!dr.IsDBNull(dr.GetOrdinal("BuyType"))) { model.BuyType = (EyouSoft.Model.TicketStructure.PackageTypes) int.Parse(dr["BuyType"].ToString()); } model.Company.ID = dr.GetString(dr.GetOrdinal("CompanyId")); model.Company.CompanyName = dr["CompanyName"].ToString(); model.FlightId = dr.GetInt32(dr.GetOrdinal("FlightId")); model.FlightName = dr.GetString(dr.GetOrdinal("FlightName")); model.FreightBuyId = dr.GetString(dr.GetOrdinal("FreightBuyId")); if (!dr.IsDBNull(dr.GetOrdinal("FreightEndDate"))) { model.FreightEndDate = dr.GetDateTime(dr.GetOrdinal("FreightEndDate")); } if (!dr.IsDBNull(dr.GetOrdinal("FreightStartDate"))) { model.FreightStartDate = dr.GetDateTime(dr.GetOrdinal("FreightStartDate")); } if (!dr.IsDBNull(dr.GetOrdinal("FreightType"))) { model.FreightType = (EyouSoft.Model.TicketStructure.FreightType) int.Parse(dr["FreightType"].ToString()); } model.GadDestCityId = dr.GetInt32(dr.GetOrdinal("GadDestCityId")); model.GadDestCityName = dr.GetString(dr.GetOrdinal("GadDestCityName")); model.GadHomeCityId = dr.GetInt32(dr.GetOrdinal("GadHomeCityId")); model.GadHomeCityName = dr.GetString(dr.GetOrdinal("GadHomeCityName")); model.IsCheckPNR = dr.GetString(dr.GetOrdinal("IsCheckPNR")) == "1" ? true : false; model.IsEnabled = dr.GetString(dr.GetOrdinal("IsEnabled")) == "1" ? true : false; model.IsExpired = dr.GetString(dr.GetOrdinal("IsExpired")) == "1" ? true : false; model.IssueTime = dr.IsDBNull(dr.GetOrdinal("IssueTime")) ? DateTime.MinValue : dr.GetDateTime(dr.GetOrdinal("IssueTime")); if (!dr.IsDBNull(dr.GetOrdinal("LastUpdateDate"))) { model.LastUpdateDate = dr.GetDateTime(dr.GetOrdinal("LastUpdateDate")); } model.MaxPCount = dr.GetInt32(dr.GetOrdinal("MaxPCount")); model.NoGadDestCityId = dr.GetInt32(dr.GetOrdinal("NoGadDestCityId")); model.NoGadDestCityName = dr.GetString(dr.GetOrdinal("NoGadDestCityName")); model.NoGadHomeCityIdName = dr.GetString(dr.GetOrdinal("NoGadHomeCityIdName")); model.NoGadHomeCityId = dr.GetInt32(dr.GetOrdinal("NoGadHomeCityId")); model.OperatorId = dr.GetString(dr.GetOrdinal("OperatorId")); if (!dr.IsDBNull(dr.GetOrdinal("ProductType"))) { model.ProductType = (EyouSoft.Model.TicketStructure.ProductType) int.Parse(dr.GetByte(dr.GetOrdinal("ProductType")).ToString()); } if (!dr.IsDBNull(dr.GetOrdinal("RateType"))) { model.RateType = (EyouSoft.Model.TicketStructure.RateType) int.Parse(dr.GetByte(dr.GetOrdinal("RateType")).ToString()); } model.SupplierRemark = dr.GetString(dr.GetOrdinal("SupplierRemark")); model.WorkEndTime = dr.GetString(dr.GetOrdinal("WorkEndTime")); model.WorkStartTime = dr.GetString(dr.GetOrdinal("WorkStartTime")); list.Add(model); } return(list); }
/// <summary> /// 获取采购商查看运价信息集合 /// </summary> /// <param name="QueryTicketFreightInfo">查询条件实体</param> /// <returns>返回运价信息实体集合</returns> public virtual IList <EyouSoft.Model.TicketStructure.TicketFreightInfoList> GetFreightInfoList(EyouSoft.Model.TicketStructure.QueryTicketFreightInfo QueryTicketFreightInfo) { List <EyouSoft.Model.TicketStructure.TicketFreightInfoList> list = new List <EyouSoft.Model.TicketStructure.TicketFreightInfoList>(); System.Xml.XmlAttributeCollection attList = null; System.Xml.XmlDocument xml = null; System.Xml.XmlNodeList xmlNodeList = null; #region 拼接Sql StringBuilder strSql = new StringBuilder(); strSql.Append(" select PayPrice,FreightAddition,Id,FlightId,FlightName,CompanyId,CompanyName,ProductType,MaxPCount,SupplierRemark,FreightType,ContactMQ,FreightStartDate,FreightEndDate from view_TicketFreightInfo where IsEnabled = '1' and IsExpired = '0' "); if (QueryTicketFreightInfo != null) { if (QueryTicketFreightInfo.FreightType.HasValue) { strSql.AppendFormat(" and FreightType = {0} ", (int)QueryTicketFreightInfo.FreightType); } if (QueryTicketFreightInfo.HomeCity > 0) { strSql.AppendFormat(" and NoGadHomeCityId = {0} ", QueryTicketFreightInfo.HomeCity); } if (QueryTicketFreightInfo.DestCity > 0) { strSql.AppendFormat(" and NoGadDestCityId = {0} ", QueryTicketFreightInfo.DestCity); } if (QueryTicketFreightInfo.AirportId > 0) { strSql.AppendFormat(" and FlightId = {0} ", QueryTicketFreightInfo.AirportId); } } strSql.Append(" order by PayPrice desc "); #endregion #region 实体赋值 DbCommand dc = this._dataBase.GetSqlStringCommand(strSql.ToString()); using (IDataReader dr = DbHelper.ExecuteReader(dc, this._dataBase)) { EyouSoft.Model.TicketStructure.TicketFreightInfo model = null; while (dr.Read()) { if (dr.IsDBNull(dr.GetOrdinal("FlightId"))) { continue; } EyouSoft.Model.TicketStructure.TicketFreightInfoList modelFreightInfoList = list.Find( (EyouSoft.Model.TicketStructure.TicketFreightInfoList tmp) => { if (int.Parse(dr["FlightId"].ToString()) == tmp.Id) { return(true); } else { return(false); } }); modelFreightInfoList = modelFreightInfoList ?? new EyouSoft.Model.TicketStructure.TicketFreightInfoList(); if (modelFreightInfoList.Id <= 0) { modelFreightInfoList.FreightInfoList = new List <EyouSoft.Model.TicketStructure.TicketFreightInfo>(); list.Add(modelFreightInfoList); //集合不存在,加入集合中 } #region 航空公司信息 modelFreightInfoList.Id = int.Parse(dr["FlightId"].ToString()); modelFreightInfoList.AirportName = dr["FlightName"].ToString(); if (!dr.IsDBNull(dr.GetOrdinal("PayPrice"))) { modelFreightInfoList.AirportPayPrice = modelFreightInfoList.AirportPayPrice + decimal.Parse(dr["PayPrice"].ToString()); } #endregion #region 运价信息 model = new EyouSoft.Model.TicketStructure.TicketFreightInfo(); model.Id = dr.GetString(dr.GetOrdinal("Id")); model.FlightId = dr.GetInt32(dr.GetOrdinal("FlightId")); model.FlightName = dr.GetString(dr.GetOrdinal("FlightName")); model.Company.ID = dr.GetString(dr.GetOrdinal("CompanyId")); model.Company.CompanyName = dr["CompanyName"].ToString(); model.ContactMQ = dr["ContactMQ"].ToString(); if (!dr.IsDBNull(dr.GetOrdinal("ProductType"))) { model.ProductType = (EyouSoft.Model.TicketStructure.ProductType) int.Parse(dr.GetByte(dr.GetOrdinal("ProductType")).ToString()); } model.MaxPCount = dr.GetInt32(dr.GetOrdinal("MaxPCount")); model.SupplierRemark = dr.GetString(dr.GetOrdinal("SupplierRemark")); if (!dr.IsDBNull(dr.GetOrdinal("FreightType"))) { model.FreightType = (EyouSoft.Model.TicketStructure.FreightType) int.Parse(dr.GetByte(dr.GetOrdinal("FreightType")).ToString()); } if (!dr.IsDBNull(dr.GetOrdinal("FreightStartDate"))) { model.FreightStartDate = DateTime.Parse(dr["FreightStartDate"].ToString()); } if (!dr.IsDBNull(dr.GetOrdinal("FreightEndDate"))) { model.FreightEndDate = DateTime.Parse(dr["FreightEndDate"].ToString()); } #endregion #region 运价扩展信息 if (!string.IsNullOrEmpty(dr["FreightAddition"].ToString())) { xml = new System.Xml.XmlDocument(); xml.LoadXml(dr["FreightAddition"].ToString()); xmlNodeList = xml.GetElementsByTagName("tbl_TicketFreightAddition"); if (xmlNodeList != null) { for (int i = 0; i < xmlNodeList.Count; i++) { if (i > 1) { break; } attList = xmlNodeList[i].Attributes; switch (attList["FromType"].Value) { case "0": //去程 if (attList["SelfDate"] != null && !string.IsNullOrEmpty(attList["SelfDate"].Value)) { model.FromSelfDate = DateTime.Parse(attList["SelfDate"].Value); } if (attList["ForDay"] != null) { model.FromForDay = attList["ForDay"].Value; } if (attList["ReferPrice"] != null && !string.IsNullOrEmpty(attList["ReferPrice"].Value)) { model.FromReferPrice = decimal.Parse(attList["ReferPrice"].Value); } if (attList["ReferRate"] != null && !string.IsNullOrEmpty(attList["ReferRate"].Value)) { model.FromReferRate = decimal.Parse(attList["ReferRate"].Value); } if (attList["SetPrice"] != null && !string.IsNullOrEmpty(attList["SetPrice"].Value)) { model.FromSetPrice = decimal.Parse(attList["SetPrice"].Value); } if (attList["FuelPrice"] != null && !string.IsNullOrEmpty(attList["FuelPrice"].Value)) { model.FromFuelPrice = decimal.Parse(attList["FuelPrice"].Value); } if (attList["BuildPrice"] != null && !string.IsNullOrEmpty(attList["BuildPrice"].Value)) { model.FromBuildPrice = decimal.Parse(attList["BuildPrice"].Value); } break; case "1": //回程 if (attList["SelfDate"] != null && !string.IsNullOrEmpty(attList["SelfDate"].Value)) { model.ToSelfDate = DateTime.Parse(attList["SelfDate"].Value); } if (attList["ForDay"] != null) { model.ToForDay = attList["ForDay"].Value; } if (attList["ReferPrice"] != null && !string.IsNullOrEmpty(attList["ReferPrice"].Value)) { model.ToReferPrice = decimal.Parse(attList["ReferPrice"].Value); } if (attList["ReferRate"] != null && !string.IsNullOrEmpty(attList["ReferRate"].Value)) { model.ToReferRate = decimal.Parse(attList["ReferRate"].Value); } if (attList["SetPrice"] != null && !string.IsNullOrEmpty(attList["SetPrice"].Value)) { model.ToSetPrice = decimal.Parse(attList["SetPrice"].Value); } if (attList["FuelPrice"] != null && !string.IsNullOrEmpty(attList["FuelPrice"].Value)) { model.ToFuelPrice = decimal.Parse(attList["FuelPrice"].Value); } if (attList["BuildPrice"] != null && !string.IsNullOrEmpty(attList["BuildPrice"].Value)) { model.ToBuildPrice = decimal.Parse(attList["BuildPrice"].Value); } break; } } } } if (attList != null) { attList.RemoveAll(); } attList = null; xmlNodeList = null; xml = null; #endregion modelFreightInfoList.FreightInfoList.Add(model); } } #endregion if (attList != null) { attList.RemoveAll(); } attList = null; xmlNodeList = null; xml = null; return(list.OrderByDescending(Item => (Item.AirportPayPrice)).ToList()); }
/// <summary> /// 获取运价信息 /// </summary> /// <param name="FreightInfoId">运价信息Id</param> /// <returns>返回运价信息实体</returns> public virtual EyouSoft.Model.TicketStructure.TicketFreightInfo GetModel(string FreightInfoId) { if (string.IsNullOrEmpty(FreightInfoId)) { return(null); } EyouSoft.Model.TicketStructure.TicketFreightInfo model = new EyouSoft.Model.TicketStructure.TicketFreightInfo(); model.Id = FreightInfoId; StringBuilder strSql = new StringBuilder(); strSql.Append(Sql_FreightInfo_Select + " where Id = @Id ;"); strSql.Append(Sql_TicketFreightAddition_Select + " where FreightId = @Id ;"); DbCommand dc = this._dataBase.GetSqlStringCommand(strSql.ToString()); this._dataBase.AddInParameter(dc, "Id", DbType.AnsiStringFixedLength, FreightInfoId); using (IDataReader dr = DbHelper.ExecuteReader(dc, this._dataBase)) { IList <EyouSoft.Model.TicketStructure.TicketFreightInfo> list = GetSelectModel(dr); if (list == null || list.Count <= 0) { return(model); } model = list[0]; list.Clear(); list = null; dr.NextResult(); #region 运价扩展信息赋值 while (dr.Read()) { if (!dr.IsDBNull(dr.GetOrdinal("FromType"))) { switch (dr["FromType"].ToString()) { case "0": //去程 if (!dr.IsDBNull(dr.GetOrdinal("SelfDate"))) { model.FromSelfDate = DateTime.Parse(dr["SelfDate"].ToString()); } model.FromForDay = dr["ForDay"].ToString(); if (!dr.IsDBNull(dr.GetOrdinal("ReferPrice"))) { model.FromReferPrice = decimal.Parse(dr["ReferPrice"].ToString()); } if (!dr.IsDBNull(dr.GetOrdinal("ReferRate"))) { model.FromReferRate = decimal.Parse(dr["ReferRate"].ToString()); } if (!dr.IsDBNull(dr.GetOrdinal("SetPrice"))) { model.FromSetPrice = decimal.Parse(dr["SetPrice"].ToString()); } if (!dr.IsDBNull(dr.GetOrdinal("FuelPrice"))) { model.FromFuelPrice = decimal.Parse(dr["FuelPrice"].ToString()); } if (!dr.IsDBNull(dr.GetOrdinal("BuildPrice"))) { model.FromBuildPrice = decimal.Parse(dr["BuildPrice"].ToString()); } break; case "1": //回程 if (!dr.IsDBNull(dr.GetOrdinal("SelfDate"))) { model.ToSelfDate = DateTime.Parse(dr["SelfDate"].ToString()); } model.ToForDay = dr["ForDay"].ToString(); if (!dr.IsDBNull(dr.GetOrdinal("ReferPrice"))) { model.ToReferPrice = decimal.Parse(dr["ReferPrice"].ToString()); } if (!dr.IsDBNull(dr.GetOrdinal("ReferRate"))) { model.ToReferRate = decimal.Parse(dr["ReferRate"].ToString()); } if (!dr.IsDBNull(dr.GetOrdinal("SetPrice"))) { model.ToSetPrice = decimal.Parse(dr["SetPrice"].ToString()); } if (!dr.IsDBNull(dr.GetOrdinal("FuelPrice"))) { model.ToFuelPrice = decimal.Parse(dr["FuelPrice"].ToString()); } if (!dr.IsDBNull(dr.GetOrdinal("BuildPrice"))) { model.ToBuildPrice = decimal.Parse(dr["BuildPrice"].ToString()); } break; } } } #endregion } return(model); }
/// <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"); }
/// <summary> /// 根据ID初始化数据 /// </summary> /// <param name="id"></param> protected void DataInit(string id) { EyouSoft.IBLL.TicketStructure.ITicketFreightInfo IBll = EyouSoft.BLL.TicketStructure.TicketFreightInfo.CreateInstance(); EyouSoft.Model.TicketStructure.TicketFreightInfo model = IBll.GetModel(id); if (model != null) { if (Convert.ToInt32(model.BuyType) == 0 || Convert.ToInt32(model.BuyType) == 2 || Convert.ToInt32(model.BuyType) == 3) { //禁止修改航空公司 this.fre_AirCompanyList.Enabled = false; //禁止修改始发地 this.fre_StartDdl.Enabled = false; //禁止修改目的地 this.fre_ToLbByUpdate.Enabled = false; } //运价类型 if (model.FreightType == EyouSoft.Model.TicketStructure.FreightType.单程 || model.FreightType.ToString() == "0") { //不显示回程信息 isOpenBack = "0"; this.fre_rdo_Single.Checked = true; } else { //显示回程信息 isOpenBack = "1"; this.fre_rdo_Back.Checked = true; } //产品类型 if (model.ProductType == EyouSoft.Model.TicketStructure.ProductType.整团) { this.fre_rdo_Integer.Checked = true; } else { this.fre_rdo_San.Checked = true; } //航空公司初始化 AirCompanyInit(model.FlightId.ToString()); //起始地 StartAddressInit(model.NoGadHomeCityId.ToString()); //目的地 FromAddressInit(model.NoGadDestCityId.ToString()); //是否启用运价 if (model.IsExpired) { this.fre_rdoPriceExpired.Checked = true; this.fre_rdoPriceEnable.Visible = false; this.fre_rdoPriceClose.Visible = false; } else { if (model.IsEnabled) { this.fre_rdoPriceEnable.Checked = true; } else { this.fre_rdoPriceClose.Checked = true; } this.fre_rdoPriceExpired.Visible = false; } //是否需要更换PNR if (model.IsCheckPNR) { this.fre_rdoPnrYes.Checked = true; } else { this.fre_rdoPnrnNo.Checked = true; } //运价开始日期 if (model.FreightStartDate != null) { this.fre_txtPriceBegin.Text = Convert.ToDateTime(model.FreightStartDate).ToString("yyyy-MM-dd"); } //运价结束日期 if (model.FreightEndDate != null) { this.fre_OfferEnd.Text = Convert.ToDateTime(model.FreightEndDate).ToString("yyyy-MM-dd"); } //去程 //去程适用 if (model.FromForDay != null) { string[] fromForDay = model.FromForDay.Split(','); if (fromForDay.Length > 0) { for (int i = 0; i < fromForDay.Length; i++) { switch (fromForDay[i]) { case "周一": this.fre_FromMonday.Checked = true; break; case "周二": this.fre_FromTuesday.Checked = true; break; case "周三": this.fre_FromWednesday.Checked = true; break; case "周四": this.fre_FromThursday.Checked = true; break; case "周五": this.fre_FromFriday.Checked = true; break; case "周六": this.fre_FromSaturday.Checked = true; break; case "周日": this.fre_FromSunday.Checked = true; break; } } } } this.fre_FromForDay.Value = model.FromForDay; if (model.FromSelfDate != null && Convert.ToDateTime(model.FromSelfDate).ToString("yyyy-MM-dd") != "1900-01-01") { this.fre_txtIndeDate.Text = Convert.ToDateTime(model.FromSelfDate).ToString("yyyy-MM-dd"); } this.fre_txtRefePrice.Text = model.FromReferPrice.ToString("0.00"); this.fre_txtDeduction.Text = model.FromReferRate.ToString("0.0"); this.fre_txtSettPrice.Text = model.FromSetPrice.ToString("0.00"); this.fre_txtFuelPrice.Text = model.FromFuelPrice.ToString("0.00"); this.fre_txtMachPrice.Text = model.FromBuildPrice.ToString("0.00"); #region 回程信息 if (model.FreightType == EyouSoft.Model.TicketStructure.FreightType.来回程) { //回程适用 if (model.ToForDay != null) { string[] backForDay = model.ToForDay.Split(','); if (backForDay.Length > 0) { for (int i = 0; i < backForDay.Length; i++) { switch (backForDay[i]) { case "周一": this.fre_BackMonday.Checked = true; break; case "周二": this.fre_BackTuesday.Checked = true; break; case "周三": this.fre_BackWednesday.Checked = true; break; case "周四": this.fre_BackThursday.Checked = true; break; case "周五": this.fre_BackFriday.Checked = true; break; case "周六": this.fre_BackSaturday.Checked = true; break; case "周日": this.fre_BackSunday.Checked = true; break; } } } } this.fre_hideToForDay.Value = model.ToForDay; if (model.ToSelfDate != null && Convert.ToDateTime(model.ToSelfDate).ToString("yyyy-MM-dd") != "1900-01-01") { this.fre_txtIndeDateBack.Text = Convert.ToDateTime(model.ToSelfDate).ToString("yyyy-MM-dd"); } this.fre_txtRefePriceBack.Text = model.ToReferPrice.ToString("0.00"); this.fre_txtDeductionBack.Text = model.ToReferRate.ToString("0"); this.fre_txtSettPriceBack.Text = model.ToSetPrice.ToString("0.00"); this.fre_txtFuelPriceBack.Text = model.ToFuelPrice.ToString("0.00"); this.fre_txtMachPriceBack.Text = model.ToBuildPrice.ToString("0.00"); } #endregion this.fre_txtPeopleCount.Text = model.MaxPCount.ToString(); this.fre_txtToWork.Text = model.WorkStartTime; this.fre_txtBackHome.Text = model.WorkEndTime; this.fre_txtRemark.Text = model.SupplierRemark; } }