예제 #1
0
        /// <summary>
        /// Fill method for populating a collection by PurposeType
        /// </summary>
        public void FillByPurposeType(LoanPurposes loanPurposes, System.Int16 id)
        {
            // create the connection to use
            SqlConnection cnn = new SqlConnection(LoanPurpose.GetConnectionString());


            try
            {
                // discover the sql parameters
                SqlParameterHash sqlparams = SqlHelperParameterCache.GetSpParameterSet(LoanPurpose.GetConnectionString(), "gsp_SelectLoanPurposesByPurposeType");


                using (cnn)
                {
                    // open the connection
                    cnn.Open();


                    // set the parameters
                    sqlparams["@type"].Value = id;


                    // create an instance of the reader to fill.
                    SqlDataReader datareader = SqlHelper.ExecuteReader(cnn, "gsp_SelectLoanPurposesByPurposeType", sqlparams);


                    // Send the collection and data to the object factory.
                    CreateObjectsFromData(loanPurposes, datareader);


                    // close the connection
                    cnn.Close();
                }


                // nullify the connection
                cnn = null;
            }
            catch (SqlException sqlex)
            {
                throw sqlex;
            }
        }
예제 #2
0
 /// <summary>
 /// Persists the object.
 /// </summary>
 public virtual void Persist(LoanPurpose persistObject)
 {
     // Make a call to the overloaded method with a null transaction
     Persist(persistObject, null);
 }
예제 #3
0
 public string GetLoanPurposeStatus(LoanPurpose purpose)
 {
     return(FindElement(purpose == LoanPurpose.HomeToLiveIn ? _buttonHomeBorrower : _buttonInvestmentBorrower)
            .GetAttribute("checked"));
 }
예제 #4
0
        /// <summary>
        /// Fills a single instance with data based on its primary key values.
        /// </summary>
        public virtual void Fill(LoanPurpose loanpurpose, System.Int64 loanApplicationId)
        {
            // create the connection to use
            SqlConnection cnn = new SqlConnection(LoanPurpose.GetConnectionString());

            try
            {
                // discover the sql parameters
                SqlParameterHash sqlparams = SqlHelperParameterCache.GetSpParameterSet(LoanPurpose.GetConnectionString(), "gsp_SelectLoanPurpose");


                using (cnn)
                {
                    // open the connection
                    cnn.Open();


                    // set the parameters
                    sqlparams["@loanApplicationId"].Value = loanApplicationId;


                    // create an instance of the reader to fill.
                    SqlDataReader datareader = SqlHelper.ExecuteReader(cnn, "gsp_SelectLoanPurpose", sqlparams);


                    if (datareader.Read())
                    {
                        loanpurpose.SetMembers(ref datareader);
                    }


                    cnn.Close();                     // close the connection
                }


                // nullify the connection var
                cnn = null;
            }
            catch (SqlException sqlex)
            {
                throw sqlex;
            }
        }
예제 #5
0
 private static decimal GetVAFundingFee(decimal _loanAmount, LoanPurpose LoanPurpose, VeteranType VeteranType, int p, bool IsVAFirstTime, out decimal VAFundingFee, out decimal VAFundingPercent)
 {
     VAFundingFee = 0m;
     VAFundingPercent = 0m;
     return 0m;
 }
예제 #6
0
        public static decimal GetPrepaids(
            LoanPurpose LoanPurpose, 
            decimal PurchasePrice,
            decimal EstimatedHomeValue,
            decimal LoanAmount,  
            decimal InterestRate, 
            bool waiveEscrows)
        {
            var value = 0m;

            if (LoanPurpose == FullerHelpers.LoanPurpose.Purchase)
            {
                if (waiveEscrows == false)
                {
                    value += GetMonthlyInsurance(LoanPurpose, PurchasePrice, EstimatedHomeValue) * 3;
                    value += GetMonthlyTaxes(LoanPurpose, PurchasePrice, EstimatedHomeValue) * 3;
                }

                //Refi only needs 3 months insurance
                var Insurance = GetMonthlyInsurance(LoanPurpose, PurchasePrice, EstimatedHomeValue) * 12;
                var Interest = Get1DayOfInterest(LoanAmount, InterestRate) * 15;

                value += Insurance + Interest;
            }
            else
            {
                value += Get1DayOfInterest(LoanAmount, InterestRate);

                if (waiveEscrows == false)
                {
                    value += GetMonthlyInsurance(LoanPurpose, PurchasePrice, EstimatedHomeValue) * 3;
                    value += GetMonthlyTaxes(LoanPurpose, PurchasePrice, EstimatedHomeValue) * 3;
                }
            }
            return value;
        }
