private AirMaterial EditFare(AirMaterial airMaterial)
    {
        int adult = ((AirSearchCondition)Utility.Transaction.CurrentSearchConditions).GetPassengerNumber(TERMS.Common.PassengerType.Adult); //������
        int child = ((AirSearchCondition)Utility.Transaction.CurrentSearchConditions).GetPassengerNumber(TERMS.Common.PassengerType.Child); //����
        decimal AirTotalPrice = 0.0m; //�ܼ�
        decimal adultTax = 0.0m; //���˵�˰
        decimal childTax = 0.0m; //С����˰
        decimal adultPrice = 0.0m; //���˺�˰����
        decimal childPrice = 0.0m; //С����˰����
        decimal adultMarkup = 0.0m;
        decimal childMarkup = 0.0m;

        decimal adultBasePrice = 0.0m; //���˲���˰����
        decimal childBasePrice = 0.0m; //С������˰����

        if (airMaterial.Profile.GetParam("FARE_TYPE").ToString() == "COMM" || airMaterial.Profile.GetParam("FARE_TYPE").ToString() == "COMMNEW" || airMaterial.Profile.GetParam("FARE_TYPE").ToString() == "NET")
        {
            adultTax = airMaterial.Profile.GetParam("ADULT_TAX") == null ? adultTax : Convert.ToDecimal(airMaterial.Profile.GetParam("ADULT_TAX"));
            childTax = airMaterial.Profile.GetParam("CHILD_TAX") == null ? childTax : Convert.ToDecimal(airMaterial.Profile.GetParam("CHILD_TAX"));
            airMaterial.SetAdultTax(adultTax);
            airMaterial.SetChildTax(childTax);

            adultBasePrice = airMaterial.Profile.GetParam("PUBLISHED_ADULT_FARE") == null ? adultBasePrice : Convert.ToDecimal(airMaterial.Profile.GetParam("PUBLISHED_ADULT_FARE"));
            childBasePrice = airMaterial.Profile.GetParam("PUBLISHED_CHILD_FARE") == null ? childBasePrice : Convert.ToDecimal(airMaterial.Profile.GetParam("PUBLISHED_CHILD_FARE"));
            int commision = airMaterial.Profile.GetParam("COMMISION") == null ? 0 : Convert.ToInt32(airMaterial.Profile.GetParam("COMMISION"));

            if (airMaterial.Profile.GetParam("FARE_TYPE").ToString() == "NET") commision = 0;
            if (child > 0)
            {
                if (airMaterial.Profile.GetParam("FARE_TYPE").ToString() == "NET")
                {
                    childPrice = airMaterial.ChildBaseFare + airMaterial.ChildMarkup + childTax;
                }
                else
                {
                    if (Convert.ToBoolean(airMaterial.Profile.GetParam("ISWEBFARE")))
                    {
                        childPrice = childBasePrice + airMaterial.ChildMarkup + childTax;
                        airMaterial.SetChildBaseFare(childBasePrice);
                        airMaterial.GetPrice().SetServiceFee(TERMS.Common.PassengerType.Child, new FareAmount(airMaterial.ChildMarkup, new Currency(), new Currency()));
                    }
                    else
                    {
                        decimal childFinalBasePrice = decimal.Ceiling(childBasePrice * (100 - commision) / 100);
                        airMaterial.SetChildBaseFare(childFinalBasePrice);
                        childPrice = childFinalBasePrice + airMaterial.ChildMarkup + childTax;

                    }
                }
            }

            if (adult > 0)
            {
                if (airMaterial.Profile.GetParam("FARE_TYPE").ToString() == "NET")
                {
                    adultPrice = airMaterial.AdultBaseFare + airMaterial.AdultMarkup + adultTax;
                }
                else
                {
                    if (Convert.ToBoolean(airMaterial.Profile.GetParam("ISWEBFARE")))
                    {
                        adultPrice = adultBasePrice + airMaterial.AdultMarkup + adultTax;
                        airMaterial.SetAdultBaseFare(adultBasePrice);
                        airMaterial.GetPrice().SetServiceFee(TERMS.Common.PassengerType.Adult, new FareAmount(airMaterial.AdultMarkup, new Currency(), new Currency()));
                    }
                    else
                    {
                        decimal adultFinalBasePrice = decimal.Ceiling(adultBasePrice * (100 - commision) / 100);
                        airMaterial.SetAdultBaseFare(adultFinalBasePrice);
                        adultPrice = adultFinalBasePrice + airMaterial.AdultMarkup + adultTax;

                    }
                }
            }

        }

        return airMaterial;
    }
