public GpsService()
        {
            SailingDbContext context = new SailingDbContext();

            _repositoryGpsData = new GpsDataRepository(context);
            _unitOfWork        = new UnitOfWork(context);
            AutoMapperConfiguration.Configuration();
        }
示例#2
0
        public BoatService()
        {
            SailingDbContext context = new SailingDbContext();

            _repositoryBoat = new BoatRepository(context);
            _unitOfWork     = new UnitOfWork(context);
            AutoMapperConfiguration.Configuration();
        }
 /// <summary>
 /// pobierania listy sesje wg daty i Id sesji
 /// </summary>
 /// <param name="start"></param>
 /// <param name="stop"></param>
 /// <param name="idBoat"></param>
 /// <returns></returns>
 public List<Session> GetSessions(DateTime start, DateTime stop, Guid idBoat)
 {
     List<Session> listSessions;
     using (_sailingDbContext = new SailingDbContext())
     {
         listSessions = _sailingDbContext.Sessions.Where(x => x.StartDate >= start && x.StopDate <= stop && x.IdBoat==idBoat).ToList();
     }
     return listSessions;
 }
 /// <summary>
 /// pobierania listy łódek z bazy
 /// </summary>
 /// <returns></returns>
 public List<Boat> GetBoats()
 {
     List<Boat> listBoats;
     using (_sailingDbContext = new SailingDbContext())
     {
         listBoats=_sailingDbContext.Boats.ToList();
     }
     return listBoats;
 }
        /// <summary>
        /// pobierania listy sesje wg daty i Id sesji
        /// </summary>
        /// <param name="start"></param>
        /// <param name="stop"></param>
        /// <param name="idBoat"></param>
        /// <returns></returns>
        public List <Session> GetSessions(DateTime start, DateTime stop, Guid idBoat)
        {
            List <Session> listSessions;

            using (_sailingDbContext = new SailingDbContext())
            {
                listSessions = _sailingDbContext.Sessions.Where(x => x.StartDate >= start && x.StopDate <= stop && x.IdBoat == idBoat).ToList();
            }
            return(listSessions);
        }
示例#6
0
        /// <summary>
        /// pobierania listy łódek z bazy
        /// </summary>
        /// <returns></returns>
        public List <Boat> GetBoats()
        {
            List <Boat> listBoats;

            using (_sailingDbContext = new SailingDbContext())
            {
                listBoats = _sailingDbContext.Boats.ToList();
            }
            return(listBoats);
        }
        /// <summary>
        /// pobieranie danych gps wg Id sesji
        /// </summary>
        /// <param name="idSession"></param>
        /// <returns></returns>
        public List <GPSData> GetGpsData(Guid idSession)
        {
            List <GPSData> data;

            using (_sailingDbContext = new SailingDbContext())
            {
                data = _sailingDbContext.GPSData.Where(x => x.IdSession == idSession).ToList();
            }
            return(data);
        }
 /// <summary>
 /// pobieranie zakresów dat wg Id łódki
 /// </summary>
 /// <param name="idBoat"></param>
 /// <returns></returns>
 public Dictionary<DateTime, DateTime> GetStartEndDate(Guid idBoat)
 {
     DateTime startDate;
     DateTime endDate;
     Dictionary<DateTime, DateTime> startEndDates = new Dictionary<DateTime, DateTime>();
     using (_sailingDbContext = new SailingDbContext())
     {
         startDate = (DateTime)_sailingDbContext.Sessions.Where(x => x.IdBoat == idBoat).Select(x => x.StartDate).Min();
         endDate = (DateTime)_sailingDbContext.Sessions.Where(x => x.IdBoat == idBoat).Select(x => x.StopDate).Max();
         startEndDates.Add(startDate, endDate);
     }
     return startEndDates;
 }
        /// <summary>
        /// pobieranie zakresów dat wg Id łódki
        /// </summary>
        /// <param name="idBoat"></param>
        /// <returns></returns>
        public Dictionary <DateTime, DateTime> GetStartEndDate(Guid idBoat)
        {
            DateTime startDate;
            DateTime endDate;
            Dictionary <DateTime, DateTime> startEndDates = new Dictionary <DateTime, DateTime>();

            using (_sailingDbContext = new SailingDbContext())
            {
                startDate = (DateTime)_sailingDbContext.Sessions.Where(x => x.IdBoat == idBoat).Select(x => x.StartDate).Min();
                endDate   = (DateTime)_sailingDbContext.Sessions.Where(x => x.IdBoat == idBoat).Select(x => x.StopDate).Max();
                startEndDates.Add(startDate, endDate);
            }
            return(startEndDates);
        }
 public SessionRepository(SailingDbContext sailingDbContext = null)
 {
     _sailingDbContext = sailingDbContext;
 }
示例#11
0
 public BoatRepository(SailingDbContext sailingDbContext = null)
 {
     _sailingDbContext = sailingDbContext;
 }
 public UnitOfWork(SailingDbContext sailingDbContext)
 {
     _sailingDbContext = sailingDbContext;
 }
 public SessionRepository(SailingDbContext sailingDbContext = null)
 {
     _sailingDbContext = sailingDbContext;
 }
 public UnitOfWork(SailingDbContext sailingDbContext)
 {
     _sailingDbContext = sailingDbContext;
 }
 public BoatRepository(SailingDbContext sailingDbContext=null)
 {
     _sailingDbContext = sailingDbContext;
 }
 public GpsDataRepository(SailingDbContext sailingDbContext = null)
 {
     _sailingDbContext = sailingDbContext;
 }