protected void btn_Search_AH_Click(object sender, EventArgs e) { if (Utility.IsSubAgent) OperaterAdvice.DoAdvice(Terms.Configuration.Utility.ConfigurationConst.OperateType.SUB_SearchPackage, this); else OperaterAdvice.DoAdvice(Terms.Configuration.Utility.ConfigurationConst.OperateType.MV_SearchPackage, this); if (!Page.IsValid) return; DateTime dateDept_A = Convert.ToDateTime(this.dateDeparture_AH.CDate); DateTime dateRtn_A = Convert.ToDateTime(this.dateReturn_AH.CDate); DateTime dateChinkIn_H; DateTime dateChinkOut_H; txtFrom_AH.Text = ConvertName(txtFullFrom_AH.Text); txtTo_AH.Text = ConvertName(txtFullTo_AH.Text); if (this.CheckIn_AH.CDate == "__/__/____" || this.CheckIn_AH.CDate == "") dateChinkIn_H = dateDept_A.AddDays(1); //若Check in为空,则默认为Air出发日期加一天 else dateChinkIn_H = Convert.ToDateTime(this.CheckIn_AH.CDate); if (this.CheckOut_AH.CDate == "__/__/____" || this.CheckOut_AH.CDate == "") dateChinkOut_H = dateRtn_A; //若Check out为空,则默认为Air返回日期 else dateChinkOut_H = Convert.ToDateTime(this.CheckOut_AH.CDate); if (dateDept_A < DateTime.Now.AddDays(7)) { Page.ClientScript.RegisterStartupScript(this.GetType(), "Warting", "<script language=javascript>alert('Departure date is greater than the current date seven days.');</script>"); return; } if (dateRtn_A < DateTime.Now.AddDays(7)) { Page.ClientScript.RegisterStartupScript(this.GetType(), "Warting", "<script language=javascript>alert('Return date is greater than the current date seven days.');</script>"); return; } if (dateChinkIn_H < DateTime.Now.AddDays(7)) { Page.ClientScript.RegisterStartupScript(this.GetType(), "Warting", "<script language=javascript>alert('Departure date is greater than the current date seven days.');</script>"); return; } if (dateChinkOut_H < DateTime.Now.AddDays(7)) { Page.ClientScript.RegisterStartupScript(this.GetType(), "Warting", "<script language=javascript>alert('Return date is greater than the current date seven days.');</script>"); return; } if (dateChinkIn_H < DateTime.Today && dateChinkOut_H < DateTime.Today) { this.Response.Redirect("~/Page/Common/ErrorMessage.aspx?ErrorMessage=We can only accept dates that occur between " + DateTime.Today.AddDays(1).ToString("MM/dd/yyyy") + " and 12/27/2008. Please enter a new date.&&GoToPage=~/Index.aspx"); return; } if (dateChinkIn_H <= DateTime.Today) { this.Response.Redirect("~/Page/Common/ErrorMessage.aspx?ErrorMessage=The check-in date must occur after the today date. Please change the date.&&GoToPage=~/Index.aspx"); return; } if (dateChinkIn_H > dateChinkOut_H) { this.Response.Redirect("~/Page/Common/ErrorMessage.aspx?ErrorMessage=The check-out date must occur after the check-in date. Please change the date.&&GoToPage=~/Index.aspx"); return; } if (dateDept_A >= dateRtn_A) { this.Response.Redirect("~/Page/Common/ErrorMessage.aspx?ErrorMessage=The Depart date must occur after the Return date. Please change the date.&&GoToPage=~/Index.aspx"); return; } if (dateDept_A > dateChinkIn_H) { this.Response.Redirect("~/Page/Common/ErrorMessage.aspx?ErrorMessage=The check-in date must occur after the Depart date. Please change the date.&&GoToPage=~/Index.aspx"); return; } if (dateChinkOut_H > dateRtn_A) { this.Response.Redirect("~/Page/Common/ErrorMessage.aspx?ErrorMessage=The Return date must occur after the check-out date. Please change the date.&&GoToPage=~/Index.aspx"); return; } //Utility.SelectAirGroup = null; PackageSearchCondition PacakgeSearch = new PackageSearchCondition(); PacakgeSearch.IsReset = true; PacakgeSearch.DepatrueAirPorts = new List<Terms.Common.Domain.Airport>(); if (txtFrom_AH.Text.Trim().Length > 3) { IList departureAirPorts = _CommonService.FindAirportByCityName(txtFrom_AH.Text.Trim()); if (departureAirPorts.Count >= 1) { PacakgeSearch.DepatrueAirPorts = departureAirPorts; } else { List<Terms.Common.Domain.Airport> airportList = _ApplicationCacheFoundationDate.FindAllAirport(); Terms.Common.Domain.Airport airport = MatchAirport(txtFrom_AH.Text.Trim(), airportList); if (airport != null) { PacakgeSearch.DepatrueAirPorts.Add(airport); } } } else { //PacakgeSearch.DepatrueAirPorts.Add(AirService.CommAirportDao.FindByAirport(txtDepartureFrom.Text.Trim())); Terms.Common.Domain.Airport airport = AirService.CommAirportDao.FindByAirport(txtFrom_AH.Text.Trim()); if (airport != null) { PacakgeSearch.DepatrueAirPorts.Add(airport); } else { IList departureAirPorts = AirService.CommAirportDao.FindByCityCode(txtFrom_AH.Text.Trim()); if (departureAirPorts.Count >= 1) { PacakgeSearch.DepatrueAirPorts = departureAirPorts; } } } PacakgeSearch.DestinationAirPorts = new List<Terms.Common.Domain.Airport>(); if (txtTo_AH.Text.Trim().Length > 3) { IList DestinationOneAirPorts = _CommonService.FindAirportByCityName(txtTo_AH.Text.Trim()); if (DestinationOneAirPorts.Count >= 1) { PacakgeSearch.DestinationAirPorts = DestinationOneAirPorts; } else { List<Terms.Common.Domain.Airport> airportList = _ApplicationCacheFoundationDate.FindAllAirport(); Terms.Common.Domain.Airport airport = MatchAirport(txtTo_AH.Text.Trim(), airportList); if (airport != null) { PacakgeSearch.DestinationAirPorts.Add(airport); } } } else { Terms.Common.Domain.Airport airport = AirService.CommAirportDao.FindByAirport(txtTo_AH.Text.Trim()); if (airport != null) { PacakgeSearch.DestinationAirPorts.Add(airport); } else { IList DestinationOneAirPorts = AirService.CommAirportDao.FindByCityCode(txtTo_AH.Text.Trim()); if (DestinationOneAirPorts.Count >= 1) { PacakgeSearch.DestinationAirPorts = DestinationOneAirPorts; } } } PacakgeSearch.AirSearchCondition.SetPassengerNumber(TERMS.Common.PassengerType.Adult, TravelerChange2.TotalAdults); PacakgeSearch.AirSearchCondition.SetPassengerNumber(TERMS.Common.PassengerType.Child, TravelerChange2.TotalChilds); //判断输入的出发地和目的地有没有机场 if (PacakgeSearch.DepatrueAirPorts.Count == 0) { Response.Redirect("~/Page/Common/ErrorMessage.aspx?ErrorMessage=We found no matches for \"" + this.txtFrom_AH.Text + "\"&GoToPage=~/index.aspx"); } if (PacakgeSearch.DestinationAirPorts.Count == 0) { Response.Redirect("~/Page/Common/ErrorMessage.aspx?ErrorMessage=We found no matches for \"" + this.txtTo_AH.Text + "\"&GoToPage=~/index.aspx"); } for (int i = 0; i < TravelerChange2.Rooms; i++) { RoomSearchCondition roomSearchCondition = new RoomSearchCondition(); roomSearchCondition.Passengers.Add(TERMS.Common.PassengerType.Adult, TravelerChange2.Adults[i]); roomSearchCondition.Passengers.Add(TERMS.Common.PassengerType.Child, TravelerChange2.Childs[i]); PacakgeSearch.HotelSearchCondition.RoomSearchConditions.Add(roomSearchCondition); } if (PacakgeSearch.DestinationAirPorts.Count > 0 || PacakgeSearch.DepatrueAirPorts.Count > 0) { PacakgeSearch.HotelSearchCondition.CheckIn = dateChinkIn_H.AddDays(0); PacakgeSearch.HotelSearchCondition.CheckOut = dateChinkOut_H; PacakgeSearch.HotelSearchCondition.Location = ((Terms.Common.Domain.Airport)PacakgeSearch.DestinationAirPorts[0]).CityCode;// "PVG"; PacakgeSearch.HotelSearchCondition.LocationIndicator = TERMS.Common.LocationIndicator.City; PacakgeSearch.HotelSearchCondition.Country = ((Terms.Common.Domain.Airport)PacakgeSearch.DestinationAirPorts[0]).City.Country.Code; AirTripCondition DPTairTripCondition = new AirTripCondition(); DPTairTripCondition.Departure = (Airport)PacakgeSearch.DepatrueAirPorts[0]; DPTairTripCondition.DepartureDate = Convert.ToDateTime(this.dateDeparture_AH.CDate); DPTairTripCondition.Destination = (Airport)PacakgeSearch.DestinationAirPorts[0]; DPTairTripCondition.IsDepartureTimeSpecified = this.chbFlexible_AH.Checked; PacakgeSearch.AirSearchCondition.AddTripCondition(DPTairTripCondition); AirTripCondition RTNairTripCondition = new AirTripCondition(); RTNairTripCondition.Departure = (Airport)PacakgeSearch.DestinationAirPorts[0]; RTNairTripCondition.DepartureDate = Convert.ToDateTime(this.dateReturn_AH.CDate); RTNairTripCondition.Destination = (Airport)PacakgeSearch.DepatrueAirPorts[0]; RTNairTripCondition.IsDepartureTimeSpecified = this.chbFlexible_AH.Checked; PacakgeSearch.AirSearchCondition.AddTripCondition(RTNairTripCondition); PacakgeSearch.AirSearchCondition.FlightType = "roundtrip"; if (ddlAirline.SelectedValue != "all") { PacakgeSearch.AirSearchCondition.Airlines = new string[1] { ddlAirline.SelectedValue.Trim() }; } else { PacakgeSearch.AirSearchCondition.Airlines = null; } Utility.IsTourMain = false;//设置是否是Tour标志 this.Transaction.IntKey = PacakgeSearch.GetHashCode(); this.Transaction.CurrentSearchConditions = PacakgeSearch; this.Transaction.CurrentTransactionObject = new TERMS.Business.Centers.SalesCenter.TransactionObject(); //设置Cabin TERMS.Common.CabinType cabin = new TERMS.Common.CabinType(); if (rdoLstCabin_AH.SelectedIndex == 0) { cabin = TERMS.Common.CabinType.Economy; } else if (rdoLstCabin_AH.SelectedIndex == 1) { cabin = TERMS.Common.CabinType.Business; } else if (rdoLstCabin_AH.SelectedIndex == 2) { cabin = TERMS.Common.CabinType.First; } for (int i = 0; i < PacakgeSearch.AirSearchCondition.AirTripCondition.Count; i++) PacakgeSearch.AirSearchCondition.AirTripCondition[i].Cabin = cabin; if (PacakgeSearch.DestinationAirPorts.Count > 1 || PacakgeSearch.DepatrueAirPorts.Count > 1) { this.Page.Response.Redirect("~/Page/Package/PackageSearchMoreForm.aspx?ConditionID=" + this.Transaction.IntKey.ToString()); } else { Utility.Transaction.Difference.Clear(); Utility.Transaction.Difference.FromTime = DateTime.Now; Utility.Transaction.Difference.StarTime = DateTime.Now; Utility.Transaction.Difference.From = "PackageSearchMoreForm Redirect Start"; this.Page.Response.Redirect("~/Page/Common/Searching1.aspx?target=~/Page/Package2/ViewYourPackages" + "&ConditionID=" + this.Transaction.IntKey.ToString()); } } else { } }
protected void btnSearch_Click(object sender, EventArgs e) { //�ж�Search���� if (!IsCheckSearch()) { return; } //�ж�CheckIn,CheckOut���� DateTime dateChinkIn_One = Convert.ToDateTime(this.dateCheckInOne.CDate); DateTime dateChinkOut_One = Convert.ToDateTime(this.dateCheckOutOne.CDate); DateTime dateChinkIn_Two = Convert.ToDateTime(this.dateCheckInTwo.CDate); DateTime dateChinkOut_Two = Convert.ToDateTime(this.dateCheckOutTwo.CDate); DateTime dateDeparture = Convert.ToDateTime(this.dateDeparture.CDate); DateTime dateReturn = Convert.ToDateTime(this.dateReturn.CDate); if (dateChinkIn_One < DateTime.Now.AddDays(7)) { Page.ClientScript.RegisterStartupScript(this.GetType(), "Warting", "<script language=javascript>alert('Departure date is greater than the current date seven days.');</script>"); return; } if (dateChinkOut_One < DateTime.Now.AddDays(7)) { Page.ClientScript.RegisterStartupScript(this.GetType(), "Warting", "<script language=javascript>alert('Return date is greater than the current date seven days.');</script>"); return; } if (dateChinkIn_Two < DateTime.Now.AddDays(7)) { Page.ClientScript.RegisterStartupScript(this.GetType(), "Warting", "<script language=javascript>alert('Departure date is greater than the current date seven days.');</script>"); return; } if (dateChinkOut_Two < DateTime.Now.AddDays(7)) { Page.ClientScript.RegisterStartupScript(this.GetType(), "Warting", "<script language=javascript>alert('Return date is greater than the current date seven days.');</script>"); return; } if (dateDeparture < DateTime.Now.AddDays(7)) { Page.ClientScript.RegisterStartupScript(this.GetType(), "Warting", "<script language=javascript>alert('Departure date is greater than the current date seven days.');</script>"); return; } if (dateReturn < DateTime.Now.AddDays(7)) { Page.ClientScript.RegisterStartupScript(this.GetType(), "Warting", "<script language=javascript>alert('Return date is greater than the current date seven days.');</script>"); return; } if ((dateChinkIn_One < DateTime.Today && dateChinkOut_One < DateTime.Today) || (dateChinkIn_Two < DateTime.Today && dateChinkOut_Two < DateTime.Today)) { this.Response.Redirect("~/Page/Common/ErrorMessage.aspx?ErrorMessage=We can only accept dates that occur between " + DateTime.Today.AddDays(1).ToString("MM/dd/yyyy") + " and 12/27/2008. Please enter a new date.&&GoToPage=~/Index.aspx"); return; } if (dateChinkIn_One <= DateTime.Today || dateChinkIn_Two < DateTime.Today) { this.Response.Redirect("~/Page/Common/ErrorMessage.aspx?ErrorMessage=The check-in date must occur after the today date. Please change the date.&&GoToPage=~/Index.aspx"); return; } if (dateChinkIn_One > dateChinkOut_One || dateChinkIn_One > dateChinkOut_Two) { this.Response.Redirect("~/Page/Common/ErrorMessage.aspx?ErrorMessage=The check-out date must occur after the check-in date. Please change the date.&&GoToPage=~/Index.aspx"); return; } if (dateChinkOut_One > dateChinkIn_Two) { this.Response.Redirect("~/Page/Common/ErrorMessage.aspx?ErrorMessage=The second destination check-in date must occur after the first destination check-out date. Please change the date.&&GoToPage=~/Index.aspx"); return; } if (dateDeparture > dateChinkIn_One || dateDeparture > dateChinkIn_Two) { this.Response.Redirect("~/Page/Common/ErrorMessage.aspx?ErrorMessage=The departure date must occur before the check-in date. Please change the date.&&GoToPage=~/Index.aspx"); return; } if (dateReturn < dateChinkOut_One || dateReturn < dateChinkOut_Two) { this.Response.Redirect("~/Page/Common/ErrorMessage.aspx?ErrorMessage=The return date must occur after the check-out date. Please change the date.&&GoToPage=~/Index.aspx"); return; } //Utility.SelectAirGroup = null; PackageSearchCondition PacakgeSearch = new PackageSearchCondition(); HotelSearchCondition hotelSearchCondition2 = new HotelSearchCondition(); PacakgeSearch.DepatrueAirPorts = new List<Terms.Common.Domain.Airport>(); if (txtDepartureFrom.Text.Trim().Length > 3) { IList departureAirPorts = _commonService.FindAirportByCityName(txtDepartureFrom.Text.Trim()); if (departureAirPorts.Count >= 1) { PacakgeSearch.DepatrueAirPorts = departureAirPorts; } else { List<Terms.Common.Domain.Airport> airportList = _ApplicationCacheFoundationDate.FindAllAirport(); Terms.Common.Domain.Airport airport = MatchAirport(txtDepartureFrom.Text.Trim(), airportList); if (airport != null) { PacakgeSearch.DepatrueAirPorts.Add(airport); } } } else { //PacakgeSearch.DepatrueAirPorts.Add(AirService.CommAirportDao.FindByAirport(txtDepartureFrom.Text.Trim())); Terms.Common.Domain.Airport airport = AirService.CommAirportDao.FindByAirport(txtDepartureFrom.Text.Trim()); if (airport != null) { PacakgeSearch.DepatrueAirPorts.Add(airport); } else { IList departureAirPorts = AirService.CommAirportDao.FindByCityCode(txtDepartureFrom.Text.Trim()); if (departureAirPorts.Count >= 1) { PacakgeSearch.DepatrueAirPorts = departureAirPorts; } } } //IList departureAirPorts = _commonService.FindAirportByCityName(this.txtDepartureFrom.Text); //PacakgeSearch.DepatrueAirPorts = departureAirPorts; PacakgeSearch.DestinationAirPorts = new List<Terms.Common.Domain.Airport>(); if (txtDestinationOne.Text.Trim().Length > 3) { IList DestinationOneAirPorts = _commonService.FindAirportByCityName(txtDestinationOne.Text.Trim()); if (DestinationOneAirPorts.Count >= 1) { PacakgeSearch.DestinationAirPorts = DestinationOneAirPorts; } else { List<Terms.Common.Domain.Airport> airportList = _ApplicationCacheFoundationDate.FindAllAirport(); Terms.Common.Domain.Airport airport = MatchAirport(txtDestinationOne.Text.Trim(), airportList); if (airport != null) { PacakgeSearch.DestinationAirPorts.Add(airport); } } } else { Terms.Common.Domain.Airport airport = AirService.CommAirportDao.FindByAirport(txtDestinationOne.Text.Trim()); if (airport != null) { PacakgeSearch.DestinationAirPorts.Add(airport); } else { IList DestinationOneAirPorts = AirService.CommAirportDao.FindByCityCode(txtDestinationOne.Text.Trim()); if (DestinationOneAirPorts.Count >= 1) { PacakgeSearch.DestinationAirPorts = DestinationOneAirPorts; } } } //IList DestinationOneAirPorts = _commonService.FindAirportByCityName(this.txtDestinationOne.Text); //PacakgeSearch.DestinationAirPorts = DestinationOneAirPorts; PacakgeSearch.DestinationAirPortsTwo = new List<Terms.Common.Domain.Airport>(); if (txtDestinationTwo.Text.Trim().Length > 3) { IList ReturnAirPorts = _commonService.FindAirportByCityName(txtDestinationTwo.Text.Trim()); if (ReturnAirPorts.Count >= 1) { PacakgeSearch.DestinationAirPortsTwo = ReturnAirPorts; } else { List<Terms.Common.Domain.Airport> airportList = _ApplicationCacheFoundationDate.FindAllAirport(); Terms.Common.Domain.Airport airport = MatchAirport(txtDestinationTwo.Text.Trim(), airportList); if (airport != null) { PacakgeSearch.DestinationAirPortsTwo.Add(airport); } } } else { Terms.Common.Domain.Airport airport = AirService.CommAirportDao.FindByAirport(txtDestinationTwo.Text.Trim()); if (airport != null) { PacakgeSearch.DestinationAirPortsTwo.Add(airport); } else { IList ReturnAirPorts = AirService.CommAirportDao.FindByCityCode(txtDestinationTwo.Text.Trim()); if (ReturnAirPorts.Count >= 1) { PacakgeSearch.DestinationAirPortsTwo = ReturnAirPorts; } } } //IList ReturnAirPorts = _commonService.FindAirportByCityName(this.txtDestinationTwo.Text); //PacakgeSearch.DestinationAirPortsTwo = ReturnAirPorts; PacakgeSearch.AirSearchCondition.SetPassengerNumber(TERMS.Common.PassengerType.Adult, TravelerChange1.TotalAdults); PacakgeSearch.AirSearchCondition.SetPassengerNumber(TERMS.Common.PassengerType.Child, TravelerChange1.TotalChilds); //�ж�����ij����غ�Ŀ�ĵ���û�л��� if (PacakgeSearch.DepatrueAirPorts.Count == 0) { Response.Redirect("~/Page/Common/ErrorMessage.aspx?ErrorMessage=We found no matches for \"" + this.txtDepartureFrom.Text + "\"&GoToPage=PackageSearchTwoDestinations.aspx"); } if (PacakgeSearch.DestinationAirPorts.Count == 0) { Response.Redirect("~/Page/Common/ErrorMessage.aspx?ErrorMessage=We found no matches for \"" + this.txtDestinationOne.Text + "\"&GoToPage=PackageSearchTwoDestinations.aspx"); } if (PacakgeSearch.DestinationAirPortsTwo.Count == 0) { Response.Redirect("~/Page/Common/ErrorMessage.aspx?ErrorMessage=We found no matches for \"" + this.txtDestinationTwo.Text + "\"&GoToPage=PackageSearchTwoDestinations.aspx"); } for (int i = 0; i < TravelerChange1.Rooms; i++) { RoomSearchCondition roomSearchCondition = new RoomSearchCondition(); roomSearchCondition.Passengers.Add(TERMS.Common.PassengerType.Adult, TravelerChange1.Adults[i]); roomSearchCondition.Passengers.Add(TERMS.Common.PassengerType.Child, TravelerChange1.Childs[i]); PacakgeSearch.HotelSearchCondition.RoomSearchConditions.Add(roomSearchCondition); hotelSearchCondition2.RoomSearchConditions.Add(roomSearchCondition); PacakgeSearch.HotelSearchCondition2 = hotelSearchCondition2; } if (PacakgeSearch.DestinationAirPorts.Count > 0 || PacakgeSearch.DepatrueAirPorts.Count > 0 || PacakgeSearch.DestinationAirPortsTwo.Count > 0) { if (PacakgeSearch.DestinationAirPorts.Count > 1 || PacakgeSearch.DepatrueAirPorts.Count > 1 || PacakgeSearch.DestinationAirPortsTwo.Count > 1) { this.Transaction.IntKey = PacakgeSearch.GetHashCode(); this.Transaction.CurrentSearchConditions = PacakgeSearch; //��������� MoreAirportsSelect(); this.btnSearch.Visible = false; this.btnSearch1.Visible = true; } else { PacakgeSearch.HotelSearchCondition.CheckIn = Convert.ToDateTime(this.dateCheckInOne.CDate); PacakgeSearch.HotelSearchCondition.CheckOut = Convert.ToDateTime(this.dateCheckOutOne.CDate); hotelSearchCondition2.CheckIn = Convert.ToDateTime(this.dateCheckInTwo.CDate); hotelSearchCondition2.CheckOut = Convert.ToDateTime(this.dateCheckOutTwo.CDate); PacakgeSearch.HotelSearchCondition.Location = ((Terms.Common.Domain.Airport)PacakgeSearch.DestinationAirPorts[0]).CityCode; //((City)_commonService.FindCitiesByName(this.txtDestinationOne.Text)[0]).Code;// "PVG"; hotelSearchCondition2.Location = ((Terms.Common.Domain.Airport)PacakgeSearch.DestinationAirPortsTwo[0]).CityCode; //((City)_commonService.FindCitiesByName(this.txtDestinationTwo.City)[0]).Code;// "PVG"; PacakgeSearch.HotelSearchCondition.LocationIndicator = TERMS.Common.LocationIndicator.City; hotelSearchCondition2.LocationIndicator = TERMS.Common.LocationIndicator.City; PacakgeSearch.HotelSearchCondition.Country = ((Terms.Common.Domain.Airport)PacakgeSearch.DestinationAirPorts[0]).City.Country.Code; // ((City)_commonService.FindCitiesByName(this.txtDestinationTwo.City)[0]).Country.Code; hotelSearchCondition2.Country = ((Terms.Common.Domain.Airport)PacakgeSearch.DestinationAirPortsTwo[0]).City.Country.Code; //hotelSearchCondition2.Country = this.txtDestinationTwo.Text; //����Cabin TERMS.Common.CabinType cabin = new TERMS.Common.CabinType(); if (ddlClass.SelectedIndex == 0) { cabin = TERMS.Common.CabinType.Economy; } else if (ddlClass.SelectedIndex == 1) { cabin = TERMS.Common.CabinType.Business; } else if (ddlClass.SelectedIndex == 2) { cabin = TERMS.Common.CabinType.First; } AirTripCondition DPTairTripCondition = new AirTripCondition(); DPTairTripCondition.Departure = (Terms.Common.Domain.Airport)PacakgeSearch.DepatrueAirPorts[0]; DPTairTripCondition.DepartureDate = Convert.ToDateTime(this.dateDeparture.CDate); DPTairTripCondition.Destination = (Terms.Common.Domain.Airport)PacakgeSearch.DestinationAirPorts[0]; DPTairTripCondition.IsDepartureTimeSpecified = this.chbFlexible.Checked; DPTairTripCondition.Cabin = cabin; PacakgeSearch.AirSearchCondition.AddTripCondition(DPTairTripCondition); PacakgeSearch.AirSearchCondition.Airlines = null; AirTripCondition RTNairTripCondition = new AirTripCondition(); RTNairTripCondition.Departure = (Terms.Common.Domain.Airport)PacakgeSearch.DestinationAirPortsTwo[0]; RTNairTripCondition.DepartureDate = Convert.ToDateTime(this.dateReturn.CDate); RTNairTripCondition.Destination = (Terms.Common.Domain.Airport)PacakgeSearch.DepatrueAirPorts[0]; RTNairTripCondition.IsDepartureTimeSpecified = this.chbFlexible.Checked; RTNairTripCondition.Cabin = cabin; PacakgeSearch.AirSearchCondition.AddTripCondition(RTNairTripCondition); PacakgeSearch.AirSearchCondition.FlightType = "openjaw"; //PacakgeSearch.AirSearchCondition.ProductType = Terms.Base.Utility.ProductType.Package; this.Transaction.IntKey = PacakgeSearch.GetHashCode(); this.Transaction.CurrentSearchConditions = PacakgeSearch; this.Transaction.CurrentTransactionObject = new TERMS.Business.Centers.SalesCenter.TransactionObject(); //PacakgeSearch.OptionalHotelSearchConditions.Clear();Ҫɾ������ȫ��ɾ�� PacakgeSearch.SetOptionalHotelSearchConditions(hotelSearchCondition2); //��¼Search Package�¼� if(Utility.IsSubAgent) OperaterAdvice.DoAdvice(Terms.Configuration.Utility.ConfigurationConst.OperateType.SUB_SearchPackage, this); else OperaterAdvice.DoAdvice(Terms.Configuration.Utility.ConfigurationConst.OperateType.MV_SearchPackage, this); this.Page.Response.Redirect("~/Page/Common/Searching1.aspx?target=~/Page/Package2/SelectRoomRates" + "&ConditionID=" + this.Transaction.IntKey.ToString()); } } else { } }
protected void btn_Search_AH_Click(object sender, EventArgs e) { if (Utility.IsSubAgent) OperaterAdvice.DoAdvice(Terms.Configuration.Utility.ConfigurationConst.OperateType.SUB_SearchPackage, this); else OperaterAdvice.DoAdvice(Terms.Configuration.Utility.ConfigurationConst.OperateType.MV_SearchPackage, this); if (!Page.IsValid) return; DateTime dateDept_A = Convert.ToDateTime(this.dateDeparture_AH.CDate); DateTime dateRtn_A = Convert.ToDateTime(this.dateReturn_AH.CDate); DateTime dateChinkIn_H; DateTime dateChinkOut_H; Session["CurrentSession"] = new SessionClass(); SessionClass sc = (SessionClass)Session["CurrentSession"]; if (txtFullFrom_AH.Text.Trim().Length == 0) { div_1.Visible = true; lblError1.Text = Resources.HintInfo.Package_Error_City1; return; } if (txtFullTo_AH.Text.Length == 0) { div_1.Visible = true; lblError1.Text += "<BR>" + Resources.HintInfo.Package_Error_City2; return; } txtFrom_AH.Text = ConvertName(txtFullFrom_AH.Text); txtTo_AH.Text = ConvertName(txtFullTo_AH.Text); //Utility.SelectAirGroup = null; PackageSearchCondition PacakgeSearch = new PackageSearchCondition(); PacakgeSearch.IsReset = true; PacakgeSearch.DepatrueAirPorts = new List<Terms.Common.Domain.Airport>(); if (txtFrom_AH.Text.Trim().Length > 3) { IList departureAirPorts = _CommonService.FindAirportByCityName(txtFrom_AH.Text.Trim()); if (departureAirPorts.Count >= 1) { PacakgeSearch.DepatrueAirPorts = departureAirPorts; sc.FromAirports = departureAirPorts; } else { List<Terms.Common.Domain.Airport> airportList = _ApplicationCacheFoundationDate.FindAllAirport(); Terms.Common.Domain.Airport airport = MatchAirport(txtFrom_AH.Text.Trim(), airportList); if (airport != null) { PacakgeSearch.DepatrueAirPorts.Add(airport); } } } else { //PacakgeSearch.DepatrueAirPorts.Add(AirService.CommAirportDao.FindByAirport(txtDepartureFrom.Text.Trim())); Terms.Common.Domain.Airport airport = AirService.CommAirportDao.FindByAirport(txtFrom_AH.Text.Trim()); if (airport != null) { PacakgeSearch.DepatrueAirPorts.Add(airport); } else { IList departureAirPorts = AirService.CommAirportDao.FindByCityCode(txtFrom_AH.Text.Trim()); if (departureAirPorts.Count >= 1) { PacakgeSearch.DepatrueAirPorts = departureAirPorts; } } } PacakgeSearch.DestinationAirPorts = new List<Terms.Common.Domain.Airport>(); if (txtTo_AH.Text.Trim().Length > 3) { IList DestinationOneAirPorts = _CommonService.FindAirportByCityName(txtTo_AH.Text.Trim()); if (DestinationOneAirPorts.Count >= 1) { PacakgeSearch.DestinationAirPorts = DestinationOneAirPorts; sc.ToAirports = DestinationOneAirPorts; } else { List<Terms.Common.Domain.Airport> airportList = _ApplicationCacheFoundationDate.FindAllAirport(); Terms.Common.Domain.Airport airport = MatchAirport(txtTo_AH.Text.Trim(), airportList); if (airport != null) { PacakgeSearch.DestinationAirPorts.Add(airport); } } } else { Terms.Common.Domain.Airport airport = AirService.CommAirportDao.FindByAirport(txtTo_AH.Text.Trim()); if (airport != null) { PacakgeSearch.DestinationAirPorts.Add(airport); } else { IList DestinationOneAirPorts = AirService.CommAirportDao.FindByCityCode(txtTo_AH.Text.Trim()); if (DestinationOneAirPorts.Count >= 1) { PacakgeSearch.DestinationAirPorts = DestinationOneAirPorts; } } } PacakgeSearch.AirSearchCondition.SetPassengerNumber(TERMS.Common.PassengerType.Adult, TravelerChange1.TotalAdults); PacakgeSearch.AirSearchCondition.SetPassengerNumber(TERMS.Common.PassengerType.Child, TravelerChange1.TotalChilds); //�ж�����ij����غ�Ŀ�ĵ���û�л��� if (PacakgeSearch.DepatrueAirPorts.Count == 0) { div_1.Visible = true; lblError1.Text += "<BR>" + Resources.HintInfo.Package_Error_City3; return; } if (PacakgeSearch.DestinationAirPorts.Count == 0) { div_1.Visible = true; lblError1.Text += "<BR>" + Resources.HintInfo.Package_Error_City4; return; } //���Ŀ�ĵصĹ����������ͼ��ô���ô�Ƶ����ס���ھ��dz������ڡ� if (this.CheckIn_AH.CDate == "__/__/____" || this.CheckIn_AH.CDate == "") { if (((Terms.Common.Domain.Airport)PacakgeSearch.DestinationAirPorts[0]).City.CountryCode == "US" || ((Terms.Common.Domain.Airport)PacakgeSearch.DestinationAirPorts[0]).City.CountryCode == "CA") { dateChinkIn_H = dateDept_A; } else { dateChinkIn_H = dateDept_A.AddDays(1); //��Check inΪ�գ���Ĭ��ΪAir�������ڼ�һ�� } } else dateChinkIn_H = Convert.ToDateTime(this.CheckIn_AH.CDate); if (this.CheckOut_AH.CDate == "__/__/____" || this.CheckOut_AH.CDate == "") dateChinkOut_H = dateRtn_A; //��Check outΪ�գ���Ĭ��ΪAir�������� else dateChinkOut_H = Convert.ToDateTime(this.CheckOut_AH.CDate); if (!ckbHotel.Checked) { dateChinkIn_H = dateDept_A.AddDays(1); dateChinkOut_H = dateRtn_A; } if (dateDept_A < DateTime.Now.AddDays(7)) { div_2.Visible = true; lblError2.Text = Resources.HintInfo.Package_Date_Error1; return; } if (dateRtn_A < DateTime.Now.AddDays(7)) { div_2.Visible = true; lblError2.Text = Resources.HintInfo.Package_Date_Error2; return; } if (dateChinkIn_H < DateTime.Now.AddDays(7)) { div_2.Visible = true; lblError2.Text = Resources.HintInfo.Package_Date_Error3; return; } if (dateChinkOut_H < DateTime.Now.AddDays(7)) { div_2.Visible = true; lblError2.Text = Resources.HintInfo.Package_Date_Error4; return; } if (dateChinkIn_H <= DateTime.Today) { div_2.Visible = true; lblError2.Text = Resources.HintInfo.Package_Date_Error5; return; } if (dateChinkIn_H > dateChinkOut_H) { div_2.Visible = true; lblError2.Text = Resources.HintInfo.Package_Date_Error6; return; } if (dateDept_A >= dateRtn_A) { div_2.Visible = true; lblError2.Text = Resources.HintInfo.Package_Date_Error7; return; } if (dateDept_A > dateChinkIn_H) { div_2.Visible = true; lblError2.Text = Resources.HintInfo.Package_Date_Error8; return; } if (dateChinkOut_H > dateRtn_A) { div_2.Visible = true; lblError2.Text = Resources.HintInfo.Package_Date_Error9; return; } for (int i = 0; i < TravelerChange1.Rooms; i++) { RoomSearchCondition roomSearchCondition = new RoomSearchCondition(); roomSearchCondition.Passengers.Add(TERMS.Common.PassengerType.Adult, TravelerChange1.Adults[i]); roomSearchCondition.Passengers.Add(TERMS.Common.PassengerType.Child, TravelerChange1.Childs[i]); PacakgeSearch.HotelSearchCondition.RoomSearchConditions.Add(roomSearchCondition); } if (PacakgeSearch.DestinationAirPorts.Count > 0 || PacakgeSearch.DepatrueAirPorts.Count > 0) { PacakgeSearch.HotelSearchCondition.CheckIn = dateChinkIn_H.AddDays(0); PacakgeSearch.HotelSearchCondition.CheckOut = dateChinkOut_H; PacakgeSearch.HotelSearchCondition.Location = ((Terms.Common.Domain.Airport)PacakgeSearch.DestinationAirPorts[0]).CityCode;// "PVG"; PacakgeSearch.HotelSearchCondition.LocationIndicator = TERMS.Common.LocationIndicator.City; PacakgeSearch.HotelSearchCondition.Country = ((Terms.Common.Domain.Airport)PacakgeSearch.DestinationAirPorts[0]).City.Country.Code; AirTripCondition DPTairTripCondition = new AirTripCondition(); DPTairTripCondition.Departure = (Airport)PacakgeSearch.DepatrueAirPorts[0]; DPTairTripCondition.DepartureDate = Convert.ToDateTime(this.dateDeparture_AH.CDate); DPTairTripCondition.Destination = (Airport)PacakgeSearch.DestinationAirPorts[0]; DPTairTripCondition.IsDepartureTimeSpecified = this.chbFlexible_AH.Checked; PacakgeSearch.AirSearchCondition.AddTripCondition(DPTairTripCondition); AirTripCondition RTNairTripCondition = new AirTripCondition(); RTNairTripCondition.Departure = (Airport)PacakgeSearch.DestinationAirPorts[0]; RTNairTripCondition.DepartureDate = Convert.ToDateTime(this.dateReturn_AH.CDate); RTNairTripCondition.Destination = (Airport)PacakgeSearch.DepatrueAirPorts[0]; RTNairTripCondition.IsDepartureTimeSpecified = this.chbFlexible_AH.Checked; PacakgeSearch.AirSearchCondition.AddTripCondition(RTNairTripCondition); PacakgeSearch.AirSearchCondition.FlightType = "roundtrip"; if (ddlAirline.SelectedValue != "all") { PacakgeSearch.AirSearchCondition.Airlines = new string[1] { ddlAirline.SelectedValue.Trim() }; } else { PacakgeSearch.AirSearchCondition.Airlines = null; } Utility.IsTourMain = false;//�����Ƿ���Tour��־ this.Transaction.IntKey = PacakgeSearch.GetHashCode(); this.Transaction.CurrentSearchConditions = PacakgeSearch; this.Transaction.CurrentTransactionObject = new TERMS.Business.Centers.SalesCenter.TransactionObject(); //����Cabin TERMS.Common.CabinType cabin = new TERMS.Common.CabinType(); if (rdoLstCabin_AH.SelectedIndex == 0) { cabin = TERMS.Common.CabinType.Economy; } else if (rdoLstCabin_AH.SelectedIndex == 1) { cabin = TERMS.Common.CabinType.Business; } else if (rdoLstCabin_AH.SelectedIndex == 2) { cabin = TERMS.Common.CabinType.First; } for (int i = 0; i < PacakgeSearch.AirSearchCondition.AirTripCondition.Count; i++) PacakgeSearch.AirSearchCondition.AirTripCondition[i].Cabin = cabin; sc.CurrentItinerary.SearchInfo = PacakgeSearch.AirSearchCondition; ForbiddenAirportControl fAH = new ForbiddenAirportControl(); bool IsErrorAirH = fAH.HasForbiddenAirport(sc); if (IsErrorAirH) { div_3.Visible = true; lblError3.Text = Resources.HintInfo.ForbiddenAirport; ; } if (PacakgeSearch.DestinationAirPorts.Count > 1 || PacakgeSearch.DepatrueAirPorts.Count > 1) { this.Page.Response.Redirect("~/Page/Package/PackageSearchMoreForm.aspx?ConditionID=" + this.Transaction.IntKey.ToString()); } else { Utility.Transaction.Difference.Clear(); Utility.Transaction.Difference.FromTime = DateTime.Now; Utility.Transaction.Difference.StarTime = DateTime.Now; Utility.Transaction.Difference.From = "PackageSearchMoreForm Redirect Start"; this.Page.Response.Redirect("~/Page/Common/Searching1.aspx?target=~/Page/Package2/ViewYourPackages" + "&ConditionID=" + this.Transaction.IntKey.ToString()); } } else { } }