public InputDataDB(DBLayer.Plot plot, int area = 0) { Contract.Requires(plot != null); VriDoc = plot.VriDoc ?? ""; Area = area; SetBtiPart(plot); VriKlass = plot.VriClassfRr; }
private void SetBtiPart(DBLayer.Plot plot) { BtiVri = ""; LoLvl = false; MidLvl = false; HiLvl = false; if (plot.Buildings != null && plot.Buildings.Any()) { var vriCodes = plot.Buildings.Select(p => p.VRI).Distinct(); foreach (var vri in vriCodes) { var btiVri = vri ?? ""; BtiVri += string.IsNullOrEmpty(BtiVri) ? btiVri : ", " + btiVri; } var houses = plot.Buildings.Where(p => p.BuildingPurpose.Equals("многоквартирный дом")); if (houses.Any()) { var nStoreys = houses.Select(p => (p.NumberOfStoreys == 0 || p.NumberOfStoreys == null) ? p.MaxStoreysOKS ?? 0 : p.NumberOfStoreys); foreach (var s in nStoreys) { if (s > 0 && s <= 4) { LoLvl = true; } if (s > 4 && s <= 8) { MidLvl = true; } if (s > 8) { HiLvl = true; } } } } }