Inheritance: RestaurantBasicData
Esempio n. 1
0
 public string AddRestToImportedDB(RestaurantOsm rest)
 {
     try
     {
         log.InfoFormat("[AddRestToImportedDB] rest.Name={0}, rest.Name={0}, rest.NodeReference.id={1}.", rest.Name, rest.NodeReference.id);
         rest.CreatedAt = DateTime.UtcNow;
         //using (ImportedRestaurants restaurantsDb = new ImportedRestaurants())
         using (FinlandSwedenOSMRestaurants restaurantsDb = new FinlandSwedenOSMRestaurants())
         {
             MongoEntityRepositoryBase<RestaurantOsm> basicData =
                             new MongoEntityRepositoryBase<RestaurantOsm>(restaurantsDb.DB);
             basicData.Add(rest);
             return rest.Id.ToString();
         }
     }
     catch (Exception e)
     {
         log.ErrorFormat("[AddRestToImportedDB] Exception={0}.", e);
         return null;
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Add conver RestaurantOsm to RestaurantBasicData and Add new rest to DB
 /// </summary>
 /// <param name="osmRestId">
 /// RetaurantOsm
 /// </param>
 public void AddNewRestaurantFromOsmRest(RestaurantOsm osmRest)
 {
     try
     {
         string osmRestId = osmRest.Id.ToString();
         log.InfoFormat("[AddNewRestaurantFromOsmRest] osmRest.Id={0}.", osmRestId);
         OpenStreetMapServices osmServices = new OpenStreetMapServices();
         RestaurantBasicData tempRest = osmRest.RestaurantOsmToRestaurantBasicData();
         if (tempRest != null)
         {
             tempRest.Source = "OpenStreetMap";
             string newRestId = AddRestaurantBasicToDB(tempRest);
             if (newRestId != null)
             {
                 osmRest.ReferenceId = ObjectId.Parse(newRestId);
                 osmServices.UpdateRestaurantOsm(osmRest);
             }
         }
     }
     catch (Exception e)
     {
         log.ErrorFormat("[AddNewRestaurantFromOsmRest] Exception={0}.", e);
     }
 }
Esempio n. 3
0
 public void UpdateRestaurantOsm(RestaurantOsm restaurant)
 {
     string restId = restaurant.Id != null ? restaurant.Id.ToString() : "";
     log.DebugFormat("[UpdateRestaurantOsm] restaurant.Id={0}.", restId);
     restaurant.UpdatedAt = DateTime.UtcNow;
     //using (ImportedRestaurants restaurantsDb = new ImportedRestaurants())
     using (FinlandSwedenOSMRestaurants restaurantsDb = new FinlandSwedenOSMRestaurants())
     {
         MongoEntityRepositoryBase<RestaurantOsm> basicData =
                       new MongoEntityRepositoryBase<RestaurantOsm>(restaurantsDb.DB);
         basicData.Update(restaurant);
     }
 }
Esempio n. 4
0
 public List<RestaurantOsm> NodesToRestaurantsOsm(List<OsmNode> nodesList)
 {
     log.InfoFormat("[NodesToRestaurantsOsm]");
     if (nodesList != null && nodesList.Count > 0)
     {
         try
         {
             List<RestaurantOsm> returnList = new List<RestaurantOsm>();
             foreach (var node in nodesList)
             {
                 RestaurantOsm tempRest = new RestaurantOsm(node);
                 if (tempRest != null)
                 {
                     returnList.Add(tempRest);
                 }
             }
             return returnList;
         }
         catch (Exception e)
         {
             log.ErrorFormat("[NodesToRestaurantsOsm] Exception={0}", e);
             return null;
         }
     }
     else return null;
 }