Exemple #1
0
        protected void GridUnitOfferView_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
        {
            var listSaP = (List <UnitOfferViewModel>)GridUnitOfferView.DataSource;
            UnitOfferViewModel model = listSaP.Find(m => m.id == e.Keys[0].ToString());

            model.IsAutoStopBooking = (bool)e.NewValues["IsAutoStopBooking"];
            model.OfferCode         = e.NewValues["OfferCode"].ToString() ?? string.Empty;
            //model.SiteCode = e.NewValues["SiteCode"].ToString() ?? string.Empty;
            model.OfferCount       = e.NewValues["OfferCount"] == null ? 0 : (int)e.NewValues["OfferCount"];
            model.OfferDescription = e.NewValues["OfferDescription"].ToString() ?? string.Empty;
            // model.OfferDescriptionTranslate = (Dictionary<string,string>) e.NewValues["OfferDescriptionTranslate"];
            model.OfferTitel = e.NewValues["OfferTitel"].ToString() ?? string.Empty;
            // model.OfferTitelTranslate = (Dictionary<string, string>)e.NewValues["OfferTitelTranslate"];
            model.ProviderNotice   = e.NewValues["ProviderNotice"].ToString() ?? string.Empty;
            model.TourOperatorCode = e.NewValues["TourOperatorCode"].ToString() ?? string.Empty;
            model.UnitCode         = e.NewValues["UnitCode"].ToString() ?? e.NewValues["UnitCode"].ToString();

            if (model.UnitCode != null)
            {
                model.SiteCode = controller.GetSiteCode(model.UnitCode);
            }

            //bool contains = controller.ContainsOfferCode(model.OfferCode);

            //if (!contains)
            //{
            controller.UpdateUnitOffer(model);
            //}
            e.Cancel = true;
            GridUnitOfferView.CancelEdit();

            Bind();
        }
        public static List <UnitOfferViewModel> GetUnitOfferViewModel()
        {
            var model   = new List <UnitOfferViewModel>();
            var manager = PlugInManager.GetMasterDataManager();

            var data = manager.GetUnitOffers();

            foreach (var UnitOffer in data)
            {
                var m = new UnitOfferViewModel();
                m.id = UnitOffer.id;
                m.IsAutoStopBooking         = UnitOffer.IsAutoStopBooking;
                m.OfferCode                 = UnitOffer.OfferCode;
                m.SiteCode                  = UnitOffer.SiteCode;
                m.OfferCount                = UnitOffer.OfferCount;
                m.OfferDescription          = UnitOffer.OfferDescription;
                m.OfferDescriptionTranslate = UnitOffer.OfferDescriptionTranslate;
                m.OfferTitel                = UnitOffer.OfferTitel;
                m.OfferTitelTranslate       = UnitOffer.OfferTitelTranslate;
                m.ProviderNotice            = UnitOffer.ProviderNotice;
                m.TourOperatorCode          = UnitOffer.TourOperatorCode;
                m.UnitCode                  = UnitOffer.UnitCode;

                model.Add(m);
            }


            return(model);
        }
Exemple #3
0
        protected void GridUnitOfferView_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            UnitOfferViewModel model = new UnitOfferViewModel();


            model.IsAutoStopBooking = (bool)e.NewValues["IsAutoStopBooking"];
            model.OfferCode         = e.NewValues["OfferCode"].ToString() ?? string.Empty;
            //model.SiteCode = e.NewValues["SiteCode"].ToString()?? string.Empty;
            model.OfferCount       = e.NewValues["OfferCount"] == null? 0:(int)e.NewValues["OfferCount"];
            model.OfferDescription = e.NewValues["OfferDescription"].ToString() ?? string.Empty;
            // model.OfferDescriptionTranslate = (Dictionary<string,string>) e.NewValues["OfferDescriptionTranslate"];
            model.OfferTitel = e.NewValues["OfferTitel"].ToString() ?? string.Empty;
            // model.OfferTitelTranslate = (Dictionary<string, string>)e.NewValues["OfferTitelTranslate"];
            model.ProviderNotice   = e.NewValues["ProviderNotice"].ToString() ?? string.Empty;
            model.TourOperatorCode = e.NewValues["TourOperatorCode"].ToString() ?? string.Empty;
            model.UnitCode         = e.NewValues["UnitCode"].ToString() ?? e.NewValues["UnitCode"].ToString();


            if (model.UnitCode != null)
            {
                model.SiteCode = controller.GetSiteCode(model.UnitCode);
            }


            bool contains = controller.ContainsOfferCode(model.OfferCode);

            if (!contains)
            {
                controller.AddUnitOffer(model);
            }
            e.Cancel = true;
            GridUnitOfferView.CancelEdit();

            Bind();
        }
