Exemplo n.º 1
0
        public IEnumerable<MSI_Port_SalesTrans_Original> GetPortfolioSalesSummary(string productCode)
        {
            MSI_Port_SalesTrans_Original salesTransaction = null;
            DBFactory db;
            List<MSI_Port_SalesTrans_Original> salesTransactions = null;
            System.Data.DataSet ds;
            try
            {
                db = new DBFactory();
                ds = db.ExecuteDataset("MSI_sp_GetPortfolioSalesSummary", "PurchaseSalesSummary", new SqlParameter("@productCode", productCode));

                if (ds.Tables["PurchaseSalesSummary"].Rows.Count > 0)
                {
                    salesTransactions = new List<MSI_Port_SalesTrans_Original>();
                    foreach (System.Data.DataRow dr in ds.Tables["PurchaseSalesSummary"].Rows)
                    {
                        salesTransaction = new MSI_Port_SalesTrans_Original();
                        salesTransaction.ID = int.Parse(dr["ID"].ToString());
                        salesTransaction.Portfolio_ = dr["Portfolio#"].ToString();
                        salesTransaction.Buyer = dr["Buyer"].ToString();
                        if (dr["SalesBasis"] != DBNull.Value)
                            salesTransaction.SalesBasis = Convert.ToDouble(dr["SalesBasis"].ToString());
                        if (dr["FaceValue"] != DBNull.Value)
                            salesTransaction.FaceValue = Convert.ToDecimal(dr["FaceValue"].ToString());
                        if (dr["Cut-OffDate"] != DBNull.Value)
                            salesTransaction.Cut_OffDate = DateTime.Parse(dr["Cut-OffDate"].ToString());
                        if (dr["#ofAccts"] != DBNull.Value)
                            salesTransaction.C_ofAccts = Convert.ToDouble(dr["#ofAccts"].ToString());
                        if (dr["SalesPrice"] != DBNull.Value)
                            salesTransaction.SalesPrice = Convert.ToDecimal(dr["SalesPrice"].ToString());
                        DateTime closingDate;
                        if (DateTime.TryParse(dr["ClosingDate"].ToString(), out closingDate))
                            salesTransaction.ClosingDate = closingDate;
                        salesTransaction.Lender = dr["Lender"].ToString();
                        int putbackTermDays;
                        if (int.TryParse(dr["PutbackTerm"].ToString(), out putbackTermDays))
                            salesTransaction.PutbackTerm_days_ = putbackTermDays;
                        DateTime putbackDeadLine;
                        if (DateTime.TryParse(dr["PutbackDeadLine"].ToString(), out putbackDeadLine))
                            salesTransaction.PutbackDeadline = putbackDeadLine;
                        salesTransaction.Notes = dr["Notes"].ToString();
                        salesTransactions.Add(salesTransaction);
                    }
                }

            }
            catch (Exception ex)
            {
            }
            return salesTransactions.AsEnumerable<MSI_Port_SalesTrans_Original>();
        }
