Example #1
0
        public IHttpActionResult GetLatestDeedDetails(string propertyBBLE)
        {
            if (!BAL.BBL.IsValidFormat(propertyBBLE))
            {
                return(BadRequest("Incorrect BBLE - Borough Block Lot & Easement number"));
            }

            BAL.DeedDetails deedDetailsObj = BAL.ACRIS.GetLatestDeedDetails(propertyBBLE);
            if (deedDetailsObj == null)
            {
                return(NotFound());
            }

            return(Ok(deedDetailsObj));
        }
        public static GeneralPropertyInformation Get(string streetNumber, string streetName, string borough)
        {
            //BBL from address
            JObject jsonObj = GetAddressDetailsFromGeoClientAPI(streetNumber, streetName, borough);

            if (jsonObj == null)
            {
                return(null);
            }

            if (CheckIfMessageContainsNotFound(jsonObj, "address"))
            {
                return(null);
            }

            GeneralPropertyInformation propertyDetails = new GeneralPropertyInformation();

            try
            {
                using (NYCDOFEntities dofDBEntities = new NYCDOFEntities())
                {
                    //Get General Property Information from Assessment and other sources
                    List <tfnGetGeneralPropertyInformation_Result> propertyInfo = dofDBEntities.tfnGetGeneralPropertyInformation((string)jsonObj.SelectToken("address.bbl")).ToList();

                    if (propertyInfo != null && propertyInfo.Count > 0)
                    {
                        propertyDetails.propertyInformation = Mapper.Map <PhysicalPropertyInformation>(propertyInfo[0]);
                        //Create a clean address
                        GeneralAddress address = new GeneralAddress();
                        address.addressLine1 = propertyInfo[0].StreetNumber + " " + StringUtilities.ToTitleCase(propertyInfo[0].StreetName);
                        if (propertyInfo[0].UnitNumber != null)
                        {
                            address.addressLine2 = "Unit #" + propertyInfo[0].UnitNumber;
                        }
                        address.city  = StringUtilities.ToTitleCase((string)jsonObj.SelectToken("address.uspsPreferredCityName"));
                        address.state = "NY";
                        address.zip   = (string)jsonObj.SelectToken("address.zipCode");

                        propertyDetails.address = address;
                    }
                    else
                    {
                        Common.Logs.log().Error(string.Format("Error finding record for BBLE {0} in Assessment", (string)jsonObj.SelectToken("address.bbl")));
                    }
                }
            }
            catch (Exception e)
            {
                Common.Logs.log().Error(string.Format("Error reading data from NYCDOF{0}", Common.Logs.FormatException(e)));
                return(null);
            }

            if (BAL.BBL.GetLot((string)jsonObj.SelectToken("address.bbl")) <= 6999)
            {
                BAL.DeedDetails deedDetailsObj = BAL.ACRIS.GetLatestDeedDetails((string)jsonObj.SelectToken("address.bbl"));
                if (deedDetailsObj != null)
                {
                    propertyDetails.owners = deedDetailsObj.owners;
                }
            }
            else
            {
                propertyDetails.errors = string.Format("Cannot get ownership information for Lot number {0}", BAL.BBL.GetLot((string)jsonObj.SelectToken("address.bbl")));
            }

            return(propertyDetails);
        }
        /// <summary>
        ///     Returns Physical Data about a property identified by BBL
        /// </summary>
        /// <param name="propertyBBL"></param>
        /// <param name="addresscleanup"></param>
        /// <returns></returns>
        public static GeneralPropertyInformation Get(string propertyBBL, bool addresscleanup)
        {
            try
            {
                using (NYCDOFEntities dofDBEntities = new NYCDOFEntities())
                {
                    //Find BBL in Assessment Table
                    List <tfnGetGeneralPropertyInformation_Result> propertyInfo = dofDBEntities.tfnGetGeneralPropertyInformation(propertyBBL).ToList();
                    if (propertyInfo == null || propertyInfo.Count <= 0)
                    {
                        //BBL not in Assessment Table check ACRIS
                        BAL.PropertyLotInformation lotObj = BAL.ACRIS.GetLotInformation(propertyBBL);
                        if (lotObj != null)
                        {
                            propertyInfo.Add(new tfnGetGeneralPropertyInformation_Result());
                            propertyInfo[0].BBLE    = propertyBBL;
                            propertyInfo[0].Borough = BAL.BBL.GetBoroughName(propertyBBL);
                            propertyInfo[0].Block   = BAL.BBL.GetBlock(propertyBBL);
                            propertyInfo[0].Lot     = BAL.BBL.GetLot(propertyBBL);

                            propertyInfo[0].StreetName   = lotObj.StreetName;
                            propertyInfo[0].StreetNumber = lotObj.StreetNumber;
                            propertyInfo[0].UnitNumber   = lotObj.UnitNumber;
                        }
                    }

                    if (propertyInfo == null || propertyInfo.Count <= 0)
                    {
                        return(null);    //BBL not found
                    }
                    GeneralAddress             address         = null;
                    GeneralPropertyInformation propertyDetails = new GeneralPropertyInformation();

                    //Clean address using GeoClinet API
                    JObject jsonObj = null;
                    if (addresscleanup)
                    {
                        jsonObj = GetAddressDetailsFromGeoClientAPI(propertyInfo[0].StreetNumber, propertyInfo[0].StreetName, propertyInfo[0].Borough);
                    }

                    if (jsonObj != null && !CheckIfMessageContainsNotFound(jsonObj, "address") && !string.IsNullOrEmpty((string)jsonObj.SelectToken("address.uspsPreferredCityName")))
                    {
                        address = new GeneralAddress();
                        address.addressLine1 = propertyInfo[0].StreetNumber + " " + StringUtilities.ToTitleCase(propertyInfo[0].StreetName);
                        if (propertyInfo[0].UnitNumber != null)
                        {
                            address.addressLine2 = "Unit #" + propertyInfo[0].UnitNumber;
                        }
                        address.city  = StringUtilities.ToTitleCase((string)jsonObj.SelectToken("address.uspsPreferredCityName"));
                        address.state = "NY";
                        address.zip   = (string)jsonObj.SelectToken("address.zipCode");
                    }
                    else
                    {   // Use the address from Assessment or ACRIS
                        address = new GeneralAddress();
                        address.addressLine1 = propertyInfo[0].StreetNumber + " " + StringUtilities.ToTitleCase(propertyInfo[0].StreetName);
                        if (propertyInfo[0].UnitNumber != null)
                        {
                            address.addressLine2 = "Unit #" + propertyInfo[0].UnitNumber;
                        }
                        address.city  = StringUtilities.ToTitleCase(BAL.BBL.GetBoroughName(propertyBBL));
                        address.state = "NY";
                        if (propertyInfo[0].ZipCode != null)
                        {
                            address.zip = propertyInfo[0].ZipCode;
                        }
                    }
                    propertyDetails.address             = address;
                    propertyDetails.propertyInformation = Mapper.Map <PhysicalPropertyInformation>(propertyInfo[0]);

                    BAL.DeedDetails deedDetailsObj = BAL.ACRIS.GetLatestDeedDetails(propertyBBL);
                    if (deedDetailsObj != null)
                    {
                        propertyDetails.owners = deedDetailsObj.owners;
                    }

                    return(propertyDetails);
                }
            }
            catch (Exception e)
            {
                Common.Logs.log().Error(string.Format("Error reading data from NYCDOF{0}", Common.Logs.FormatException(e)));
                return(null);
            }
        }