Exemplo n.º 1
0
        public static DeedDetails GetLatestDeedDetails(string propertyBBLE)
        {
            try
            {
                using (ACRISEntities acrisDBEntities = new ACRISEntities())
                {
                    LatestDeedDocument documentObj = acrisDBEntities.LatestDeedDocuments.FirstOrDefault(i => i.BBLE == propertyBBLE);

                    if (documentObj == null)
                    {
                        Common.Logs.log().Error(string.Format("Error finding record for BBLE {0} in LatestDeedDocument", propertyBBLE));
                        return(null);
                    }
                    DeedDetails deedDetailsObj = new DeedDetails();
                    deedDetailsObj.deedDocument = documentObj;
                    foreach (tfnGetDocumentParties_Result a in acrisDBEntities.tfnGetDocumentParties(documentObj.DeedUniqueKey, "BUYER").ToList())
                    {
                        if (deedDetailsObj.owners == null)
                        {
                            deedDetailsObj.owners = new List <DeedParty>();
                        }
                        deedDetailsObj.owners.Add(Mapper.Map <DeedParty>(a));
                    }
                    return(deedDetailsObj);
                }
            }
            catch (Exception e)
            {
                Common.Logs.log().Error(string.Format("Error reading AreaAbstract{0}", Common.Logs.FormatException(e)));
                return(null);
            }
        }
Exemplo n.º 2
0
        public static List <MortgageDocumentDetail> GetMortgageChain(string propertyBBL)
        {
            using (ACRISEntities acrisDBEntities = new ACRISEntities())
            {
                var resultList = acrisDBEntities.tfnGetMortgageChain(propertyBBL).OrderByDescending(m => (m.DocumentDate != null) ? m.DocumentDate : m.DateRecorded)
                                 .ThenByDescending(m => (m.RelatedDocumentDate != null) ? m.RelatedDocumentDate : m.RelatedDocumentRecordDate)
                                 .ToList();
                if (resultList == null || resultList.Count == 0)
                {
                    return(null);
                }

                List <MortgageDocumentDetail> mortgageChain = new List <MortgageDocumentDetail>();
                string documentKey = "";
                MortgageDocumentDetail mortgage = null;
                foreach (var rec in resultList)
                {
                    if (documentKey != rec.UniqueKey)
                    {
                        documentKey = rec.UniqueKey;

                        mortgage         = Mapper.Map <MortgageDocumentDetail>(rec);
                        mortgage.IsPaid  = false;
                        mortgage.Parties = Mapper.Map <List <tfnGetDocumentParties_Result>, List <DocumentParty> >(acrisDBEntities.tfnGetDocumentParties(rec.UniqueKey, null).ToList());
                        mortgageChain.Add(mortgage);
                    }
                    if (rec.RelatedDocumentUniqueKey != null)
                    {
                        if (mortgage.RelatedDocuments == null)
                        {
                            mortgage.RelatedDocuments = new List <MortgageRelatedDocumentDetail>();
                        }
                        if (rec.RelatedDocumentType == "SAT")
                        {
                            mortgage.IsPaid = true;
                        }
                        MortgageRelatedDocumentDetail rDoc = new MortgageRelatedDocumentDetail();
                        rDoc.UniqueKey               = rec.RelatedDocumentUniqueKey;
                        rDoc.DocumentType            = rec.RelatedDocumentType;
                        rDoc.DocumentTypeDescription = rec.RelatedDocumentTypeDescription;
                        rDoc.DocumentDate            = rec.RelatedDocumentDate;
                        rDoc.DateRecorded            = rec.RelatedDocumentRecordDate;
                        rDoc.URL     = rec.RelatedDocumentURL;
                        rDoc.Parties = Mapper.Map <List <tfnGetDocumentParties_Result>, List <DocumentParty> >(acrisDBEntities.tfnGetDocumentParties(rec.RelatedDocumentUniqueKey, null).ToList());
                        mortgage.RelatedDocuments.Add(rDoc);
                    }
                }
                return(mortgageChain);
            }
        }