示例#1
0
 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;
 }
示例#2
0
 public static SurveyHelper GetInstance()
 {
     if (_instance == null)
     {
         _instance = new SurveyHelper();
     }
     return(_instance);
 }
示例#3
0
 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
     };
 }
示例#4
0
 private void ModulePromptExpire(SurveyHelper helper, string moduleName, int majorVersion)
 {
     helper.Modules[moduleName].ActiveDays = 0;
 }
示例#5
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));
示例#6
0
 private void AzPredictorPrompt(SurveyHelper helper, string moduleName, int majorVersion)
 {
     helper.Modules[moduleName].LastActiveDate = CurrentDate;
     helper.Modules[moduleName].ActiveDays    += 1;
 }
示例#7
0
 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));
示例#8
0
 private void ModulePrompt(SurveyHelper helper, string moduleName, int majorVersion)
 {
     helper.LastPromptDate = Today;
     helper.Modules[moduleName].LastActiveDate = CurrentDate;
     helper.Modules[moduleName].ActiveDays    += 1;
 }
示例#9
0
 private void ModuleCountExpire(SurveyHelper helper, string moduleName, int majorVersion)
 {
     helper.Modules[moduleName].FirstActiveDate = CurrentDate;
     helper.Modules[moduleName].LastActiveDate  = CurrentDate;
     helper.Modules[moduleName].ActiveDays      = 1;
 }
示例#10
0
 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);
示例#11
0
 private bool ShouldModuleBumpVersion(SurveyHelper helper, string moduleName, int majorVersion)
 => majorVersion > helper.Modules[moduleName].MajorVersion;
示例#12
0
 private bool ShouldModuleAdd(SurveyHelper helper, string moduleName, int majorVersion) => !helper.Modules.ContainsKey(moduleName);