Beispiel #1
0
        public void ParseOwnedPropertySingleRow(string estateTypeStr, string ownTypeStr, string areaStr, string countryStr, Person person, string ownTypeByColumn = null)
        {
            estateTypeStr = estateTypeStr.Trim().Trim('-', ' ');
            areaStr       = areaStr.ReplaceEolnWithSpace();
            if (DataHelper.IsEmptyValue(estateTypeStr))
            {
                return;
            }

            RealEstateProperty realEstateProperty = new RealEstateProperty();

            realEstateProperty.square             = DataHelper.ParseSquare(areaStr);
            realEstateProperty.square_raw         = ParserBase.NormalizeRawDecimalForTest(areaStr);
            realEstateProperty.country_raw        = DataHelper.ParseCountry(countryStr).NormSpaces();
            realEstateProperty.own_type_by_column = ownTypeByColumn;

            // колонка с типом недвижимости отдельно
            if (ownTypeStr != null)
            {
                realEstateProperty.type_raw     = estateTypeStr.NormSpaces();
                realEstateProperty.own_type_raw = ownTypeStr.NormSpaces();
                realEstateProperty.Text         = estateTypeStr.NormSpaces();
            }
            else // колонка содержит тип недвижимости и тип собственности
            {
                realEstateProperty.Text = estateTypeStr.NormSpaces();
                if (realEstateProperty.Text.ToLower().Contains("пользовани"))
                {
                    realEstateProperty.own_type_raw = TRealtyCellSpan.StateString;
                }
            }

            realEstateProperty.Text = estateTypeStr.NormSpaces();
            person.RealEstateProperties.Add(realEstateProperty);
        }
Beispiel #2
0
        public void ParseStatePropertySingleRow(string statePropTypeStr, string statePropOwnershipTypeStr,
                                                string statePropSquareStr, string statePropCountryStr, Person person)
        {
            statePropTypeStr = statePropTypeStr.Trim();
            if (DataHelper.IsEmptyValue(statePropTypeStr))
            {
                return;
            }
            RealEstateProperty stateProperty = new RealEstateProperty();

            statePropTypeStr          = statePropTypeStr.Trim(' ', '-');
            stateProperty.Text        = statePropTypeStr.NormSpaces();
            stateProperty.type_raw    = statePropTypeStr.NormSpaces();
            stateProperty.square      = DataHelper.ParseSquare(statePropSquareStr);;
            stateProperty.square_raw  = ParserBase.NormalizeRawDecimalForTest(statePropSquareStr);
            stateProperty.country_raw = DataHelper.ParseCountry(statePropCountryStr).NormSpaces();
            if (statePropOwnershipTypeStr != "" && statePropOwnershipTypeStr != null)
            {
                stateProperty.own_type_raw = statePropOwnershipTypeStr.NormSpaces();
            }
            stateProperty.own_type_by_column = StateString;
            person.RealEstateProperties.Add(stateProperty);
        }
Beispiel #3
0
        void ParseTypeAndCountry(DataRow currRow, DeclarationField realtyType, string ownTypeByColumn, Person person)
        {
            var        typeAndCountry   = new TRealtyCell(currRow.GetDeclarationField(realtyType));
            var        cellSquareField  = (realtyType == DeclarationField.OwnedRealEstateTypeAndCountry) ? DeclarationField.OwnedRealEstateSquare : DeclarationField.StatePropertySquare;
            var        squareCell       = new TRealtyCell(currRow.GetDeclarationField(cellSquareField));
            List <int> linesWithNumbers = TRealtyCellSpan.GetLinesStaringWithNumbers(squareCell.DataCell.GetText(true));

            if (linesWithNumbers.Count > 0)
            {
                typeAndCountry.ParseByEmptyLines(linesWithNumbers);
                squareCell.ParseByEmptyLines(linesWithNumbers);
            }
            for (int i = 0; i < squareCell.ParsedItems.Count; ++i)
            {
                var typeAndCountryStr = typeAndCountry.GetParsedItem(i);
                var type       = typeAndCountryStr;
                var countryStr = "";

                if (typeAndCountryStr.Contains('('))
                {
                    int bracket = typeAndCountryStr.IndexOf('(');
                    type       = typeAndCountryStr.Substring(0, bracket).Trim();
                    countryStr = typeAndCountryStr.Substring(bracket).Trim(' ', '\n', '(', ')');
                }
                var squareRaw = squareCell.GetParsedItem(i);

                RealEstateProperty realEstateProperty = new RealEstateProperty();
                realEstateProperty.Text               = type;
                realEstateProperty.type_raw           = type;
                realEstateProperty.square             = DataHelper.ParseSquare(squareRaw);
                realEstateProperty.square_raw         = ParserBase.NormalizeRawDecimalForTest(squareRaw);
                realEstateProperty.country_raw        = DataHelper.ParseCountry(countryStr).NormSpaces();
                realEstateProperty.own_type_by_column = ownTypeByColumn;
                person.RealEstateProperties.Add(realEstateProperty);
            }
        }
Beispiel #4
0
        private void ParseRealEstateTable(Table table, PublicServant person, string ownTypeByColumn)
        {
            var    rows = table.Descendants <TableRow>().ToList().Skip(1);
            string currentRealEstateType = "";

            foreach (var row in rows)
            {
                var cells           = row.Descendants <TableCell>().ToList();
                var gridSpan        = cells[0].TableCellProperties.GetFirstChild <GridSpan>();
                var mergedColsCount = (gridSpan == null) ? 1 : (int)gridSpan.Val;
                var text            = cells[0].InnerText;

                if (mergedColsCount > 1)
                {
                    currentRealEstateType = text;
                    continue;
                }

                var textStr = cells[1].InnerText;
                if (textStr.OnlyRussianLowercase() == "неимеет")
                {
                    continue;
                }
                var areaStr    = cells[2].InnerText;
                var countryStr = cells[3].InnerText;
                var ownerStr   = cells[4].InnerText;

                var owners = ownerStr.Split(",").ToList();
                var shares = owners.Where(x => x.Contains(" доля") || x.Contains(" доли")).ToList();
                owners = owners.Where(x => !(x.Contains(" доля") || x.Contains(" доли"))).ToList();

                if (shares.Count != owners.Count && shares.Count > 0)
                {
                    throw new SmartParserException("shares.Count != owners.Count in SovetFederaciiDocxScheme");
                }

                if (shares.Count < owners.Count)
                {
                    shares = Enumerable.Repeat <string>(null, owners.Count - shares.Count).ToList();
                }

                var zippedOwners = owners.Zip(shares);

                foreach (var pair in zippedOwners)
                {
                    var owner = pair.First;
                    var share = pair.Second;
                    var realEstateProperty = new RealEstateProperty
                    {
                        Text               = textStr,
                        square             = DataHelper.ParseSquare(areaStr),
                        type_raw           = currentRealEstateType,
                        square_raw         = ParserBase.NormalizeRawDecimalForTest(areaStr),
                        country_raw        = DataHelper.ParseCountry(countryStr),
                        own_type_by_column = ownTypeByColumn
                    };

                    if (share != default)
                    {
                        realEstateProperty.own_type_raw = share;
                    }

                    var relationType = DataHelper.ParseRelationType(owner, false);
                    if (DataHelper.IsRelativeInfo(owner))
                    {
                        var relative = GetPersonRelative(person, relationType);
                        relative.RealEstateProperties.Add(realEstateProperty);
                    }
                    else
                    {
                        person.RealEstateProperties.Add(realEstateProperty);
                    }
                }
            }
        }