Esempio n. 1
0
        public SpecialFaresModel GetSpecialFaresDetail(int id)
        {
            Air_SpecialFares result = ent.Air_SpecialFares.Where(x => x.SpecialFareId == id).FirstOrDefault();

            if (result != null)
            {
                SpecialFaresModel model = new SpecialFaresModel();

                model.SpecialFareId  = result.SpecialFareId;
                model.FromCityId     = result.FromCityId;
                model.hdfFromCityId  = (int)result.FromCityId;
                model.FromCityName   = result.AirlineCities.CityName;
                model.ToCityId       = result.ToCityId;
                model.hdfToCityId    = (int)result.ToCityId;
                model.ToCityName     = result.AirlineCities1.CityName;
                model.AirlineId      = result.AirlineId;
                model.hdfAirlineName = (int)result.AirlineId;
                model.AirlineName    = result.Airlines.AirlineName;
                model.RegularFare    = result.RegularFare;
                model.SpecialFare    = result.SpecialFare;
                model.EffectiveFrom  = result.EffectiveFrom;
                model.ExpireOn       = result.ExpireOn;

                return(model);
            }
            return(null);
        }
Esempio n. 2
0
        public void DeleteSpecialFare(int id)
        {
            Air_SpecialFares result = ent.Air_SpecialFares.Where(x => x.SpecialFareId == id).FirstOrDefault();

            ent.DeleteObject(result);
            ent.SaveChanges();
        }
Esempio n. 3
0
        public void CreateSpecialFares(SpecialFaresModel model)
        {
            Air_SpecialFares obj = new Air_SpecialFares();

            obj.FromCityId    = model.hdfFromCityId;
            obj.ToCityId      = model.hdfToCityId;
            obj.AirlineId     = model.hdfAirlineName;
            obj.RegularFare   = Convert.ToDouble(model.RegularFare);
            obj.SpecialFare   = Convert.ToDouble(model.SpecialFare);
            obj.CreatedBy     = model.CreatedBy;
            obj.CreatedDate   = DateTime.Now;
            obj.EffectiveFrom = Convert.ToDateTime(model.EffectiveFrom);
            obj.ExpireOn      = Convert.ToDateTime(model.ExpireOn);

            ent.AddToAir_SpecialFares(obj);
            ent.SaveChanges();
        }
Esempio n. 4
0
        public void EditSpecialFare(SpecialFaresModel model)
        {
            Air_SpecialFares result = ent.Air_SpecialFares.Where(u => u.SpecialFareId == model.SpecialFareId).FirstOrDefault();

            if (result != null)
            {
                result.FromCityId    = model.hdfFromCityId;
                result.ToCityId      = model.hdfToCityId;
                result.AirlineId     = model.hdfAirlineName;
                result.RegularFare   = Convert.ToDouble(model.RegularFare);
                result.SpecialFare   = Convert.ToDouble(model.SpecialFare);
                result.UpdatedBy     = model.UpdatedBy;
                result.UpdatedDate   = DateTime.Now;
                result.EffectiveFrom = Convert.ToDateTime(model.EffectiveFrom);
                result.ExpireOn      = Convert.ToDateTime(model.ExpireOn);

                ent.ApplyCurrentValues(result.EntityKey.EntitySetName, result);
                ent.SaveChanges();
            }
        }