private void CreateCondition() { bool IsSelectAirport = false; bool IsRealCity = true; Session["CurrentSession"] = new SessionClass(); SessionClass sc = (SessionClass)Session["CurrentSession"]; AirSearchCondition airSearchCondition = new AirSearchCondition(); airSearchCondition.SetPassengerNumber(PassengerType.Adult, Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["Adults"])); CabinType cabin = new CabinType(); cabin = CabinType.All; airSearchCondition.SetPassengerNumber(PassengerType.Child, Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["Childs"])); airSearchCondition.FlightType = "roundtrip"; airSearchCondition.FlexibleDays = 0; AirTripCondition deptCondition = new AirTripCondition(); deptCondition.Cabin = cabin; string depCity = ""; sc.FromCityName = depCity; if (depCity.Length > 3) { IList departureAirPorts = _CommonService.FindAirportByCityName(depCity); if (departureAirPorts.Count > 1) { IsSelectAirport = true; sc.FromAirports = departureAirPorts; } else if (departureAirPorts.Count == 1) { deptCondition.Departure = (Terms.Common.Domain.Airport)departureAirPorts[0]; } else { List<Terms.Common.Domain.Airport> airportList = _ApplicationCacheFoundationDate.FindAllAirport(); Terms.Common.Domain.Airport airport = MatchAirport(depCity, airportList); if (airport != null) deptCondition.Departure = airport; else sc.IsRealFromCity = IsRealCity = false; } } else { deptCondition.Departure = AirService.CommAirportDao.FindByAirport(depCity.Trim()); if (deptCondition.Departure == null) { deptCondition.Departure = new Terms.Common.Domain.Airport(); deptCondition.Departure.Code = depCity; } } deptCondition.DepartureDate = GlobalUtility.GetDateTime(DateTime.Now.AddDays(14).ToString("MM/dd/yyyy", DateTimeFormatInfo.InvariantInfo)); string toCity = this.Request["ToCity"]; sc.ToCityName = toCity; if (toCity.Length > 3) { IList destinationAirPorts = _CommonService.FindAirportByCityName(toCity); if (destinationAirPorts.Count > 1) { IsSelectAirport = true; sc.ToAirports = destinationAirPorts; } else if (destinationAirPorts.Count == 1) { deptCondition.Destination = (Terms.Common.Domain.Airport)destinationAirPorts[0]; } else { List<Terms.Common.Domain.Airport> airportList = _ApplicationCacheFoundationDate.FindAllAirport(); Terms.Common.Domain.Airport airport = MatchAirport(toCity, airportList); if (airport != null) deptCondition.Destination = airport; else sc.IsRealToCity = IsRealCity = false; } } else { deptCondition.Destination = AirService.CommAirportDao.FindByAirport(toCity); if (deptCondition.Destination == null) { deptCondition.Destination = new Terms.Common.Domain.Airport(); deptCondition.Destination.Code = toCity; } } AirTripCondition rtnCondition = new AirTripCondition(); rtnCondition.Cabin = cabin; rtnCondition.Departure = deptCondition.Destination; rtnCondition.Destination = deptCondition.Departure; rtnCondition.DepartureDate = GlobalUtility.GetDateTime(DateTime.Now.AddDays(21).ToString("MM/dd/yyyy", DateTimeFormatInfo.InvariantInfo)); airSearchCondition.AddTripCondition(deptCondition); airSearchCondition.AddTripCondition(rtnCondition); sc.CurrentItinerary.SearchInfo = airSearchCondition; this.Transaction.CurrentSearchConditions = airSearchCondition; this.Transaction.CurrentTransactionObject = new TERMS.Business.Centers.SalesCenter.TransactionObject(); if (!IsRealCity) { Response.Redirect("~/Page/Flight/SearchConditionsMeaasageForm.aspx?TYPE=Promos"); } Response.Redirect("~/Page/Flight/SearchConditionsMeaasageForm.aspx?TYPE=Promos"); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btn_Search_Click(object sender, EventArgs e) { if (CheckSearch() == true) { if (!Page.IsValid) return; log.Info("\r\n"); System.Random rd = new Random(); Session["LOG_RANDOM"] = rd.Next(999999999); if (!Utility.IsLogin) { log.Info(Session["LOG_RANDOM"].ToString() + " >==================Not Login=============================="); } else { log.Info(Session["LOG_RANDOM"].ToString() + " >==================Login=============================="); } bool IsSelectAirport = false; bool IsRealCity = true; SessionClass sc = new SessionClass(); AirSearchCondition airSearchCondition = new AirSearchCondition(); airSearchCondition.SetPassengerNumber(PassengerType.Adult, Convert.ToInt32(ddlAdult.SelectedValue)); airSearchCondition.SetPassengerNumber(PassengerType.Child, Convert.ToInt32(ddlChild.SelectedValue)); airSearchCondition.SetPassengerNumber(PassengerType.Infant, Convert.ToInt32(ddlInfant.SelectedValue)); SessionClass CurrentSession = (SessionClass)Session["CurrentSession"]; airSearchCondition.FlightType = FlightType.Value.Trim(); airSearchCondition.FlexibleDays = 0; CabinType cabin = new CabinType(); if (ddlClass.SelectedIndex == 0) { cabin = CabinType.All; } else if (ddlClass.SelectedIndex == 1) { cabin = CabinType.Economy; } else if (ddlClass.SelectedIndex == 2) { cabin = CabinType.Business; } else if (ddlClass.SelectedIndex == 3) { cabin = CabinType.First; } AirTripCondition deptCondition = new AirTripCondition(); deptCondition.Cabin = cabin; deptCondition.DepartureDate = GlobalUtility.GetDateTime(this.depCalendar.CDate.Trim()); bool IsDataError = true; if (deptCondition.DepartureDate < DateTime.Now.AddDays(3)) { IsRealCity = false; IsDataError = false; } sc.FromCityName = ltxFrom.City.Trim(); if (ltxFrom.City.Trim().Length > 3) { IList departureAirPorts = _CommonService.FindAirportByCityName(ltxFrom.City.Trim()); if (departureAirPorts.Count > 1) { IsSelectAirport = true; sc.FromAirports = departureAirPorts; } else if (departureAirPorts.Count == 1) { deptCondition.Departure = (Terms.Common.Domain.Airport)departureAirPorts[0]; } else { List<Terms.Common.Domain.Airport> airportList = _ApplicationCacheFoundationDate.FindAllAirport(); Terms.Common.Domain.Airport airport = MatchAirport(ltxFrom.City.Trim(), airportList); if (airport != null) deptCondition.Departure = airport; else sc.IsRealFromCity = IsRealCity = false; } } else { deptCondition.Departure = AirService.CommAirportDao.FindByAirport(ltxFrom.City.Trim()); if (deptCondition.Departure == null) { deptCondition.Departure = new Terms.Common.Domain.Airport(); deptCondition.Departure.Code = ltxFrom.City.Trim(); } } sc.ToCityName = ltxTo.City.Trim(); if (ltxTo.City.Trim().Length > 3) { IList destinationAirPorts = _CommonService.FindAirportByCityName(ltxTo.City.Trim()); if (destinationAirPorts.Count > 1) { IsSelectAirport = true; sc.ToAirports = destinationAirPorts; } else if (destinationAirPorts.Count == 1) { deptCondition.Destination = (Terms.Common.Domain.Airport)destinationAirPorts[0]; } else { List<Terms.Common.Domain.Airport> airportList = _ApplicationCacheFoundationDate.FindAllAirport(); Terms.Common.Domain.Airport airport = MatchAirport(ltxTo.City.Trim(), airportList); if (airport != null) deptCondition.Destination = airport; else sc.IsRealToCity = IsRealCity = false; } } else { deptCondition.Destination = AirService.CommAirportDao.FindByAirport(ltxTo.City.Trim()); if (deptCondition.Destination == null) { deptCondition.Destination = new Terms.Common.Domain.Airport(); deptCondition.Destination.Code = ltxTo.City.Trim(); } } AirTripCondition rtnCondition = new AirTripCondition(); rtnCondition.Cabin = cabin; rtnCondition.DepartureDate = GlobalUtility.GetDateTime(rtnCalendar.CDate.Trim()); if (airSearchCondition.FlightType.ToLower().Equals("oneway")) { rtnCondition.Departure = deptCondition.Destination; rtnCondition.Destination = deptCondition.Departure; rtnCondition.DepartureDate = DateTime.MaxValue; } else if (airSearchCondition.FlightType.ToLower().Equals("roundtrip")) { rtnCondition.Departure = deptCondition.Destination; rtnCondition.Destination = deptCondition.Departure; rtnCondition.DepartureDate = GlobalUtility.GetDateTime(rtnCalendar.CDate.Trim()); } else if (airSearchCondition.FlightType.ToLower().Equals("openjaw")) { rtnCondition.DepartureDate = GlobalUtility.GetDateTime(rtnCalendar.CDate.Trim()); sc.ReturnFromCityName = ltxRtnFrom.City.Trim(); if (ltxRtnFrom.City.Trim().Length > 3) { IList returnFromAirPorts = _CommonService.FindAirportByCityName(ltxRtnFrom.City.Trim()); if (returnFromAirPorts.Count > 1) { IsSelectAirport = true; sc.ReturnFromAirports = returnFromAirPorts; } else if (returnFromAirPorts.Count == 1) { rtnCondition.Departure = (Terms.Common.Domain.Airport)returnFromAirPorts[0]; } else { List<Terms.Common.Domain.Airport> airportList = _ApplicationCacheFoundationDate.FindAllAirport(); Terms.Common.Domain.Airport airport = MatchAirport(ltxTo.City.Trim(), airportList); airport = MatchAirport(ltxRtnFrom.City.Trim(), airportList); if (airport != null) rtnCondition.Departure = airport; else sc.IsRealReturnFromCity = IsRealCity = false; } } else { rtnCondition.Departure = AirService.CommAirportDao.FindByAirport(ltxRtnFrom.City.Trim()); if (rtnCondition.Departure == null) { rtnCondition.Departure = new Terms.Common.Domain.Airport(); rtnCondition.Departure.Code = ltxRtnFrom.City.Trim(); } } sc.ReturnToCityName = ltxRtnTo.City.Trim(); if (ltxRtnTo.City.Trim().Length > 3) { IList returnToAirPorts = _CommonService.FindAirportByCityName(ltxRtnTo.City.Trim()); if (returnToAirPorts.Count > 1) { IsSelectAirport = true; sc.ReturnToAirports = returnToAirPorts; } else if (returnToAirPorts.Count == 1) { rtnCondition.Destination = (Terms.Common.Domain.Airport)returnToAirPorts[0]; } else { List<Terms.Common.Domain.Airport> airportList = _ApplicationCacheFoundationDate.FindAllAirport(); Terms.Common.Domain.Airport airport = MatchAirport(ltxTo.City.Trim(), airportList); airport = MatchAirport(ltxRtnTo.City.Trim(), airportList); if (airport != null) rtnCondition.Destination = airport; else sc.IsRealReturnToCity = IsRealCity = false; } } else { rtnCondition.Destination = AirService.CommAirportDao.FindByAirport(ltxRtnTo.City.Trim()); if (rtnCondition.Destination == null) { rtnCondition.Destination = new Terms.Common.Domain.Airport(); rtnCondition.Destination.Code = ltxRtnTo.City.Trim(); } } } airSearchCondition.AddTripCondition(deptCondition); airSearchCondition.AddTripCondition(rtnCondition); airSearchCondition.Airlines = ((AirSearchCondition)Transaction.CurrentSearchConditions).Airlines; string logAirline = airSearchCondition.Airlines == null ? "All" : string.Join(",", airSearchCondition.Airlines); log.Info(Session["LOG_RANDOM"].ToString() + " >====================AirLine:" + logAirline + "==========================="); log.Info(Session["LOG_RANDOM"].ToString() + " >SearchClick Begin Start time : " + System.DateTime.Now); Utility.IsTourMain = false;//�����Ƿ���Tour��־ sc.CurrentItinerary.SearchInfo = airSearchCondition;//(AirSearchCondition)Transaction.CurrentSearchConditions; Session["CurrentSession"] = sc; if (ForbiddenAirportControl1.HasForbiddenAirport(sc)) { string[] arrayCtrlID = new string[2]; arrayCtrlID[0] = ddlAdult.ClientID; arrayCtrlID[1] = ddlChild.ClientID; ForbiddenAirportControl1.ShowMsgBox(arrayCtrlID, upSearch); } else { this.Transaction.IntKey = airSearchCondition.GetHashCode(); Transaction.CurrentSearchConditions = airSearchCondition; this.Transaction.CurrentTransactionObject = new TERMS.Business.Centers.SalesCenter.TransactionObject(); if (!IsRealCity) { if (IsDataError) { Response.Redirect("~/Page/Flight/SearchConditionsMeaasageForm.aspx"); } else { Response.Redirect("~/Page/Flight/SearchConditionsMeaasageForm.aspx?DateErrorMsg=" + Resources.HintInfo.AirDateError); } } else { if (IsSelectAirport) { if (IsDataError) { Response.Redirect("~/Page/Flight/SearchConditionsForm.aspx"); } else { Response.Redirect("~/Page/Flight/SearchConditionsForm.aspx?DateErrorMsg=" + Resources.HintInfo.AirDateError); } } else { if (Utility.IsSubAgent) OperaterAdvice.DoAdvice(Terms.Configuration.Utility.ConfigurationConst.OperateType.SUB_SearchAir, this); else OperaterAdvice.DoAdvice(Terms.Configuration.Utility.ConfigurationConst.OperateType.MV_SearchAir, this); log.Info(Session["LOG_RANDOM"].ToString() + " >Redirect Searching.aspx Begin Start time : " + System.DateTime.Now + " By "); if (IsDataError) { Response.Redirect("~/Page/Promos/PromosSearching.aspx" + "?ConditionID=" + this.Transaction.IntKey.ToString()); } else { Response.Redirect("~/Page/Promos/PromosSearching.aspx" + "?ConditionID=" + this.Transaction.IntKey.ToString() + "&DateErrorMsg=" + Resources.HintInfo.AirDateError); } } } } } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "Serarch", "<script>alert('Invaluable search condition.');</script>"); return; } }
protected void btnSearch_Click1(object sender, EventArgs e) { if (CheckSearch()) { //if (!Page.IsValid) // return; //log begin 20081017 henry Utility.IsTourMain = false; log.Info("\r\n"); System.Random rd = new Random(); Session["LOG_RANDOM"] = rd.Next(999999999); if (!Transaction.IsLogin) { log.Info(Session["LOG_RANDOM"].ToString() + " >====================Not Login========================"); } else { log.Info(Session["LOG_RANDOM"].ToString() + " >==========================Login========================"); } string logAirline = txtAirline.Text.Trim().Equals(string.Empty) ? "All" : txtAirline.Text; //log end 20081017 henry bool IsSelectAirport = false; bool IsRealCity = true; Session["CurrentSession"] = new SessionClass(); SessionClass sc = (SessionClass)Session["CurrentSession"]; AirSearchCondition airSearchCondition = new AirSearchCondition(); airSearchCondition.SetPassengerNumber(PassengerType.Adult, Convert.ToInt32(ddlAdult.SelectedValue)); CabinType cabin = new CabinType(); if (rdoLstCabin.SelectedIndex == 0) { cabin = CabinType.Economy; } else if (rdoLstCabin.SelectedIndex == 1) { cabin = CabinType.Business; } else if (rdoLstCabin.SelectedIndex == 2) { cabin = CabinType.First; } else if (rdoLstCabin.SelectedIndex == 3) { cabin = CabinType.All; } airSearchCondition.SetPassengerNumber(PassengerType.Child, Convert.ToInt32(ddlChild.SelectedValue)); //airSearchCondition.SetPassengerNumber(PassengerType.Infant, Convert.ToInt32(ddlInfant.SelectedValue)); if (rdbOneway.Checked) airSearchCondition.FlightType = "oneway"; else if (rdbOpenjaw.Checked) airSearchCondition.FlightType = "openjaw"; else airSearchCondition.FlightType = "roundtrip"; airSearchCondition.FlexibleDays = 0; AirTripCondition deptCondition = new AirTripCondition(); deptCondition.Cabin = cabin; TextBox cityDep = (TextBox)this.txtDepartureFrom.FindControl("txtCity"); TextBox cityDes = (TextBox)this.txtTo.FindControl("txtCity"); TextBox depDate = (TextBox)this.departureCalendar.FindControl("calendarDate"); sc.FromCityName = cityDep.Text.Trim(); if (cityDep.Text.Trim().Length > 3) { IList departureAirPorts = _CommonService.FindAirportByCityName(cityDep.Text.Trim()); if (departureAirPorts.Count > 1) { IsSelectAirport = true; sc.FromAirports = departureAirPorts; } else if (departureAirPorts.Count == 1) { deptCondition.Departure = (Terms.Common.Domain.Airport)departureAirPorts[0]; } else { List<Terms.Common.Domain.Airport> airportList = _ApplicationCacheFoundationDate.FindAllAirport(); Terms.Common.Domain.Airport airport = MatchAirport(cityDep.Text.Trim(), airportList); if (airport != null) deptCondition.Departure = airport; else sc.IsRealFromCity = IsRealCity = false; //Response.Redirect("ErrorMessage.aspx?ErrorMessage=We found no matches for \"" + this.txtDepCity.Value + "\"&GoToPage=~/index.aspx"); } } else { deptCondition.Departure = AirService.CommAirportDao.FindByAirport(cityDep.Text.Trim()); if (deptCondition.Departure == null) { deptCondition.Departure = new Terms.Common.Domain.Airport(); deptCondition.Departure.Code = cityDep.Text.Trim(); } } deptCondition.DepartureDate = GlobalUtility.GetDateTime(depDate.Text.Trim()); if (deptCondition.DepartureDate < DateTime.Now.AddDays(3)) { label32.Visible = false; label3.Visible = false; label2.Visible = false; lblDateErrorMsg.Visible = true; lblDateErrorMsg.Text = Resources.HintInfo.AirDateError; return; } sc.ToCityName = cityDes.Text.Trim(); if (cityDes.Text.Trim().Length > 3) { IList destinationAirPorts = _CommonService.FindAirportByCityName(cityDes.Text.Trim()); if (destinationAirPorts.Count > 1) { IsSelectAirport = true; sc.ToAirports = destinationAirPorts; } else if (destinationAirPorts.Count == 1) { deptCondition.Destination = (Terms.Common.Domain.Airport)destinationAirPorts[0]; } else { List<Terms.Common.Domain.Airport> airportList = _ApplicationCacheFoundationDate.FindAllAirport(); Terms.Common.Domain.Airport airport = MatchAirport(cityDes.Text.Trim(), airportList); if (airport != null) deptCondition.Destination = airport; else sc.IsRealToCity = IsRealCity = false; //Response.Redirect("ErrorMessage.aspx?ErrorMessage=We found no matches for \"" + this.txtDesCity.Value + "\"&GoToPage=~/index.aspx"); } } else { deptCondition.Destination = AirService.CommAirportDao.FindByAirport(cityDes.Text.Trim()); if (deptCondition.Destination == null) { deptCondition.Destination = new Terms.Common.Domain.Airport(); deptCondition.Destination.Code = cityDes.Text.Trim(); } } AirTripCondition rtnCondition = new AirTripCondition(); rtnCondition.Cabin = cabin; TextBox cityRtnFrom = (TextBox)this.txtReturnFrom.FindControl("txtCity"); TextBox cityRtnTo = (TextBox)this.txtReturnTo.FindControl("txtCity"); TextBox rtnDate = (TextBox)this.returnCalendar.FindControl("calendarDate"); if (airSearchCondition.FlightType.ToLower().Equals("oneway")) { rtnCondition.Departure = deptCondition.Destination; rtnCondition.Destination = deptCondition.Departure; rtnCondition.DepartureDate = DateTime.MaxValue; } else if (airSearchCondition.FlightType.ToLower().Equals("roundtrip")) { rtnCondition.Departure = deptCondition.Destination; rtnCondition.Destination = deptCondition.Departure; rtnCondition.DepartureDate = GlobalUtility.GetDateTime(rtnDate.Text.Trim()); } else if (airSearchCondition.FlightType.ToLower().Equals("openjaw")) { //rtnCondition.Departure = AirService.CommAirportDao.FindByAirport(txtRtnFrom.Value.Trim()); //rtnCondition.Destination = AirService.CommAirportDao.FindByAirport(txtRtnTo.Value.Trim()); rtnCondition.DepartureDate = GlobalUtility.GetDateTime(rtnDate.Text.Trim()); sc.ReturnFromCityName = cityRtnFrom.Text.Trim(); if (cityRtnFrom.Text.Trim().Length > 3) { IList returnFromAirPorts = _CommonService.FindAirportByCityName(cityRtnFrom.Text.Trim()); if (returnFromAirPorts.Count > 1) { IsSelectAirport = true; sc.ReturnFromAirports = returnFromAirPorts; } else if (returnFromAirPorts.Count == 1) { rtnCondition.Departure = (Terms.Common.Domain.Airport)returnFromAirPorts[0]; } else { List<Terms.Common.Domain.Airport> airportList = _ApplicationCacheFoundationDate.FindAllAirport(); Terms.Common.Domain.Airport airport = MatchAirport(cityRtnFrom.Text.Trim(), airportList); if (airport != null) rtnCondition.Departure = airport; else sc.IsRealReturnFromCity = IsRealCity = false; //Response.Redirect("ErrorMessage.aspx?ErrorMessage=We found no matches for \"" + this.txtRtnFrom.Value + "\"&GoToPage=~/index.aspx"); } } else { rtnCondition.Departure = AirService.CommAirportDao.FindByAirport(cityRtnFrom.Text.Trim()); if (rtnCondition.Departure == null) { rtnCondition.Departure = new Terms.Common.Domain.Airport(); rtnCondition.Departure.Code = cityRtnFrom.Text.Trim(); } } sc.ReturnToCityName = cityRtnTo.Text.Trim(); if (cityRtnTo.Text.Trim().Length > 3) { IList returnToAirPorts = _CommonService.FindAirportByCityName(cityRtnTo.Text.Trim()); if (returnToAirPorts.Count > 1) { IsSelectAirport = true; sc.ReturnToAirports = returnToAirPorts; } else if (returnToAirPorts.Count == 1) { rtnCondition.Destination = (Terms.Common.Domain.Airport)returnToAirPorts[0]; } else { List<Terms.Common.Domain.Airport> airportList = _ApplicationCacheFoundationDate.FindAllAirport(); Terms.Common.Domain.Airport airport = MatchAirport(cityRtnTo.Text.Trim(), airportList); if (airport != null) rtnCondition.Destination = airport; else sc.IsRealReturnToCity = IsRealCity = false; //Response.Redirect("ErrorMessage.aspx?ErrorMessage=We found no matches for \"" + this.txtRtnTo.Value + "\"&GoToPage=~/index.aspx"); } } else { rtnCondition.Destination = AirService.CommAirportDao.FindByAirport(cityRtnTo.Text.Trim()); if (rtnCondition.Destination == null) { rtnCondition.Destination = new Terms.Common.Domain.Airport(); rtnCondition.Destination.Code = cityRtnTo.Text.Trim(); } } } airSearchCondition.AddTripCondition(deptCondition); airSearchCondition.AddTripCondition(rtnCondition); //if (ddlAirline.SelectedItem.Text != "Search All Airlines") if (txtAirline.Text.Trim() != "") { //param.Airways = ddlAirline.SelectedValue.Split(','); airSearchCondition.Airlines = txtAirline.Text.Split(','); } sc.CurrentItinerary.SearchInfo = airSearchCondition; //this.Transaction.CurrentTransactionObject = new TERMS.Business.Centers.SalesCenter.TransactionObject(); if (ForbiddenAirportControl1.HasForbiddenAirport(sc)) { string[] arrayCtrlID = new string[2]; arrayCtrlID[0] = ddlAdult.ClientID; arrayCtrlID[1] = ddlChild.ClientID; ForbiddenAirportControl1.ShowMsgBox(arrayCtrlID, upSearch); } else { this.Transaction.IntKey = airSearchCondition.GetHashCode(); Transaction.CurrentSearchConditions = airSearchCondition; this.Transaction.CurrentTransactionObject = new TERMS.Business.Centers.SalesCenter.TransactionObject(); if (!IsRealCity) { Response.Redirect("~/Page/Flight/SearchConditionsMeaasageForm.aspx?ConditionID=" + this.Transaction.IntKey.ToString()); } else { if (IsSelectAirport) Response.Redirect("~/Page/Flight/SearchConditionsForm.aspx?ConditionID=" + this.Transaction.IntKey.ToString()); else { Response.Redirect("~/Page/Flight/Searching.aspx" + "?ConditionID=" + this.Transaction.IntKey.ToString()); } } } } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "Serarch", "<script>alert('Invaluable search condition.');</script>"); return; } }
private void SetSearchCondition(ref bool IsRealCity, ref bool IsSelectAirport) { Session["CurrentSession"] = new SessionClass(); SessionClass sc = (SessionClass)Session["CurrentSession"]; AirSearchCondition airSearchCondition = new AirSearchCondition(); airSearchCondition.SetPassengerNumber(PassengerType.Adult, Convert.ToInt32(ddlAdult.SelectedValue)); CabinType cabin = new CabinType(); if (rdoLstCabin.SelectedIndex == 0) { cabin = CabinType.Economy; } else if (rdoLstCabin.SelectedIndex == 1) { cabin = CabinType.Business; } else if (rdoLstCabin.SelectedIndex == 2) { cabin = CabinType.First; } else if (rdoLstCabin.SelectedIndex == 3) { cabin = CabinType.All; } airSearchCondition.SetPassengerNumber(PassengerType.Child, Convert.ToInt32(ddlChild.SelectedValue)); airSearchCondition.SetPassengerNumber(PassengerType.Infant, Convert.ToInt32(ddlInfant.SelectedValue)); airSearchCondition.FlightType = FlightType.Value.Trim(); airSearchCondition.FlexibleDays = 0; AirTripCondition deptCondition = new AirTripCondition(); deptCondition.Cabin = cabin; sc.FromCityName = depCity.Text.Trim(); if (depCity.Text.Trim().Length > 3) { IList departureAirPorts = _CommonService.FindAirportByCityName(depCity.Text.Trim()); if (departureAirPorts.Count > 1) { IsSelectAirport = true; sc.FromAirports = departureAirPorts; } else if (departureAirPorts.Count == 1) { deptCondition.Departure = (Terms.Common.Domain.Airport)departureAirPorts[0]; } else { List<Terms.Common.Domain.Airport> airportList = _ApplicationCacheFoundationDate.FindAllAirport(); Terms.Common.Domain.Airport airport = MatchAirport(depCity.Text.Trim(), airportList); if (airport != null) deptCondition.Departure = airport; else sc.IsRealFromCity = IsRealCity = false; //Response.Redirect("ErrorMessage.aspx?ErrorMessage=We found no matches for \"" + this.txtDepCity.Value + "\"&GoToPage=~/index.aspx"); } } else { deptCondition.Departure = AirService.CommAirportDao.FindByAirport(depCity.Text.Trim()); if (deptCondition.Departure == null) { deptCondition.Departure = new Terms.Common.Domain.Airport(); deptCondition.Departure.Code = depCity.Text.Trim(); } } deptCondition.DepartureDate = GlobalUtility.GetDateTime(depFlightCalendar.CDate.Trim()); sc.ToCityName = toCity.Text.Trim(); if (toCity.Text.Trim().Length > 3) { IList destinationAirPorts = _CommonService.FindAirportByCityName(toCity.Text.Trim()); if (destinationAirPorts.Count > 1) { IsSelectAirport = true; sc.ToAirports = destinationAirPorts; } else if (destinationAirPorts.Count == 1) { deptCondition.Destination = (Terms.Common.Domain.Airport)destinationAirPorts[0]; } else { List<Terms.Common.Domain.Airport> airportList = _ApplicationCacheFoundationDate.FindAllAirport(); Terms.Common.Domain.Airport airport = MatchAirport(toCity.Text.Trim(), airportList); if (airport != null) deptCondition.Destination = airport; else sc.IsRealToCity = IsRealCity = false; // Response.Redirect("ErrorMessage.aspx?ErrorMessage=We found no matches for \"" + this.txtDesCity.Value + "\"&GoToPage=~/index.aspx"); } } else { deptCondition.Destination = AirService.CommAirportDao.FindByAirport(toCity.Text.Trim()); if (deptCondition.Destination == null) { deptCondition.Destination = new Terms.Common.Domain.Airport(); deptCondition.Destination.Code = toCity.Text.Trim(); } } AirTripCondition rtnCondition = new AirTripCondition(); rtnCondition.Cabin = cabin; if (airSearchCondition.FlightType.ToLower().Equals("oneway")) { rtnCondition.Departure = deptCondition.Destination; rtnCondition.Destination = deptCondition.Departure; rtnCondition.DepartureDate = DateTime.MaxValue; } else if (airSearchCondition.FlightType.ToLower().Equals("roundtrip")) { rtnCondition.Departure = deptCondition.Destination; rtnCondition.Destination = deptCondition.Departure; rtnCondition.DepartureDate = GlobalUtility.GetDateTime(rtnFlightCalendar.CDate.Trim()); } else if (airSearchCondition.FlightType.ToLower().Equals("openjaw")) { //rtnCondition.Departure = AirService.CommAirportDao.FindByAirport(txtRtnFrom.Value.Trim()); //rtnCondition.Destination = AirService.CommAirportDao.FindByAirport(txtRtnTo.Value.Trim()); rtnCondition.DepartureDate = GlobalUtility.GetDateTime(rtnFlightCalendar.CDate.Trim()); sc.ReturnFromCityName = rtnFromCity.Text.Trim(); if (rtnFromCity.Text.Trim().Length > 3) { IList returnFromAirPorts = _CommonService.FindAirportByCityName(rtnFromCity.Text.Trim()); if (returnFromAirPorts.Count > 1) { IsSelectAirport = true; sc.ReturnFromAirports = returnFromAirPorts; } else if (returnFromAirPorts.Count == 1) { rtnCondition.Departure = (Terms.Common.Domain.Airport)returnFromAirPorts[0]; } else { List<Terms.Common.Domain.Airport> airportList = _ApplicationCacheFoundationDate.FindAllAirport(); Terms.Common.Domain.Airport airport = MatchAirport(rtnFromCity.Text.Trim(), airportList); if (airport != null) rtnCondition.Departure = airport; else sc.IsRealReturnFromCity = IsRealCity = false; //Response.Redirect("ErrorMessage.aspx?ErrorMessage=We found no matches for \"" + this.txtRtnFrom.Value + "\"&GoToPage=~/index.aspx"); } } else { rtnCondition.Departure = AirService.CommAirportDao.FindByAirport(rtnFromCity.Text.Trim()); if (rtnCondition.Departure == null) { rtnCondition.Departure = new Terms.Common.Domain.Airport(); rtnCondition.Departure.Code = rtnFromCity.Text.Trim(); } } sc.ReturnToCityName = rtnToCity.Text.Trim(); if (rtnToCity.Text.Trim().Length > 3) { IList returnToAirPorts = _CommonService.FindAirportByCityName(rtnToCity.Text.Trim()); if (returnToAirPorts.Count > 1) { IsSelectAirport = true; sc.ReturnToAirports = returnToAirPorts; } else if (returnToAirPorts.Count == 1) { rtnCondition.Destination = (Terms.Common.Domain.Airport)returnToAirPorts[0]; } else { List<Terms.Common.Domain.Airport> airportList = _ApplicationCacheFoundationDate.FindAllAirport(); Terms.Common.Domain.Airport airport = MatchAirport(rtnToCity.Text.Trim(), airportList); if (airport != null) rtnCondition.Destination = airport; else sc.IsRealReturnToCity = IsRealCity = false; //Response.Redirect("ErrorMessage.aspx?ErrorMessage=We found no matches for \"" + this.txtRtnTo.Value + "\"&GoToPage=~/index.aspx"); } } else { rtnCondition.Destination = AirService.CommAirportDao.FindByAirport(rtnToCity.Text.Trim()); if (rtnCondition.Destination == null) { rtnCondition.Destination = new Terms.Common.Domain.Airport(); rtnCondition.Destination.Code = rtnToCity.Text.Trim(); } } } airSearchCondition.AddTripCondition(deptCondition); airSearchCondition.AddTripCondition(rtnCondition); //if (ddlAirline.SelectedItem.Text != "Search All Airlines") if (txtAirline.Text.Trim() != "") { //param.Airways = ddlAirline.SelectedValue.Split(','); airSearchCondition.Airlines = txtAirline.Text.Split(','); } sc.CurrentItinerary.SearchInfo = airSearchCondition; Utility.IsTourMain = false;//设置是否是Tour标志 this.Transaction.IntKey = airSearchCondition.GetHashCode(); this.Transaction.CurrentSearchConditions = airSearchCondition; this.Transaction.CurrentTransactionObject = new TERMS.Business.Centers.SalesCenter.TransactionObject(); }
private void SearchAllType() { if (Request["searchtype"] == null || Request["searchtype"].Trim().Length == 0) { return; } string searchtype = Request["searchtype"].Trim(); switch (searchtype) { case "A": string depCity = ConvertName(Request["fromcity"].Trim()); string toCity = ConvertName(Request["tocity"].Trim()); string rtnFromCity = ConvertName(Request["rtnfromah"].Trim()); string rtnToCity = ConvertName(Request["rtntoah"].Trim()); //log begin 20090312 Leon log.Info("\r\n"); System.Random rd = new Random(); Session["LOG_RANDOM"] = rd.Next(999999999); if (!Utility.IsLogin) { log.Info(Session["LOG_RANDOM"].ToString() + " >====================Not Login========================"); } else { log.Info(Session["LOG_RANDOM"].ToString() + " >==========================Login========================"); } string logAirline = Request["aircode"].Trim().Trim().Equals(string.Empty) ? "All" : Request["aircode"].Trim(); log.Info(Session["LOG_RANDOM"].ToString() + " >==========================AirLine:" + logAirline + "========================"); log.Info(Session["LOG_RANDOM"].ToString() + " >SearchClick Begin Start time : " + System.DateTime.Now); //log end 20090312 Leon if (Utility.IsSubAgent) OperaterAdvice.DoAdvice(Terms.Configuration.Utility.ConfigurationConst.OperateType.SUB_SearchAir, this); else OperaterAdvice.DoAdvice(Terms.Configuration.Utility.ConfigurationConst.OperateType.MV_SearchAir, this); Session["HasReminder"] = true; //if (!Page.IsValid) // return; bool IsSelectAirport = false; bool IsRealCity = true; Session["CurrentSession"] = new SessionClass(); SessionClass sc = (SessionClass)Session["CurrentSession"]; AirSearchCondition airSearchCondition = new AirSearchCondition(); airSearchCondition.SetPassengerNumber(PassengerType.Adult, Convert.ToInt32(Convert.ToInt32(Request["adults"].Trim()))); CabinType cabinA = new CabinType(); if (Request["airclass"].Trim() == "ECONOMY") { cabinA = CabinType.Economy; } else if (Request["airclass"].Trim() == "BUSINESS") { cabinA = CabinType.Business; } else if (Request["airclass"].Trim() == "FIRST") { cabinA = CabinType.First; } else { cabinA = CabinType.All; } airSearchCondition.SetPassengerNumber(PassengerType.Child, Convert.ToInt32(Convert.ToInt32(Request["children"].Trim()))); airSearchCondition.FlightType = Request["airtype"].Trim(); airSearchCondition.FlexibleDays = 0; AirTripCondition deptCondition = new AirTripCondition(); deptCondition.Cabin = cabinA; sc.FromCityName = depCity.Trim(); if (depCity.Trim().Length > 3) { IList departureAirPorts = _CommonService.FindAirportByCityName(depCity.Trim()); if (departureAirPorts.Count > 1) { IsSelectAirport = true; sc.FromAirports = departureAirPorts; } else if (departureAirPorts.Count == 1) { deptCondition.Departure = (Terms.Common.Domain.Airport)departureAirPorts[0]; } else { List<Terms.Common.Domain.Airport> airportList = _ApplicationCacheFoundationDate.FindAllAirport(); Terms.Common.Domain.Airport airport = MatchAirport(depCity.Trim(), airportList); if (airport != null) deptCondition.Departure = airport; else sc.IsRealFromCity = IsRealCity = false; //Response.Redirect("ErrorMessage.aspx?ErrorMessage=We found no matches for \"" + this.txtDepCity.Value + "\"&GoToPage=~/index.aspx"); } } else { deptCondition.Departure = AirService.CommAirportDao.FindByAirport(depCity.Trim()); if (deptCondition.Departure == null) { deptCondition.Departure = new Terms.Common.Domain.Airport(); deptCondition.Departure.Code = depCity.Trim(); } } deptCondition.DepartureDate = GlobalUtility.GetDateTime(Request["fromdate"].Trim()); bool IsDataError = true; if (deptCondition.DepartureDate < DateTime.Now.AddDays(3)) { IsRealCity = false; IsDataError = false; } sc.ToCityName = toCity.Trim(); if (toCity.Trim().Length > 3) { IList destinationAirPorts = _CommonService.FindAirportByCityName(toCity.Trim()); if (destinationAirPorts.Count > 1) { IsSelectAirport = true; sc.ToAirports = destinationAirPorts; } else if (destinationAirPorts.Count == 1) { deptCondition.Destination = (Terms.Common.Domain.Airport)destinationAirPorts[0]; } else { List<Terms.Common.Domain.Airport> airportList = _ApplicationCacheFoundationDate.FindAllAirport(); Terms.Common.Domain.Airport airport = MatchAirport(toCity.Trim(), airportList); if (airport != null) deptCondition.Destination = airport; else sc.IsRealToCity = IsRealCity = false; // Response.Redirect("ErrorMessage.aspx?ErrorMessage=We found no matches for \"" + this.txtDesCity.Value + "\"&GoToPage=~/index.aspx"); } } else { deptCondition.Destination = AirService.CommAirportDao.FindByAirport(toCity.Trim()); if (deptCondition.Destination == null) { deptCondition.Destination = new Terms.Common.Domain.Airport(); deptCondition.Destination.Code = toCity.Trim(); } } AirTripCondition rtnCondition = new AirTripCondition(); rtnCondition.Cabin = cabinA; if (Request["airtype"].Trim().ToLower().Equals("oneway")) { rtnCondition.Departure = deptCondition.Destination; rtnCondition.Destination = deptCondition.Departure; rtnCondition.DepartureDate = DateTime.MaxValue; } else if (Request["airtype"].Trim().ToLower().Equals("roundtrip")) { rtnCondition.Departure = deptCondition.Destination; rtnCondition.Destination = deptCondition.Departure; rtnCondition.DepartureDate = GlobalUtility.GetDateTime(Request["todate"].Trim()); } else if (Request["airtype"].Trim().ToLower().Equals("openjaw")) { rtnCondition.DepartureDate = GlobalUtility.GetDateTime(Request["todate"].Trim()); sc.ReturnFromCityName = rtnFromCity.Trim(); if (rtnFromCity.Trim().Length > 3) { IList returnFromAirPorts = _CommonService.FindAirportByCityName(rtnFromCity.Trim()); if (returnFromAirPorts.Count > 1) { IsSelectAirport = true; sc.ReturnFromAirports = returnFromAirPorts; } else if (returnFromAirPorts.Count == 1) { rtnCondition.Departure = (Terms.Common.Domain.Airport)returnFromAirPorts[0]; } else { List<Terms.Common.Domain.Airport> airportList = _ApplicationCacheFoundationDate.FindAllAirport(); Terms.Common.Domain.Airport airport = MatchAirport(rtnFromCity.Trim(), airportList); if (airport != null) rtnCondition.Departure = airport; else sc.IsRealReturnFromCity = IsRealCity = false; //Response.Redirect("ErrorMessage.aspx?ErrorMessage=We found no matches for \"" + this.txtRtnFrom.Value + "\"&GoToPage=~/index.aspx"); } } else { rtnCondition.Departure = AirService.CommAirportDao.FindByAirport(rtnFromCity.Trim()); if (rtnCondition.Departure == null) { rtnCondition.Departure = new Terms.Common.Domain.Airport(); rtnCondition.Departure.Code = rtnFromCity.Trim(); } } sc.ReturnToCityName = rtnToCity.Trim(); if (rtnToCity.Trim().Length > 3) { IList returnToAirPorts = _CommonService.FindAirportByCityName(rtnToCity.Trim()); if (returnToAirPorts.Count > 1) { IsSelectAirport = true; sc.ReturnToAirports = returnToAirPorts; } else if (returnToAirPorts.Count == 1) { rtnCondition.Destination = (Terms.Common.Domain.Airport)returnToAirPorts[0]; } else { List<Terms.Common.Domain.Airport> airportList = _ApplicationCacheFoundationDate.FindAllAirport(); Terms.Common.Domain.Airport airport = MatchAirport(rtnToCity.Trim(), airportList); if (airport != null) rtnCondition.Destination = airport; else sc.IsRealReturnToCity = IsRealCity = false; //Response.Redirect("ErrorMessage.aspx?ErrorMessage=We found no matches for \"" + this.txtRtnTo.Value + "\"&GoToPage=~/index.aspx"); } } else { rtnCondition.Destination = AirService.CommAirportDao.FindByAirport(rtnToCity.Trim()); if (rtnCondition.Destination == null) { rtnCondition.Destination = new Terms.Common.Domain.Airport(); rtnCondition.Destination.Code = rtnToCity.Trim(); } } } airSearchCondition.AddTripCondition(deptCondition); airSearchCondition.AddTripCondition(rtnCondition); //if (ddlAirline.SelectedItem.Text != "Search All Airlines") if (Request["aircode"].Trim().Trim() != "") { //param.Airways = ddlAirline.SelectedValue.Split(','); airSearchCondition.Airlines = Request["aircode"].Trim().Split(','); } sc.CurrentItinerary.SearchInfo = airSearchCondition; Utility.IsTourMain = false;//�����Ƿ���Tour��־ this.Transaction.IntKey = airSearchCondition.GetHashCode(); this.Transaction.CurrentSearchConditions = airSearchCondition; this.Transaction.CurrentTransactionObject = new TERMS.Business.Centers.SalesCenter.TransactionObject(); ForbiddenAirportControl f = new ForbiddenAirportControl(); bool IsErrorAir = f.HasForbiddenAirport(sc); if (IsErrorAir) { Response.Redirect("~/Page/Flight/SearchConditionsMeaasageForm.aspx?ConditionID=" + Utility.Transaction.IntKey.ToString() + "&DateErrorMsg=" + Resources.HintInfo.ForbiddenAirport); } if (!IsRealCity) { if (!Utility.IsLogin && Session["IndexForFlight"] == null) { if (IsDataError) { Response.Redirect("~/IndexForFlight.aspx?ConditionID=" + Utility.Transaction.IntKey.ToString() + "&IsRealCity=" + IsRealCity.ToString() + "&IsSelectAirport=" + IsSelectAirport.ToString()); } else { Response.Redirect("~/IndexForFlight.aspx?ConditionID=" + Utility.Transaction.IntKey.ToString() + "&IsRealCity=" + IsRealCity.ToString() + "&IsSelectAirport=" + IsSelectAirport.ToString() + "&DateErrorMsg=" + Resources.HintInfo.AirDateError); } } if (IsDataError) { Response.Redirect("~/Page/Flight/SearchConditionsMeaasageForm.aspx?ConditionID=" + Utility.Transaction.IntKey.ToString()); } else { Response.Redirect("~/Page/Flight/SearchConditionsMeaasageForm.aspx?ConditionID=" + Utility.Transaction.IntKey.ToString() + "&DateErrorMsg=" + Resources.HintInfo.AirDateError); } } else { if (IsSelectAirport) { if (!Utility.IsLogin && Session["IndexForFlight"] == null) { if (IsDataError) { Response.Redirect("~/IndexForFlight.aspx?ConditionID=" + Utility.Transaction.IntKey.ToString() + "&IsRealCity=" + IsRealCity.ToString() + "&IsSelectAirport=" + IsSelectAirport.ToString()); } else { Response.Redirect("~/IndexForFlight.aspx?ConditionID=" + Utility.Transaction.IntKey.ToString() + "&IsRealCity=" + IsRealCity.ToString() + "&IsSelectAirport=" + IsSelectAirport.ToString() + "&DateErrorMsg=" + Resources.HintInfo.AirDateError); } } if (IsDataError) { Response.Redirect("~/Page/Flight/SearchConditionsForm.aspx?ConditionID=" + Utility.Transaction.IntKey.ToString()); } else { Response.Redirect("~/Page/Flight/SearchConditionsForm.aspx?ConditionID=" + Utility.Transaction.IntKey.ToString() + "&DateErrorMsg=" + Resources.HintInfo.AirDateError); } } else { if (!Utility.IsLogin && Session["IndexForFlight"] == null) { if (IsDataError) { Response.Redirect("~/IndexForFlight.aspx?ConditionID=" + Utility.Transaction.IntKey.ToString() + "&IsRealCity=" + IsRealCity.ToString() + "&IsSelectAirport=" + IsSelectAirport.ToString()); } else { Response.Redirect("~/IndexForFlight.aspx?ConditionID=" + Utility.Transaction.IntKey.ToString() + "&IsRealCity=" + IsRealCity.ToString() + "&IsSelectAirport=" + IsSelectAirport.ToString() + "&DateErrorMsg=" + Resources.HintInfo.AirDateError); } } log.Info(Session["LOG_RANDOM"].ToString() + " >Redirect Searching.aspx Begin Start time : " + System.DateTime.Now); if (IsDataError) { Response.Redirect("~/Page/Flight/Searching.aspx?ConditionID=" + Utility.Transaction.IntKey.ToString()); } else { Response.Redirect("~/Page/Flight/Searching.aspx?ConditionID=" + Utility.Transaction.IntKey.ToString() + "&DateErrorMsg=" + Resources.HintInfo.AirDateError); } } } break; case "AH": if (Utility.IsSubAgent) OperaterAdvice.DoAdvice(Terms.Configuration.Utility.ConfigurationConst.OperateType.SUB_SearchPackage, this); else OperaterAdvice.DoAdvice(Terms.Configuration.Utility.ConfigurationConst.OperateType.MV_SearchPackage, this); List<TourErrorMsg> errorsP = new List<TourErrorMsg>(); DateTime dateDept_A = Convert.ToDateTime(Request["fromdate"].Trim()); DateTime dateRtn_A = Convert.ToDateTime(Request["todate"].Trim()); DateTime dateChinkIn_H; DateTime dateChinkOut_H; Session["CurrentSession"] = new SessionClass(); SessionClass scAH = (SessionClass)Session["CurrentSession"]; if (Request["fromcity"].Trim().Length == 0) { TourErrorMsg error = new TourErrorMsg(); error.IsError = true; error.ErrorMsg = Resources.HintInfo.Package_Error_City1; errorsP.Add(error); } else { TourErrorMsg error = new TourErrorMsg(); errorsP.Add(error); } if (Request["tocity"].Trim().Length == 0) { TourErrorMsg error = new TourErrorMsg(); error.IsError = true; error.ErrorMsg = Resources.HintInfo.Package_Error_City2; errorsP.Add(error); } else { TourErrorMsg error = new TourErrorMsg(); errorsP.Add(error); } string txtFrom_AH = ConvertName(Request["fromcity"].Trim()); string txtTo_AH = ConvertName(Request["tocity"].Trim()); //Utility.SelectAirGroup = null; PackageSearchCondition PacakgeSearch = new PackageSearchCondition(); PacakgeSearch.IsReset = true; PacakgeSearch.DepatrueAirPorts = new List<Terms.Common.Domain.Airport>(); scAH.FromCityName = txtFrom_AH.Trim(); if (txtFrom_AH.Trim().Length > 3) { IList departureAirPorts = _CommonService.FindAirportByCityName(txtFrom_AH.Trim()); if (departureAirPorts.Count >= 1) { PacakgeSearch.DepatrueAirPorts = departureAirPorts; scAH.FromAirports = departureAirPorts; } else { List<Terms.Common.Domain.Airport> airportList = _ApplicationCacheFoundationDate.FindAllAirport(); Terms.Common.Domain.Airport airport = MatchAirport(txtFrom_AH.Trim(), airportList); if (airport != null) { PacakgeSearch.DepatrueAirPorts.Add(airport); } else { scAH.IsRealFromCity = false; TourErrorMsg error = new TourErrorMsg(); error.IsError = true; error.ErrorMsg = Resources.HintInfo.Package_Error_City3; errorsP.Add(error); } } } else { Terms.Common.Domain.Airport airport = AirService.CommAirportDao.FindByAirport(txtFrom_AH.Trim()); if (airport != null) { PacakgeSearch.DepatrueAirPorts.Add(airport); } else { IList departureAirPorts = AirService.CommAirportDao.FindByCityCode(txtFrom_AH.Trim()); if (departureAirPorts.Count >= 1) { PacakgeSearch.DepatrueAirPorts = departureAirPorts; } else { scAH.IsRealFromCity = false; TourErrorMsg error = new TourErrorMsg(); error.IsError = true; error.ErrorMsg = Resources.HintInfo.Package_Error_City3; errorsP.Add(error); } } } PacakgeSearch.DestinationAirPorts = new List<Terms.Common.Domain.Airport>(); scAH.ToCityName = txtTo_AH.Trim(); if (txtTo_AH.Trim().Length > 3) { IList DestinationOneAirPorts = _CommonService.FindAirportByCityName(txtTo_AH.Trim()); if (DestinationOneAirPorts.Count >= 1) { PacakgeSearch.DestinationAirPorts = DestinationOneAirPorts; scAH.ToAirports = DestinationOneAirPorts; } else { List<Terms.Common.Domain.Airport> airportList = _ApplicationCacheFoundationDate.FindAllAirport(); Terms.Common.Domain.Airport airport = MatchAirport(txtTo_AH.Trim(), airportList); if (airport != null) { PacakgeSearch.DestinationAirPorts.Add(airport); } else { scAH.IsRealToCity = false; TourErrorMsg error = new TourErrorMsg(); error.IsError = true; error.ErrorMsg = Resources.HintInfo.Package_Error_City4; errorsP.Add(error); } } } else { Terms.Common.Domain.Airport airport = AirService.CommAirportDao.FindByAirport(txtTo_AH.Trim()); if (airport != null) { PacakgeSearch.DestinationAirPorts.Add(airport); } else { IList DestinationOneAirPorts = AirService.CommAirportDao.FindByCityCode(txtTo_AH.Trim()); if (DestinationOneAirPorts.Count >= 1) { PacakgeSearch.DestinationAirPorts = DestinationOneAirPorts; } else { scAH.IsRealToCity = false; TourErrorMsg error = new TourErrorMsg(); error.IsError = true; error.ErrorMsg = Resources.HintInfo.Package_Error_City4; errorsP.Add(error); } } } //�ж�����ij����غ�Ŀ�ĵ���û�л��� if (PacakgeSearch.DepatrueAirPorts.Count == 0) { TourErrorMsg error = new TourErrorMsg(); error.IsError = true; error.ErrorMsg = Resources.HintInfo.Package_Error_City3; errorsP.Add(error); } else { TourErrorMsg error = new TourErrorMsg(); errorsP.Add(error); } if (PacakgeSearch.DestinationAirPorts.Count == 0) { TourErrorMsg error = new TourErrorMsg(); error.IsError = true; error.ErrorMsg = Resources.HintInfo.Package_Error_City4; errorsP.Add(error); } else { TourErrorMsg error = new TourErrorMsg(); errorsP.Add(error); } //���Ŀ�ĵصĹ����������ͼ��ô���ô�Ƶ����ס���ھ��dz������ڡ� if (Request["checkin"].Trim() == "__/__/____" || Request["checkin"].Trim() == "") { 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; //��Check inΪ�գ���Ĭ��ΪAir�������ڼ�һ�� } else { dateChinkIn_H = dateDept_A.AddDays(1); //��Check inΪ�գ���Ĭ��ΪAir�������ڼ�һ�� } } else { dateChinkIn_H = Convert.ToDateTime(Request["checkin"].Trim()); } if (Request["checkout"].Trim() == "__/__/____" || Request["checkout"].Trim() == "") dateChinkOut_H = dateRtn_A; //��Check outΪ�գ���Ĭ��ΪAir�������� else dateChinkOut_H = Convert.ToDateTime(Request["checkout"].Trim()); if (dateDept_A < DateTime.Now.AddDays(7)) { TourErrorMsg error = new TourErrorMsg(); error.IsError = true; error.ErrorMsg = Resources.HintInfo.Package_Date_Error1; errorsP.Add(error); } else if (dateRtn_A < DateTime.Now.AddDays(7)) { TourErrorMsg error = new TourErrorMsg(); error.IsError = true; error.ErrorMsg = Resources.HintInfo.Package_Date_Error2; errorsP.Add(error); } else if (dateChinkIn_H < DateTime.Now.AddDays(7)) { TourErrorMsg error = new TourErrorMsg(); error.IsError = true; error.ErrorMsg = Resources.HintInfo.Package_Date_Error3; errorsP.Add(error); } else if (dateChinkOut_H < DateTime.Now.AddDays(7)) { TourErrorMsg error = new TourErrorMsg(); error.IsError = true; error.ErrorMsg = Resources.HintInfo.Package_Date_Error4; errorsP.Add(error); } else if (dateChinkIn_H <= DateTime.Today) { TourErrorMsg error = new TourErrorMsg(); error.IsError = true; error.ErrorMsg = Resources.HintInfo.Package_Date_Error5; errorsP.Add(error); } else if (dateChinkIn_H > dateChinkOut_H) { TourErrorMsg error = new TourErrorMsg(); error.IsError = true; error.ErrorMsg = Resources.HintInfo.Package_Date_Error6; errorsP.Add(error); } else if (dateDept_A >= dateRtn_A) { TourErrorMsg error = new TourErrorMsg(); error.IsError = true; error.ErrorMsg = Resources.HintInfo.Package_Date_Error7; errorsP.Add(error); } else if (dateDept_A > dateChinkIn_H) { TourErrorMsg error = new TourErrorMsg(); error.IsError = true; error.ErrorMsg = Resources.HintInfo.Package_Date_Error8; errorsP.Add(error); } else if (dateChinkOut_H > dateRtn_A) { TourErrorMsg error = new TourErrorMsg(); error.IsError = true; error.ErrorMsg = Resources.HintInfo.Package_Date_Error9; errorsP.Add(error); } else { TourErrorMsg error = new TourErrorMsg(); errorsP.Add(error); } int adult = 0; int child = 0; for (int i = 0; i < Convert.ToInt32(Request["roomnumber"].Trim()); i++) { adult += Convert.ToInt32(Request["a" + (i + 1)].Trim()); child += Convert.ToInt32(Request["c" + (i + 1)].Trim()); RoomSearchCondition roomSearchCondition = new RoomSearchCondition(); roomSearchCondition.Passengers.Add(TERMS.Common.PassengerType.Adult, Convert.ToInt32(Request["a" + (i + 1)].Trim())); roomSearchCondition.Passengers.Add(TERMS.Common.PassengerType.Child, Convert.ToInt32(Request["c" + (i + 1)].Trim())); PacakgeSearch.HotelSearchCondition.RoomSearchConditions.Add(roomSearchCondition); } PacakgeSearch.AirSearchCondition.SetPassengerNumber(TERMS.Common.PassengerType.Adult, adult); PacakgeSearch.AirSearchCondition.SetPassengerNumber(TERMS.Common.PassengerType.Child, child); 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 = (Terms.Common.Domain.Airport)PacakgeSearch.DepatrueAirPorts[0]; DPTairTripCondition.DepartureDate = Convert.ToDateTime(dateDept_A); DPTairTripCondition.Destination = (Terms.Common.Domain.Airport)PacakgeSearch.DestinationAirPorts[0]; DPTairTripCondition.IsDepartureTimeSpecified = Convert.ToBoolean(Request["isadd"].Trim()); PacakgeSearch.AirSearchCondition.AddTripCondition(DPTairTripCondition); AirTripCondition RTNairTripCondition = new AirTripCondition(); RTNairTripCondition.Departure = (Terms.Common.Domain.Airport)PacakgeSearch.DestinationAirPorts[0]; RTNairTripCondition.DepartureDate = Convert.ToDateTime(dateRtn_A); RTNairTripCondition.Destination = (Terms.Common.Domain.Airport)PacakgeSearch.DepatrueAirPorts[0]; RTNairTripCondition.IsDepartureTimeSpecified = Convert.ToBoolean(Request["isadd"].Trim()); PacakgeSearch.AirSearchCondition.AddTripCondition(RTNairTripCondition); PacakgeSearch.AirSearchCondition.FlightType = "roundtrip"; if (Request["aircode"].Trim() != "all") { PacakgeSearch.AirSearchCondition.Airlines = new string[1] { Request["aircode"].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 (Request["airclass"].Trim() == "ECONOMY") { cabin = TERMS.Common.CabinType.Economy; } else if (Request["airclass"].Trim() == "BUSINESS") { cabin = TERMS.Common.CabinType.Business; } else if (Request["airclass"].Trim() == "FIRST") { 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/Package2/PackageMoreSearch.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"; ConditionID = this.Transaction.IntKey.ToString(); Target = @"~/Page/Package2/ViewYourPackages"; } } else { PacakgeSearch.HotelSearchCondition.CheckIn = dateChinkIn_H.AddDays(0); PacakgeSearch.HotelSearchCondition.CheckOut = dateChinkOut_H; PacakgeSearch.HotelSearchCondition.LocationIndicator = TERMS.Common.LocationIndicator.City; AirTripCondition DPTairTripCondition = new AirTripCondition(); DPTairTripCondition.DepartureDate = Convert.ToDateTime(dateDept_A); DPTairTripCondition.IsDepartureTimeSpecified = Convert.ToBoolean(Request["isadd"].Trim()); PacakgeSearch.AirSearchCondition.AddTripCondition(DPTairTripCondition); AirTripCondition RTNairTripCondition = new AirTripCondition(); RTNairTripCondition.DepartureDate = Convert.ToDateTime(dateRtn_A); RTNairTripCondition.IsDepartureTimeSpecified = Convert.ToBoolean(Request["isadd"].Trim()); PacakgeSearch.AirSearchCondition.AddTripCondition(RTNairTripCondition); PacakgeSearch.AirSearchCondition.FlightType = "roundtrip"; if (Request["aircode"].Trim() != "all") { PacakgeSearch.AirSearchCondition.Airlines = new string[1] { Request["aircode"].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 (Request["aircode"].Trim() == "ECONOMY") { cabin = TERMS.Common.CabinType.Economy; } else if (Request["aircode"].Trim() == "BUSINESS") { cabin = TERMS.Common.CabinType.Business; } else if (Request["aircode"].Trim() == "FIRST") { 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/Package2/PackageMoreSearch.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"; ConditionID = this.Transaction.IntKey.ToString(); Target = @"~/Page/Package2/ViewYourPackages"; } } scAH.CurrentItinerary.SearchInfo = PacakgeSearch.AirSearchCondition; ForbiddenAirportControl fAH = new ForbiddenAirportControl(); bool IsErrorAirH = fAH.HasForbiddenAirport(scAH); if (IsErrorAirH) { TourErrorMsg error = new TourErrorMsg(); error.IsError = true; error.ErrorMsg = Resources.HintInfo.ForbiddenAirport; errorsP.Add(error); } else { TourErrorMsg error = new TourErrorMsg(); errorsP.Add(error); } bool IsErrorP = false; for (int i = 0; i < errorsP.Count; i++) { if (errorsP[i].IsError) { IsErrorP = true; } } if (IsErrorP) { Session["ErrorMsg"] = errorsP; Response.Redirect("~/Page/Package2/SearchConditionsMeassageAHForm.aspx"); } break; case "H": List<TourErrorMsg> errors = new List<TourErrorMsg>(); if (Request["city"].Trim().Trim().Length == 0) { TourErrorMsg error = new TourErrorMsg(); error.IsError = true; error.ErrorMsg = Resources.HintInfo.Hotel_Error_City; errors.Add(error); } else { TourErrorMsg error = new TourErrorMsg(); errors.Add(error); } string txtName = ConvertName(Request["city"].Trim()); DateTime dtNow = DateTime.Now; hotelSearchHotelByZyl.Info("MV_B2C Hotel Serach Start : " + dtNow.ToString("HH:mm:ss") + ":" + dtNow.Millisecond); if (Utility.IsSubAgent) OperaterAdvice.DoAdvice(Terms.Configuration.Utility.ConfigurationConst.OperateType.SUB_SearchHotel, this); else OperaterAdvice.DoAdvice(Terms.Configuration.Utility.ConfigurationConst.OperateType.MV_SearchHotel, this); try { //log begin 20090312 Leon log.Info("\r\n"); if (!Utility.IsLogin) { log.Info(PageUtility.HotelLogRandomNumber.ToString() + " >====================Not Login========================"); } else { log.Info(PageUtility.HotelLogRandomNumber.ToString() + " >==========================Login========================"); } log.Info(PageUtility.HotelLogRandomNumber.ToString() + " >SearchClick Begin Start time : " + System.DateTime.Now); //log end 20090312 Leon } catch { } DateTime ChinkIn_H = Convert.ToDateTime(Request["checkin"].Trim()); DateTime ChinkOut_H = Convert.ToDateTime(Request["checkout"].Trim()); if (ChinkIn_H < DateTime.Now.AddDays(7)) { if (Utility.IsLogin && Utility.IsSubAgent) { if (ChinkIn_H < DateTime.Now.AddDays(3)) { TourErrorMsg error = new TourErrorMsg(); error.IsError = true; error.ErrorMsg = Resources.HintInfo.Hotel_Date_Error1; errors.Add(error); } } else { TourErrorMsg error = new TourErrorMsg(); error.IsError = true; error.ErrorMsg = Resources.HintInfo.Hotel_Date_Error1; errors.Add(error); } } else if (ChinkOut_H < DateTime.Now.AddDays(7)) { if (Utility.IsLogin && Utility.IsSubAgent) { if (ChinkOut_H < DateTime.Now.AddDays(3)) { TourErrorMsg error = new TourErrorMsg(); error.IsError = true; error.ErrorMsg = Resources.HintInfo.Hotel_Date_Error2; errors.Add(error); } } else { TourErrorMsg error = new TourErrorMsg(); error.IsError = true; error.ErrorMsg = Resources.HintInfo.Hotel_Date_Error2; errors.Add(error); } } else if (ChinkIn_H < DateTime.Today && ChinkOut_H < DateTime.Today) { TourErrorMsg error = new TourErrorMsg(); error.IsError = true; error.ErrorMsg = Resources.HintInfo.Hotel_Date_Error3; errors.Add(error); } else if (ChinkIn_H <= DateTime.Today) { TourErrorMsg error = new TourErrorMsg(); error.IsError = true; error.ErrorMsg = Resources.HintInfo.Hotel_Date_Error4; errors.Add(error); } else if (ChinkOut_H <= ChinkIn_H) { TourErrorMsg error = new TourErrorMsg(); error.IsError = true; error.ErrorMsg = Resources.HintInfo.Hotel_Date_Error5; errors.Add(error); } else { TourErrorMsg error = new TourErrorMsg(); errors.Add(error); } HotelSearchCondition hotelSearchCondition = new HotelSearchCondition(); for (int i = 0; i < Convert.ToInt32(Request["roomnumber"].Trim()); i++) { RoomSearchCondition roomSearchCondition = new RoomSearchCondition(); roomSearchCondition.Passengers.Add(PassengerType.Adult, Convert.ToInt32(Request["a" + (i + 1)].Trim())); roomSearchCondition.Passengers.Add(PassengerType.Child, Convert.ToInt32(Request["c" + (i + 1)].Trim())); hotelSearchCondition.RoomSearchConditions.Add(roomSearchCondition); } hotelSearchCondition.UserInputInfo = Request["city"].Trim(); hotelSearchCondition.LocationIndicator = LocationIndicator.City; hotelSearchCondition.CheckIn = ChinkIn_H; hotelSearchCondition.CheckOut = ChinkOut_H; this.Transaction.IntKey = hotelSearchCondition.GetHashCode(); this.Transaction.CurrentSearchConditions = hotelSearchCondition; this.Transaction.CurrentTransactionObject = new TERMS.Business.Centers.SalesCenter.TransactionObject(); Utility.IsTourMain = false;//�����Ƿ���Tour��־ ConditionID = this.Transaction.IntKey.ToString(); Target = @"~/Page/Hotel2/SearchResultForm"; bool IsError = false; for (int i = 0; i < errors.Count; i++) { if (errors[i].IsError) { IsError = true; } } if (IsError) { Session["ErrorMsg"] = errors; Response.Redirect("~/Page/Hotel2/SearchConditionsMeassageHForm.aspx"); } if (txtName.Trim().Length == 3) { Terms.Common.Domain.City CityName = _cityService.Get(txtName); if (CityName != null) { ((HotelSearchCondition)this.Transaction.CurrentSearchConditions).Location = CityName.Code; ((HotelSearchCondition)this.Transaction.CurrentSearchConditions).Country = CityName.CountryCode; } else { Terms.Common.Domain.Airport airport = _airportService.Get(txtName); if (airport != null) { ((HotelSearchCondition)this.Transaction.CurrentSearchConditions).Location = airport.City.Code; ((HotelSearchCondition)this.Transaction.CurrentSearchConditions).Country = airport.City.CountryCode; } else { IList ilCityName = _cityService.FindSomeCityByName(txtName); if (ilCityName.Count > 1) { Session["CityNameList"] = ilCityName; this.Response.Redirect(SaleWebSuffix + "Page/Hotel2/SearchMoreCityForm.aspx?CityName=" + txtName); } else if (ilCityName.Count == 1) { Terms.Common.Domain.City citylist = (Terms.Common.Domain.City)ilCityName[0]; ((HotelSearchCondition)this.Transaction.CurrentSearchConditions).Location = citylist.Code; ((HotelSearchCondition)this.Transaction.CurrentSearchConditions).Country = citylist.CountryCode; } else if (ilCityName == null || ilCityName.Count == 0) { Session["CityNameList"] = null; this.Response.Redirect(SaleWebSuffix + "Page/Hotel2/SearchMoreCityForm.aspx?CityName=" + txtName); } } } } else { //�ж��Ƿ��ж��.�������ͬ��SerachMoreҳ�����ѡ��,���û�����������ҳ�� IList ilCityName = _cityService.FindSomeCityByName(txtName); if (ilCityName.Count > 1) { Session["CityNameList"] = ilCityName; this.Response.Redirect(SaleWebSuffix + "Page/Hotel2/SearchMoreCityForm.aspx?CityName=" + txtName); } else if (ilCityName.Count == 1) { Terms.Common.Domain.City citylist = (Terms.Common.Domain.City)ilCityName[0]; ((HotelSearchCondition)this.Transaction.CurrentSearchConditions).Location = citylist.Code; ((HotelSearchCondition)this.Transaction.CurrentSearchConditions).Country = citylist.CountryCode; } else if (ilCityName == null || ilCityName.Count == 0) { Terms.Common.Domain.Airport airport = _airportService.Get(txtName); if (airport != null) { ((HotelSearchCondition)this.Transaction.CurrentSearchConditions).Location = airport.City.Code; ((HotelSearchCondition)this.Transaction.CurrentSearchConditions).Country = airport.City.CountryCode; } else { this.Response.Redirect(SaleWebSuffix + "Page/Hotel2/SearchMoreCityForm.aspx?CityName=" + txtName); } } } log.Info(PageUtility.HotelLogRandomNumber.ToString() + " >Redirect Searching1.aspx Begin Start time : " + System.DateTime.Now); hotelSearchHotelByZyl.Debug("Hotel Start :" + DateTime.Now.ToLongTimeString()); dtNow = DateTime.Now; hotelSearchHotelByZyl.Info("MV_B2C Hotel Serach To Searching1 Start : " + dtNow.ToString("HH:mm:ss") + ":" + dtNow.Millisecond); break; case "T": if (Utility.IsSubAgent) OperaterAdvice.DoAdvice(Terms.Configuration.Utility.ConfigurationConst.OperateType.SUB_SearchTour, this); else OperaterAdvice.DoAdvice(Terms.Configuration.Utility.ConfigurationConst.OperateType.MV_SearchTour, this); List<TourErrorMsg> errorsT = new List<TourErrorMsg>(); //log begin 20090312 Leon PageUtility.TourSearchingTimeLog.Info("\r\n"); if (!Utility.IsLogin) PageUtility.TourSearchingTimeLog.Info(PageUtility.TourLogRandomNumber.ToString() + " >====================Not Login========================"); else PageUtility.TourSearchingTimeLog.Info(PageUtility.TourLogRandomNumber.ToString() + " >==========================Login========================"); PageUtility.TourSearchingTimeLog.Info(PageUtility.TourLogRandomNumber.ToString() + " >Tour Searching(1) Begin at: " + System.DateTime.Now); //log end 20090312 Leon TourSearchCondition tourSearchCondition = new TourSearchCondition(); tourSearchCondition.Region = Request["region"].Trim(); if (tourSearchCondition.Region.Trim() == "Please select a area") { TourErrorMsg error = new TourErrorMsg(); error.IsError = true; error.ErrorMsg = Resources.HintInfo.Tour_Error1; errorsT.Add(error); } else { TourErrorMsg error = new TourErrorMsg(); errorsT.Add(error); } string country = Request["counrty"].Trim(); int index = country.IndexOf("-"); if (index < 0) { TourErrorMsg error = new TourErrorMsg(); error.IsError = true; error.ErrorMsg = Resources.HintInfo.Tour_Error2; errorsT.Add(error); } else { TourErrorMsg error = new TourErrorMsg(); errorsT.Add(error); } tourSearchCondition.Counrty = country.Substring(index + 1).Trim(); string city = Request["city"].Trim(); index = city.IndexOf("-"); if (index < 0) { TourErrorMsg error = new TourErrorMsg(); error.IsError = true; error.ErrorMsg = Resources.HintInfo.Tour_Error3; errorsT.Add(error); } else { TourErrorMsg error = new TourErrorMsg(); errorsT.Add(error); } tourSearchCondition.City = city.Substring(index + 1).Trim(); tourSearchCondition.IsLandOnly = Convert.ToBoolean(Request["landonly"].Trim()); tourSearchCondition.TravelBeginDate = GlobalUtility.GetDateTime(Request["tourdate"].Trim()); if (Request["tourdate"].Trim() == "__/__/____" || Request["tourdate"].Trim() == "") { TourErrorMsg error = new TourErrorMsg(); error.IsError = true; error.ErrorMsg = Resources.HintInfo.Tour_Error4; errorsT.Add(error); } else { TourErrorMsg error = new TourErrorMsg(); errorsT.Add(error); } if (tourSearchCondition.TravelBeginDate < DateTime.Now.AddDays(3)) { TourErrorMsg error = new TourErrorMsg(); error.IsError = true; error.ErrorMsg = Resources.HintInfo.Tour_Error5; errorsT.Add(error); } else { TourErrorMsg error = new TourErrorMsg(); errorsT.Add(error); } switch (Request["traveldate"].Trim()) { case "5": tourSearchCondition.TravelDaysFrom = 1; tourSearchCondition.TravelDaysTo = 10; break; case "11": tourSearchCondition.TravelDaysFrom = 11; tourSearchCondition.TravelDaysTo = 15; break; case "15": tourSearchCondition.TravelDaysFrom = 16; tourSearchCondition.TravelDaysTo = 800; break; default: tourSearchCondition.TravelDaysFrom = 1; tourSearchCondition.TravelDaysTo = 800; break; } this.Transaction.IntKey = tourSearchCondition.GetHashCode(); this.Transaction.CurrentSearchConditions = tourSearchCondition; this.Transaction.CurrentTransactionObject = new TERMS.Business.Centers.SalesCenter.TransactionObject(); Utility.IsTourMain = false;//�����Ƿ���Tour��־ Utility.IsTourMore = false;//�����Ƿ���Tour More ConditionID = this.Transaction.IntKey.ToString(); Target = @"~/Page/Tour/TourMoreSearchResultForm"; bool IsErrorT = false; for (int i = 0; i < errorsT.Count; i++) { if (errorsT[i].IsError) { IsErrorT = true; } } if (IsErrorT) { Session["ErrorMsg"] = errorsT; Response.Redirect("~/Page/Tour/SearchConditionsMeassageTForm.aspx"); } break; case "P": SearchPromos(); break; case "C": string fromcity = ConvertName(Request["fromcity"].Trim()); string tocity = ConvertName(Request["tocity"].Trim()); string checkindate = ConvertName(Request["checkindate"].Trim()); string checkoutdate = ConvertName(Request["checkoutdate"].Trim()); string CheckInTimeCode = Request["checkintime"].Trim(); string CheckOutTimeCode = Request["checkouttime"].Trim(); string checkintime = CheckInTimeCode.Substring(0, 4); string checkouttime = CheckOutTimeCode.Substring(0, 4); string checkintimeX = CheckInTimeCode.Substring(4); string checkouttimeX = CheckOutTimeCode.Substring(4); string cartype = ConvertName(Request["cartype"].Trim()); string carcodetype = ConvertName(Request["carcodetype"].Trim()); DateTime fromDate = DateTime.MinValue; DateTime toDate = DateTime.MinValue; if (checkintimeX == "A") { fromDate = Convert.ToDateTime(checkindate).AddHours(Convert.ToDouble(checkintime.Substring(0, 2))).AddMinutes(Convert.ToDouble(checkintime.Substring(2))); } else { if (checkintime == "1200") { fromDate = Convert.ToDateTime(checkindate); } else { fromDate = Convert.ToDateTime(checkindate).AddHours(Convert.ToDouble(checkintime.Substring(0, 2)) + Convert.ToDouble("12")).AddMinutes(Convert.ToDouble(checkintime.Substring(2))); } } if (checkouttimeX == "A") { toDate = Convert.ToDateTime(checkoutdate).AddHours(Convert.ToDouble(checkouttime.Substring(0, 2))).AddMinutes(Convert.ToDouble(checkouttime.Substring(2))); } else { if (checkouttime == "1200") { toDate = Convert.ToDateTime(checkoutdate); } else { toDate = Convert.ToDateTime(checkoutdate).AddHours(Convert.ToDouble(checkouttime.Substring(0, 2)) + Convert.ToDouble("12")).AddMinutes(Convert.ToDouble(checkouttime.Substring(2))); } } string UserInputInfoFrom = Request["fromcity"].Trim(); string UserInputInfoTo = Request["tocity"].Trim(); if (carcodetype.Trim().ToUpper() == "D") { } else { UserInputInfoTo = Request["fromcity"].Trim(); tocity = fromcity; } string PickupAirportCode = string.Empty; string PickupISOCountryCode = string.Empty; string DropoffAirportCode = string.Empty; string DropoffISOCountryCode = string.Empty; if (fromcity.Trim().Length == 3) { Terms.Common.Domain.Airport airport = _airportService.Get(fromcity); if (airport != null) { PickupAirportCode = airport.Code; PickupISOCountryCode = airport.City.CountryCode; } else { IList ilCityName = _cityService.FindSomeCityByName(fromcity); if (ilCityName.Count > 1) { } else if (ilCityName.Count == 1) { Terms.Common.Domain.City citylist = (Terms.Common.Domain.City)ilCityName[0]; PickupAirportCode = citylist.Code; PickupISOCountryCode = citylist.CountryCode; } } } else { //�ж��Ƿ��ж��.�������ͬ��SerachMoreҳ�����ѡ��,���û�����������ҳ�� IList DestinationOneAirPorts = _CommonService.FindAirportByCityName(fromcity); if (DestinationOneAirPorts.Count >= 1) { PickupAirportCode = ((Airport)DestinationOneAirPorts[0]).Code; PickupISOCountryCode = ((Airport)DestinationOneAirPorts[0]).City.CountryCode ; } else { List<Terms.Common.Domain.Airport> airportList = _ApplicationCacheFoundationDate.FindAllAirport(); Terms.Common.Domain.Airport airport = MatchAirport(fromcity, airportList); if (airport != null) { PickupAirportCode = airport.Code; PickupISOCountryCode = airport.City.CountryCode; } } } if (tocity.Trim().Length == 3) { Terms.Common.Domain.Airport airport = _airportService.Get(tocity); if (airport != null) { DropoffAirportCode = airport.Code; DropoffISOCountryCode = airport.City.CountryCode; } else { IList ilCityName = _cityService.FindSomeCityByName(tocity); if (ilCityName.Count > 1) { } else if (ilCityName.Count == 1) { Terms.Common.Domain.City citylist = (Terms.Common.Domain.City)ilCityName[0]; DropoffAirportCode = citylist.Code; DropoffISOCountryCode = citylist.CountryCode; } } } else { //�ж��Ƿ��ж��.�������ͬ��SerachMoreҳ�����ѡ��,���û�����������ҳ�� IList DestinationOneAirPorts = _CommonService.FindAirportByCityName(tocity); if (DestinationOneAirPorts.Count >= 1) { DropoffAirportCode = ((Airport)DestinationOneAirPorts[0]).Code; DropoffISOCountryCode = ((Airport)DestinationOneAirPorts[0]).City.CountryCode; } else { List<Terms.Common.Domain.Airport> airportList = _ApplicationCacheFoundationDate.FindAllAirport(); Terms.Common.Domain.Airport airport = MatchAirport(tocity, airportList); if (airport != null) { DropoffAirportCode = airport.Code; DropoffISOCountryCode = airport.City.CountryCode; } } } TERMS.Common.Search.VehcileSearchCondition sear = null; if (carcodetype.Trim().ToUpper() != "D") { sear = new TERMS.Common.Search.VehcileSearchCondition(PickupISOCountryCode, PickupAirportCode, UserInputInfoFrom, fromDate, toDate); } else { sear = new TERMS.Common.Search.VehcileSearchCondition(PickupISOCountryCode, PickupAirportCode, UserInputInfoFrom, fromDate, DropoffISOCountryCode, DropoffAirportCode, UserInputInfoTo, toDate); } sear.Category = cartype; Terms.Sales.Business.VehcileSearchCondition vehcilesearchcondition = new Terms.Sales.Business.VehcileSearchCondition(sear); this.Transaction.IntKey = vehcilesearchcondition.GetHashCode(); this.Transaction.CurrentSearchConditions = vehcilesearchcondition; this.Transaction.CurrentTransactionObject = new TERMS.Business.Centers.SalesCenter.TransactionObject(); Utility.IsTourMain = false;//�����Ƿ���Tour��־ ConditionID = this.Transaction.IntKey.ToString(); Target = @"~/Page/Vehcile/SearchConditionsMeassageCForm"; break; } }
private void SearchPromos() { string depCity = ConvertName(Request["fromcity"].Trim()); string toCity = ConvertName(Request["tocity"].Trim()); string rtnFromCity = ConvertName(Request["rtnfromah"].Trim()); string rtnToCity = ConvertName(Request["rtntoah"].Trim()); //log begin 20090312 Leon log.Info("\r\n"); System.Random rd = new Random(); Session["LOG_RANDOM"] = rd.Next(999999999); if (!Utility.IsLogin) { log.Info(Session["LOG_RANDOM"].ToString() + " >====================Not Login========================"); } else { log.Info(Session["LOG_RANDOM"].ToString() + " >==========================Login========================"); } string logAirline = Request["aircode"].Trim().Trim().Equals(string.Empty) ? "All" : Request["aircode"].Trim(); log.Info(Session["LOG_RANDOM"].ToString() + " >==========================AirLine:" + logAirline + "========================"); log.Info(Session["LOG_RANDOM"].ToString() + " >SearchClick Begin Start time : " + System.DateTime.Now); //log end 20090312 Leon if (Utility.IsSubAgent) OperaterAdvice.DoAdvice(Terms.Configuration.Utility.ConfigurationConst.OperateType.SUB_SearchAir, this); else OperaterAdvice.DoAdvice(Terms.Configuration.Utility.ConfigurationConst.OperateType.MV_SearchAir, this); Session["HasReminder"] = true; //if (!Page.IsValid) // return; bool IsSelectAirport = false; bool IsRealCity = true; Session["CurrentSession"] = new SessionClass(); SessionClass sc = (SessionClass)Session["CurrentSession"]; AirSearchCondition airSearchCondition = new AirSearchCondition(); airSearchCondition.SetPassengerNumber(PassengerType.Adult, Convert.ToInt32(Convert.ToInt32(Request["adults"].Trim()))); CabinType cabinA = new CabinType(); if (Request["airclass"].Trim() == "ECONOMY") { cabinA = CabinType.Economy; } else if (Request["airclass"].Trim() == "BUSINESS") { cabinA = CabinType.Business; } else if (Request["airclass"].Trim() == "FIRST") { cabinA = CabinType.First; } else { cabinA = CabinType.All; } airSearchCondition.SetPassengerNumber(PassengerType.Child, Convert.ToInt32(Convert.ToInt32(Request["children"].Trim()))); airSearchCondition.FlightType = Request["airtype"].Trim(); airSearchCondition.FlexibleDays = 0; AirTripCondition deptCondition = new AirTripCondition(); deptCondition.Cabin = cabinA; sc.FromCityName = depCity.Trim(); if (depCity.Trim().Length > 3) { IList departureAirPorts = _CommonService.FindAirportByCityName(depCity.Trim()); if (departureAirPorts.Count > 1) { IsSelectAirport = true; sc.FromAirports = departureAirPorts; } else if (departureAirPorts.Count == 1) { deptCondition.Departure = (Terms.Common.Domain.Airport)departureAirPorts[0]; } else { List<Terms.Common.Domain.Airport> airportList = _ApplicationCacheFoundationDate.FindAllAirport(); Terms.Common.Domain.Airport airport = MatchAirport(depCity.Trim(), airportList); if (airport != null) deptCondition.Departure = airport; else sc.IsRealFromCity = IsRealCity = false; //Response.Redirect("ErrorMessage.aspx?ErrorMessage=We found no matches for \"" + this.txtDepCity.Value + "\"&GoToPage=~/index.aspx"); } } else { deptCondition.Departure = AirService.CommAirportDao.FindByAirport(depCity.Trim()); if (deptCondition.Departure == null) { deptCondition.Departure = new Terms.Common.Domain.Airport(); deptCondition.Departure.Code = depCity.Trim(); } } deptCondition.DepartureDate = GlobalUtility.GetDateTime(Request["fromdate"].Trim()); bool IsDataError = true; if (deptCondition.DepartureDate < DateTime.Now.AddDays(3)) { IsRealCity = false; IsDataError = false; } sc.ToCityName = toCity.Trim(); if (toCity.Trim().Length > 3) { IList destinationAirPorts = _CommonService.FindAirportByCityName(toCity.Trim()); if (destinationAirPorts.Count > 1) { IsSelectAirport = true; sc.ToAirports = destinationAirPorts; } else if (destinationAirPorts.Count == 1) { deptCondition.Destination = (Terms.Common.Domain.Airport)destinationAirPorts[0]; } else { List<Terms.Common.Domain.Airport> airportList = _ApplicationCacheFoundationDate.FindAllAirport(); Terms.Common.Domain.Airport airport = MatchAirport(toCity.Trim(), airportList); if (airport != null) deptCondition.Destination = airport; else sc.IsRealToCity = IsRealCity = false; // Response.Redirect("ErrorMessage.aspx?ErrorMessage=We found no matches for \"" + this.txtDesCity.Value + "\"&GoToPage=~/index.aspx"); } } else { deptCondition.Destination = AirService.CommAirportDao.FindByAirport(toCity.Trim()); if (deptCondition.Destination == null) { deptCondition.Destination = new Terms.Common.Domain.Airport(); deptCondition.Destination.Code = toCity.Trim(); } } AirTripCondition rtnCondition = new AirTripCondition(); rtnCondition.Cabin = cabinA; if (Request["airtype"].Trim().ToLower().Equals("oneway")) { rtnCondition.Departure = deptCondition.Destination; rtnCondition.Destination = deptCondition.Departure; rtnCondition.DepartureDate = DateTime.MaxValue; } else if (Request["airtype"].Trim().ToLower().Equals("roundtrip")) { rtnCondition.Departure = deptCondition.Destination; rtnCondition.Destination = deptCondition.Departure; rtnCondition.DepartureDate = GlobalUtility.GetDateTime(Request["todate"].Trim()); } else if (Request["airtype"].Trim().ToLower().Equals("openjaw")) { rtnCondition.DepartureDate = GlobalUtility.GetDateTime(Request["todate"].Trim()); sc.ReturnFromCityName = rtnFromCity.Trim(); if (rtnFromCity.Trim().Length > 3) { IList returnFromAirPorts = _CommonService.FindAirportByCityName(rtnFromCity.Trim()); if (returnFromAirPorts.Count > 1) { IsSelectAirport = true; sc.ReturnFromAirports = returnFromAirPorts; } else if (returnFromAirPorts.Count == 1) { rtnCondition.Departure = (Terms.Common.Domain.Airport)returnFromAirPorts[0]; } else { List<Terms.Common.Domain.Airport> airportList = _ApplicationCacheFoundationDate.FindAllAirport(); Terms.Common.Domain.Airport airport = MatchAirport(rtnFromCity.Trim(), airportList); if (airport != null) rtnCondition.Departure = airport; else sc.IsRealReturnFromCity = IsRealCity = false; //Response.Redirect("ErrorMessage.aspx?ErrorMessage=We found no matches for \"" + this.txtRtnFrom.Value + "\"&GoToPage=~/index.aspx"); } } else { rtnCondition.Departure = AirService.CommAirportDao.FindByAirport(rtnFromCity.Trim()); if (rtnCondition.Departure == null) { rtnCondition.Departure = new Terms.Common.Domain.Airport(); rtnCondition.Departure.Code = rtnFromCity.Trim(); } } sc.ReturnToCityName = rtnToCity.Trim(); if (rtnToCity.Trim().Length > 3) { IList returnToAirPorts = _CommonService.FindAirportByCityName(rtnToCity.Trim()); if (returnToAirPorts.Count > 1) { IsSelectAirport = true; sc.ReturnToAirports = returnToAirPorts; } else if (returnToAirPorts.Count == 1) { rtnCondition.Destination = (Terms.Common.Domain.Airport)returnToAirPorts[0]; } else { List<Terms.Common.Domain.Airport> airportList = _ApplicationCacheFoundationDate.FindAllAirport(); Terms.Common.Domain.Airport airport = MatchAirport(rtnToCity.Trim(), airportList); if (airport != null) rtnCondition.Destination = airport; else sc.IsRealReturnToCity = IsRealCity = false; //Response.Redirect("ErrorMessage.aspx?ErrorMessage=We found no matches for \"" + this.txtRtnTo.Value + "\"&GoToPage=~/index.aspx"); } } else { rtnCondition.Destination = AirService.CommAirportDao.FindByAirport(rtnToCity.Trim()); if (rtnCondition.Destination == null) { rtnCondition.Destination = new Terms.Common.Domain.Airport(); rtnCondition.Destination.Code = rtnToCity.Trim(); } } } airSearchCondition.AddTripCondition(deptCondition); airSearchCondition.AddTripCondition(rtnCondition); //if (ddlAirline.SelectedItem.Text != "Search All Airlines") if (Request["aircode"].Trim().Trim() != "") { //param.Airways = ddlAirline.SelectedValue.Split(','); airSearchCondition.Airlines = Request["aircode"].Trim().Split(','); } sc.CurrentItinerary.SearchInfo = airSearchCondition; Utility.IsTourMain = false;//�����Ƿ���Tour��־ this.Transaction.IntKey = airSearchCondition.GetHashCode(); this.Transaction.CurrentSearchConditions = airSearchCondition; this.Transaction.CurrentTransactionObject = new TERMS.Business.Centers.SalesCenter.TransactionObject(); ForbiddenAirportControl f = new ForbiddenAirportControl(); bool IsErrorAir = f.HasForbiddenAirport(sc); if (IsErrorAir) { Response.Redirect("~/Page/Flight/SearchConditionsMeaasageForm.aspx?ConditionID=" + Utility.Transaction.IntKey.ToString() + "&DateErrorMsg=" + Resources.HintInfo.ForbiddenAirport); } if (!IsRealCity) { if (!Utility.IsLogin && Session["IndexForFlight"] == null) { if (IsDataError) { Response.Redirect("~/Page/Promos/PromosSearching.aspx" + "?ConditionID=" + Utility.Transaction.IntKey.ToString()); } else { Response.Redirect("~/Page/Promos/PromosSearching.aspx" + "?ConditionID=" + Utility.Transaction.IntKey.ToString()); } } if (IsDataError) { Response.Redirect("~/Page/Flight/SearchConditionsMeaasageForm.aspx?ConditionID=" + Utility.Transaction.IntKey.ToString()); } else { Response.Redirect("~/Page/Flight/SearchConditionsMeaasageForm.aspx?ConditionID=" + Utility.Transaction.IntKey.ToString() + "&DateErrorMsg=" + Resources.HintInfo.AirDateError); } } else { if (IsSelectAirport) { if (!Utility.IsLogin && Session["IndexForFlight"] == null) { if (IsDataError) { Response.Redirect("~/Page/Promos/PromosSearching.aspx" + "?ConditionID=" + Utility.Transaction.IntKey.ToString()); } else { Response.Redirect("~/Page/Promos/PromosSearching.aspx" + "?ConditionID=" + Utility.Transaction.IntKey.ToString()); } } if (IsDataError) { Response.Redirect("~/Page/Flight/SearchConditionsForm.aspx?ConditionID=" + Utility.Transaction.IntKey.ToString()); } else { Response.Redirect("~/Page/Flight/SearchConditionsForm.aspx?ConditionID=" + Utility.Transaction.IntKey.ToString() + "&DateErrorMsg=" + Resources.HintInfo.AirDateError); } } else { if (!Utility.IsLogin && Session["IndexForFlight"] == null) { if (IsDataError) { Response.Redirect("~/Page/Promos/PromosSearching.aspx" + "?ConditionID=" + Utility.Transaction.IntKey.ToString()); } else { Response.Redirect("~/Page/Promos/PromosSearching.aspx" + "?ConditionID=" + Utility.Transaction.IntKey.ToString()); } } log.Info(Session["LOG_RANDOM"].ToString() + " >Redirect Searching.aspx Begin Start time : " + System.DateTime.Now); if (IsDataError) { Response.Redirect("~/Page/Promos/PromosSearching.aspx?ConditionID=" + Utility.Transaction.IntKey.ToString()); } else { Response.Redirect("~/Page/Promos/PromosSearching.aspxx?ConditionID=" + Utility.Transaction.IntKey.ToString() + "&DateErrorMsg=" + Resources.HintInfo.AirDateError); } } } }