Exemple #1
0
        /// <summary>
        /// Подсчет площадей блок-секций и типов
        /// </summary>
        public void Calc()
        {
            // Разбивка секций на типы и подсчет общей площади счекций одного типа
            Dictionary <string, SectionType> types = new Dictionary <string, SectionType>();

            foreach (var section in _service.Sections)
            {
                SectionType secType;
                string      key = section.Name.ToUpper();
                if (!types.TryGetValue(key, out secType))
                {
                    secType = new SectionType(section.Name, section.Floors);
                    types.Add(key, secType);
                }
                secType.AddSection(section);

                KP_GNS_BKFN    += section.AreaGNS;
                KP_GNS_Typical += section.AreaGNS * (section.Floors - 1);
            }
            KP_GNS_Total = KP_GNS_BKFN + KP_GNS_Typical;
            SectionTypes = types.Values.ToList();
            SectionTypes.Sort();

            // Подсчет общих значений для всех типов секций
            var bsByFloor   = SectionTypes.SelectMany(b => b.Sections).GroupBy(g => g.Floors);
            var totalFloors = bsByFloor.Sum(s => s.Key * s.Count());

            AverageFloors  = totalFloors / (double)bsByFloor.Sum(s => s.Count());
            TotalAreaApart = SectionTypes.Sum(s => s.AreaApartTotal);
            TotalAreaBKFN  = SectionTypes.Sum(s => s.AreaBKFN);
            TotalArea      = TotalAreaApart + TotalAreaBKFN;

            // По классификатору
            if (_service.Classes.Count > 0)
            {
                var landClass = _service.Classes.Find(c => c.ClassType.ClassName == ClassTypeService.Site);
                if (landClass != null)
                {
                    FC_LandArea    = landClass.Area * 0.0001;
                    FC_QuarterArea = FC_LandArea;
                    foreach (var item in _service.Classes)
                    {
                        double val = GetreduceArea(item);
                        if (val != 0)
                        {
                            FC_QuarterArea -= val * 0.0001;
                        }
                    }
                    FC_Density = KP_GNS_Total / FC_QuarterArea;
                }
            }
        }
        /// <summary>
        /// Подсчет площадей блок-секций и типов
        /// </summary>
        public void Calc()
        {
            // Разбивка секций на типы и подсчет общей площади счекций одного типа
            Dictionary <string, SectionType> types = new Dictionary <string, SectionType>();

            foreach (var section in _service.Sections)
            {
                SectionType secType;
                string      key = section.Name.ToUpper();
                if (!types.TryGetValue(key, out secType))
                {
                    secType = new SectionType(section.Name, section.NumberFloor);
                    types.Add(key, secType);
                }
                secType.AddSection(section);
            }
            SectionTypes = types.Values.ToList();
            SectionTypes.Sort();

            // Подсчет общих значений для всех типов секций
            AverageFloors  = SectionTypes.Average(s => s.NumberFloor);
            TotalAreaApart = SectionTypes.Sum(s => s.AreaApartTotal);
            TotalAreaBKFN  = SectionTypes.Sum(s => s.AreaBKFN);
        }