private void ModuleBumpVersion(SurveyHelper helper, string moduleName, int majorVersion) { helper.Modules[moduleName].MajorVersion = majorVersion; helper.Modules[moduleName].FirstActiveDate = CurrentDate; helper.Modules[moduleName].LastActiveDate = CurrentDate; helper.Modules[moduleName].ActiveDays = 1; }
public static SurveyHelper GetInstance() { if (_instance == null) { _instance = new SurveyHelper(); } return(_instance); }
private void ModuleAdd(SurveyHelper helper, string moduleName, int majorVersion) { helper.Modules[moduleName] = new ModuleInfo() { Name = moduleName, MajorVersion = majorVersion, ActiveDays = 1, FirstActiveDate = CurrentDate, LastActiveDate = CurrentDate, Enabled = true }; }
private void ModulePromptExpire(SurveyHelper helper, string moduleName, int majorVersion) { helper.Modules[moduleName].ActiveDays = 0; }
private bool ShouldModulePromptExpire(SurveyHelper helper, string moduleName, int majorVersion) => helper.Modules[moduleName].MajorVersion == majorVersion && (Modules[moduleName].ActiveDays == _surveyTriggerCount + 1 && helper.LastPromptDate == Convert.ToDateTime(Modules[moduleName].LastActiveDate) && helper.Today > helper.LastPromptDate.AddDays(_delayForSecondPrompt) || Modules[moduleName].ActiveDays == _surveyTriggerCount + 2 && helper.LastPromptDate == Convert.ToDateTime(Modules[moduleName].LastActiveDate) && helper.Today > LastPromptDate.AddDays(_delayForThirdPrompt));
private void AzPredictorPrompt(SurveyHelper helper, string moduleName, int majorVersion) { helper.Modules[moduleName].LastActiveDate = CurrentDate; helper.Modules[moduleName].ActiveDays += 1; }
private bool ShouldAzPredictorPrompt(SurveyHelper helper, string moduleName, int majorVersion) => _predictor.Equals(moduleName, StringComparison.OrdinalIgnoreCase) && helper.Modules[moduleName].MajorVersion == majorVersion && ((helper.Modules[moduleName].ActiveDays == _surveyTriggerCount && helper.Today <= Convert.ToDateTime(helper.Modules[moduleName].FirstActiveDate).AddDays(_countExpiredDays)) || helper.Modules[moduleName].ActiveDays == _surveyTriggerCount + 1 && helper.Today == Convert.ToDateTime(helper.Modules[moduleName].LastActiveDate).AddDays(_delayForSecondPrompt) || helper.Modules[moduleName].ActiveDays == _surveyTriggerCount + 2 && helper.Today == Convert.ToDateTime(helper.Modules[moduleName].LastActiveDate).AddDays(_delayForThirdPrompt));
private void ModulePrompt(SurveyHelper helper, string moduleName, int majorVersion) { helper.LastPromptDate = Today; helper.Modules[moduleName].LastActiveDate = CurrentDate; helper.Modules[moduleName].ActiveDays += 1; }
private void ModuleCountExpire(SurveyHelper helper, string moduleName, int majorVersion) { helper.Modules[moduleName].FirstActiveDate = CurrentDate; helper.Modules[moduleName].LastActiveDate = CurrentDate; helper.Modules[moduleName].ActiveDays = 1; }
private bool ShouldModuleCountExpire(SurveyHelper helper, string moduleName, int majorVersion) => helper.Modules[moduleName].MajorVersion == majorVersion && helper.Modules[moduleName].ActiveDays <_surveyTriggerCount && helper.Today> Convert.ToDateTime(helper.Modules[moduleName].LastActiveDate) && helper.Today > Convert.ToDateTime(helper.Modules[moduleName].FirstActiveDate).AddDays(_countExpiredDays);
private bool ShouldModuleBumpVersion(SurveyHelper helper, string moduleName, int majorVersion) => majorVersion > helper.Modules[moduleName].MajorVersion;
private bool ShouldModuleAdd(SurveyHelper helper, string moduleName, int majorVersion) => !helper.Modules.ContainsKey(moduleName);