public TourMerchandise SearchTourByTourCode(string tourCode, string Language) { TourMerchandise tourMerchandise = null; TourMerchandise tourMerchandiseAll = null; if (Utility.IsSubAgent) tourMerchandiseAll = (TourMerchandise)MVMerchandisePool.Find("SUBTour"); else tourMerchandiseAll = (TourMerchandise)MVMerchandisePool.Find("Tour"); if (tourMerchandiseAll == null) { tourMerchandiseAll = SearchTour(Language); } if (tourMerchandiseAll != null) { tourMerchandise = new TourMerchandise(); tourMerchandise.TourProductList = tourMerchandiseAll.TourProductList; for (int i = 0; i < tourMerchandiseAll.Items.Count; i++) { TourMaterial tourMaterial = (TourMaterial)tourMerchandiseAll.Items[i]; TourMaterial tourMaterialCN = (TourMaterial)tourMerchandiseAll.TourMCN[i]; TourProfile tourprofile = (TourProfile)tourMaterial.Profile; if (tourprofile.Code.Trim().ToUpper() == tourCode.Trim().ToUpper()) { tourMerchandise.Add(tourMaterial); tourMerchandise.TourMCN.Add(tourMaterialCN); break; ; } } } else return null; tourMerchandise.LanguageFlag = Language; return tourMerchandise; }
//public TourMerchandise SearchTour(Terms.Sales.Business.TourSearchCondition searchCondition, List<string> citys, string Language) //{ // searchCondition.UserInfo = UserInfo; // //��Cache�в��ҽ� // TourMerchandise tourMerchandise = (TourMerchandise)MVMerchandisePool.Find(citys); // if (tourMerchandise == null) // { // TourProductSearcher searcher = new TourProductSearcher(); // TERMS.Common.Search.TourSearchCondition tourSearchCondition = new TERMS.Common.Search.TourSearchCondition(); // tourSearchCondition.SetCity(searchCondition.City); // tourSearchCondition.SetRegion(searchCondition.Region); // tourSearchCondition.SetCountry(searchCondition.Counrty); // tourSearchCondition.IsLandOnly = searchCondition.IsLandOnly; // tourSearchCondition.TravelDaysFrom = searchCondition.TravelDaysFrom; // tourSearchCondition.TravelDaysTo = searchCondition.TravelDaysTo; // tourSearchCondition.PriceType = searchCondition.PriceType; // tourSearchCondition.SetDepartureRange(searchCondition.TravelBeginDate.AddDays(-7), searchCondition.TravelBeginDate.AddDays(300)); // IList<TourProduct> tps = new List<TourProduct>(); // tps = searcher.Search(tourSearchCondition, citys, userInfo.Entity); // if (tps != null && tps.Count > 0) // { // TourMerchandise tourMerchandiseNew = new TourMerchandise((List<TourProduct>)tps); // if (Utility.IsSubAgent) // { // GetSpecialTourPrice(tourMerchandise, searchCondition.IsLandOnly); // } // MVMerchandisePool.Cache(citys, tourMerchandiseNew); //Cache // tourMerchandise = tourMerchandiseNew; // } // else // return null; // } // tourMerchandise.LanguageFlag = Language; // return tourMerchandise; //} public TourMerchandise SearchTour(Terms.Sales.Business.TourSearchCondition searchCondition, List<string> citys, string Language) { //searchCondition.UserInfo = UserInfo; TourMerchandise tourMerchandise = null; TourMerchandise tourMerchandiseAll = null; if (Utility.IsSubAgent) tourMerchandiseAll = (TourMerchandise)MVMerchandisePool.Find("SUBTour"); else tourMerchandiseAll = (TourMerchandise)MVMerchandisePool.Find("Tour"); if (tourMerchandiseAll == null) { tourMerchandiseAll = SearchTour(Language); } if (tourMerchandiseAll != null) { tourMerchandise = new TourMerchandise(); tourMerchandise.TourProductList = tourMerchandiseAll.TourProductList; for (int i = 0; i < tourMerchandiseAll.Items.Count; i++) { TourMaterial tourMaterial = (TourMaterial)tourMerchandiseAll.Items[i]; TourMaterial tourMaterialCN = (TourMaterial)tourMerchandiseAll.TourMCN[i]; TourProfile tourprofile = (TourProfile)tourMaterial.Profile; TERMS.Common.City StartCity = tourprofile.StartCity; TERMS.Common.City EndCity = tourprofile.EndCity; List<TERMS.Common.City> PassCities = (List<TERMS.Common.City>)tourprofile.PassCities; if (searchCondition.TravelDaysFrom != 0 && searchCondition.TravelDaysTo != 0 && (tourprofile.Days < searchCondition.TravelDaysFrom || tourprofile.Days > searchCondition.TravelDaysTo)) { continue; } if (citys.Contains(StartCity.Code)) { tourMerchandise.Add(tourMaterial); tourMerchandise.TourMCN.Add(tourMaterialCN); continue; } if (citys.Contains(EndCity.Code)) { tourMerchandise.Add(tourMaterial); tourMerchandise.TourMCN.Add(tourMaterialCN); continue; } for (int index = 0; index < PassCities.Count; index++) { if (citys.Contains(PassCities[index].Code)) { tourMerchandise.Add(tourMaterial); tourMerchandise.TourMCN.Add(tourMaterialCN); break; } } } } else return null; //tourMerchandise.Items.Sort(CompareByStartFromLandOnlyFareAndTourCode); tourMerchandise.LanguageFlag = Language; return tourMerchandise; }