public TourLog AddNewTourLog(string name, string description, string report, string vehicle, string dateTime, int tourId, decimal distance, decimal totalTime, int rating) { ITourLogDAO tourLogDao = DALFactory.CreateTourLogDAO(); return(tourLogDao.AddNewTourLog(name, description, report, vehicle, dateTime, tourId, distance, totalTime, rating)); }
public IEnumerable <Tour> ImportToursFromFile(string fileName = "TourData.json") { try { JsonSerializerOptions options = new() { WriteIndented = true, MaxDepth = 0, ReferenceHandler = ReferenceHandler.Preserve }; string fileString = File.ReadAllText(filefolder + fileName); List <Tour> tourList = JsonSerializer.Deserialize <List <Tour> >(fileString, options); foreach (Tour tour in tourList) { Tour tmptour = tourDAO.AddNewTour(tour); if (tour.LogList != null) { foreach (Log log in tour.LogList) { log.Tour = tmptour; logDAO.AddNewTourLog(log.Tour, log); } } } } catch (Exception e) { Debug.WriteLine(e.ToString() + " Source: " + e.Source + "\n" + e.Message); } return(tourDAO.GetTours()); }
public void TourLogCreateWithDb() { Tour tour = _tourDao.AddNewItem("Tour1", "Test Description", "Start", "End", 7, _imagePath); TourLog tourLog = _tourLogDao.AddNewTourLog("testlog", "das ist ein log fuer tour1", "einfache Strecke macht echt spaß", "zu fuß", "01.01.1234", tour.Id, 23, 1, 9); Assert.AreEqual("testlog", tourLog.Name); Assert.AreEqual("das ist ein log fuer tour1", tourLog.Description); Assert.AreEqual("einfache Strecke macht echt spaß", tourLog.Report); Assert.AreEqual("zu fuß", tourLog.Vehicle); Assert.AreEqual("01.01.1234", tourLog.DateTime); Assert.AreEqual(tour.Id, tourLog.TourId); Assert.AreEqual(23, tourLog.Distance); Assert.AreEqual(1, tourLog.TotalTime); Assert.AreEqual(9, tourLog.Rating); }
public IEnumerable <Log> CreateNewLogAndRefreshTourLogList(Tour tour, string date, string report = "", int distance = 0, string duration = "", int rating = 0, int steps = 0, float weightkg = 0, string bloodpreassure = "", string feeling = "", string weather = "") { try { logDAO.AddNewTourLog(tour, date, report, distance, duration, rating, steps, weightkg, bloodpreassure, feeling, weather); } catch (Exception e) { Debug.WriteLine(e.Message); } return(logDAO.GetLogsOfTour(tour)); }
public async Task CreateItem(TourLog t) { await _tourLogDAO.AddNewTourLog(t); _log.Debug("Create new TourLog"); }