Exemplo n.º 2
0
        public IEnumerable<MSI_Debtor> GetDebtors(string accountNumber)
        {
            MSI_Debtor debtor = null;
            DBFactory db;
            List<MSI_Debtor> debtors = null;
            System.Data.DataSet ds;
            try
            {
                db = new DBFactory();
                ds = db.ExecuteDataset("MSI_spGetDebtors", "Debtors", new SqlParameter("@pimsAccountNumber", accountNumber));

                if (ds.Tables["Debtors"].Rows.Count > 0)
                {
                    debtors = new List<MSI_Debtor>();
                    foreach (System.Data.DataRow dr in ds.Tables["Debtors"].Rows)
                    {
                        debtor = new MSI_Debtor();
                        debtor.Account = dr["ACCOUNT"].ToString();
                        debtor.FirstName = dr["FirstName"].ToString();
                        debtor.LastName = dr["LastName"].ToString();
                        debtor.Address1 = dr["ADDRESS1"].ToString();
                        debtor.Address2 = dr["ADDRESS2"].ToString();
                        debtor.City = dr["CITY"].ToString();
                        debtor.State = dr["STATE"].ToString();
                        debtor.Zip = dr["ZIP_CODE"].ToString();
                        string ssn = dr["SSN"].ToString().Trim();
                        debtor.LastFourSSN = ssn.Substring(7, 4);
                        debtor.MobilePhone = dr["PHONE_CELL"].ToString();
                        debtor.HomePhone = dr["PHONE_HOME"].ToString();
                        debtor.WorkPhone = dr["PHONE_WORK"].ToString();
                        debtor.DOB = dr["DOB"].ToString();
                        debtor.DebtCurrentBalance = dr["DebtCurrentBalance"].ToString();
                        debtor.DebtPurchaseBalance = dr["DebtorPurchaseBalance"].ToString();
                        debtor.CreditorName = dr["CreditorName"].ToString();

                        debtors.Add(debtor);
                    }
                }

            }
            catch (Exception ex)
            {
            }
            return debtors.AsEnumerable<MSI_Debtor>();
        }
