示例#1
0
 public IntvBaseVm(AdminLevel a, IntvDetails d, ICalcIndicators c)
 {
     r = new IntvRepository();
     this.model = r.GetById(d.Id);
     adminLevel = a;
     calc = c;
 }
 public void Delete(IntvDetails details, int userId) { interventions.Delete(details, userId); }
 public IView GetIntv(IntvDetails details)
 {
     return new DataEntryEdit(new IntvBaseVm(adminLevel, details, new CalcIntv()));
 }
 private IntvBase SplitIntv(List<IntvBase> toMerge, IntvDetails details, AdminLevel dest, double multiplier, int redistrictId, OleDbCommand command, OleDbConnection connection)
 {
     var intv = intvRepo.GetById(details.Id);
     var newForm = Util.DeepClone(intv);
     if (newForm.AdminLevelId != dest.Id)
     {
         newForm.Id = 0;
         newForm.IsRedistricted = true;
         newForm.AdminLevelId = dest.Id;
     }
     newForm.IndicatorValues = RedistributeIndicators(intv.IndicatorValues, multiplier);
     if (toMerge == null)
     {
         intvRepo.SaveIntvBase(command, connection, newForm, userId);
         demoRepo.InsertRedistrictForm(command, connection, userId, redistrictId, intv.Id, newForm.Id, IndicatorEntityType.Intervention);
     }
     else
         toMerge.Add(newForm);
     return newForm;
 }