예제 #1
0
 public SurveyBaseVm(AdminLevel a, int typeId, ICalcIndicators c)
 {
     adminLevel = a;
     r = new SurveyRepository();
     model = r.CreateSurvey(typeId);
     calc = c;
 }
예제 #2
0
 public SurveyBaseVm(AdminLevel a, SurveyDetails s, ICalcIndicators c)
 {
     r = new SurveyRepository();
     this.model = r.GetById(s.Id);
     adminLevel = a;
     calc = c;
 }
 public void LoadModel(SurveyBase m)
 {
     model = m;
     Localizer.TranslateControl(this);
     GetAndUpdateSites();
     bsSurvey.DataSource = model;
     SetupSiteTypeComboBox(m);
 }
예제 #4
0
 public SurveyBase CreateCopy(int newTypeId, int roundsId, int surveyTimingId, string roundsName, string timingName)
 {
     SurveyRepository repo = new SurveyRepository();
     SurveyBase copy = new SurveyBase();
     copy.TypeOfSurvey = repo.GetSurveyType(newTypeId);
     copy.AdminLevels = AdminLevels;
     copy.StartDate = StartDate;
     copy.EndDate = EndDate;
     copy.SiteType = Translations.Sentinel;
     copy.SiteTypeId = SiteTypeId.Sentinel;
     copy.Notes = Notes;
     copy.HasSentinelSite = true;
     copy.IndicatorValues.Add(new IndicatorValue { DynamicValue = "0", IndicatorId = roundsId, Indicator = copy.TypeOfSurvey.Indicators[roundsName] });
     copy.IndicatorValues.Add(new IndicatorValue { DynamicValue = Translations.Baseline, IndicatorId = surveyTimingId, Indicator = copy.TypeOfSurvey.Indicators[timingName] });
     return copy;
 }
 private void SetupSiteTypeComboBox(SurveyBase m)
 {
     siteTypeBindingSource.DataSource = new Dictionary<SiteTypeId, string>()
     {
         {SiteTypeId.Sentinel, TranslationLookup.GetValue("Sentinel", "Sentinel")},
         {SiteTypeId.SpotCheck, TranslationLookup.GetValue("SpotCheck", "SpotCheck")}
     };
     cbSiteType.DisplayMember = "Value";
     cbSiteType.ValueMember = "Key";
     cbSiteType.SelectedValue = m.SiteTypeId;
     SwitchSiteType(m.SiteTypeId);
 }
예제 #6
0
        private void AddTypeOfLfSurveySite(excel.Worksheet xlsWorksheet, excel.Range rng, int rowCount, SurveyBase mostRecentSurvey)
        {
            string typeName = "";
            if (mostRecentSurvey.TypeOfSurvey.Id == (int)StaticSurveyType.LfSentinel)
            {
                var testType = mostRecentSurvey.IndicatorValues.FirstOrDefault(v => v.Indicator.DisplayName == "LFSurTestType");
                if (testType != null && testType.DynamicValue != null)
                {
                    // Determine if it is a spot check or sentinel site
                    if (mostRecentSurvey.SentinelSiteId.HasValue)
                        typeName = string.Format("{0} ({1})", "SS", testType.DynamicValue);
                    else
                        typeName = string.Format("{0} ({1})", "SC", testType.DynamicValue);
                }
            }
            else if (mostRecentSurvey.TypeOfSurvey.Id == (int)StaticSurveyType.LfMapping)
            {
                var testType = mostRecentSurvey.IndicatorValues.FirstOrDefault(v => v.Indicator.DisplayName == "LFMapSurTestType");
                if (testType != null && testType.DynamicValue != null)
                {
                    typeName = string.Format("{0} ({1})", "MAP", testType.DynamicValue);
                }
            }
            else
                typeName = transLookup.GetValue("RtiTas", "RtiTas");

            AddValueToRange(xlsWorksheet, rng, "I" + rowCount, typeName);
        }
예제 #7
0
 private void AddTraLevelToRange(excel.Worksheet xlsWorksheet, excel.Range rng, int rowCount, SurveyBase mostRecentSurvey, string indName, string colName)
 {
     var ind = mostRecentSurvey.IndicatorValues.FirstOrDefault(v => v.Indicator.DisplayName == indName);
     if (ind != null && !string.IsNullOrEmpty(ind.DynamicValue))
     {
         if (ind.DynamicValue == "TraSurDistLevel")
             AddValueToRange(xlsWorksheet, rng, colName + rowCount, TranslationLookup.GetValue("RtiDistrict", "RtiDistrict"));
         else if (ind.DynamicValue == "TraSurSubDistLevel")
             AddValueToRange(xlsWorksheet, rng, colName + rowCount, TranslationLookup.GetValue("RtiSubDistrict", "RtiSubDistrict"));
     }
 }
예제 #8
0
 private void AddIndicatorToRange(excel.Worksheet xlsWorksheet, excel.Range rng, int rowCount, SurveyBase mostRecentSurvey, string indName, string colName)
 {
     var ind = mostRecentSurvey.IndicatorValues.FirstOrDefault(v => v.Indicator.DisplayName == indName);
     if (ind != null && !string.IsNullOrEmpty(ind.DynamicValue))
         AddValueToRange(xlsWorksheet, rng, colName + rowCount, ind.DynamicValue);
 }
예제 #9
0
 private string GetPercentPositive(SurveyBase mostRecentSurvey, string posName, string examinedName, out int year)
 {
     string percent = "";
     var pos = mostRecentSurvey.IndicatorValues.FirstOrDefault(v => v.Indicator.DisplayName == posName);
     var examined = mostRecentSurvey.IndicatorValues.FirstOrDefault(v => v.Indicator.DisplayName == examinedName);
     if (pos != null && examined != null)
     {
         percent = CalcBase.GetPercentage(pos.DynamicValue, examined.DynamicValue, 1);
         if (percent == Translations.NA)
             percent = "";
     }
     year = mostRecentSurvey.DateReported.Year;
     return percent;
 }
예제 #10
0
 public SentinelSiteList(SurveyBase surveyBase) : this()
 {
     Survey = surveyBase;
     AdminLevelId = Survey.AdminLevelId.HasValue ? Survey.AdminLevelId.Value : 0;
 }