public void SearchRoads(RoadSearchModel model)
 {
     try
     {
         Logger.LogNewMessage($"Searching for road with name {model.Name} and label {model.Label}.", LogType.INFO);
         Roads = new BindingList <Road>(RoadServiceProxy.SearchRoads(model.Name, model.Label));
     }catch (Exception ex)
     {
         Logger.LogNewMessage($"Error occured during search. Message {ex.Message}", LogType.ERROR);
     }
 }
 public void DeleteSelectedRoad(Road road)
 {
     try
     {
         Logger.LogNewMessage($"Delete called for road with name {road.Name}..", LogType.INFO);
         RoadServiceProxy.DeleteRoad(road.Id);
         RefreshRoadsList();
     }
     catch (Exception e)
     {
         Logger.LogNewMessage($"Error occured deleting road. Error message {e.Message}", LogType.ERROR);
     }
 }
 public Road AddRoad(Road road)
 {
     try
     {
         Logger.LogNewMessage($"Adding road with name {road.Name}", LogType.INFO);
         var road_added = RoadServiceProxy.AddRoad(road);
         RefreshRoadsList();
         return(road_added);
     }catch (Exception ex)
     {
         Logger.LogNewMessage($"Road couldn't be added. Error: {ex.Message}", LogType.ERROR);
         return(null);
     }
 }
 public Road CloneSelectedRoad(Road road)
 {
     try
     {
         Logger.LogNewMessage($"Clone called for road with name {road.Name}..", LogType.INFO);
         var road_cloned = RoadServiceProxy.CloneRoad(road);
         RefreshRoadsList();
         return(road_cloned);
     }
     catch (Exception e)
     {
         Logger.LogNewMessage($"Error occured deleting road. Error message {e.Message}", LogType.ERROR);
         return(null);
     }
 }
 public void RefreshRoadsList()
 {
     Logger.LogNewMessage("Getting all roads from server..", LogType.INFO);
     try
     {
         Roads = new BindingList <Road>(RoadServiceProxy.GetAllRoads());
         if (Roads == null)
         {
             Roads = new BindingList <Road>();
         }
     }
     catch (Exception e)
     {
         Logger.LogNewMessage($"Error occured getting all roads. Error message {e.Message}", LogType.ERROR);
     }
 }