public void AddMasterData(TouristUnit document) { if (document.id == string.Empty) { document.id = Guid.NewGuid().ToString(); } collectionTouristUnit.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); }
private static TouristUnit MapUnit(SEH_UnitInfo unitinfo) { string region; string place; TouristUnit unit = new TouristUnit(); unit.ShortDescription = unitinfo.suKurzBeschreibung != null?unitinfo.suKurzBeschreibung.Trim() : ""; unit.Description = unitinfo.suLangBeschreibung != null?unitinfo.suLangBeschreibung.Trim() : ""; unit.SiteCode = unitinfo.SiteCode != null?unitinfo.SiteCode.Trim() : ""; unit.UnitCode = unitinfo.UnitOfferCode != null?unitinfo.UnitOfferCode.Trim() : ""; unit.ImageGalleryPath = unitinfo.suImageLocation != null?unitinfo.suImageLocation.Trim() : ""; unit.Bedrooms = unitinfo.suSchlafzimmer; unit.MobilehomeSize = unitinfo.suMHGroße; unit.MaxPersons = unitinfo.suMaxBelegung; unit.MaxAdults = unitinfo.suMaxErwachsener; unit.Pets = unitinfo.suHund; unit.TourOperatorCode = unitinfo.suTourOperator.ToString(); unit.OpenDate = unitinfo.suAngebotVon; unit.CloseDate = unitinfo.suAngebotBis; unit.BedWashing = unitinfo.suBettwaesche == "y" ? true : false; unit.UnitType = unitinfo.suRouteObjektTyp != null?unitinfo.suRouteObjektTyp.Trim() : ""; unit.UnitTitel = unitinfo.suKurzBeschreibung != null?unitinfo.suKurzBeschreibung.Trim() : ""; unit.MobilhomeArea = unitinfo.suMHGroße; unit.SiteName = unitinfo.suKurzBeschreibung != null?unitinfo.suKurzBeschreibung.Trim() : ""; unit.TourOperatorCode = "IDOM"; unit.CountryName = "Kroatien"; SEH_SiteInfo site = unitinfo.SEH_SiteInfo; region = GetRegion(site); place = GetPlace(site); unit.PlaceName = place; unit.RegionName = region; return(unit); }
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); }
public void UpdateMasterData(TouristUnit document) { var filter = Builders <TouristUnit> .Filter.Eq(s => s.id, document.id); collectionTouristUnit.ReplaceOne(filter, document); }