Exemple #4
0
        /*   public List<TouristOfferViewModel> GetTouristOfferViewModel()
         * {
         *
         *     List<TouristUnitViewModel> tourists = GetTouristUnitViewModel();
         *     List<TouristOfferViewModel> model = new List<TouristOfferViewModel>();
         *     foreach (var tourist in tourists)
         *     {
         *         var touristoffer = new TouristOfferViewModel();
         *         List<UnitOfferViewModel> offers = GetUnitOfferViewModel().FindAll(m => m.UnitCode == tourist.UnitCode);
         *         foreach (var offer in offers)
         *         {
         *             touristoffer.UnitOfferId = offer.id;
         *             touristoffer.TourOperatorCode = offer.TourOperatorCode;
         *             touristoffer.SiteCode = offer.SiteCode;
         *             touristoffer.OfferCode = offer.OfferCode;
         *             touristoffer.OfferTitel = offer.OfferTitel;
         *             touristoffer.OfferDescription = offer.OfferDescription;
         *             touristoffer.OfferCount = offer.OfferCount;
         *             touristoffer.UnitCode = offer.UnitCode;
         *             touristoffer.IsAutoStopBooking = offer.IsAutoStopBooking;
         *             touristoffer.ProviderNotice = offer.ProviderNotice;
         *             touristoffer.TouristUnitId = tourist.id;
         *             touristoffer.CountryName = tourist.CountryName;
         *             touristoffer.RegionName = tourist.RegionName;
         *             touristoffer.PlaceName = tourist.PlaceName;
         *             touristoffer.UnitTitel = tourist.UnitTitel;
         *             touristoffer.TravelServiceProvider = tourist.TravelServiceProvider;
         *             touristoffer.SiteName = tourist.SiteName;
         *             touristoffer.MobilhomeArea = tourist.MobilhomeArea;
         *             touristoffer.TerraceArea = tourist.TerraceArea;
         *             touristoffer.Bedroom = tourist.Bedroom;
         *             touristoffer.Bathrooms = tourist.Bathrooms;
         *             touristoffer.Beds = tourist.Beds;
         *             touristoffer.ImageGalleryPath = tourist.ImageGalleryPath;
         *             touristoffer.ImageThumbnailsPath = tourist.ImageThumbnailsPath;
         *             touristoffer.MaxPersons = tourist.MaxPersons;
         *             touristoffer.MaxAdults = tourist.MaxAdults;
         *             touristoffer.OpenDate = tourist.OpenDate;
         *             touristoffer.CloseDate = tourist.CloseDate;
         *             touristoffer.PurchasePriceListId = tourist.PurchasePriceListId;
         *         }
         *         model.Add(touristoffer);
         *     }
         *     return model;
         * }
         *
         * public static void UpdateMasterData(TouristOfferViewModel model)
         * {
         *     TouristUnitViewModel touristmodel = new TouristUnitViewModel();
         *     touristmodel = GetTouristUnitFromModel(model);
         *     UnitOfferViewModel offermodel = new UnitOfferViewModel();
         *     offermodel = GetUnitOfferFromModel(model);
         *
         *     UpdateMasterData(touristmodel);
         *     UpdateMasterData(offermodel);
         * }
         *
         * public static TouristUnitViewModel GetTouristUnitFromModel(TouristOfferViewModel model)
         * {
         *     TouristUnitViewModel data = new TouristUnitViewModel();
         *     data.id = model.TouristUnitId;
         *     data.Bathrooms = model.Bathrooms;
         *     data.Bedroom = model.Bedroom;
         *     data.Beds = model.Beds;
         *     data.CloseDate = model.CloseDate;
         *     data.CountryName = model.CountryName;
         *     data.ImageGalleryPath = model.ImageGalleryPath;
         *     data.ImageThumbnailsPath = model.ImageThumbnailsPath;
         *     data.MaxAdults = model.MaxAdults;
         *     data.MaxPersons = model.MaxPersons;
         *     data.MobilhomeArea = model.MobilhomeArea;
         *     data.OpenDate = model.OpenDate;
         *     data.PlaceName = model.PlaceName;
         *     data.PurchasePriceListId = model.PurchasePriceListId;
         *     data.RegionName = model.RegionName;
         *     data.SiteCode = model.SiteCode;
         *     data.SiteName = model.SiteName;
         *     data.TerraceArea = model.TerraceArea;
         *     data.TourOperatorCode = model.TourOperatorCode;
         *     data.TravelServiceProvider = model.TravelServiceProvider;
         *     data.UnitCode = model.UnitCode;
         *     data.UnitTitel = model.UnitTitel;
         *
         *     return data;
         *
         * }*/

        public static UnitOfferViewModel GetUnitOfferFromModel(TouristOfferViewModel model)
        {
            UnitOfferViewModel data = new UnitOfferViewModel();

            data.id = model.UnitOfferId;
            data.IsAutoStopBooking = model.IsAutoStopBooking;
            data.OfferCode         = model.OfferCode;
            data.OfferCount        = model.OfferCount;
            data.OfferDescription  = model.OfferDescription;
            data.OfferTitel        = model.OfferTitel;
            data.ProviderNotice    = model.ProviderNotice;
            data.SiteCode          = model.SiteCode;
            data.TourOperatorCode  = model.TourOperatorCode;
            data.UnitCode          = model.UnitCode;

            return(data);
        }
