Esempio n. 1
0
 public void Test(int intervals, double[] levels, double[] values, int[] intervalCounts)
 {
     for (int i = 0; i < intervals; i++)
     {
         field.IntervalList.Add(new StatValueInterval
         {
             IntervalLowLevel = levels[i],
             IntervalUpLevel = levels[i + 1]
         });
     }
     viewModel = new StatFieldViewModel(field, values);
     List<StatValueIntervalSetting> settingList = viewModel.IntervalSettingList;
     Assert.AreEqual(settingList.Count, intervals);
     for (int i = 0; i < intervals; i++)
     {
         Assert.AreEqual(settingList[i].IntervalLowLevel, field.IntervalList[i].IntervalLowLevel);
         Assert.AreEqual(settingList[i].IntervalUpLevel, field.IntervalList[i].IntervalUpLevel);
         Assert.AreEqual(settingList[i].SuggestUpLevel, field.IntervalList[i].IntervalUpLevel);
         Assert.AreEqual(settingList[i].RecordsCount, intervalCounts[i]);
     }
 }
Esempio n. 2
0
 public ActionResult DisplayDef(StatFieldViewModel viewModel,
     StatComplexFieldRepository repository)
 {
     for (int i = 0; i < repository.FieldList.Count; i++)
     {
         if (i == (int)viewModel.FieldName.GetStatRuIndex()
             + StatValueChoiceQueries.Choices.Count()
             || i == (int)viewModel.FieldName.GetStatValueIndex()
             || repository.FieldList[i].IntervalList.Count == 0)
         {
             repository.FieldList[i].AutoGenerateIntervals(
                 viewModel.FieldLength, viewModel.ColorThemeDescription.GetColorThemeIndex());
         }
     }
     GenerateValuesMrsService service = new GenerateValuesMrsService(RutraceStatContainer.MrsStats);
     return View(new StatFieldViewModel(repository[viewModel.FieldName],
         service.GenerateValues(viewModel.FieldName))
     {
         FieldLength = viewModel.FieldLength,
         ColorThemeDescription = viewModel.ColorThemeDescription
     });
 }
 public ActionResult PointsAnalysis(StatFieldViewModel viewModel,
     StatValueFieldRepository repository)
 {
     for (int i = 0; i < repository.FieldList.Count; i++)
     {
         if (i == (int)viewModel.FieldName.GetStatValueIndex()
             || repository.FieldList[i].IntervalList.Count == 0)
         {
             repository.FieldList[i].AutoGenerateIntervals(
                 viewModel.FieldLength, viewModel.ColorThemeDescription.GetColorThemeIndex());
         }
     }
     return View(new StatFieldViewModel(repository.FieldList[(int)viewModel.FieldName.GetStatValueIndex()])
     {
         FieldLength = viewModel.FieldLength,
         ColorThemeDescription = viewModel.ColorThemeDescription
     });
 }