Exemplo n.º 3
0
        public MSI_Port_Acq_Original GetPortfolioPurchaseSummary(string productCode)
        {
            MSI_Port_Acq_Original portfolio = null;
            DBFactory db;
            System.Data.DataSet ds;
            System.Data.DataRow dr;
            try
            {
                portfolio = new MSI_Port_Acq_Original();
                db = new DBFactory();
                ds = db.ExecuteDataset("MSI_sp_GetPortfolioPurchaseSummary", "PurchaseSummary", new SqlParameter("@productCode", productCode));

                dr = ds.Tables["PurchaseSummary"].Rows[0];
                portfolio.Portfolio_ = dr["Portfolio#"].ToString();
                portfolio.Company = dr["Company"].ToString();
                portfolio.Seller = dr["Seller"].ToString();
                portfolio.CostBasis = Convert.ToDouble(dr["CostBasis"].ToString());
                portfolio.Face = Convert.ToDecimal(dr["Face"].ToString());
                portfolio.Cut_OffDate = DateTime.Parse(dr["Cut-OffDate"].ToString());
                portfolio.C_ofAccts = Convert.ToDouble(dr["#ofAccts"].ToString());
                portfolio.PurchasePrice = Convert.ToDecimal(dr["PurchasePrice"].ToString());
                DateTime closingDate;
                if (DateTime.TryParse(dr["ClosingDate"].ToString(), out closingDate))
                    portfolio.ClosingDate = closingDate;
                portfolio.Lender_FileDescription = dr["Lender/FileDescription"].ToString();
                int putbackTermDays;
                if (int.TryParse(dr["PutBackTerm"].ToString(), out putbackTermDays))
                    portfolio.PutbackTerm__days_ = putbackTermDays;
                DateTime putbackDeadLine;
                if (DateTime.TryParse(dr["PutbackDeadLine"].ToString(), out putbackDeadLine))
                    portfolio.PutbackDeadline = putbackDeadLine;
                portfolio.Notes = dr["Notes"].ToString();
                int resaleId;
                if (int.TryParse(dr["ResaleRestrictionId"].ToString(), out resaleId))
                    portfolio.ResaleRestrictionId = resaleId;

            }
            catch (Exception ex)
            {
            }
            return portfolio;
        }
        public IEnumerable<MSI_Debtor> GetDebtors(string accountNumber)
        {
            string thisMethod = string.Format("{0}.{1}", thisClass, System.Reflection.MethodBase.GetCurrentMethod().Name);
            string logMessage = string.Format("{0}|Method incoming parameters accountNumber={1}", thisMethod, accountNumber);
            LogHelper.Info(logMessage);

            MSI_Debtor debtor = null;
            DBFactory db;
            List<MSI_Debtor> debtors = null;
            System.Data.DataSet ds;
            try
            {
                db = new DBFactory();
                ds = db.ExecuteDataset("MSI_spGetDebtors", "Debtors", new SqlParameter("@pimsAccountNumber", accountNumber));

                if (ds.Tables["Debtors"].Rows.Count > 0)
                {
                    debtors = new List<MSI_Debtor>();
                    foreach (System.Data.DataRow dr in ds.Tables["Debtors"].Rows)
                    {
                        debtor = new MSI_Debtor();
                        debtor.Account = dr["ACCOUNT"].ToString();
                        debtor.FirstName = dr["FirstName"].ToString();
                        debtor.LastName = dr["LastName"].ToString();
                        debtor.Address1 = dr["ADDRESS1"].ToString();
                        debtor.Address2 = dr["ADDRESS2"].ToString();
                        debtor.City = dr["CITY"].ToString();
                        debtor.State = dr["STATE"].ToString();
                        debtor.Zip = dr["ZIP_CODE"].ToString();
                        string ssn = dr["SSN"].ToString().Trim();
                        debtor.LastFourSSN = ssn.Substring(7, 4);
                        debtor.MobilePhone = dr["PHONE_CELL"].ToString();
                        debtor.HomePhone = dr["PHONE_HOME"].ToString();
                        debtor.WorkPhone = dr["PHONE_WORK"].ToString();
                        debtor.DOB = dr["DOB"].ToString();
                        debtor.DebtCurrentBalance = dr["DebtCurrentBalance"].ToString();
                        debtor.DebtPurchaseBalance = dr["DebtorPurchaseBalance"].ToString();
                        debtor.CreditorName = dr["CreditorName"].ToString();

                        debtors.Add(debtor);
                    }
                }

            }
            catch (Exception ex)
            {
                ErrorLogHelper.Error(logMessage, ex);
            }
            return debtors.AsEnumerable<MSI_Debtor>();
        }
        public IEnumerable<MSI_Port_SalesTrans_Original> GetPortfolioSalesSummary(string productCode, string userId)
        {
            string thisMethod = string.Format("{0}.{1}", thisClass, System.Reflection.MethodBase.GetCurrentMethod().Name);
            string logMessage = string.Format("{0}|Method incoming parameters productCode={1}, userId={2}", thisMethod, productCode, userId);
            LogHelper.Info(logMessage);

            MSI_Port_SalesTrans_Original salesTransaction = null;
            DBFactory db;
            List<MSI_Port_SalesTrans_Original> salesTransactions = null;
            System.Data.DataSet ds;
            try
            {
                db = new DBFactory();
                ds = db.ExecuteDataset("MSI_sp_GetPortfolioSalesSummary", "PurchaseSalesSummary", new SqlParameter("@productCode", productCode), new SqlParameter("@userId", userId));

                if (ds.Tables["PurchaseSalesSummary"].Rows.Count > 0)
                {
                    salesTransactions = new List<MSI_Port_SalesTrans_Original>();
                    foreach (System.Data.DataRow dr in ds.Tables["PurchaseSalesSummary"].Rows)
                    {
                        salesTransaction = new MSI_Port_SalesTrans_Original();
                        salesTransaction.ID = int.Parse(dr["ID"].ToString());
                        salesTransaction.Portfolio_ = dr["Portfolio#"].ToString();
                        salesTransaction.Buyer = dr["Buyer"].ToString();
                        if (dr["SalesBasis"] != DBNull.Value)
                            salesTransaction.SalesBasis = Convert.ToDouble(dr["SalesBasis"].ToString());
                        if (dr["FaceValue"] != DBNull.Value)
                            salesTransaction.FaceValue = Convert.ToDecimal(dr["FaceValue"].ToString());
                        if (dr["Cut-OffDate"] != DBNull.Value)
                            salesTransaction.Cut_OffDate = DateTime.Parse(dr["Cut-OffDate"].ToString());
                        if (dr["#ofAccts"] != DBNull.Value)
                            salesTransaction.C_ofAccts = Convert.ToDouble(dr["#ofAccts"].ToString());
                        if (dr["SalesPrice"] != DBNull.Value)
                            salesTransaction.SalesPrice = Convert.ToDecimal(dr["SalesPrice"].ToString());
                        DateTime closingDate;
                        if (DateTime.TryParse(dr["ClosingDate"].ToString(), out closingDate))
                            salesTransaction.ClosingDate = closingDate;
                        salesTransaction.Lender = dr["Lender"].ToString();
                        int putbackTermDays;
                        if (int.TryParse(dr["PutbackTerm"].ToString(), out putbackTermDays))
                            salesTransaction.PutbackTerm_days_ = putbackTermDays;
                        DateTime putbackDeadLine;
                        if (DateTime.TryParse(dr["PutbackDeadLine"].ToString(), out putbackDeadLine))
                            salesTransaction.PutbackDeadline = putbackDeadLine;
                        salesTransaction.Notes = dr["Notes"].ToString();
                        DateTime notNullDt;
                        if (DateTime.TryParse(dr["CreatedDate"].ToString(), out notNullDt))
                            salesTransaction.CreatedDate = notNullDt;

                        if (DateTime.TryParse(dr["UpdatedDate"].ToString(), out notNullDt))
                            salesTransaction.UpdatedDate = notNullDt;
                        salesTransaction.CreatedBy = dr["CreatedBy"].ToString();
                        salesTransaction.UpdatedBy = dr["UpdatedBy"].ToString();
                        salesTransactions.Add(salesTransaction);
                    }
                }

            }
            catch (Exception ex)
            {
                ErrorLogHelper.Error(logMessage, ex);
            }
            return salesTransactions.AsEnumerable<MSI_Port_SalesTrans_Original>();
        }
        public MSI_Port_Acq_Original GetPortfolioPurchaseSummary(string productCode)
        {
            string thisMethod = string.Format("{0}.{1}", thisClass, System.Reflection.MethodBase.GetCurrentMethod().Name);
            string logMessage = string.Format("{0}|Method incoming parameters productCode={1}", thisMethod, productCode);
            LogHelper.Info(logMessage);

            MSI_Port_Acq_Original portfolio = null;
            DBFactory db;
            System.Data.DataSet ds;
            System.Data.DataRow dr;
            try
            {
                portfolio = new MSI_Port_Acq_Original();
                db = new DBFactory();
                ds = db.ExecuteDataset("MSI_sp_GetPortfolioPurchaseSummary", "PurchaseSummary", new SqlParameter("@productCode", productCode));

                dr = ds.Tables["PurchaseSummary"].Rows[0];
                portfolio.Portfolio_ = dr["Portfolio#"].ToString();
                portfolio.Company = dr["Company"].ToString();
                portfolio.Seller = dr["Seller"].ToString();
                portfolio.CostBasis = Convert.ToDouble(dr["CostBasis"].ToString());
                portfolio.Face = Convert.ToDecimal(dr["Face"].ToString());
                portfolio.Cut_OffDate = DateTime.Parse(dr["Cut-OffDate"].ToString());
                portfolio.C_ofAccts = Convert.ToDouble(dr["#ofAccts"].ToString());
                portfolio.PurchasePrice = Convert.ToDecimal(dr["PurchasePrice"].ToString());
                DateTime closingDate;
                if (DateTime.TryParse(dr["ClosingDate"].ToString(), out closingDate))
                    portfolio.ClosingDate = closingDate;
                portfolio.Lender_FileDescription = dr["Lender/FileDescription"].ToString();
                int putbackTermDays;
                if (int.TryParse(dr["PutBackTerm"].ToString(), out putbackTermDays))
                    portfolio.PutbackTerm__days_ = putbackTermDays;
                DateTime putbackDeadLine;
                if (DateTime.TryParse(dr["PutbackDeadLine"].ToString(), out putbackDeadLine))
                    portfolio.PutbackDeadline = putbackDeadLine;
                portfolio.Notes = dr["Notes"].ToString();
                int resaleId;
                if (int.TryParse(dr["ResaleRestrictionId"].ToString(), out resaleId))
                    portfolio.ResaleRestrictionId = resaleId;
                portfolio.CreatedBy = dr["CreatedBy"].ToString();
                portfolio.CreatedDate = DateTime.Parse(dr["CreatedDate"].ToString());
                portfolio.UpdatedBy = dr["UpdatedBy"].ToString();
                portfolio.UpdatedDate = DateTime.Parse(dr["UpdatedDate"].ToString());
            }
            catch (Exception ex)
            {
                ErrorLogHelper.Error(logMessage, ex);
            }
            return portfolio;
        }
        public IEnumerable<MSI_Port_InvestmentsTrans> GetPortfolioInvestmentsSummary(string productCode, string userId, bool isOriginal)
        {
            string thisMethod = string.Format("{0}.{1}", thisClass, System.Reflection.MethodBase.GetCurrentMethod().Name);
            string logMessage = string.Format("{0}|Method incoming parameters productCode={1}, userId={2}", thisMethod, productCode, userId);
            LogHelper.Info(logMessage);

            MSI_Port_InvestmentsTrans investmentTransaction = null;
            DBFactory db;
            List<MSI_Port_InvestmentsTrans> investmentTransactions = null;
            System.Data.DataSet ds;
            try
            {
                db = new DBFactory();
                ds = db.ExecuteDataset("MSI_sp_GetPortfolioInvestmentsSummary", "PurchaseInvestmentsSummary", new SqlParameter("@productCode", productCode), new SqlParameter("@userId", userId), new SqlParameter("@isOriginal", isOriginal));

                if (ds.Tables["PurchaseInvestmentsSummary"].Rows.Count > 0)
                {
                    investmentTransactions = new List<MSI_Port_InvestmentsTrans>();
                    foreach (System.Data.DataRow dr in ds.Tables["PurchaseInvestmentsSummary"].Rows)
                    {
                        investmentTransaction = new MSI_Port_InvestmentsTrans();
                        investmentTransaction.ID = int.Parse(dr["ID"].ToString());
                        investmentTransaction.Portfolio_ = dr["Portfolio#"].ToString();
                        if (dr["ProfitShare_before"] != DBNull.Value)
                            investmentTransaction.ProfitShare_before = Convert.ToDouble(dr["ProfitShare_before"].ToString());
                        if (dr["ProfitShare_after"] != DBNull.Value)
                            investmentTransaction.ProfitShare_after = Convert.ToDouble(dr["ProfitShare_after"].ToString());
                        if (dr["SalesPrice"] != DBNull.Value)
                            investmentTransaction.SalesPrice = Convert.ToDecimal(dr["SalesPrice"].ToString());
                        if (dr["Notes"] != DBNull.Value)
                            investmentTransaction.Notes = dr["Notes"].ToString();
                        if (dr["Interest"] != DBNull.Value)
                            investmentTransaction.Interest = Convert.ToDouble( dr["Interest"].ToString());
                        investmentTransaction.Inv_AgencyName = dr["Inv_AgencyName"].ToString();
                        DateTime notNullDt;
                        if (DateTime.TryParse(dr["CreatedDate"].ToString(), out notNullDt))
                            investmentTransaction.CreatedDate = notNullDt;
                        if (DateTime.TryParse(dr["UpdatedDate"].ToString(), out notNullDt))
                            investmentTransaction.UpdatedDate = notNullDt;
                        investmentTransaction.CreatedBy = dr["CreatedBy"].ToString();
                        investmentTransaction.UpdatedBy = dr["UpdatedBy"].ToString();
                        investmentTransaction.TransType = dr["TransType"].ToString();
                        investmentTransactions.Add(investmentTransaction);
                    }
                }

            }
            catch (Exception ex)
            {
                ErrorLogHelper.Error(logMessage, ex);
            }
            return investmentTransactions.AsEnumerable<MSI_Port_InvestmentsTrans>();
        }