private InterestMasterDto ReadLoanInterestFormData(FormCollection form)
        {
            InterestMasterDto interestMasterDto = new InterestMasterDto();
            int interestId = default(int);

            int.TryParse(form["InterestID"], out interestId);

            int?penalAhId = null;

            //int.TryParse(form["PenalAHID"], out penalAhId);


            interestMasterDto.InterestID         = interestId;
            interestMasterDto.InterestCode       = Convert.ToString(form["InterestCode"]);
            interestMasterDto.InterestName       = Convert.ToString(form["InterestName"]);
            interestMasterDto.Base               = Convert.ToInt32(form["Base"]);
            interestMasterDto.CaluculationMethod = Convert.ToInt32(form["CaluculationMethod"]);
            if (form["PrincipalAHID"] != "")
            {
                interestMasterDto.PrincipalAHID = Convert.ToInt32(form["PrincipalAHID"]);
            }
            interestMasterDto.InterestAHID = Convert.ToInt32(form["InterestAHID"]);

            interestMasterDto.PenalAHID = penalAhId;

            interestMasterDto.UserId = UserInfo.UserID;

            int maxIndex = Convert.ToInt32(form["hdnMaxRateIndex"]);

            interestMasterDto.InterestRates = new List <InterestRatesDto>();
            InterestRatesDto rate = null;

            for (int i = 1; i <= maxIndex; i++)
            {
                if (form["hdnROI_" + i] == null)
                {
                    continue;
                }

                DateTime dtFromDate = form["hdnFDate_" + i].ConvertToDateTime();
                DateTime dtToDate   = form["hdnToDate_" + i].ConvertToDateTime();

                rate               = new InterestRatesDto();
                rate.ROI           = Convert.ToDecimal(form["hdnROI_" + i]);
                rate.PenalROI      = Convert.ToDecimal(form["hdnPROI_" + i]);
                rate.FromDate      = dtFromDate;
                rate.ToDate        = dtToDate;
                rate.IntrestRateID = Convert.ToInt32(form["hdnRateId_" + i]);

                interestMasterDto.InterestRates.Add(rate);
            }

            return(interestMasterDto);
        }
Beispiel #2
0
        public InterestMasterDto GetIntrestRateByIntrestId(int Id)
        {
            InterestMasterDto objIntrestMasterDto = null;
            AdoHelper         obj = new AdoHelper();

            SqlParameter[] parms = new SqlParameter[1];

            parms[0]           = new SqlParameter("@InterestID", Id);
            parms[0].SqlDbType = System.Data.SqlDbType.Int;

            SqlDataReader Dr = obj.ExecDataReaderProc("uspInterestByID", parms);

            if (Dr.Read())
            {
                objIntrestMasterDto = new InterestMasterDto();
                if (!string.IsNullOrEmpty(Convert.ToString(Dr["PenalAHID"])))
                {
                    objIntrestMasterDto.PenalAHID = Convert.ToInt32(Dr["PenalAHID"]);
                }
                objIntrestMasterDto.InterestAHID       = Convert.ToInt32(Dr["InterestAHID"]);
                objIntrestMasterDto.InterestCode       = Convert.ToString(Dr["InterestCode"]);
                objIntrestMasterDto.InterestName       = Convert.ToString(Dr["InterestName"]);
                objIntrestMasterDto.InterestID         = Convert.ToInt32(Dr["InterestID"]);
                objIntrestMasterDto.PrincipalAHID      = Convert.ToInt32(Dr["PrincipalAHID"]);
                objIntrestMasterDto.AHName             = Convert.ToString(Dr["AHName"]);
                objIntrestMasterDto.InterestAHName     = Convert.ToString(Dr["INTERESTAHNAME"]);
                objIntrestMasterDto.CaluculationMethod = Convert.ToInt32(Dr["CaluculationMethod"]);
                objIntrestMasterDto.Base = Convert.ToInt32(Dr["Base"]);
            }
            List <InterestRatesDto> lstrates = new List <InterestRatesDto>();
            InterestRatesDto        rateDto  = null;

            if (Dr.NextResult())
            {
                while (Dr.Read())
                {
                    rateDto = new InterestRatesDto();
                    rateDto.IntrestRateID = Convert.ToInt32(Dr["IntrestRateID"]);
                    rateDto.ROI           = Convert.ToInt32(Dr["ROI"]);
                    rateDto.PenalROI      = Convert.ToInt32(Dr["PenalROI"]);
                    rateDto.FromDate      = Convert.ToDateTime(Dr["FromDate"]);
                    if (Dr["ToDate"] != DBNull.Value)
                    {
                        rateDto.ToDate = Convert.ToDateTime(Dr["ToDate"]);
                    }
                    lstrates.Add(rateDto);
                }
                objIntrestMasterDto.InterestRates = lstrates;
            }
            return(objIntrestMasterDto);
        }
