protected void dlAirFare_ItemCommand(object sender, DataListCommandEventArgs e) { int merchandiseIndex; AirMaterial tempAirMaterial; if (SessionExpired) { //Err(Resources.HintInfo.TheResearch, "", "Step2.aspx"); } else { int flightdetailIndex = e.Item.ItemIndex + PageNumber2.PageSize * PageNumber2.CurrentPageIndex; AirMaterial merchandise = (AirMaterial)(SelectContactFlightList[flightdetailIndex]); AirProfile currentAirProfile = (AirProfile)merchandise.Profile; AirMaterial currentAirMaterial = (AirMaterial)SelectContactFlightList[flightdetailIndex]; int index = int.Parse(currentAirMaterial.Profile.GetParam(Key_FlightMerchandisIndex).ToString()); AirMaterial tGoup = (AirMaterial)SelectContactFlightList[flightdetailIndex]; if (e.CommandName == "Select") { FlightMerchandiseManager manager = new FlightMerchandiseManager(); OperaterAdvice.DoAdvice(Terms.Configuration.Utility.ConfigurationConst.OperateType.SelectAir, this); //System.Threading.Thread.Sleep(1000); ImageButton btnSel = (ImageButton)e.Item.FindControl("btnSelect"); btnSel.Visible = false; //currentGroup ֻΪ�˴���һ���¼�GteReBindContactAgentList(componentGroup.Items) IList<TERMS.Core.Product.Component> currentGroup = null; if (((TERMS.Core.Product.ComponentGroup)FlightMerchandise.AirProduct.Items[index]).ItemGetter != null) { currentGroup = ((TERMS.Core.Product.ComponentGroup)FlightMerchandise.AirProduct.Items[index]).ItemGetter.Get(); } else { tGoup.Profile.SetParam("SHOULD_CALL", true); runFlag.Value = "0"; return; } for (int i = 0; i < FlightMerchandise.Items.Count; i++) { TERMS.Core.Product.ComponentGroup componentGroup = (TERMS.Core.Product.ComponentGroup)FlightMerchandise.AirProduct.Items[i]; if (componentGroup.Profile.GetParam("VISITTED") == null && componentGroup.ItemGetter != null && componentGroup.ItemGetter.GetStatus() == ComponentGetterStatus.HasGot) { //δ���ʹ� && ��getter(SR,PUBû��) && getter��ȡ������ AirMerchandise airMerchandise = (AirMerchandise)FlightMerchandise.Items[i]; if (componentGroup.Items != null && componentGroup.Items.Count > 0) { //��ɾ�����Merchandise��Select merchandiseIndex = 0; int firstIndex = 0; for (int materialIndex = 0; materialIndex < SelectContactFlightList.Count; materialIndex++) { tempAirMaterial = (AirMaterial)SelectContactFlightList[materialIndex]; merchandiseIndex = int.Parse(tempAirMaterial.Profile.GetParam(Key_FlightMerchandisIndex).ToString()); if (merchandiseIndex == i) { if (firstIndex == 0) { firstIndex = materialIndex; } //materialIndex--; } } IList<TERMS.Core.Product.Component> group = componentGroup.Items; foreach (TERMS.Core.Product.ComponentGroup cGroup in group) { if (cGroup.Items != null && cGroup.Items.Count > 0) { int currentInsertIndex = firstIndex; AirMaterial airMaterial; for (int airMaterialindex = 0; airMaterialindex < cGroup.Items.Count; airMaterialindex++) { airMaterial = (AirMaterial)cGroup.Items[airMaterialindex]; airMaterial.Profile = (AirProfile)SelectContactFlightList[firstIndex].Profile; //airMaterial.Profile = (AirProfile)airMerchandise.Profile; airMaterial.Profile.SetParam(Key_FlightMerchandisIndex, i); //airMaterial.Profile.SetParam("FARE_TYPE", Terms.Product.Utility.FlightFareType.PUB.ToString()); //((AirProfile)airMaterial.Profile).set //SetFare //airMaterial.SetAdultBaseFare(airMerchandise.AdultBaseFare); //airMaterial.SetAdultMarkup(airMerchandise.AdultMarkup); //airMaterial.SetAdultTax(airMerchandise.AdultTax); //airMaterial.SetChildBaseFare(airMerchandise.ChildBaseFare); //airMaterial.SetChildMarkup(airMerchandise.ChildMarkup); //airMaterial.SetChildTax(airMerchandise.ChildTax); CopyMarkup(airMerchandise, airMaterial); //airMaterial.Profile.SetParam("FARE_TYPE", Terms.Product.Utility.FlightFareType.NET.ToString()); //airMaterial.Profile.SetParam("VISITTED", true); //����Ϊ�ѷ��� airMaterial.Profile.SetParam("SelectAvailable", true); //airMaterial = EditGroupMarkupAfterSelect(airMaterial, groupMarkup); airMaterial = manager.EditMaterialGroupMarkup(airMaterial); airMerchandise.Add(airMaterial); SelectContactFlightList.Insert(currentInsertIndex + 1, airMaterial); currentInsertIndex++; //firstIndex++; } } SelectContactFlightList[firstIndex].Profile.SetParam("SHOULD_CALL", true); //else //{ // SelectContactFlightList[firstIndex].Profile.SetParam("SHOULD_CALL", true); // //cGroup.Profile.SetParam("SHOULD_CALL", true); //} } } else { for (int materialIndex = 0; materialIndex < SelectContactFlightList.Count; materialIndex++) { tempAirMaterial = (AirMaterial)SelectContactFlightList[materialIndex]; merchandiseIndex = int.Parse(tempAirMaterial.Profile.GetParam(Key_FlightMerchandisIndex).ToString()); if (merchandiseIndex == i) { tempAirMaterial.Profile.SetParam("SHOULD_CALL", true); } } } bool isAvailable = true; string errMessage = string.Empty; if (airMerchandise.Items == null || airMerchandise.Items.Count == 0) { isAvailable = false; //errMessage = Resources.HintInfo.NoAvailableFlight; } if (isAvailable) { //ImageButton btnAvail = (ImageButton)e.Item.FindControl("btnAvail"); //btnAvail.Visible = true; //btnAvail.CommandName = "BeAvail"; } else { //ImageButton btnNotAvail = (ImageButton)e.Item.FindControl("btnNotAvail"); //btnNotAvail.Visible = true; //btnSel.Visible = false; //btnNotAvail.Enabled = true; //Panel p = (Panel)e.Item.FindControl("PopupMenu"); //Label lbl_ErrorMessage = (Label)e.Item.FindControl("lbl_ErrorMessage"); //lbl_ErrorMessage.Text = errMessage; //airMerchandise.Profile.SetParam("ERR_MESSAGE", errMessage); merchandiseIndex = 0; for (int materialIndex = 0; materialIndex < SelectContactFlightList.Count; materialIndex++) { tempAirMaterial = (AirMaterial)SelectContactFlightList[materialIndex]; merchandiseIndex = int.Parse(tempAirMaterial.Profile.GetParam(Key_FlightMerchandisIndex).ToString()); if (merchandiseIndex == i) { tempAirMaterial.Profile.SetParam("ERR_MESSAGE", errMessage); } } //p.Visible = true; } componentGroup.Profile.SetParam("VISITTED", true); //����Ϊ�ѷ��� merchandiseIndex = 0; //for (int materialIndex = 0; materialIndex < FlightDetailList.Count; materialIndex++) //{ // tempAirMaterial = (AirMaterial)FlightDetailList[materialIndex]; // merchandiseIndex = int.Parse(tempAirMaterial.Profile.GetParam(Key_FlightMerchandisIndex).ToString()); // if (merchandiseIndex == i) // { // tempAirMaterial.Profile.SetParam("VISITTED", true); //����Ϊ�ѷ��� // } //} } } //TERMS.Business.Centers.ProductCenter.Profiles.AirProfile profile = (TERMS.Business.Centers.ProductCenter.Profiles.AirProfile)airMerchandise.Profile; //foreach (TERMS.Core.Product.ComponentGroup componentGroup in group) //{ // if (componentGroup.Items != null && componentGroup.Items.Count > 0) // { // foreach (AirMaterial airMaterial in componentGroup.Items) // { // airMerchandise.Add(airMaterial); // } // } //} tGoup.Profile.SetParam("SHOULD_CALL", true); BindAfterSelect(PageNumber2.CurrentPageIndex); runFlag.Value = "0"; } else if (e.CommandName == "Avail" || e.CommandName == "BeAvail") { isClickAvailable = false; DoAvailableProcess(flightdetailIndex, tGoup); isClickAvailable = true; } //tonglanli 20080918 else if (e.CommandName == "ContactAgt") { AnalyseContactAgt(); } else if (e.CommandName == "NotAvail") { } else { SelectAirMaterial = tGoup; CurrentSession.OriginalIndex = flightdetailIndex; Response.Redirect("Step3_bulk.aspx"); } } }
private void DoAvailableProcess(int flightdetailIndex, AirMaterial tGoup) { OperaterAdvice.DoAdvice(Terms.Configuration.Utility.ConfigurationConst.OperateType.ClickAvalibale, this); CurrentSession.OriginalIndex = flightdetailIndex; FlightMerchandiseManager flightMerchandiseManager = new FlightMerchandiseManager(); AirMaterial airMaterial = tGoup; decimal originalPrice = GetTotalPrice(airMaterial); decimal newPrice = 0; bool bclError = false; //if (tGoup.Profile.GetParam("FARE_TYPE").Equals(FlightFareType.SR.ToString()) || tGoup.Profile.GetParam("FARE_TYPE").Equals("COMMNEW") || tGoup.Profile.GetParam("FARE_TYPE").Equals(FlightFareType.PUB.ToString())) //{ // //AirMaterial airMaterial = tGoup; // AirOrderItem airOrderItem = new AirOrderItem(airMaterial); // this.Transaction.CurrentTransactionObject.Items.Clear(); // this.Transaction.CurrentTransactionObject.AddItem(airOrderItem); // IList<TERMS.Business.Centers.SalesCenter.Passenger> passengers = new List<TERMS.Business.Centers.SalesCenter.Passenger>(); // SetPreBookingPassengers(airMaterial, ref passengers); // try // { // AirService.PreBookAirline2(ref airMaterial, passengers); // } // catch (Exception ex) // { // DoErrorProcess(ex); // log.Error(ex.Message, ex); // bclError = true; // } // if (bclError) // this.Err("", "Booking failed", "NewStep2.aspx"); // FlightMerchandiseManager flightMerchandiseManager = new FlightMerchandiseManager(); // airMaterial = flightMerchandiseManager.EditMaterialGroupMarkup(airMaterial); //} //else //{ // IList<TERMS.Business.Centers.SalesCenter.Passenger> passengers = new List<TERMS.Business.Centers.SalesCenter.Passenger>(); // try // { // GetAirBookingCondition(ref passengers, tGoup); // } // catch (Exception E) // { // log.Error(E.Message, E); // } // //AirMaterial airMaterial = tGoup; // bool bclError = false; // try // { // string[] requestXML = new string[3]; // //ws.PreBookAirline(ref group, SearchArray, requestXML); // AirService.PreBookAirline2(ref airMaterial, passengers); // FlightMerchandiseManager flightMerchandiseManager = new FlightMerchandiseManager(); // airMaterial = flightMerchandiseManager.EditMaterialGroupMarkup(airMaterial); // } // catch (Exception ex) // { // DoErrorProcess(ex); // log.Error(ex.Message, ex); // bclError = true; // } // if (bclError) // this.Err("", "Booking failed", "NewStep2.aspx"); //} try { IList<TERMS.Business.Centers.SalesCenter.Passenger> passengers = new List<TERMS.Business.Centers.SalesCenter.Passenger>(); if (tGoup.Profile.GetParam("FARE_TYPE").Equals(FlightFareType.SR.ToString()) || tGoup.Profile.GetParam("FARE_TYPE").Equals("COMMNEW") || tGoup.Profile.GetParam("FARE_TYPE").Equals(FlightFareType.PUB.ToString())) { AirOrderItem airOrderItem = new AirOrderItem(airMaterial); this.Transaction.CurrentTransactionObject.Items.Clear(); this.Transaction.CurrentTransactionObject.AddItem(airOrderItem); SetPreBookingPassengers(airMaterial, ref passengers); } else { try { GetAirBookingCondition(ref passengers, tGoup); } catch (Exception E) { log.Error(E.Message, E); } } AirService.PreBookAirline2(ref airMaterial, passengers); airMaterial = flightMerchandiseManager.EditMaterialGroupMarkup(airMaterial); } catch (Exception ex) { DoErrorProcess(ex); log.Error(ex.Message, ex); bclError = true; DisplayCannotbook(); return; } if (bclError) { DisplayCannotbook(); return; } if (Convert.ToBoolean(tGoup.Profile.GetParam("ISWEBFARE"))) { tGoup.FareType = AirFareType.Published; Price price = new Price(); price.SetAmount(TERMS.Common.PassengerType.Adult,new FareAmount(Convert.ToDecimal(tGoup.Profile.GetParam("PUBLISHED_ADULT_FARE")))); price.SetAmount(TERMS.Common.PassengerType.Child,new FareAmount(Convert.ToDecimal(tGoup.Profile.GetParam("PUBLISHED_CHILD_FARE")))); Markup mk = FlightMerchandise.AirProduct.GetMarkup(tGoup); price.AddMarkup(mk); tGoup.SetPrice(price); } // //if (IsPriceChanged()) airMaterial = EditFare(airMaterial); newPrice = GetTotalPrice(airMaterial); SelectAirMaterial = tGoup; //���õ�ǰҳ�� SetCurrentPageNumber(); SetCurrentTabFlag(); if (isClickAvailable == true && IsChangeNotLess(newPrice, originalPrice)) { OperaterAdvice.DoAdvice(Terms.Configuration.Utility.ConfigurationConst.OperateType.IBE_AvailableFareChanged, this); ScriptManager.RegisterStartupScript(upSelect, upSelect.GetType(), "alt", "<script>$('ctl00_MainContent_pnlSelectProcessing').style.display ='none';</script>", false); Label lblCurrentMsg = null; Panel pnlCurrentComfirm = null; if (isClickAvailable == false) { lblCurrentMsg = lblSoldOutMsg_Select; pnlCurrentComfirm = pnlComfirm_Select; } else { lblCurrentMsg = lblSoldOutMsg; pnlCurrentComfirm = pnlComfirm; } if (IsLittleChanged(originalPrice, newPrice)) { lblCurrentMsg.Text = string.Format(LittleChangedSoldoutMsg, ((decimal)(newPrice - originalPrice)).ToString("#,###.##")); } else { lblCurrentMsg.Text = string.Format(LargeChangedSoldoutMsg, ((decimal)(newPrice - originalPrice)).ToString("#,###.##")); } pnlCurrentComfirm.Attributes.Add("style", "display:block;"); } else { ScriptManager.RegisterStartupScript(upSelect, upSelect.GetType(), "alt", "<script>$('ctl00_MainContent_pnlSelectProcessing').style.display ='none';document.getElementById('maskDIV').style.display = 'none';</script>", false); Response.Redirect("Step3_confirm.aspx?ConditionID=" + Request.Params["ConditionID"]); } //Response.Redirect("Step3_bulk.aspx"); }