Example #1
0
        public void ParseStateProperty(DataRow currRow, Person person)
        {
            if (!currRow.ColumnOrdering.ContainsField(DeclarationField.StatePropertySquare))
            {
                AddRealEstateWithNaturalText(currRow, DeclarationField.StateColumnWithNaturalText, TRealtyCellSpan.StateString, person);
                return;
            }
            else if (currRow.ColumnOrdering.ContainsField(DeclarationField.StateRealEstateTypeAndCountry))
            {
                ParseTypeAndCountry(currRow, DeclarationField.StateRealEstateTypeAndCountry, TRealtyCellSpan.StateString, person);
            }
            else
            {
                Cell propTypeCell = currRow.GetDeclarationField(DeclarationField.StatePropertyType, false);
                if (propTypeCell == null || DataHelper.IsEmptyValue(propTypeCell.GetText(true)))
                {
                    return;
                }
                Cell ownershipTypeCell = currRow.GetDeclarationField(DeclarationField.StatePropertyOwnershipType, false);
                Cell squareCell        = currRow.GetDeclarationField(DeclarationField.StatePropertySquare);
                Cell countryCell       = currRow.GetDeclarationField(DeclarationField.StatePropertyCountry, false);


                try
                {
                    var cellSpan = new TRealtyCellSpan(propTypeCell, ownershipTypeCell, squareCell, countryCell);
                    cellSpan.ParseStatePropertyManyValuesInOneCell(person);
                }
                catch (Exception e)
                {
                    Logger.Error("***ERROR row({0}) {1}", currRow.Cells[0].Row, e.Message);
                }
            }
        }
Example #2
0
 public void ParseOwnedOrMixedProperty(Cell estateTypeCell, Cell ownTypeCell, Cell squareCell, Cell countryCell,
                                       DataRow currRow, Person person, string ownTypeByColumn = null)
 {
     try
     {
         var cellSpan = new TRealtyCellSpan(estateTypeCell, ownTypeCell, squareCell, countryCell);
         cellSpan.ParseOwnedPropertyManyValuesInOneCell(person, ownTypeByColumn);
     }
     catch (Exception e)
     {
         Logger.Error("***ERROR row({0}) {1}", currRow.Cells[0].Row, e.Message);
     }
 }
Example #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);
            }
        }