コード例 #1
0
        public bool SavePromotionalFare(PromotionalFareModel model)
        {
            //Save Air_PromotionalFares
            Air_PromotionalFares promotionalFareToSave = new Air_PromotionalFares
            {
                //AirlineId = model.PromotionalFareSector.AirlineId,
                //FromCityId = model.PromotionalFareSector.PromotionalFareSegment.FirstOrDefault().FromCityId,
                //ToCityId = model.PromotionalFareSector.PromotionalFareSegment.LastOrDefault().ToCityId,
                //DepartureDate = model.PromotionalFareSector.PromotionalFareSegment.FirstOrDefault().DepartureDate,
                //ArrivalDate = model.PromotionalFareSector.PromotionalFareSegment.LastOrDefault().ArrivalDate,
                //DepartureTime = model.PromotionalFareSector.PromotionalFareSegment.FirstOrDefault().DepartureDate.Value.TimeOfDay,
                //ArrivalTime = model.PromotionalFareSector.PromotionalFareSegment.LastOrDefault().ArrivalDate.Value.TimeOfDay,
                //TourCode = model.PromotionalFareSector.TourCode,
                //CurrencyId = model.PromotionalFareSector.CurrencyId,
                //BaseFare = (double)model.PromotionalFareSector.BaseFare,
                //OtherCharges = (double)model.PromotionalFareSector.OtherCharges,
                //Class = model.PromotionalFareSector.BICClass,
                //FareBasis = model.PromotionalFareSector.FareBasis,
                //EffectiveFrom = model.PromotionalFareSector.EffectiveFrom,
                //ExpireOn = model.PromotionalFareSector.ExpireOn,
                //NoOfPax = model.PromotionalFareSector.NoOfPax,
                //CreatedBy = 1,
                //CreatedDate = DateTime.UtcNow,
                //isActive = true
            };

            entity.AddToAir_PromotionalFares(promotionalFareToSave);
            entity.SaveChanges();

            SavePromotionalSegments(model, promotionalFareToSave.PromotionalFareId);
            SavePromotionalFareTaxes(model, promotionalFareToSave.PromotionalFareId);
            entity.SaveChanges();
            return(true);
        }
コード例 #2
0
        public bool EditPromotionalFare(PromotionalFareModel model)
        {
            Air_PromotionalFares promotionalFareToEdit = entity.Air_PromotionalFares.Where(x => x.PromotionalFareId == model.PromotionalFareSector.PromotionalFareId).FirstOrDefault();

            //promotionalFareToEdit.AirlineId = model.PromotionalFareSector.AirlineId;

            //promotionalFareToEdit.FromCityId = model.PromotionalFareSector.PromotionalFareSegment.FirstOrDefault().FromCityId;
            //promotionalFareToEdit.ToCityId = model.PromotionalFareSector.PromotionalFareSegment.LastOrDefault().ToCityId;
            //promotionalFareToEdit.DepartureDate = model.PromotionalFareSector.PromotionalFareSegment.FirstOrDefault().DepartureDate;
            //promotionalFareToEdit.ArrivalDate = model.PromotionalFareSector.PromotionalFareSegment.LastOrDefault().ArrivalDate;
            //promotionalFareToEdit.DepartureTime = model.PromotionalFareSector.PromotionalFareSegment.FirstOrDefault().DepartureDate.Value.TimeOfDay;
            //promotionalFareToEdit.ArrivalTime = model.PromotionalFareSector.PromotionalFareSegment.LastOrDefault().ArrivalDate.Value.TimeOfDay;
            //promotionalFareToEdit.TourCode = model.PromotionalFareSector.TourCode;
            //promotionalFareToEdit.CurrencyId = model.PromotionalFareSector.CurrencyId;
            //promotionalFareToEdit.BaseFare = (double)model.PromotionalFareSector.BaseFare;
            //promotionalFareToEdit.OtherCharges = (double)model.PromotionalFareSector.OtherCharges;
            //promotionalFareToEdit.Class = model.PromotionalFareSector.BICClass;
            //promotionalFareToEdit.FareBasis = model.PromotionalFareSector.FareBasis;
            //promotionalFareToEdit.EffectiveFrom = model.PromotionalFareSector.EffectiveFrom;
            //promotionalFareToEdit.ExpireOn = model.PromotionalFareSector.ExpireOn;
            //promotionalFareToEdit.NoOfPax = model.PromotionalFareSector.NoOfPax;
            //promotionalFareToEdit.CreatedBy = 1;
            //promotionalFareToEdit.CreatedDate = DateTime.UtcNow;
            //promotionalFareToEdit.isActive = true;

            entity.ApplyCurrentValues(promotionalFareToEdit.EntityKey.EntitySetName, promotionalFareToEdit);

            EditPromotionalSegments(model);
            EditPromotionalFareTaxes(model);
            entity.SaveChanges();
            return(true);
        }
コード例 #3
0
        public bool Delete(Int64 promotionalFareId)
        {
            Air_PromotionalFares promotionalFares = entity.Air_PromotionalFares.Where(x => x.PromotionalFareId == promotionalFareId).FirstOrDefault();

            promotionalFares.isActive = false;
            entity.ApplyCurrentValues(promotionalFares.EntityKey.EntitySetName, promotionalFares);
            entity.SaveChanges();
            return(true);
        }
