Exemple #1
0
        public TRealtyCellSpan(Cell estateTypeCell, Cell ownTypeCell, Cell squareCell, Cell countryCell)
        {
            if (squareCell != null && countryCell != null)
            {
                if (CountryAndSquareAreSwapped(squareCell.GetText(true), countryCell.GetText(true)))
                {
                    (squareCell, countryCell) = (countryCell, squareCell);
                }
            }

            EstateTypeCell = new TRealtyCell(estateTypeCell);
            OwnTypeCell    = new TRealtyCell(ownTypeCell);
            SquareCell     = new TRealtyCell(squareCell);
            CountryCell    = new TRealtyCell(countryCell);
            if (!ShouldStartParsing())
            {
                EstateTypeCell.CopyUnparsedValue();
                OwnTypeCell.CopyUnparsedValue();
                SquareCell.CopyUnparsedValue();
                CountryCell.CopyUnparsedValue();
            }
            else
            {
                ParseCellTexts();
            }
            CountryCell.SetDefaultValueIfUnique();
        }
Exemple #2
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);
            }
        }