/// <summary>
        /// Import the given surveys into the DB
        /// </summary>
        public void ImportSurveys(NSurveyForm importSurveys, int userId, int folderId)
        {
            ISurvey survey = SurveyFactory.Create();

            this.TurnOverPrimaryKeys(importSurveys);
            survey.ImportSurveys(importSurveys, userId, folderId);
        }
Пример #2
0
 public SurveyController(ISurvey survey, ICommon common, ICustomer customer, IEmployee employee)
 {
     surveyContext   = survey;
     commonContext   = common;
     customerContext = customer;
     employeeContext = employee;
 }
Пример #3
0
 public SurveyController(IPool pool, ILookUps lookUps, IForm form, ISurvey survey, IUser user)
 {
     _pool    = pool;
     _lookUps = lookUps;
     _form    = form;
     _survey  = survey;
     _user    = user;
 }
Пример #4
0
        public ActionResult EmailSurvey([FromBody] EmailSurveyRequest req)
        {

           ISurvey emailSurvey = SurveyFactory.Build(SurveyTypes.EmailSurvey);
           var survey = _context.Survey.Find(req.SurveyId);
           emailSurvey.LoadSurvey(survey);
           emailSurvey.execute();
           return Ok();
        }
Пример #5
0
 //Constructor
 public SurveyBusiness(IUser userDAL, ISurvey surveyDAL, IQuestion questionDAL, ITextAnswers textAnswerDAL, IOptionChoice optionChoiceDAL, IAnswers answerDAL, IInputType inputTypeDAL)
 {
     this.userDAL         = userDAL;
     this.surveyDAL       = surveyDAL;
     this.questionDAL     = questionDAL;
     this.textAswersDAL   = textAnswerDAL;
     this.optionChoiceDAL = optionChoiceDAL;
     this.answerDAL       = answerDAL;
     this.inputTypeDAL    = inputTypeDAL;
 }
Пример #6
0
 public InstrumentDto MapToInstrumentDto(ISurvey instrument)
 {
     return(new InstrumentDto
     {
         Name = instrument.Name,
         ServerParkName = instrument.ServerPark,
         InstallDate = instrument.InstallDate,
         Status = instrument.Status,
         DataRecordCount = GetNumberOfDataRecords(instrument as ISurvey2)
     });
 }
 private void BackupSurvey(ISurvey survey, string localFolderPath, string bucketFolderPath)
 {
     _blaiseApi
     .WithConnection(_blaiseApi.DefaultConnection)
     .WithInstrument(survey.Name)
     .WithServerPark(survey.ServerPark)
     .Survey
     .ToPath(localFolderPath)
     .ToBucket(_configurationProvider.BucketName, bucketFolderPath)
     .Backup();
 }
        private static IConfiguration GetSurveyConfiguration(ISurvey survey)
        {
            var configuration = survey.Configuration.Configurations.FirstOrDefault();

            if (configuration == null)
            {
                throw new NullReferenceException($"There was no configuration found for survey '{survey.Name}'");
            }

            return configuration;
        }
Пример #9
0
        public void Cast_ToISurvey_ReturnsNotNull()
        {
            // Arange
            var survey = new Survey();

            // Act
            ISurvey cast = (ISurvey)survey;

            // Assert
            Assert.IsNotNull(cast);
        }
        public SurveyPage(ISurvey survey)
            : base(null)
        {
            _survey = survey;

            _navigateBackCommand = new DelegateCommand (
                _ => OnNavigateBack (),
                _ => OnCanExecuteNavigateBack ());

            _submitPageCommand = new DelegateCommand (
                _ => OnSubmitPage (),
                _ => OnCanExecuteSubmitPage ());
        }
