コード例 #1
0
    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");
    }