Exemple #5
0
        public static void UpdateMasterData(UnitOfferViewModel model)
        {
            var manager   = PlugInManager.GetMasterDataManager();
            var unitoffer = manager.GetUnitOffer(model.id);

            unitoffer.IsAutoStopBooking         = model.IsAutoStopBooking;
            unitoffer.OfferCode                 = model.OfferCode;
            unitoffer.SiteCode                  = model.SiteCode;
            unitoffer.OfferCount                = model.OfferCount;
            unitoffer.OfferDescription          = model.OfferDescription;
            unitoffer.OfferDescriptionTranslate = model.OfferDescriptionTranslate;
            unitoffer.OfferTitel                = model.OfferTitel;
            unitoffer.OfferTitelTranslate       = model.OfferTitelTranslate;
            unitoffer.ProviderNotice            = model.ProviderNotice;
            unitoffer.TourOperatorCode          = model.TourOperatorCode;
            unitoffer.UnitCode                  = model.UnitCode;

            manager.UpdateMasterData(unitoffer);
        }
Exemple #6
0
        public static void AddMasterData(UnitOfferViewModel model)
        {
            var manager   = PlugInManager.GetMasterDataManager();
            var unitoffer = new  IdomOffice.Interface.BackOffice.MasterData.UnitOffer();

            unitoffer.id = Guid.NewGuid().ToString();
            unitoffer.IsAutoStopBooking         = model.IsAutoStopBooking;
            unitoffer.OfferCode                 = model.OfferCode;
            unitoffer.SiteCode                  = model.SiteCode;
            unitoffer.OfferCount                = model.OfferCount;
            unitoffer.OfferDescription          = model.OfferDescription;
            unitoffer.OfferDescriptionTranslate = model.OfferDescriptionTranslate;
            unitoffer.OfferTitel                = model.OfferTitel;
            unitoffer.OfferTitelTranslate       = model.OfferTitelTranslate;
            unitoffer.ProviderNotice            = model.ProviderNotice;
            unitoffer.TourOperatorCode          = model.TourOperatorCode;
            unitoffer.UnitCode                  = model.UnitCode;

            manager.AddMasterData(unitoffer);
        }
Exemple #7
0
 public void UpdateUnitOffer(UnitOfferViewModel model)
 {
     MasterDataRepository.UpdateMasterData(model);
 }
Exemple #8
0
 public void AddUnitOffer(UnitOfferViewModel model)
 {
     MasterDataRepository.AddMasterData(model);
 }