예제 #7
0
 public static decimal GetMonthlyTaxes(LoanPurpose LoanPurpose, decimal PurchasePrice, decimal EstimatedHomeValue)
 {
     var value = 0m;
     if (LoanPurpose == FullerHelpers.LoanPurpose.Purchase)
     {
         value = PurchasePrice;
     }
     else if(LoanPurpose == FullerHelpers.LoanPurpose.Refinance)
     {
         value = EstimatedHomeValue;
     }
     var taxes = ((value * .025m) / 12m);
     taxes = Math.Round(taxes * 100m) / 100m;
     return taxes;
 }
예제 #8
0
        public static decimal GetClosingCosts(
            decimal LoanAmount, 
            LoanPurpose LoanPurpose, 
            LoanType LoanType, 
            bool AddSurvey, 
            bool GetHOATransfer,
            bool? IsVAFirstTime,
            VeteranType? VeteranType, 
            decimal? PurchasePrice,
            DateTime? OriginalCloseDate,
            decimal? EstimatedLoanPayoff,
            out decimal VAFundingPercent,
            out decimal VAFundingFee
            )
        {
            VAFundingFee = 0;
            VAFundingPercent = 0;
            var ClosingCosts = 0m;

            decimal
                SellerContributions = 0m,
                NonAllowableContributions = 1990m;

            bool IsCashOutRefi = false,
                T17 = true,
                T19 = true,
                T36 = true,
                R19 = true,
                R24 = true,
                T33 = true,
                T42 = true,
                T421 = true;

            if (AddSurvey == true)
            {
                var surveyCost = 200;
                ClosingCosts += surveyCost;
            }

            if (GetHOATransfer == true)
            {
                var HoaTransferFee = 100;
                ClosingCosts += HoaTransferFee;
            }

            if (LoanPurpose == FullerHelpers.LoanPurpose.Purchase)
            {
                ClosingCosts = 2465m;
                if (LoanType == FullerHelpers.LoanType.VA)
                {
                    SellerContributions = 1990;
                    VAFundingFee = GetVAFundingFee(LoanAmount, LoanPurpose, VeteranType.Value, 0, IsVAFirstTime.Value, out VAFundingFee, out VAFundingPercent);
                    ClosingCosts += VAFundingFee;
                }

                if (LoanAmount == 0 || PurchasePrice == 0)
                {
                    throw new Exception("Cannot be Zero");
                }
                else
                {

                }
            }
            else if(LoanPurpose == FullerHelpers.LoanPurpose.Refinance)
            {
                ClosingCosts += 2557.42m;
                if (LoanType == FullerHelpers.LoanType.VA)
                {
                    SellerContributions = 1990;
                    VAFundingFee = GetVAFundingFee(LoanAmount, LoanPurpose, VeteranType.Value, 0, IsVAFirstTime.Value, out VAFundingFee, out VAFundingPercent);
                    ClosingCosts += VAFundingFee;
                }

                if (LoanAmount == 0 || EstimatedLoanPayoff == 0 || OriginalCloseDate == null)
                {
                    throw new Exception("");
                }
            }
            return ClosingCosts;
        }
예제 #9
0
 public static decimal GetMonthlyInsurance(LoanPurpose LoanPurpose, decimal PurchasePrice, decimal EstimatedHomeValue)
 {
     var value = 0m;
     if (LoanPurpose == FullerHelpers.LoanPurpose.Purchase)
     {
         value = PurchasePrice;
     }
     else if(LoanPurpose == FullerHelpers.LoanPurpose.Refinance)
     {
         value = EstimatedHomeValue;
     }
     var insurance = (value * .00875m) / 12m;
     insurance = Math.Round(insurance * 100m) / 100m;
     return insurance;
 }