Пример #1
0
        public LoanOBByLoanDto InsertLoanOB(LoanOBByLoanDto loanOBDto)
        {
            LoanOBByLoanDto result = loanOBDto;

            try
            {
                AdoHelper obj = new AdoHelper();

                SqlParameter[] parms = new SqlParameter[21];
                if (loanOBDto.LoanMasrterID > 0)
                {
                    parms               = new SqlParameter[23];
                    parms[21]           = new SqlParameter("@LoanMasterID", loanOBDto.LoanMasrterID);
                    parms[21].SqlDbType = SqlDbType.Int;
                    parms[22]           = new SqlParameter("@SLAccountNumberAHID", loanOBDto.SLAccountNumberAHID);
                    parms[22].SqlDbType = SqlDbType.Int;
                }
                parms[0]           = new SqlParameter("@LoanType", loanOBDto.LoanType);
                parms[0].SqlDbType = SqlDbType.Char;

                parms[1]           = new SqlParameter("@MemberID", loanOBDto.MemberId);
                parms[1].SqlDbType = SqlDbType.Int;

                parms[2]           = new SqlParameter("@GroupID", loanOBDto.GroupId);
                parms[2].SqlDbType = SqlDbType.Int;

                parms[3]           = new SqlParameter("@LoanApplicationDate", loanOBDto.LoanDisbursedDate);
                parms[3].SqlDbType = SqlDbType.Date;

                parms[4]           = new SqlParameter("@LoanPurpose", loanOBDto.Purpose);
                parms[4].SqlDbType = SqlDbType.Int;

                parms[5]           = new SqlParameter("@LoanAmountApplied", loanOBDto.LoanAmountGiven);
                parms[5].SqlDbType = SqlDbType.Decimal;


                parms[6]           = new SqlParameter("@DisbursedAmount", loanOBDto.LoanAmountGiven);
                parms[6].SqlDbType = SqlDbType.Decimal;

                parms[7]           = new SqlParameter("@NoOfInstallments", loanOBDto.Period);
                parms[7].SqlDbType = SqlDbType.Int;

                parms[8]           = new SqlParameter("@DisbursementDate", loanOBDto.LoanDisbursedDate);
                parms[8].SqlDbType = SqlDbType.Date;

                parms[9]           = new SqlParameter("@SLAccountNumber", loanOBDto.SLAccountNumber);
                parms[9].SqlDbType = SqlDbType.VarChar;

                parms[10]           = new SqlParameter("@GroupInterstRateID", loanOBDto.Interest);
                parms[10].SqlDbType = SqlDbType.Int;

                parms[11]           = new SqlParameter("@InterestRateID", loanOBDto.Interest);
                parms[11].SqlDbType = SqlDbType.Int;

                parms[12]           = new SqlParameter("@InstallmentStartFrom", loanOBDto.FinalInstallmentDate);
                parms[12].SqlDbType = SqlDbType.Date;


                parms[13]           = new SqlParameter("@MonthlyPrincipalDemand", loanOBDto.MonthlyDemand);
                parms[13].SqlDbType = SqlDbType.Decimal;

                parms[14]           = new SqlParameter("@FundSourceID", loanOBDto.Fundsource);
                parms[14].SqlDbType = SqlDbType.Int;

                parms[15]           = new SqlParameter("@ProjectID", loanOBDto.Project);
                parms[15].SqlDbType = SqlDbType.Int;

                parms[16]           = new SqlParameter("@UserID", loanOBDto.UserID);
                parms[16].SqlDbType = SqlDbType.Int;

                parms[17]           = new SqlParameter("@OutStandingAmount", loanOBDto.PrincipalOutstanding);
                parms[17].SqlDbType = SqlDbType.Decimal;

                parms[18]           = new SqlParameter("@InterestMasterID", loanOBDto.Interest);
                parms[18].SqlDbType = SqlDbType.Int;

                parms[19]           = new SqlParameter("@LastPaidDate", loanOBDto.LastPaidDate);
                parms[19].SqlDbType = SqlDbType.Date;

                parms[20]           = new SqlParameter("@PrincipalOD", loanOBDto.PrincipalOD);
                parms[20].SqlDbType = SqlDbType.Int;

                SqlDataReader sdr = obj.ExecDataReaderProc("uspLoanDisbursementInsertOldLoans", parms);
                while (sdr.Read())
                {
                    result.LoanMasrterID       = Convert.ToInt32(sdr["LoanMasterID"]);
                    result.SLAccountNumberAHID = Convert.ToInt32(sdr["SLAccountNumberAHID"]);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }
Пример #2
0
        public LoanOBDto GetByID(int loanMasterid, char loanType)
        {
            LoanOBDto       objLoanOBDto = new LoanOBDto();
            LoanOBByLoanDto objLoanOB    = new LoanOBByLoanDto();

            try
            {
                AdoHelper obj = new AdoHelper();

                SqlParameter[] parms = new SqlParameter[2];
                parms[0]           = new SqlParameter("@LoanMasterID", loanMasterid);
                parms[0].SqlDbType = SqlDbType.Int;
                parms[1]           = new SqlParameter("@Type", loanType);
                parms[1].SqlDbType = SqlDbType.Char;

                SqlDataReader sdr   = obj.ExecDataReaderProc("uspLoanMasterGetByLoanmasterID", parms);
                int           count = 1;
                while (sdr.Read())
                {
                    if (count == 1)
                    {
                        objLoanOBDto.LoanMasrterID1        = Convert.ToInt32(sdr["LoanMasterID"]);
                        objLoanOBDto.AHCode1               = Convert.ToString(sdr["AHCode"]);
                        objLoanOBDto.AHName1               = Convert.ToString(sdr["AHName"]);
                        objLoanOBDto.GroupId               = Convert.ToInt32(sdr["GroupID"]);
                        objLoanOBDto.VillageID             = Convert.ToInt32(sdr["VillageID"]);
                        objLoanOBDto.ClusterID             = Convert.ToInt32(sdr["ClusterID"]);
                        objLoanOBDto.LoanDisbursedDate1    = Convert.ToString(sdr["LoanApplicationDate"]);
                        objLoanOBDto.Purpose1              = Convert.ToInt32(sdr["LoanPurposeID"]);
                        objLoanOBDto.LoanAmountGiven1      = Convert.ToDecimal(sdr["DisbursedAmount"]);
                        objLoanOBDto.Period1               = Convert.ToInt32(sdr["NoofInstallmentsProposed"]);
                        objLoanOBDto.Period1               = Convert.ToInt32(sdr["NoOfInstallments"]);
                        objLoanOBDto.SLAccountNumberAHID1  = Convert.ToInt32(sdr["SLAccountNumber"]);
                        objLoanOBDto.SLAccountNumber1      = Convert.ToString(sdr["SlAccountName"]);
                        objLoanOBDto.Interest1             = Convert.ToInt32(sdr["InterestRateID"]);
                        objLoanOBDto.FinalInstallmentDate1 = Convert.ToString(sdr["InstallmentStartFrom"]);
                        objLoanOBDto.MonthlyDemand1        = Convert.ToDecimal(sdr["MonthlyPrincipalDemand"]);
                        objLoanOBDto.Fundsource1           = Convert.ToInt32(sdr["FundSourceID"]);
                        objLoanOBDto.Project1              = Convert.ToInt32(sdr["ProjectID"]);
                        objLoanOBDto.PrincipalOutstanding1 = Convert.ToDecimal(sdr["OutStandingAmount"]);
                        objLoanOBDto.Interest1             = Convert.ToInt32(sdr["InterestMasterID"]);
                        objLoanOBDto.ROI1          = Convert.ToInt32(sdr["ROI"]);
                        objLoanOBDto.LastPaidDate1 = Convert.ToString(sdr["LastPaidDate"]);
                        objLoanOBDto.DueDay        = Convert.ToInt32(sdr["MeetingDay"]);
                        if (sdr["InterestDue"] != DBNull.Value)
                        {
                            objLoanOBDto.InterestDue1 = Convert.ToDecimal(sdr["InterestDue"]);
                        }
                        if (sdr["MemberID"] != DBNull.Value)
                        {
                            objLoanOBDto.MemberID = Convert.ToInt32(sdr["MemberID"]);
                        }
                        if (sdr["PrincipalDue"] != DBNull.Value)
                        {
                            objLoanOBDto.PrincipalOD1 = Convert.ToDecimal(sdr["PrincipalDue"]);
                        }
                    }
                    else if (count == 2)
                    {
                        objLoanOBDto.LoanMasrterID2        = Convert.ToInt32(sdr["LoanMasterID"]);
                        objLoanOBDto.AHCode2               = Convert.ToString(sdr["AHCode"]);
                        objLoanOBDto.AHName2               = Convert.ToString(sdr["AHName"]);
                        objLoanOBDto.GroupId               = Convert.ToInt32(sdr["GroupID"]);
                        objLoanOBDto.LoanDisbursedDate2    = Convert.ToString(sdr["LoanApplicationDate"]);
                        objLoanOBDto.Purpose2              = Convert.ToInt32(sdr["LoanPurposeID"]);
                        objLoanOBDto.LoanAmountGiven2      = Convert.ToDecimal(sdr["LoanAmountApplied"]);
                        objLoanOBDto.Period2               = Convert.ToInt32(sdr["NoofInstallmentsProposed"]);
                        objLoanOBDto.LoanAmountGiven2      = DBNull.Value == sdr["DisbursedAmount"] ? 0 : Convert.ToDecimal(sdr["DisbursedAmount"]);
                        objLoanOBDto.Period2               = sdr["NoOfInstallments"] == DBNull.Value ? 0 : Convert.ToInt32(sdr["NoOfInstallments"]);
                        objLoanOBDto.SLAccountNumberAHID2  = sdr["SLAccountNumber"] == DBNull.Value ? 0 : Convert.ToInt32(sdr["SLAccountNumber"]);
                        objLoanOBDto.SLAccountNumber2      = sdr["SlAccountName"] == DBNull.Value ? string.Empty : Convert.ToString(sdr["SlAccountName"]);
                        objLoanOBDto.Interest2             = Convert.ToInt32(sdr["InterestRateID"]);
                        objLoanOBDto.FinalInstallmentDate2 = Convert.ToString(sdr["InstallmentStartFrom"]);
                        objLoanOBDto.MonthlyDemand2        = Convert.ToDecimal(sdr["MonthlyPrincipalDemand"]);
                        objLoanOBDto.Fundsource2           = Convert.ToInt32(sdr["FundSourceID"]);
                        objLoanOBDto.Project2              = Convert.ToInt32(sdr["ProjectID"]);
                        objLoanOBDto.PrincipalOutstanding2 = Convert.ToDecimal(sdr["OutStandingAmount"]);
                        objLoanOBDto.Interest2             = Convert.ToInt32(sdr["InterestMasterID"]);
                        objLoanOBDto.DueDay        = Convert.ToInt32(sdr["MeetingDay"]);
                        objLoanOBDto.LastPaidDate2 = Convert.ToString(sdr["LastPaidDate"]);
                        objLoanOBDto.ROI2          = Convert.ToInt32(sdr["ROI"]);
                        if (sdr["InterestDue"] != DBNull.Value)
                        {
                            objLoanOBDto.InterestDue2 = Convert.ToDecimal(sdr["InterestDue"]);
                        }
                        if (sdr["MemberID"] != DBNull.Value)
                        {
                            objLoanOBDto.MemberID = Convert.ToInt32(sdr["MemberID"]);
                        }
                        if (sdr["PrincipalDue"] != DBNull.Value)
                        {
                            objLoanOBDto.PrincipalOD2 = Convert.ToDecimal(sdr["PrincipalDue"]);
                        }
                    }
                    else if (count == 3)
                    {
                        objLoanOBDto.LoanMasrterID3 = Convert.ToInt32(sdr["LoanMasterID"]);
                        // objLoanOBDto.MemberId = Convert.ToInt32(sdr["MemberID"]);
                        objLoanOBDto.GroupId               = Convert.ToInt32(sdr["GroupID"]);
                        objLoanOBDto.AHCode3               = Convert.ToString(sdr["AHCode"]);
                        objLoanOBDto.AHName3               = Convert.ToString(sdr["AHName"]);
                        objLoanOBDto.LoanDisbursedDate3    = Convert.ToString(sdr["LoanApplicationDate"]);
                        objLoanOBDto.Purpose3              = Convert.ToInt32(sdr["LoanPurposeID"]);
                        objLoanOBDto.LoanAmountGiven3      = Convert.ToDecimal(sdr["LoanAmountApplied"]);
                        objLoanOBDto.Period3               = Convert.ToInt32(sdr["NoofInstallmentsProposed"]);
                        objLoanOBDto.LoanAmountGiven3      = Convert.ToDecimal(sdr["DisbursedAmount"]);
                        objLoanOBDto.Period3               = Convert.ToInt32(sdr["NoOfInstallments"]);
                        objLoanOBDto.SLAccountNumberAHID3  = Convert.ToInt32(sdr["SLAccountNumber"]);
                        objLoanOBDto.SLAccountNumber3      = Convert.ToString(sdr["SlAccountName"]); objLoanOBDto.SLAccountNumber3 = Convert.ToString(sdr["SlAccountName"]);
                        objLoanOBDto.Interest3             = Convert.ToInt32(sdr["InterestRateID"]);
                        objLoanOBDto.FinalInstallmentDate3 = Convert.ToString(sdr["InstallmentStartFrom"]);
                        objLoanOBDto.MonthlyDemand3        = Convert.ToDecimal(sdr["MonthlyPrincipalDemand"]);
                        objLoanOBDto.Fundsource3           = Convert.ToInt32(sdr["FundSourceID"]);
                        objLoanOBDto.Project3              = Convert.ToInt32(sdr["ProjectID"]);
                        objLoanOBDto.PrincipalOutstanding3 = Convert.ToDecimal(sdr["OutStandingAmount"]);
                        objLoanOBDto.Interest3             = Convert.ToInt32(sdr["InterestMasterID"]);
                        objLoanOBDto.ROI3          = Convert.ToInt32(sdr["ROI"]);
                        objLoanOBDto.DueDay        = Convert.ToInt32(sdr["MeetingDay"]);
                        objLoanOBDto.LastPaidDate3 = Convert.ToString(sdr["LastPaidDate"]);
                        if (sdr["MemberID"] != DBNull.Value)
                        {
                            objLoanOBDto.MemberID = Convert.ToInt32(sdr["MemberID"]);
                        }
                        if (sdr["InterestDue"] != DBNull.Value)
                        {
                            objLoanOBDto.InterestDue3 = Convert.ToDecimal(sdr["InterestDue"]);
                        }
                        if (sdr["PrincipalDue"] != DBNull.Value)
                        {
                            objLoanOBDto.PrincipalOD3 = Convert.ToDecimal(sdr["PrincipalDue"]);
                        }
                    }
                    else if (count == 4)
                    {
                        objLoanOBDto.LoanMasrterID4 = Convert.ToInt32(sdr["LoanMasterID"]);
                        //  objLoanOBDto.MemberId = Convert.ToInt32(sdr["MemberID"]);
                        objLoanOBDto.GroupId               = Convert.ToInt32(sdr["GroupID"]);
                        objLoanOBDto.AHCode4               = Convert.ToString(sdr["AHCode"]);
                        objLoanOBDto.AHName4               = Convert.ToString(sdr["AHName"]);
                        objLoanOBDto.LoanDisbursedDate4    = Convert.ToString(sdr["LoanApplicationDate"]);
                        objLoanOBDto.Purpose4              = Convert.ToInt32(sdr["LoanPurposeID"]);
                        objLoanOBDto.LoanAmountGiven4      = Convert.ToDecimal(sdr["LoanAmountApplied"]);
                        objLoanOBDto.Period4               = Convert.ToInt32(sdr["NoofInstallmentsProposed"]);
                        objLoanOBDto.LoanAmountGiven4      = Convert.ToDecimal(sdr["DisbursedAmount"]);
                        objLoanOBDto.Period4               = Convert.ToInt32(sdr["NoOfInstallments"]);
                        objLoanOBDto.SLAccountNumberAHID4  = Convert.ToInt32(sdr["SLAccountNumber"]);
                        objLoanOBDto.SLAccountNumber4      = Convert.ToString(sdr["SlAccountName"]);
                        objLoanOBDto.Interest4             = Convert.ToInt32(sdr["InterestRateID"]);
                        objLoanOBDto.FinalInstallmentDate4 = Convert.ToString(sdr["InstallmentStartFrom"]);
                        objLoanOBDto.MonthlyDemand4        = Convert.ToDecimal(sdr["MonthlyPrincipalDemand"]);
                        objLoanOBDto.Fundsource4           = Convert.ToInt32(sdr["FundSourceID"]);
                        objLoanOBDto.Project4              = Convert.ToInt32(sdr["ProjectID"]);
                        objLoanOBDto.PrincipalOutstanding4 = Convert.ToDecimal(sdr["OutStandingAmount"]);
                        objLoanOBDto.Interest4             = Convert.ToInt32(sdr["InterestMasterID"]);
                        objLoanOBDto.DueDay        = Convert.ToInt32(sdr["MeetingDay"]);
                        objLoanOBDto.ROI4          = Convert.ToInt32(sdr["ROI"]);
                        objLoanOBDto.LastPaidDate4 = Convert.ToString(sdr["LastPaidDate"]);
                        if (sdr["InterestDue"] != DBNull.Value)
                        {
                            objLoanOBDto.InterestDue4 = Convert.ToDecimal(sdr["InterestDue"]);
                        }
                        if (sdr["MemberID"] != DBNull.Value)
                        {
                            objLoanOBDto.MemberID = Convert.ToInt32(sdr["MemberID"]);
                        }
                        if (sdr["PrincipalDue"] != DBNull.Value)
                        {
                            objLoanOBDto.PrincipalOD4 = Convert.ToDecimal(sdr["PrincipalDue"]);
                        }
                    }
                    count++;
                }
            }
            catch (Exception ex)
            {
            }
            return(objLoanOBDto);
        }
Пример #3
0
        public LoanOBDto InsertLoanOB(LoanOBDto loanOBDto)
        {
            for (int i = 0; i < 4; i++)
            {
                LoanOBByLoanDto loanOBByLoanDto = new LoanOBByLoanDto();
                if (i == 0 && loanOBDto.PrincipalOutstanding1 == 0)
                {
                    continue;
                }
                else if (i == 1 && loanOBDto.PrincipalOutstanding2 == 0)
                {
                    continue;
                }
                else if (i == 2 && loanOBDto.PrincipalOutstanding3 == 0)
                {
                    continue;
                }
                else if (i == 3 && loanOBDto.PrincipalOutstanding4 == 0)
                {
                    continue;
                }



                loanOBByLoanDto = ConvertLoanDtoToLoanByDto(loanOBDto, i);
                LoanOBDll dll = new LoanOBDll();

                bool isDisbursed = CheckForDisbursementStart(loanOBByLoanDto.LoanMasrterID);
                if (isDisbursed)
                {
                    switch (i)
                    {
                    case 0: loanOBDto.IsDisbursed1 = true;
                        break;

                    case 1: loanOBDto.IsDisbursed2 = true;
                        break;

                    case 2: loanOBDto.IsDisbursed3 = true;
                        break;

                    case 3: loanOBDto.IsDisbursed4 = true;
                        break;

                    default:
                        break;
                    }

                    continue;
                }

                loanOBByLoanDto = dll.InsertLoanOB(loanOBByLoanDto);

                if (i == 0)
                {
                    loanOBDto.SLAccountNumberAHID1 = loanOBByLoanDto.SLAccountNumberAHID;
                }
                else if (i == 1)
                {
                    loanOBDto.SLAccountNumberAHID2 = loanOBByLoanDto.SLAccountNumberAHID;
                }
                else if (i == 2)
                {
                    loanOBDto.SLAccountNumberAHID3 = loanOBByLoanDto.SLAccountNumberAHID;
                }
                else if (i == 3)
                {
                    loanOBDto.SLAccountNumberAHID4 = loanOBByLoanDto.SLAccountNumberAHID;
                }

                if (i == 0)
                {
                    loanOBDto.LoanMasrterID1 = loanOBByLoanDto.LoanMasrterID;
                }
                else if (i == 1)
                {
                    loanOBDto.LoanMasrterID2 = loanOBByLoanDto.LoanMasrterID;
                }
                else if (i == 2)
                {
                    loanOBDto.LoanMasrterID3 = loanOBByLoanDto.LoanMasrterID;
                }
                else if (i == 3)
                {
                    loanOBDto.LoanMasrterID4 = loanOBByLoanDto.LoanMasrterID;
                }
            }

            return(loanOBDto);
        }
Пример #4
0
        public LoanOBByLoanDto ConvertLoanDtoToLoanByDto(LoanOBDto loanOBDto, int index)
        {
            LoanOBByLoanDto loanOBByLoanDto = new LoanOBByLoanDto();

            loanOBByLoanDto.GroupId  = loanOBDto.GroupId;
            loanOBByLoanDto.LoanType = loanOBDto.LoanType;
            loanOBByLoanDto.MemberId = loanOBDto.MemberID;
            loanOBByLoanDto.UserID   = loanOBDto.UserID;
            loanOBByLoanDto.DueDay   = loanOBDto.DueDay;
            if (index == 0)
            {
                loanOBByLoanDto.LoanMasrterID        = loanOBDto.LoanMasrterID1;
                loanOBByLoanDto.FinalInstallmentDate = loanOBDto.FinalInstallmentDate1;
                loanOBByLoanDto.Fundsource           = loanOBDto.Fundsource1;
                loanOBByLoanDto.Interest             = loanOBDto.Interest1;
                loanOBByLoanDto.InterestDue          = loanOBDto.InterestDue1;
                loanOBByLoanDto.InterestOD           = loanOBDto.InterestOD1;
                loanOBByLoanDto.LastPaidDate         = loanOBDto.LastPaidDate1;
                loanOBByLoanDto.LoanAmountGiven      = loanOBDto.LoanAmountGiven1;
                loanOBByLoanDto.LoanDisbursedDate    = loanOBDto.LoanDisbursedDate1;
                loanOBByLoanDto.LoanMasrterID        = loanOBDto.LoanMasrterID1;
                loanOBByLoanDto.MonthlyDemand        = loanOBDto.MonthlyDemand1;
                loanOBByLoanDto.Period               = loanOBDto.Period1;
                loanOBByLoanDto.PrincipalOD          = loanOBDto.PrincipalOD1;
                loanOBByLoanDto.PrincipalOutstanding = loanOBDto.PrincipalOutstanding1;
                loanOBByLoanDto.Project              = loanOBDto.Project1;
                loanOBByLoanDto.Purpose              = loanOBDto.Purpose1;
                loanOBByLoanDto.SLAccountNumber      = loanOBDto.SLAccountNumber1;
                loanOBByLoanDto.SLAccountNumberAHID  = loanOBDto.SLAccountNumberAHID1;
                loanOBByLoanDto.PrincipalAHID        = loanOBDto.PrincipalAHID1;
            }



            else if (index == 1)
            {
                loanOBByLoanDto.LoanMasrterID        = loanOBDto.LoanMasrterID2;
                loanOBByLoanDto.FinalInstallmentDate = loanOBDto.FinalInstallmentDate2;
                loanOBByLoanDto.Fundsource           = loanOBDto.Fundsource2;
                loanOBByLoanDto.Interest             = loanOBDto.Interest2;
                loanOBByLoanDto.InterestDue          = loanOBDto.InterestDue2;
                loanOBByLoanDto.InterestOD           = loanOBDto.InterestOD2;
                loanOBByLoanDto.LastPaidDate         = loanOBDto.LastPaidDate2;
                loanOBByLoanDto.LoanAmountGiven      = loanOBDto.LoanAmountGiven2;
                loanOBByLoanDto.LoanDisbursedDate    = loanOBDto.LoanDisbursedDate2;
                loanOBByLoanDto.LoanMasrterID        = loanOBDto.LoanMasrterID2;
                loanOBByLoanDto.MonthlyDemand        = loanOBDto.MonthlyDemand2;
                loanOBByLoanDto.Period               = loanOBDto.Period2;
                loanOBByLoanDto.PrincipalOD          = loanOBDto.PrincipalOD2;
                loanOBByLoanDto.PrincipalOutstanding = loanOBDto.PrincipalOutstanding2;
                loanOBByLoanDto.Project              = loanOBDto.Project2;
                loanOBByLoanDto.Purpose              = loanOBDto.Purpose2;
                loanOBByLoanDto.SLAccountNumber      = loanOBDto.SLAccountNumber2;
                loanOBByLoanDto.SLAccountNumberAHID  = loanOBDto.SLAccountNumberAHID2;
                loanOBByLoanDto.PrincipalAHID        = loanOBDto.PrincipalAHID2;
            }

            else if (index == 2)
            {
                loanOBByLoanDto.LoanMasrterID        = loanOBDto.LoanMasrterID3;
                loanOBByLoanDto.FinalInstallmentDate = loanOBDto.FinalInstallmentDate3;
                loanOBByLoanDto.Fundsource           = loanOBDto.Fundsource3;
                loanOBByLoanDto.Interest             = loanOBDto.Interest3;
                loanOBByLoanDto.InterestDue          = loanOBDto.InterestDue3;
                loanOBByLoanDto.InterestOD           = loanOBDto.InterestOD3;
                loanOBByLoanDto.LastPaidDate         = loanOBDto.LastPaidDate3;
                loanOBByLoanDto.LoanAmountGiven      = loanOBDto.LoanAmountGiven3;
                loanOBByLoanDto.LoanDisbursedDate    = loanOBDto.LoanDisbursedDate3;
                loanOBByLoanDto.LoanMasrterID        = loanOBDto.LoanMasrterID3;
                loanOBByLoanDto.MonthlyDemand        = loanOBDto.MonthlyDemand3;
                loanOBByLoanDto.Period               = loanOBDto.Period3;
                loanOBByLoanDto.PrincipalOD          = loanOBDto.PrincipalOD3;
                loanOBByLoanDto.PrincipalOutstanding = loanOBDto.PrincipalOutstanding3;
                loanOBByLoanDto.Project              = loanOBDto.Project3;
                loanOBByLoanDto.Purpose              = loanOBDto.Purpose3;
                loanOBByLoanDto.SLAccountNumber      = loanOBDto.SLAccountNumber3;
                loanOBByLoanDto.SLAccountNumberAHID  = loanOBDto.SLAccountNumberAHID3;
                loanOBByLoanDto.PrincipalAHID        = loanOBDto.PrincipalAHID2;
            }

            else if (index == 3)
            {
                loanOBByLoanDto.LoanMasrterID        = loanOBDto.LoanMasrterID4;
                loanOBByLoanDto.FinalInstallmentDate = loanOBDto.FinalInstallmentDate4;
                loanOBByLoanDto.Fundsource           = loanOBDto.Fundsource4;
                loanOBByLoanDto.Interest             = loanOBDto.Interest4;
                loanOBByLoanDto.InterestDue          = loanOBDto.InterestDue4;
                loanOBByLoanDto.InterestOD           = loanOBDto.InterestOD4;
                loanOBByLoanDto.LastPaidDate         = loanOBDto.LastPaidDate4;
                loanOBByLoanDto.LoanAmountGiven      = loanOBDto.LoanAmountGiven4;
                loanOBByLoanDto.LoanDisbursedDate    = loanOBDto.LoanDisbursedDate4;
                loanOBByLoanDto.LoanMasrterID        = loanOBDto.LoanMasrterID4;
                loanOBByLoanDto.MonthlyDemand        = loanOBDto.MonthlyDemand4;
                loanOBByLoanDto.Period               = loanOBDto.Period4;
                loanOBByLoanDto.PrincipalOD          = loanOBDto.PrincipalOD4;
                loanOBByLoanDto.PrincipalOutstanding = loanOBDto.PrincipalOutstanding4;
                loanOBByLoanDto.Project              = loanOBDto.Project4;
                loanOBByLoanDto.Purpose              = loanOBDto.Purpose4;
                loanOBByLoanDto.SLAccountNumber      = loanOBDto.SLAccountNumber4;
                loanOBByLoanDto.SLAccountNumberAHID  = loanOBDto.SLAccountNumberAHID4;
                loanOBByLoanDto.PrincipalAHID        = loanOBDto.PrincipalAHID4;
            }

            return(loanOBByLoanDto);
        }
Пример #5
0
        public ActionResult GetLoanOB(int?id)
        {
            ViewBag.clusters   = GroupInfo.Cluster;
            ViewBag.village    = GroupInfo.Village;
            ViewBag.GroupName  = GroupInfo.GroupName;
            ViewBag.MeetingDay = GroupInfo.MeetingDay;
            ViewBag.LockStatus = GroupInfo.LockStatus;
            int             LoanMasterId = Convert.ToInt32(id);
            LoanOBByLoanDto lstdtos      = new LoanOBByLoanDto();
            LoanOBBll       objLoanOBBll = new LoanOBBll();
            LoanOBDto       lstLoanOBDto = new LoanOBDto();

            if (LoanMasterId > 0)
            {
                lstLoanOBDto        = objLoanOBBll.GetByID(LoanMasterId);
                lstLoanOBDto.Total1 = lstLoanOBDto.PrincipalOutstanding1 + lstLoanOBDto.InterestDue1;
                lstLoanOBDto.Total2 = lstLoanOBDto.PrincipalOutstanding2 + lstLoanOBDto.InterestDue2;
                lstLoanOBDto.Total3 = lstLoanOBDto.PrincipalOutstanding3 + lstLoanOBDto.InterestDue3;
                lstLoanOBDto.Total4 = lstLoanOBDto.PrincipalOutstanding4 + lstLoanOBDto.InterestDue4;
            }

            List <LoanPurposeLookupDto> lstLoanpurposeDto = _loanpurposeService.Lookup();
            SelectList lstloanpurpose = new SelectList(lstLoanpurposeDto, "LoanPurposeID", "Purpose");

            ViewBag.lonapurpose = lstloanpurpose;
            List <SelectListDto> lstProjects = _projectService.GetProjectSelectList();
            SelectList           slProjects  = new SelectList(lstProjects, "ID", "Text");

            ViewBag.projects = slProjects;
            List <MemberLookupDto> lstMembers = _memberService.GetByGroupId(GroupInfo.GroupID);
            SelectList             slMembers  = new SelectList(lstMembers, "MemberID", "MemberName");

            if (lstLoanOBDto.MemberID == 0)
            {
                LoanOBBll           loanOBBll = new LoanOBBll();
                List <LoanOBLookup> lstLoanOB = loanOBBll.LoanOBLookUpList('M', GroupInfo.GroupID);
                foreach (var member in lstLoanOB)
                {
                    lstMembers.Remove(lstMembers.Find(l => l.MemberID == member.MemberID));
                }
                slMembers = new SelectList(lstMembers, "MemberID", "MemberName");
            }
            else
            {
                List <MemberLookupDto> lstMembersTemp = new List <MemberLookupDto>();
                foreach (var member in lstMembers)
                {
                    if (member.MemberID == lstLoanOBDto.MemberID)
                    {
                        lstMembersTemp.Add(lstMembers.Find(l => l.MemberID == member.MemberID));
                    }
                }
                slMembers = new SelectList(lstMembersTemp, "MemberID", "MemberName");
            }


            ViewBag.Members = slMembers;

            List <SelectListDto> lstFundSources = _fundSourceService.GetFundSourceSelectList();
            SelectList           slFundsource   = new SelectList(lstFundSources, "ID", "Text");

            ViewBag.fundsource = slFundsource;

            List <SelectListDto> lstInterests = _interestService.GetInterestsSelectList(GroupInfo.GroupID);
            SelectList           slInterests  = new SelectList(lstInterests, "ID", "Text");

            ViewBag.interests = slInterests;

            if (LoanMasterId == 0)
            {
                if (lstInterests != null && lstInterests.Count > 0 && lstInterests.Exists(l => l.Text.ToUpper().Contains("BIG LOANS TO")))
                {
                    SelectListDto     s        = lstInterests.Find(l => l.Text.ToUpper().Contains("BIG LOANS TO"));
                    InterestMasterDto interest = GetInterestDetailsDto(s.ID);
                    lstLoanOBDto.AHCode1 = interest.PrincipalAHCode;
                    lstLoanOBDto.AHName1 = interest.PrincipalAHName;
                    lstLoanOBDto.ROI1    = Convert.ToInt32(interest.InterestRate);
                    //lstLoanOBDto.InterestDue1 = 0;
                    lstLoanOBDto.Interest1 = s.ID;
                }

                if (lstInterests != null && lstInterests.Count > 0 && lstInterests.Exists(l => l.Text.ToUpper().Contains("SMALL LOANS TO")))
                {
                    SelectListDto     s        = lstInterests.Find(l => l.Text.ToUpper().Contains("SMALL LOANS TO"));
                    InterestMasterDto interest = GetInterestDetailsDto(s.ID);
                    lstLoanOBDto.AHCode2 = interest.PrincipalAHCode;
                    lstLoanOBDto.AHName2 = interest.PrincipalAHName;
                    lstLoanOBDto.ROI2    = Convert.ToInt32(interest.InterestRate);
                    //lstLoanOBDto.InterestDue2 = 0;
                    lstLoanOBDto.Interest2 = s.ID;
                }
                if (lstInterests != null && lstInterests.Count > 0 && lstInterests.Exists(l => l.Text.ToUpper().Contains("HOUSING LOANS TO")))
                {
                    SelectListDto     s        = lstInterests.Find(l => l.Text.ToUpper().Contains("HOUSING LOANS TO"));
                    InterestMasterDto interest = GetInterestDetailsDto(s.ID);
                    lstLoanOBDto.AHCode3 = interest.PrincipalAHCode;
                    lstLoanOBDto.AHName3 = interest.PrincipalAHName;
                    lstLoanOBDto.ROI3    = Convert.ToInt32(interest.InterestRate);
                    //lstLoanOBDto.InterestDue3 = 0;
                    lstLoanOBDto.Interest3 = s.ID;
                }
            }
            else if (LoanMasterId > 0 && lstLoanOBDto.AHCode1 != null && lstLoanOBDto.AHCode2 != null && lstLoanOBDto.AHCode3 != null)
            {
            }
            else if (LoanMasterId > 0 && lstLoanOBDto.AHCode1 != null && lstLoanOBDto.AHCode2 != null)
            {
                if (lstInterests != null && lstInterests.Count > 0 && lstInterests.Exists(l => l.Text.ToUpper().Contains("BIG LOANS TO")))
                {
                    SelectListDto     s        = lstInterests.Find(l => l.Text.ToUpper().Contains("BIG LOANS TO"));
                    InterestMasterDto interest = GetInterestDetailsDto(s.ID);
                    lstLoanOBDto.AHCode3 = interest.PrincipalAHCode;
                    lstLoanOBDto.AHName3 = interest.PrincipalAHName;

                    lstLoanOBDto.Interest3 = s.ID;
                }
            }
            else
            {
                if (lstInterests != null && lstInterests.Count > 0 && lstInterests.Exists(l => l.Text.ToUpper().Contains("BIG LOANS TO")))
                {
                    SelectListDto     s        = lstInterests.Find(l => l.Text.ToUpper().Contains("BIG LOANS TO"));
                    InterestMasterDto interest = GetInterestDetailsDto(s.ID);
                    lstLoanOBDto.AHCode2 = interest.PrincipalAHCode;
                    lstLoanOBDto.AHName2 = interest.PrincipalAHName;

                    lstLoanOBDto.Interest2 = s.ID;
                }

                if (lstInterests != null && lstInterests.Count > 0 && lstInterests.Exists(l => l.Text.ToUpper().Contains("SMALL LOANS TO")))
                {
                    SelectListDto     s        = lstInterests.Find(l => l.Text.ToUpper().Contains("SMALL LOANS TO"));
                    InterestMasterDto interest = GetInterestDetailsDto(s.ID);
                    lstLoanOBDto.AHCode2 = interest.PrincipalAHCode;
                    lstLoanOBDto.AHName2 = interest.PrincipalAHName;

                    lstLoanOBDto.Interest2 = s.ID;
                }

                if (lstInterests != null && lstInterests.Count > 0 && lstInterests.Exists(l => l.Text.ToUpper().Contains("HOUSING LOANS TO")))
                {
                    SelectListDto     s        = lstInterests.Find(l => l.Text.ToUpper().Contains("HOUSING LOANS TO"));
                    InterestMasterDto interest = GetInterestDetailsDto(s.ID);
                    lstLoanOBDto.AHCode3 = interest.PrincipalAHCode;
                    lstLoanOBDto.AHName3 = interest.PrincipalAHName;

                    lstLoanOBDto.Interest3 = s.ID;
                }
            }
            ViewBag.lastpaidDate       = string.Format("{0}/Mar/2016", GroupInfo.MeetingDay);
            lstLoanOBDto.LastPaidDate1 = ViewBag.lastpaidDate;
            lstLoanOBDto.LastPaidDate2 = ViewBag.lastpaidDate;
            lstLoanOBDto.LastPaidDate3 = ViewBag.lastpaidDate;
            lstLoanOBDto.LastPaidDate4 = ViewBag.lastpaidDate;
            ViewBag.meetingDay         = GroupInfo.MeetingDay;
            //List<SelectListDto> lstPrincipalAHIDs=_accountHeadService.loan

            ViewBag.LoanAccountHeads = slInterests;
            return(View(lstLoanOBDto));
        }
Пример #6
0
        public ActionResult GetLoanOB(int?id)
        {
            int             LoanMasterId = Convert.ToInt32(id);
            LoanOBByLoanDto lstdtos      = new LoanOBByLoanDto();
            LoanOBBll       objLoanOBBll = new LoanOBBll();
            LoanOBDto       lstLoanOBDto = new LoanOBDto();
            char            LoanType     = 'G';

            if (LoanMasterId > 0)
            {
                lstLoanOBDto        = objLoanOBBll.GetByID(LoanMasterId, LoanType);
                lstLoanOBDto.Total1 = lstLoanOBDto.PrincipalOutstanding1 + lstLoanOBDto.InterestDue1;
                lstLoanOBDto.Total2 = lstLoanOBDto.PrincipalOutstanding2 + lstLoanOBDto.InterestDue2;
                lstLoanOBDto.Total3 = lstLoanOBDto.PrincipalOutstanding3 + lstLoanOBDto.InterestDue3;
                lstLoanOBDto.Total4 = lstLoanOBDto.PrincipalOutstanding4 + lstLoanOBDto.InterestDue4;
            }

            List <SelectListDto> lstClusters = _clusterService.GetClusterSelectList();
            SelectList           slClusters  = new SelectList(lstClusters, "ID", "Text");

            ViewBag.clusters = slClusters;

            List <LoanPurposeLookupDto> lstLoanpurposeDto = _loanpurposeService.Lookup();
            SelectList lstloanpurpose = new SelectList(lstLoanpurposeDto, "LoanPurposeID", "Purpose");

            ViewBag.lonapurpose = lstloanpurpose;

            List <SelectListDto> lstProjects = _projectService.GetProjectSelectList();
            SelectList           slProjects  = new SelectList(lstProjects, "ID", "Text");

            ViewBag.projects = slProjects;

            List <SelectListDto> lstFundSources = _fundSourceService.GetFundSourceSelectList();
            SelectList           slFundsource   = new SelectList(lstFundSources, "ID", "Text");

            ViewBag.fundsource = slFundsource;


            List <SelectListDto> lstvilllages = _villageService.GetVillageSelectList();
            SelectList           slvillages   = new SelectList(lstvilllages, "ID", "Text");

            ViewBag.village = slvillages;


            List <SelectListDto> lstgroups = _groupService.GetGroupsSelectList();
            SelectList           slgroups  = new SelectList(lstgroups, "ID", "Text");

            if (lstLoanOBDto.GroupId == 0)
            {
                LoanOBBll           loanOBBll = new LoanOBBll();
                List <LoanOBLookup> lstLoanOB = loanOBBll.LoanOBLookUpList('G', 0);
                foreach (var group in lstLoanOB)
                {
                    lstgroups.Remove(lstgroups.Find(l => l.ID == group.GroupID));
                }
                slgroups = new SelectList(lstgroups, "ID", "Text");
            }
            else
            {
                List <SelectListDto> lstGroupsTemp = new List <SelectListDto>();
                foreach (var group in lstgroups)
                {
                    if (group.ID == lstLoanOBDto.GroupId)
                    {
                        lstGroupsTemp.Add(lstgroups.Find(l => l.ID == group.ID));
                    }
                }
                slgroups = new SelectList(lstGroupsTemp, "ID", "Text");
            }


            ViewBag.group = slgroups;

            List <SelectListDto> lstInterests = _interestService.GetInterestsSelectList();
            SelectList           slInterests  = new SelectList(lstInterests, "ID", "Text");

            ViewBag.interests = slInterests;

            //List<SelectListDto> lstPrincipalAHIDs=_accountHeadService.loan

            ViewBag.LoanAccountHeads = slInterests;

            return(View(lstLoanOBDto));
        }