Пример #11
0
 public InstrumentDto MapToInstrumentDto(ISurvey instrument)
 {
     return(new InstrumentDto
     {
         Name = instrument.Name,
         Id = instrument.InstrumentID,
         ServerParkName = instrument.ServerPark,
         InstallDate = instrument.InstallDate,
         Status = _statusMapper.GetInstrumentStatus(instrument).ToString(),
         DataRecordCount = GetNumberOfDataRecords(instrument as ISurvey2),
         Nodes = _nodeDtoMapper.MapToInstrumentNodeDtos(instrument.Configuration)
     });
 }
Пример #12
0
 public TestsController(IQMaster question, ISurvey survey, IAMaster answerOptions, IResult results,
                        ISeedService seedService, IQuestion demoQuestions, ISurveyMaster demoSurveyMasters,
                        ISessionUser demoSessionUsers, IAnswerOption demoAnswerOptions)
 {
     _questions         = question;
     _answers           = survey;
     _answerOptions     = answerOptions;
     _results           = results;
     _seedService       = seedService;
     _demoQuestions     = demoQuestions;
     _demoAnswerOptions = demoAnswerOptions;
     _demoSessionUsers  = demoSessionUsers;
     _demoSurveys       = demoSurveyMasters;
 }
        public SurveyStatusType GetInstrumentStatus(ISurvey instrument)
        {
            if (AllInstrumentNodesAreInAStatus(instrument, SurveyStatusType.Active))
            {
                return(SurveyStatusType.Active);
            }

            if (AllInstrumentNodesAreInAStatus(instrument, SurveyStatusType.Inactive))
            {
                return(SurveyStatusType.Inactive);
            }

            return(AnyInstrumentNodeHasFailedOrTakenTooLongToInstall(instrument)
                ? SurveyStatusType.Failed
                : SurveyStatusType.Installing);
        }
Пример #14
0
        public async Task <ISurvey> CreateNewSurvey(ISurvey surveyDto)
        {
            try
            {
                var survey = Mappings.Mapper.Map <Entities.Survey>(surveyDto);
                survey.Id = Guid.NewGuid();
                var preservedEntity = await _surveyRepository.Create(survey);

                surveyDto.Id = preservedEntity.Id;
                return(surveyDto);
            }
            catch (Exception e)
            {
                _logger.Error(e, "SurveyManagementService.CreateNewSurvey");
                throw;
            }
        }
Пример #15
0
 public CatiInstrumentDto MapToCatiInstrumentDto(ISurvey instrument, List <DateTime> surveyDays)
 {
     return(new CatiInstrumentDto
     {
         Name = instrument.Name,
         Id = instrument.InstrumentID,
         ServerParkName = instrument.ServerPark,
         InstallDate = instrument.InstallDate,
         Status = _statusMapper.GetInstrumentStatus(instrument).ToString(),
         Nodes = _nodeDtoMapper.MapToInstrumentNodeDtos(instrument.Configuration),
         DataRecordCount = GetNumberOfDataRecords(instrument as ISurvey2),
         SurveyDays = surveyDays,
         Active = SurveyIsActive(surveyDays),
         ActiveToday = SurveyIsActiveToday(surveyDays),
         DeliverData = SetDeliverDataWhichIncludesADaysGraceFromLastSurveyDay(surveyDays)
     });
 }
Пример #16
0
        public CatiInstrumentDto MapToCatiInstrumentDto(ISurvey instrument, List <DateTime> surveyDays)
        {
            var catiInstrument = new CatiInstrumentDto
            {
                Name            = instrument.Name,
                ServerParkName  = instrument.ServerPark,
                InstallDate     = instrument.InstallDate,
                Status          = instrument.Status,
                DataRecordCount = GetNumberOfDataRecords(instrument as ISurvey2),
                SurveyDays      = surveyDays,
                Active          = surveyDays.Any(s => s.Date <= DateTime.Today) &&
                                  surveyDays.Any(s => s.Date >= DateTime.Today),
                ActiveToday = surveyDays.Any(s => s.Date == DateTime.Today)
            };

            catiInstrument.DeliverData = SetDeliverDataWhichIncludesADayGraceFromLastSurveyDay(catiInstrument);

            return(catiInstrument);
        }
