Example #1
0
 public CandidateSessionServiceTest()
 {
     TecAppContext           = new TecAppContext();
     CandidateService        = new EmployeeService.CandidateService(TecAppContext);
     SessionService          = new SessionService.SessionService(TecAppContext);
     CandidateSessionService = new CandidateSessionService(TecAppContext);
 }
Example #2
0
        public EmptyDatabase()
        {
            var context = new TecAppContext();

            AddressService        = new AddressService.AddressService(context);
            CandidateService      = new EmployeeService.CandidateService(context);
            QualificationsService = new QualificationsService.QualificationsService(context);
            CourseService         = new CourseService.CourseService(context);
            CompanyService        = new CompanyService.CompanyService(context);
            JobService            = new JobService.JobService(context);
            SessionService        = new SessionService.SessionService(context);
            LocationService       = new LocationService.LocationService(context);
            OpeningService        = new OpeningsService.OpeningsService(context);
            PlacementService      = new PlacementService.PlacementService(context);
            JobHistoryService     = new JobHistoryService.JobHistoryService(context);

            JobHistoryCompanyService              = new JobHistoryCompanyService.JobHistoryCompanyService(context);
            SessionLocationService                = new SessionLocationService.SessionLocationService(context);
            JobHistoryJobService                  = new JobHistoryJobService.JobHistoryJobService(context);
            AddressCandidateService               = new AddressCandidateService.AddressCandidateService(context);
            CandidateQualificationService         = new CandidateQualificationService.CandidateQualificationService(context);
            PrerequisitesForCourseService         = new PrerequisitesForCourseService.PrerequisitesForCourseService(context);
            QualificationDevelopedByCourseService =
                new QualificationDevelopedByCourseService.QualificationDevelopedByCourseService(context);
        }
Example #3
0
 public SessionLocationServiceTest()
 {
     TecAppContext          = new TecAppContext();
     SessionService         = new SessionService.SessionService(TecAppContext);
     LocationService        = new LocationService.LocationService(TecAppContext);
     SessionLocationService = new SessionLocationService(TecAppContext);
 }
        /// <summary>
        ///  udostępniona metoda dodania danych gps do bazy
        /// </summary>
        /// <param name="addDataRequest"></param>
        /// <returns>zwracana odpowiedź czy udało się dodać dane do bazy</returns>
        public BaseResponse AddData(AddDataRequest addDataRequest)
        {
            var response = new BaseResponse();

            try
            {
                var addSession         = new SessionService.SessionService();
                AddSessionResponse res = addSession.AddSession(new AddSessionRequest
                {
                    IdBoat    = addDataRequest.IdBoat,
                    StartDate = addDataRequest.GpsDataList.Max(x => x.SecondsFromStart),
                    StopDate  = addDataRequest.GpsDataList.Min(x => x.SecondsFromStart)
                });

                _unitOfWork.BeginTransaction();
                if (res.IsSuccess)
                {
                    foreach (var item in addDataRequest.GpsDataList)
                    {
                        GPSData data = Mapper.Map <GPSData>(item);
                        data.BoatDirection = 4;
                        data.BoatSpeed     = 6;
                        data.WindDirection = 2;
                        data.WindSpeed     = 9;
                        data.IdSession     = new Guid("4ADAEDD9-DAB7-E511-82AF-ACB57D99B460");
                        data.IdGPSData     = Guid.NewGuid();
                        _repositoryGpsData.Add(data);
                    }

                    _unitOfWork.Commit();
                    response.IsSuccess = true;
                }
                else
                {
                    _unitOfWork.Commit();
                    response.IsSuccess    = false;
                    response.ErrorMessage = "Nie udalo sie utworzyc sesji.";
                }
            }
            catch (DbEntityValidationException dbEx)
            {
                foreach (var validationErrors in dbEx.EntityValidationErrors)
                {
                    foreach (var validationError in validationErrors.ValidationErrors)
                    {
                        response.ErrorMessage += validationError.PropertyName + "\n";
                        response.ErrorMessage += validationError.ErrorMessage + "\n";
                    }
                }
                response.IsSuccess = false;
            }

            return(response);
        }
        /// <summary>
        ///  udostępniona metoda dodania danych gps do bazy
        /// </summary>
        /// <param name="addDataRequest"></param>
        /// <returns>zwracana odpowiedź czy udało się dodać dane do bazy</returns>
        public BaseResponse AddData(AddDataRequest addDataRequest)
        {
            var response = new BaseResponse();
            try
            {
                var addSession = new SessionService.SessionService();
                AddSessionResponse res = addSession.AddSession(new AddSessionRequest
                {
                    IdBoat = addDataRequest.IdBoat,
                    StartDate = addDataRequest.GpsDataList.Max(x => x.SecondsFromStart),
                    StopDate = addDataRequest.GpsDataList.Min(x => x.SecondsFromStart)
                });

                _unitOfWork.BeginTransaction();
                if (res.IsSuccess)
                {
                    foreach (var item in addDataRequest.GpsDataList)
                    {
                        GPSData data= Mapper.Map<GPSData>(item);
                        data.BoatDirection = 4;
                        data.BoatSpeed = 6;
                        data.WindDirection = 2;
                        data.WindSpeed = 9;
                        data.IdSession =new Guid("4ADAEDD9-DAB7-E511-82AF-ACB57D99B460");
                        data.IdGPSData = Guid.NewGuid();
                        _repositoryGpsData.Add(data);
                    }

                    _unitOfWork.Commit();
                    response.IsSuccess = true;
                }
                else
                {
                    _unitOfWork.Commit();
                    response.IsSuccess = false;
                    response.ErrorMessage = "Nie udalo sie utworzyc sesji.";
                }
            }
            catch (DbEntityValidationException dbEx)
            {
                foreach (var validationErrors in dbEx.EntityValidationErrors)
                {
                    foreach (var validationError in validationErrors.ValidationErrors)
                    {
                        response.ErrorMessage += validationError.PropertyName + "\n";
                        response.ErrorMessage += validationError.ErrorMessage + "\n";
                    }
                }
                response.IsSuccess = false;
            }

            return response;
        }
Example #6
0
        public InitializeDatabase()
        {
            var context = new TecAppContext();

            AddressService        = new AddressService.AddressService(context);
            CandidateService      = new EmployeeService.CandidateService(context);
            QualificationsService = new QualificationsService.QualificationsService(context);
            CourseService         = new CourseService.CourseService(context);
            CompanyService        = new CompanyService.CompanyService(context);
            JobService            = new JobService.JobService(context);
            SessionService        = new SessionService.SessionService(context);
            LocationService       = new LocationService.LocationService(context);
            OpeningService        = new OpeningsService.OpeningsService(context);
            PlacementService      = new PlacementService.PlacementService(context);
            JobHistoryService     = new JobHistoryService.JobHistoryService(context);

            SessionLocationService = new SessionLocationService.SessionLocationService(context);
            JobHistoryJobService   = new JobHistoryJobService.JobHistoryJobService(context);
        }