/// <summary>
        /// CreatedBy : Nadeeka
        /// CreatedDate: 2016/02/09
        /// 
        /// retreive Curtailment Detail By CurtailmentId
        /// 
        /// argument : curtailment_id (int)
        /// 
        /// </summary>
        /// <returns>curtailment list</returns>
        public List<Curtailment> retreiveCurtailmentByLoanId(int loanId)
        {
            try
            {
                List<Curtailment> lstCurtailment = new List<Curtailment>();
                DataHandler dataHandler = new DataHandler();
                List<object[]> paramertList = new List<object[]>();
                paramertList.Add(new object[] { "@loan_id", loanId });

                DataSet dataSet = dataHandler.GetDataSet("spRetrieveCurtailmentByLoanId", paramertList);
                if (dataSet != null && dataSet.Tables.Count != 0)
                {
                    foreach (DataRow dataRow in dataSet.Tables[0].Rows)
                    {
                        Curtailment curtailment = new Curtailment();
                        curtailment.CurtailmentId = int.Parse(dataRow["curtailment_id"].ToString());
                        curtailment.LoanId = int.Parse(dataRow["loan_id"].ToString());
                        curtailment.TimePeriod = Convert.ToInt32(dataRow["time_period"]);
                        curtailment.Percentage = Convert.ToInt32(dataRow["percentage"].ToString());
                        lstCurtailment.Add(curtailment);
                    }
                    return lstCurtailment;
                }
                else
                {
                    return null;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        /// <summary>
        /// CreatedBy : Nadeeka
        /// CreatedDate: 2016/03/15
        /// 
        /// Get loan curtailment schedule by loan id
        /// 
        /// </summary>
        /// <param name="loanId">loan id</param>
        /// <returns>curtialment breakdown as a DataSet</returns>
        public LoanSetupStep1 GetLoanCurtailmentBreakdown(int loanId)
        {
            DataHandler dataHandler = new DataHandler();
            List<object[]> paramertList = new List<object[]>();
            paramertList.Add(new object[] { "@loan_id", loanId });

            DataSet dataSet = dataHandler.GetDataSet("spGetLoanCurtailmentBreakdown", paramertList);
            if (dataSet != null && dataSet.Tables.Count != 0)
            {
                LoanSetupStep1 loan = new LoanSetupStep1();
                loan.curtailmetList = new List<Curtailment>();
                loan.payOffPeriodType = dataSet.Tables[0].Rows[0]["pay_off_type"].ToString().Equals("d") ? 0 : 1;
                //loan.payOffPeriod = Convert.ToInt32(dataSet.Tables[0].Rows[0]["pay_off_period"].ToString());
                loan.CurtailmentCalculationBase = dataSet.Tables[0].Rows[0]["curtailment_calculation_type"].ToString();
                loan.advancePercentage = Convert.ToInt32(dataSet.Tables[0].Rows[0]["advance"].ToString());
                foreach (DataRow dataRow in dataSet.Tables[0].Rows)
                {
                    Curtailment curtailment = new Curtailment();
                    curtailment.CurtailmentId = Convert.ToInt32(dataRow["curtailment_id"].ToString());
                    curtailment.TimePeriod = Convert.ToInt32(dataRow["time_period"].ToString());
                    curtailment.Percentage = Convert.ToInt32(dataRow["percentage"].ToString());
                    loan.curtailmetList.Add(curtailment);
                }

                return loan;
            }
            else
            {
                return null;
            }
        }