示例#2
0
    private void GetAirBookingCondition(ref IList<Passenger> passengers)
    {
        AirMaterial airMaterial = new AirMaterial(SelectedAirMerchandise.Profile);
        airMaterial.SetAdultBaseFare(SelectedAirMerchandise.AdultBaseFare);
        airMaterial.SetChildBaseFare(SelectedAirMerchandise.ChildBaseFare);

        //ADD PengZhaohui
        TERMS.Common.Markup markup = new TERMS.Common.Markup(TERMS.Common.PassengerType.Adult, new TERMS.Common.FareAmount(SelectedAirMerchandise.AdultMarkup));
        markup.SetAmount(TERMS.Common.PassengerType.Child, new TERMS.Common.FareAmount(SelectedAirMerchandise.ChildMarkup));

        airMaterial.Price.SetMarkup(markup);
        //airMaterial.Price.AddMarkup(new TERMS.Common.Markup(TERMS.Common.PassengerType.Child, new TERMS.Common.FareAmount(SelectedAirMerchandise.ChildMarkup)));
        //ADD END

        if (Request["rdDept"] != null)
        {
            //IList<Terms.Product.Domain.ComponentGroupItem> componentGroupItems = ((AirComponentGroup)((ComponentGroup)CurrentSession.SecondSearchResults[Index.ToString()]).Items[0].Component).Items;
            //airBooking.AdultNumber =((AirProfile) Group.Profile).AdultNumber;
            //airBooking.ChildNumber = ((AirProfile)Group.Profile).ChildNumber;

            //airBooking.IsMexico = CurrentSession.SearchCondition.IsMexico;
            //airBooking.FareType = ((AirProfile)Group.Profile).FareType.ToUpper().Equals("COMM") ? FlightFareType.COMM : FlightFareType.NET;
            //airBooking.AdultAirFare.SetConsolidatorBase(0, Group.AdultBaseFare, airBooking.FareType);
            //airBooking.AdultAirFare.SetConsolidatorMarkup(Group.AdultMarkup, airBooking.FareType == FlightFareType.COMM);
            //airBooking.ChildAirFare.SetConsolidatorBase(0, Group.ChildBaseFare, airBooking.FareType);
            //airBooking.ChildAirFare.SetConsolidatorMarkup(Group.ChildMarkup, airBooking.FareType == FlightFareType.COMM);
            //componentGroup.SetAdultConsolidatorBase(0, componentGroup.AdultBaseFare);
            //componentGroup.SetChildConsolidatorBase(0, componentGroup.ChildBaseFare);
            //componentGroup.SetConsolidatorAdultMarkup(componentGroup.AdultMarkup, componentGroup.FareType == FlightFareType.COMM);
            //componentGroup.SetConsolidatorChildMarkup(componentGroup.ChildMarkup, componentGroup.FareType == FlightFareType.COMM);
            //AirTrip airTrip = ((Terms.Product.Domain.AirMaterial)componentGroupItems[Convert.ToInt32(Request["rdDept"].ToString())].Component).AirTrip;
            //airBooking.Trips.Add(airTrip);

            //AirComponentGroup gourp = new AirComponentGroup((AirProfile)((ComponentGroup)CurrentSession.SecondSearchResults[Index.ToString()]).Profile);
            //gourp.Items.Add(componentGroupItems[Convert.ToInt32(Request["rdDept"].ToString())]);

            AirMaterial depAirMaterial =(AirMaterial) ((AirMerchandise)SelectedAirMerchandise.Items[0]).Items[Convert.ToInt32(Request["rdDept"].ToString())];

            airMaterial.AirTrip.SubTrips.Add(depAirMaterial.AirTrip.SubTrips[0]);

        }

        if (Request["rdRtn"] != null && !((AirSearchCondition)this.Transaction.CurrentSearchConditions).FlightType.ToUpper().Equals("ONEWAY"))
        {

            //IList<Terms.Product.Domain.ComponentGroupItem> componentGroupItems = ((AirComponentGroup)((ComponentGroup)CurrentSession.SecondSearchResults[Index.ToString()]).Items[1].Component).Items;
            //AirTrip airTrip = ((Terms.Product.Domain.AirMaterial)componentGroupItems[Convert.ToInt32(Request["rdRtn"].ToString())].Component).AirTrip;
            //airBooking.Trips.Add(airTrip);

            //AirComponentGroup gourp = new AirComponentGroup((AirProfile)((ComponentGroup)CurrentSession.SecondSearchResults[Index.ToString()]).Profile);
            //gourp.Items.Add(componentGroupItems[Convert.ToInt32(Request["rdRtn"].ToString())]);
            //componentGroup.Items.Add(new ComponentGroupItem(gourp));

            AirMaterial depAirMaterial = (AirMaterial)((AirMerchandise)SelectedAirMerchandise.Items[1]).Items[Convert.ToInt32(Request["rdRtn"].ToString())];

            airMaterial.AirTrip.SubTrips.Add(depAirMaterial.AirTrip.SubTrips[0]);
        }
        //ComponentGroupItem componentGroupItem = new ComponentGroupItem(componentGroup);

        //ComponentGroup newComponentGroup = new ComponentGroup(((ComponentGroup)PackageMerchandise.ComponentGroup.Items[0].Component).Profile);
        //newComponentGroup.Items.Add(componentGroupItem);
        //SaleMerchandise saleMerchandise = new SaleMerchandise();
        //saleMerchandise.ComponentGroup = newComponentGroup;
        //this.Transaction.CurrentTransactionObject.Items.Clear();
        //this.Transaction.CurrentTransactionObject.AddItem(saleMerchandise);
        AirOrderItem airOrderItem = new AirOrderItem(airMaterial);

        this.Transaction.CurrentTransactionObject.Items.Clear();
        this.Transaction.CurrentTransactionObject.AddItem(airOrderItem);

        for (int i = 0; i < Convert.ToInt32(airMaterial.Profile.GetParam("ADULT_NUMBER")); i++)
        {
            Passenger passenger = new Passenger(ProductConst.PASSFIRSTNAME, ProductConst.ADTPASSLASTNAME,ProductConst.PASSMIDDLENAME, TERMS.Common.PassengerType.Adult);
            passengers.Add(passenger);
        }
        for (int i = 0; i < Convert.ToInt32(airMaterial.Profile.GetParam("CHILD_NUMBER")); i++)
        {
            Passenger passenger = new Passenger(ProductConst.PASSFIRSTNAME, ProductConst.CHDPASSLASTNAME, ProductConst.PASSMIDDLENAME, TERMS.Common.PassengerType.Child);
            passengers.Add(passenger);
        }
    }