コード例 #4
0
        //***************************************************************************************************Save Part*************************************************************//
        public void Save(PromotionalFareModel model)
        {
            Air_PromotionalFares ObjToSave = new Air_PromotionalFares()
            {
                CurrencyId    = model.PromotionalFareSector.CurrencyId,
                BaseFare      = Convert.ToDouble(model.PromotionalFareSector.BaseFare),
                FareRules     = model.PromotionalFareSector.FareRule != null ? model.PromotionalFareSector.FareRule : string.Empty,
                isActive      = model.PromotionalFareSector.Status,
                EffectiveFrom = model.PromotionalFareSector.EffectiveFrom.Value,
                ExpireOn      = model.PromotionalFareSector.ExpireOn.Value,
                CreatedBy     = model.PromotionalFareSector.CreatedBy,
                Notes         = model.PromotionalFareSector.Note,
                Qutota        = model.PromotionalFareSector.TotalSeatQuota,
                CreatedDate   = DateTime.UtcNow,
                Air_PromotionalFareSegments = SaveSegments(model),
                Air_PromotionalFareTaxes    = SaveTax(model)
            };

            entity.AddToAir_PromotionalFares(ObjToSave);
            entity.SaveChanges();
        }
コード例 #5
0
        public PromotionalFareModel GetPromotionalFareSetupEditModel(Int64 promotionalFareId)
        {
            GeneralProvider       generalProvider       = new GeneralProvider();
            PromotionalFareModel  model                 = new PromotionalFareModel();
            PromotionalFareSector promotionalFareSector = new PromotionalFareSector();

            Air_PromotionalFares promotionalFares = entity.Air_PromotionalFares.Where(x => x.PromotionalFareId == promotionalFareId).FirstOrDefault();

            if (promotionalFares != null)
            {
                //  promotionalFareSector.CityList = generalProvider.GetAirlineCityList();
                //promotionalFareSector.AirlinesList = generalProvider.GetInternationAirlinesList(1);
                //promotionalFareSector.CurrencyList = generalProvider.GetCurrencyList();

                //promotionalFareSector.PromotionalFareId = promotionalFares.PromotionalFareId;
                //promotionalFareSector.AirlineId = promotionalFares.AirlineId;

                //promotionalFareSector.TourCode = promotionalFares.TourCode;
                //promotionalFareSector.CurrencyId = promotionalFares.CurrencyId;
                //promotionalFareSector.BICClass = promotionalFares.Class;

                //promotionalFareSector.FareBasis = promotionalFares.FareBasis;
                //promotionalFareSector.EffectiveFrom = promotionalFares.EffectiveFrom;
                //promotionalFareSector.ExpireOn = promotionalFares.ExpireOn;
                //promotionalFareSector.NoOfPax = promotionalFares.NoOfPax;

                //promotionalFareSector.BaseFare = (decimal)promotionalFares.BaseFare;
                //promotionalFareSector.OtherCharges = (decimal)promotionalFares.OtherCharges;
                //promotionalFareSector.NoOfPax = promotionalFares.NoOfPax;

                var taxes = promotionalFares.Air_PromotionalFareTaxes;
                List <PromotionalFareTaxes> promotionalFareTaxesList = new List <PromotionalFareTaxes>();
                foreach (var tax in taxes)
                {
                    PromotionalFareTaxes promotionalFareTaxes = new PromotionalFareTaxes()
                    {
                        PromotionalFareId    = tax.PromotionalFareId,
                        PromotionalFareTaxId = tax.PromotionalFareTaxId,
                        TaxName   = tax.TaxName,
                        TaxAmount = tax.TaxAmount
                    };
                    promotionalFareTaxesList.Add(promotionalFareTaxes);
                }

                promotionalFareSector.Taxes = promotionalFareTaxesList;

                var segments = promotionalFares.Air_PromotionalFareSegments;
                List <PromotionalFareSegment> promotionalFareSegmentList = new List <PromotionalFareSegment>();
                foreach (var segment in segments)
                {
                    PromotionalFareSegment promotionalFareSegment = new PromotionalFareSegment()
                    {
                        //PromotionalFareId = segment.PromotionalFareId,
                        //PromotionalFareSegmentId = segment.PromotionalFareSegmentId,
                        //FromCity = entity.Air_PromotionalFares.Where(x =>x.FromCityId== segment.FromCityId).Select(x=>x.AirlineCities.CityCode).FirstOrDefault(),
                        //ToCity = entity.Air_PromotionalFares.Where(x => x.ToCityId == segment.ToCityId).Select(x => x.AirlineCities1.CityCode).FirstOrDefault(),
                        //FromCityId = segment.FromCityId,
                        //ToCityId = segment.ToCityId,
                        //DepartureDate = segment.DepartureDate,
                        //DepartureTime = segment.DepartureTime,
                        //ArrivalDate = segment.ArrivalDate,
                        //ArrivalTime = segment.ArrivalTime,
                        //FlightNo = segment.FlightNo,
                        //FromCityList=new SelectList( generalProvider.GetAirlineCityList(),"Value","Text",segment.FromCityId),
                        //ToCityList = new SelectList(generalProvider.GetAirlineCityList(), "Value", "Text", segment.ToCityId)
                    };
                    promotionalFareSegmentList.Add(promotionalFareSegment);
                }
                promotionalFareSector.PromotionalFareSegment = promotionalFareSegmentList;
            }
            model.PromotionalFareSector = promotionalFareSector;
            return(model);
        }