private LoanForGoal GetLoansForGoalInfo(int goalId) { DataTable dtLoanForGoal = DataBase.DBService.ExecuteCommand(string.Format(SELECT_LOANGFORGOAL_BYID, goalId)); if (dtLoanForGoal != null && dtLoanForGoal.Rows.Count > 0) { LoanForGoal loanForGoal = convertToLoanForGoalsObject(dtLoanForGoal.Rows[0]); return(loanForGoal); } return(null); }
private LoanForGoal convertToLoanForGoalsObject(DataRow dr) { LoanForGoal loanForGoal = new LoanForGoal(); loanForGoal.Id = dr.Field <int>("ID"); loanForGoal.GoalId = dr.Field <int>("GoalID"); loanForGoal.LoanAmount = double.Parse(dr["LoanAmount"].ToString()); loanForGoal.EMI = double.Parse(dr["EMI"].ToString()); loanForGoal.ROI = decimal.Parse(dr["ROI"].ToString()); loanForGoal.LoanYears = dr.Field <int>("LoanYears"); loanForGoal.StratYear = dr.Field <int>("StartYear"); loanForGoal.EndYear = dr.Field <int>("EndYear"); loanForGoal.LoanPortion = (dr["LoanPortion"] == DBNull.Value) ? 0 : decimal.Parse(dr["LoanPortion"].ToString()); return(loanForGoal); }