Beispiel #3
0
        public InterestMasterDto GetInterestDetailsDto(int id)
        {
            //InterestMasterDto interestDto = _interestService.GetByID(id);
            InterestMasterDto interestDto     = _loanDisbursementDataAccess.GetIntrestRateByIntrestId(id);
            InterestRatesDto  interestRateDto = interestDto.InterestRates.Find(l => l.FromDate < DateTime.Now && (DateTime.Now < l.ToDate || l.ToDate == DateTime.MinValue));

            if (interestRateDto != null && interestRateDto.ROI > 0)
            {
                interestDto.InterestRate = interestRateDto.ROI;
            }
            if (interestRateDto != null && interestRateDto.PenalROI > 0)
            {
                interestDto.PenalROI = interestRateDto.PenalROI;
            }
            if (interestRateDto != null && interestRateDto.IntrestRateID > 0)
            {
                interestDto.InterestRateID = interestRateDto.IntrestRateID;
            }
            return(interestDto);
        }
Beispiel #4
0
        public InterestMasterDto GetGroupInterestByID(int id)
        {
            InterestMasterDto interestMasterDto = new InterestMasterDto();
            AdoHelper         obj = new AdoHelper();

            SqlParameter[] parms = new SqlParameter[1];

            parms[0]           = new SqlParameter("@InterestID", id);
            parms[0].SqlDbType = System.Data.SqlDbType.Int;

            SqlDataReader Dr = obj.ExecDataReaderProc("uspGroupInterestByID", parms);

            if (Dr.Read())
            {
                interestMasterDto.PrincipalAHCode    = DBNull.Value == Dr["AHCode"] ? string.Empty : Dr["AHCode"].ToString();
                interestMasterDto.PrincipalAHName    = DBNull.Value == Dr["AHName"] ? string.Empty : Dr["AHName"].ToString();
                interestMasterDto.PrincipalAHID      = DBNull.Value == Dr["InterestAHID"] ? 0 : Convert.ToInt32(Dr["PrincipalAHID"]);
                interestMasterDto.InterestAHID       = DBNull.Value == Dr["InterestAHID"] ? 0 : Convert.ToInt32(Dr["InterestAHID"]);
                interestMasterDto.InterestID         = DBNull.Value == Dr["InterestID"] ? 0 : Convert.ToInt32(Dr["InterestID"]);
                interestMasterDto.Base               = Dr["Base"] == DBNull.Value ? 0 : Convert.ToInt32(Dr["Base"]);
                interestMasterDto.CaluculationMethod = Dr["CaluculationMethod"] == DBNull.Value ? 0 : Convert.ToInt32(Dr["CaluculationMethod"]);
                interestMasterDto.InterestRates      = new List <InterestRatesDto>();
            }
            Dr.NextResult();
            while (Dr.Read())
            {
                InterestRatesDto rate = new InterestRatesDto();
                rate.FromDate      = Dr["FromDate"] == DBNull.Value ? DateTime.MinValue : Convert.ToDateTime(Dr["FromDate"]);
                rate.ToDate        = Dr["ToDate"] == DBNull.Value ? DateTime.MinValue : Convert.ToDateTime(Dr["ToDate"]);
                rate.ROI           = Dr["ROI"] == DBNull.Value ? 0 : Convert.ToInt32(Dr["ROI"]);
                rate.PenalROI      = Dr["PenalROI"] == DBNull.Value ? 0 : Convert.ToDecimal(Dr["PenalROI"]);
                rate.IntrestRateID = Dr["InterestRateID"] == DBNull.Value ? 0 : Convert.ToInt32(Dr["InterestRateID"]);
                interestMasterDto.InterestRates.Add(rate);
            }
            return(interestMasterDto);
        }