Пример #17
0
        public ISurvey AddSurvey(ISurvey survey)
        {
            var message = new AddSurveyCommand
            {
                surveyToAdd = (Survey)survey
            };

            Survey resultSurvey = new Survey();
            var    task         = bus.Send(message).Register((result =>
            {
                var reply = result.Messages;

                return;
            }));

            var a = task.GetAwaiter();

            a.GetResult();
            return(resultSurvey);
        }
Пример #18
0
        /// <summary>
        /// Static mechanism to render a survey.
        /// </summary>
        /// <param name="survey">The survey.</param>
        /// <param name="placeHolder">The place holder.</param>
        /// <param name="readOnly">if set to <c>true</c> [read only].</param>
        /// <param name="showRequiredNotation">if set to <c>true</c> [show required notation].</param>
        /// <param name="validationProvider">The validation provider.</param>
        /// <param name="localizer">Localizes text.</param>
        public static void RenderSurvey(ISurvey survey, PlaceHolder placeHolder, bool readOnly, bool showRequiredNotation, ValidationProviderBase validationProvider, ILocalizer localizer)
        {
            Debug.Assert(placeHolder != null, "placeHolder cannot be null");
            Debug.Assert(validationProvider != null, "validationProvider cannot be null");

            // add the survey title
            if (survey.ShowText)
            {
                var titleDiv = new HtmlGenericControl("DIV");
                titleDiv.Attributes["class"] = Utility.CssClassSurveyTitle;
                titleDiv.InnerText           = survey.Text;
                placeHolder.Controls.Add(titleDiv);
            }

            List <ISection> sections = survey.GetSections();

            foreach (ISection s in sections)
            {
                s.Render(placeHolder, readOnly, showRequiredNotation, validationProvider, localizer);
            }
        }
Пример #19
0
        public ISurvey UpdateSurvey(ISurvey survey)
        {
            Survey updatedSurvey = null;

            return(ExecuteFaultHandeledOperation(() =>
            {
                if (survey.SurveyId == Guid.Empty)
                {
                    //add new survey
                    updatedSurvey = (Survey)survey;
                }
                //update existing
                updatedSurvey = (Survey)survey;
                if (updatedSurvey == null)
                {
                    throw new FaultException("Something happend -_-");
                }

                return updatedSurvey;
            }));
        }
Пример #20
0
        public async Task <bool> UpdateExistingSurvey(Guid id, ISurvey surveyDto)
        {
            try
            {
                var survey = await _surveyRepository.Get(id);

                if (survey == null)
                {
                    return(false);
                }

                Mappings.Mapper.Map(surveyDto, survey);
                await _surveyRepository.Update(survey);

                return(true);
            }
            catch (Exception e)
            {
                _logger.Error(e, "SurveyManagementService.UpdateExistingSurvey");
                throw;
            }
        }
Пример #21
0
 public virtual void AddOption(ISurvey pSurvey, ISurveyOption pOption)
 {
     throw new System.NotImplementedException();
 }
Пример #22
0
 public virtual void AddVote(ISurvey pSurvey, IVote pVote)
 {
     throw new System.NotImplementedException();
 }
Пример #23
0
 public SurveyRepoImpl(ISurvey survey)
 {
     this._survey = survey;
 }
Пример #24
0
 public SurveysController(NewsManDbContext context, ISurvey survey, IResult result)
 {
     _context = context;
     _survey  = survey;
     _result  = result;
 }
Пример #25
0
 /// <summary>
 /// This method adds a Survey to the list of surveys from the project
 /// </summary>
 /// <param name="pSurvey"></param>
 public virtual void AddSurvey(ISurvey pSurvey)
 {
     SurveyList.Add(pSurvey);
     List<InteractionAttributes> changedAttributes = new List<InteractionAttributes>();
     changedAttributes.Add(InteractionAttributes.SurveyList);
     OnModify(new InteractionEventArgs($"Survey IsActive changed [Id={Id}]", DateTime.Now, InteractionType.Project));
 }
