コード例 #1
0
        public void UpdateMasterData(UnitOffer document)
        {
            document.LastChange = DateTime.Now;
            var filter = Builders <UnitOffer> .Filter.Eq(s => s.id, document.id);

            collectionUnitOffer.ReplaceOne(filter, document);
        }
コード例 #2
0
        public void AddMasterData(UnitOffer document)
        {
            if (document.id == string.Empty)
            {
                document.id = Guid.NewGuid().ToString();
            }

            document.LastChange = DateTime.Now;

            collectionUnitOffer.InsertOne(document);
        }
コード例 #3
0
ファイル: DBData.cs プロジェクト: ibudisa/IDOM
        public static void SaveTouristUnits()
        {
            var units = datarepository.GetAllUnits();

            foreach (var unit in units)
            {
                TouristUnit t         = MapUnit(unit);
                UnitOffer   unitOffer = CreateOffer(t);
                manager.AddMasterData(t);
                manager.AddMasterData(unitOffer);
            }
        }
コード例 #4
0
ファイル: DBData.cs プロジェクト: ibudisa/IDOM
        private static UnitOffer CreateOffer(TouristUnit unit)
        {
            UnitOffer unitOffer = new UnitOffer();

            unitOffer.OfferCode        = unit.UnitCode;
            unitOffer.UnitCode         = unit.UnitCode;
            unitOffer.TourOperatorCode = unit.TourOperatorCode;
            unitOffer.SiteCode         = unit.SiteCode;
            unitOffer.OfferTitel       = unit.UnitTitel;
            unitOffer.OfferDescription = unit.Description;
            unitOffer.OfferCount       = 1;

            return(unitOffer);
        }
コード例 #5
0
        public GeoMasterDateInfo GetGeoMasterDateInfo(string TourOperatorCode, string TouristSiteCode, string UnitOfferCode)
        {
            GeoMasterDateInfo data        = new GeoMasterDateInfo();
            UnitOffer         unitOffer   = GetUnitOffer(TourOperatorCode, TouristSiteCode, UnitOfferCode);
            string            unitcode    = unitOffer.UnitCode;
            TouristUnit       touristUnit = GetTouristUnitByUnitCode(unitcode);
            TouristSite       touristSite = GetTouristSiteForCode(TouristSiteCode);

            int     countryid = touristSite.CountryId;
            int     regionid  = touristSite.RegionId;
            int     placeid   = touristSite.PlaceId;
            Country country   = GetCountry(countryid);
            Region  region    = GetRegion(regionid);
            Place   place     = GetPlace(placeid);

            data.Country     = country;
            data.Place       = place;
            data.Region      = region;
            data.TouristSite = touristSite;
            data.TouristUnit = touristUnit;
            data.UnitOffer   = unitOffer;

            return(data);
        }