public void UpdateMasterData(UnitOffer document) { document.LastChange = DateTime.Now; var filter = Builders <UnitOffer> .Filter.Eq(s => s.id, document.id); collectionUnitOffer.ReplaceOne(filter, document); }
public void AddMasterData(UnitOffer document) { if (document.id == string.Empty) { document.id = Guid.NewGuid().ToString(); } document.LastChange = DateTime.Now; collectionUnitOffer.InsertOne(document); }
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); } }
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); }
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); }