Пример #26
0
 public Campaign(ISurvey survey, List <ISurveyLocations> locations)
 {
     Id       = 1;
     Survey   = survey;
     Adresses = locations;
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="context"></param>
 /// <param name="survey"></param>
 /// <param name="userManager"></param>
 public SurveysController(AppointmentContext context, ISurvey survey, UserManager <ApplicationUser> userManager)
 {
     _context     = context;
     _survey      = survey;
     _userManager = userManager;
 }
Пример #28
0
 public SurveyController(ISurvey surveyDAO, IPark parkDAO)
 {
     this.surveyDAO = surveyDAO;
     this.parkDAO   = parkDAO;
 }
        private static bool InstrumentHasTakenTooLongToInstall(ISurvey instrument)
        {
            var expiredInstallDateTime = DateTime.Now.AddMinutes(-InstallExpiryTimeOutInMinutes);

            return(instrument.InstallDate < expiredInstallDateTime);
        }
Пример #30
0
        /// <summary>
        /// Static mechanism to render a survey.
        /// </summary>
        /// <param name="survey">The survey.</param>
        /// <param name="placeHolder">The place holder.</param>
        /// <param name="readOnly">if set to <c>true</c> [read only].</param>
        /// <param name="showRequiredNotation">if set to <c>true</c> [show required notation].</param>
        /// <param name="validationProvider">The validation provider.</param>
        /// <param name="localizer">Localizes text.</param>
        public static void RenderSurvey(ISurvey survey, PlaceHolder placeHolder, bool readOnly, bool showRequiredNotation, ValidationProviderBase validationProvider, ILocalizer localizer)
        {
            Debug.Assert(placeHolder != null, "placeHolder cannot be null");
            Debug.Assert(validationProvider != null, "validationProvider cannot be null");

            // add the survey title
            if (survey.ShowText)
            {
                var titleDiv = new HtmlGenericControl("DIV");
                titleDiv.Attributes["class"] = Utility.CssClassSurveyTitle;
                titleDiv.InnerText = survey.Text;
                placeHolder.Controls.Add(titleDiv);
            }

            List<ISection> sections = survey.GetSections();
            foreach (ISection s in sections)
            {
                s.Render(placeHolder, readOnly, showRequiredNotation, validationProvider, localizer);
            }
        }
 private static bool AnyInstrumentNodeHasFailed(ISurvey instrument)
 {
     return(instrument.Configuration.Configurations.Any(c =>
                                                        c.Status != SurveyStatusType.Active.ToString() &&
                                                        c.Status != SurveyStatusType.Installing.ToString()));
 }
 private static bool AnyInstrumentNodeHasFailedOrTakenTooLongToInstall(ISurvey instrument)
 {
     return(AnyInstrumentNodeHasFailed(instrument) || InstrumentHasTakenTooLongToInstall(instrument));
 }
 private static bool AllInstrumentNodesAreInAStatus(ISurvey instrument, SurveyStatusType statusType)
 {
     return(instrument.Configuration.Configurations
            .All(c => c.Status == statusType.ToString()));
 }
Пример #34
0
 public CustomerController(ICustomer context, IQuery query, ISurvey survey)
 {
     _context      = context;
     queryContext  = query;
     surveyContext = survey;
 }
Пример #35
0
 public virtual void AddSurvey(ISurvey pSurvey)
 {
     throw new System.NotImplementedException();
 }
Пример #36
0
 public virtual bool UpsertSurvey(ISurvey pSurvey)
 {
     throw new System.NotImplementedException();
 }
Пример #37
0
        private CatiInstrumentDto GetCatiInstrumentDto(ISurvey instrument)
        {
            var surveyDays = _blaiseCatiApi.GetSurveyDays(instrument.Name, instrument.ServerPark);

            return(_mapper.MapToCatiInstrumentDto(instrument, surveyDays));
        }