예제 #1
0
        //private void BindLoanCodeDetails()
        //{
        //    try
        //    {
        //        LoansBLL bll = new LoansBLL();
        //        string strLoanName = ddlAddLoanCode.Text.ToString();
        //        if (strLoanName.Contains(';'))
        //        {
        //            strLoanName = strLoanName.Replace(';', ' ');
        //        }
        //        Loans loan = bll.GetLoanByCode(strLoanName.Trim());
        //        if (loan != null)
        //        {
        //            txtBoxAddBorrower.Text = Convert.ToString(loan.Borrower);
        //            txtBoxAddSector.Text = Convert.ToString(loan.Sector);
        //            if (loan.Signing_Date != "")
        //                txtBoxAddSigningDate.SelectedDate = Convert.ToDateTime(loan.Signing_Date);
        //            else
        //                txtBoxAddSigningDate.Clear();
        //            if (loan.Maturity_Date != "")
        //                txtBoxAddMaturityDate.SelectedDate = Convert.ToDateTime(loan.Maturity_Date);
        //            else
        //                txtBoxAddMaturityDate.Clear();
        //            txtBoxFacilitySize.Text = loan.FacilitySize;
        //            ddlAddFixedOrFloating.SelectedValue = loan.FixedOrFloating;
        //            txtBoxAddMargin.Text = loan.Margin;
        //            ddlAddCurrency.SelectedValue = loan.Currency;
        //            ddlCountry.SelectedValue = loan.Country;
        //            ddlAddCouponFrequency.SelectedValue = loan.CouponFrequency;
        //            if (loan.Bilateral == true)
        //                ddlAddBilateral.SelectedValue = "Yes";
        //            else
        //                ddlAddBilateral.SelectedValue = "No";
        //            ddlAmortizing.SelectedValue = loan.Amortizing;
        //            lblConfirm.Text = "Loan already exists, do you wish to overwrite?";
        //            _operation = "Edit";
        //        }
        //        else
        //        {
        //            _operation = "Add";
        //        }
        //        //else
        //        //{
        //        //    Clear();
        //        //}
        //    }
        //    catch (Exception)
        //    {
        //    }
        //}
        private void BindLoanCodeDetails()
        {
            try
            {
                LoansBLL bll = new LoansBLL();
                string strLoanName = ddlAddLoanCode.Text.ToString();
                if (strLoanName.Contains(';'))
                {
                    strLoanName = strLoanName.Replace(';', ' ');
                }
                Loans loan = bll.GetLoanByCode(strLoanName.Trim());
                if (loan != null)
                {
                    if (loan.Borrower != null)
                    {
                        ddlBorrower.SelectedValue = Convert.ToString(loan.Borrower);
                        BorrowersBL borrowerBL = new BorrowersBL();
                        if (ddlBorrower.SelectedValue != string.Empty)
                        {
                            if (ddlBorrower.SelectedItem != null)
                            {
                                Borrower borrower = borrowerBL.GetBorrower(ddlBorrower.SelectedItem.Text);
                                txtGrid.Text = loan.Grid;
                                txtSummitCredit.Text = loan.SummitCreditEntity;
                            }
                        }

                    }

                    //  txtBoxAddSector.Text = Convert.ToString(loan.Sector);
                    if (loan.Sector != null)
                    {
                        ddlSector.SelectedValue = Convert.ToString(loan.Sector);
                    }

                    if (loan.Signing_Date != "" && loan.Signing_Date != null)
                        txtBoxAddSigningDate.SelectedDate = Convert.ToDateTime(loan.Signing_Date);
                    else
                        txtBoxAddSigningDate.Clear();
                    if (loan.Maturity_Date != "" && loan.Maturity_Date != null)
                        txtBoxAddMaturityDate.SelectedDate = Convert.ToDateTime(loan.Maturity_Date);
                    else
                        txtBoxAddMaturityDate.Clear();
                    if (loan.CouponDate != "" && loan.CouponDate != null)
                        txtCouponDate.SelectedDate = Convert.ToDateTime(loan.CouponDate);
                    else
                        txtCouponDate.Clear();
                    if (loan.FacilitySize != null)
                    {
                        txtBoxFacilitySize.Text = Convert.ToDecimal(loan.FacilitySize).ToString("N");

                    }
                    if (loan.Fixed_Floating != null)
                    {
                        ddlAddFixedOrFloating.SelectedValue = loan.FixedOrFloating;
                    }

                    txtBoxAddMargin.Text = loan.Margin;
                    if (loan.Currency != null)
                    {
                        ddlAddCurrency.SelectedValue = loan.Currency;
                    }
                    if (loan.Country != null)
                    {
                        ddlCountry.SelectedValue = loan.Country;
                    }

                    txtPP.Text = loan.PP;
                    //  txtCRating.Text = loan.CreditRating;
                    txtStructureID.Text = loan.StructureID;
                    if (loan.CouponFrequency != null)
                    {
                        ddlAddCouponFrequency.SelectedValue = loan.CouponFrequency;
                    }

                    txtNotional.Text = Convert.ToDecimal(loan.Notional).ToString("N");
                    if (loan.Bilateral == true)
                        ddlAddBilateral.SelectedValue = "Yes";
                    else
                        ddlAddBilateral.SelectedValue = "No";
                    if (loan.Amortizing == "Yes")
                    {
                        ddlAmortizing.SelectedValue = loan.Amortizing;
                        if (ddlAmortizing.SelectedValue == "Yes")
                        {
                            if (loan.AmortisationsStartPoint != null)
                                txtAmortisationsStartDate.SelectedDate = Convert.ToDateTime(loan.AmortisationsStartPoint);
                            txtAmortisations.Text = loan.NoOfAmortisationPoint.ToString();
                            trDate.Visible = true;
                            trNo.Visible = true;
                            tblAmortisation.Visible = true;
                        }
                    }
                    else
                    {
                        ddlAmortizing.SelectedValue = "No";
                        trDate.Visible = false;
                        trNo.Visible = false;
                        tblAmortisation.Visible = false;
                    }
                    txtGurantor.Text = loan.Gurantor;
                    txtGrid.Text = loan.Grid;
                    txtSummitCredit.Text = loan.SummitCreditEntity;

                    CheckNodes(tvCreditRating, loan);

                    txtBoxAddMargin.Text = loan.Margin;

                    LoanScheduleBL scheduleBL = new LoanScheduleBL();
                    List<LoanSchedule> scheduleList = scheduleBL.GetLoanByID(loan.ID);

                    if (scheduleList != null && scheduleList.Count > 0)
                    {
                        dt1.Clear();
                        //dt1.Columns.Add("ID", typeof(int));
                        //dt1.Columns.Add("StartDate", typeof(DateTime));
                        //dt1.Columns.Add("EndDate", typeof(DateTime));
                        //dt1.Columns.Add("Notional", typeof(long));
                        //dt1.Columns.Add("Factor", typeof(float));

                        for (int i = 0; i < scheduleList.Count; i++)
                        {
                            // dt1.Rows.Add(scheduleList[i].ID, scheduleList[i].StartDate, scheduleList[i].EndDate, scheduleList[i].Notation, scheduleList[i].Factor);
                            dt1.Rows.Add(i + 1, scheduleList[i].StartDate.Value.ToShortDateString(), scheduleList[i].EndDate.Value.ToShortDateString(), scheduleList[i].CoupFrac, scheduleList[i].Notation, scheduleList[i].Amortisation, scheduleList[i].Factor, scheduleList[i].Spread, scheduleList[i].CouponPaymentDate, scheduleList[i].RiskFreeDP1, scheduleList[i].RiskFreeDP2, scheduleList[i].FloatingRate, scheduleList[i].AllInRate, scheduleList[i].Interest, scheduleList[i].Days, scheduleList[i].AmortisationInt);
                        }
                        pnlAmortizing.Visible = true;
                        grdAmortizing.Visible = true;
                        btnCalculatSchedule.Visible = true;
                        Session.Add("LoanScheduleData", dt1);
                        grdAmortizing.DataSource = dt1;
                        grdAmortizing.DataBind();
                    }
                    else
                    {
                        Session.Remove("LoanScheduleData");
                        dt1.Clear();
                        pnlAmortizing.Visible = false;
                        btnCalculatSchedule.Visible = false;
                        grdAmortizing.Visible = false;
                    }
                    hfLoanID.Value = loan.ID.ToString();
                    Session.Add("EditLoanID", loan.ID.ToString());
                    lblConfirm.Text = "Loan already exists, do you wish to overwrite?";
                    _operation = "Edit";
                }
                else
                {
                    hfLoanID.Value = string.Empty;
                    _operation = "Add";
                    lblConfirm.Text = "Are you sure you want to add this loan to database?";
                    // Clear();
                }
            }
            catch (Exception)
            {

            }
        }
예제 #2
0
        protected void grdLoans_FilterCheckListItemsRequested(object sender, GridFilterCheckListItemsRequestedEventArgs e)
        {
            DataTable data = new DataTable();

            switch (e.Column.DataField)
            {
                case "CodeName":
                    data.Columns.Add("CodeName");
                    LoansBLL loansBLL = new LoansBLL();
                    List<Loans> loans = loansBLL.GetLoans();

                    for (int i = 0; i <= loans.Count - 1; i++)
                    {
                        data.Rows.Add(loans[i].CodeName);
                    }

                    e.ListBox.DataSource = data;
                    e.ListBox.DataKeyField = "CodeName";
                    e.ListBox.DataTextField = "CodeName";
                    e.ListBox.DataValueField = "CodeName";
                    e.ListBox.DataBind();

                    break;
                case "Borrower":
                    data = new DataTable();
                    data.Columns.Add("Borrower");

                    BorrowersBL borrowerBL = new BorrowersBL();
                    List<Borrower> borrower = borrowerBL.GetBorrowers();
                    for (int i = 0; i < borrower.Count - 1; i++)
                    {
                        data.Rows.Add(borrower[i].Name);
                    }

                    e.ListBox.DataSource = data;
                    e.ListBox.DataKeyField = "Borrower";
                    e.ListBox.DataTextField = "Borrower";
                    e.ListBox.DataValueField = "Borrower";
                    e.ListBox.DataBind();
                    break;
                case "Country":
                    data = new DataTable();
                    data.Columns.Add("Country");

                    CountryBL CountryBL = new CountryBL();
                    List<tblCountry> country = CountryBL.GetCountry();
                    for (int i = 0; i < country.Count - 1; i++)
                    {
                        data.Rows.Add(country[i].Name);
                    }

                    e.ListBox.DataSource = data;
                    e.ListBox.DataKeyField = "Country";
                    e.ListBox.DataTextField = "Country";
                    e.ListBox.DataValueField = "Country";
                    e.ListBox.DataBind();
                    break;
                case "CreditRating":
                    data = new DataTable();
                    data.Columns.Add("CreditRating");

                    CreditRatingsBL CreditRatingsBL = new CreditRatingsBL();
                    List<CreditRating> CreditRating = CreditRatingsBL.GetRatings();
                    for (int i = 0; i < CreditRating.Count - 1; i++)
                    {
                        data.Rows.Add(CreditRating[i].Rating);
                    }

                    e.ListBox.DataSource = data;
                    e.ListBox.DataKeyField = "CreditRating";
                    e.ListBox.DataTextField = "CreditRating";
                    e.ListBox.DataValueField = "CreditRating";
                    e.ListBox.DataBind();
                    break;
                case "Sector":
                    data = new DataTable();
                    data.Columns.Add("Sector");

                    LoansBLL loansBll = new LoansBLL();
                    List<Sectors> sector = loansBll.GetSector();

                    for (int i = 0; i < sector.Count; i++)
                    {
                        if (sector[i] != null)
                        {
                            data.Rows.Add(sector[i].Sector);
                        }
                    }

                    e.ListBox.DataSource = data;
                    e.ListBox.DataKeyField = "Sector";
                    e.ListBox.DataTextField = "Sector";
                    e.ListBox.DataValueField = "Sector";
                    e.ListBox.DataBind();
                    break;
                case "PP":
                    data = new DataTable();
                    data.Columns.Add("PP");

                    loansBll = new LoansBLL();
                    List<PP> pp = loansBll.GetPP();

                    for (int i = 0; i < pp.Count; i++)
                    {
                        if (pp[i] != null)
                        {
                            data.Rows.Add(pp[i].pp);
                        }
                    }

                    e.ListBox.DataSource = data;
                    e.ListBox.DataKeyField = "PP";
                    e.ListBox.DataTextField = "PP";
                    e.ListBox.DataValueField = "PP";
                    e.ListBox.DataBind();
                    break;
                case "FixedOrFloating":
                    data = new DataTable();
                    data.Columns.Add("FixedOrFloating");

                    loansBll = new LoansBLL();
                    List<BLL.FixedOrFloating> fof = loansBll.GetFixedFloating();

                    for (int i = 0; i < fof.Count; i++)
                    {
                        if (fof[i] != null)
                        {
                            data.Rows.Add(fof[i].fixedorfloating);
                        }
                    }

                    e.ListBox.DataSource = data;
                    e.ListBox.DataKeyField = "FixedOrFloating";
                    e.ListBox.DataTextField = "FixedOrFloating";
                    e.ListBox.DataValueField = "FixedOrFloating";
                    e.ListBox.DataBind();
                    break;
                case "Notional":
                    data = new DataTable();
                    data.Columns.Add("Notional");

                    loansBll = new LoansBLL();
                    List<BLL.Notional> notional = loansBll.GetNotional();

                    for (int i = 0; i < notional.Count; i++)
                    {
                        if (notional[i] != null)
                        {
                            data.Rows.Add(notional[i].notional);
                        }
                    }

                    e.ListBox.DataSource = data;
                    e.ListBox.DataKeyField = "Notional";
                    e.ListBox.DataTextField = "Notional";
                    e.ListBox.DataValueField = "Notional";
                    e.ListBox.DataBind();
                    break;
                case "Margin":
                    data = new DataTable();
                    data.Columns.Add("Margin");

                    loansBll = new LoansBLL();
                    List<BLL.Margin> margin = loansBll.GetMargin();

                    for (int i = 0; i < margin.Count; i++)
                    {
                        if (margin[i] != null)
                        {
                            data.Rows.Add(margin[i].margin);
                        }
                    }

                    e.ListBox.DataSource = data;
                    e.ListBox.DataKeyField = "Margin";
                    e.ListBox.DataTextField = "Margin";
                    e.ListBox.DataValueField = "Margin";
                    e.ListBox.DataBind();
                    break;
                case "Currency":
                    data = new DataTable();
                    data.Columns.Add("Currency");

                    CurrenciesBL currencyBL = new CurrenciesBL();
                    List<Currency> currency = currencyBL.GetCurrency();

                    for (int i = 0; i < currency.Count; i++)
                    {
                        if (currency[i].Currancy != null)
                        {
                            data.Rows.Add(currency[i].Currancy);
                        }
                    }

                    e.ListBox.DataSource = data;
                    e.ListBox.DataKeyField = "Currency";
                    e.ListBox.DataTextField = "Currency";
                    e.ListBox.DataValueField = "Currency";
                    e.ListBox.DataBind();
                    break;
                case "CouponFrequency":
                    data = new DataTable();
                    data.Columns.Add("CouponFrequency");

                    loansBll = new LoansBLL();
                    List<BLL.CouponFrequency> couponFreq = loansBll.GetCouponFrequency();

                    for (int i = 0; i < couponFreq.Count; i++)
                    {
                        if (couponFreq[i] != null)
                        {
                            data.Rows.Add(couponFreq[i].coupon);
                        }
                    }

                    e.ListBox.DataSource = data;
                    e.ListBox.DataKeyField = "CouponFrequency";
                    e.ListBox.DataTextField = "CouponFrequency";
                    e.ListBox.DataValueField = "CouponFrequency";
                    e.ListBox.DataBind();
                    break;
                case "FacilitySize":
                    data = new DataTable();
                    data.Columns.Add("FacilitySize");

                    loansBll = new LoansBLL();
                    List<BLL.FacilitySize> facility = loansBll.GetFacilitySize();

                    for (int i = 0; i < facility.Count; i++)
                    {
                        if (facility[i] != null)
                        {
                            data.Rows.Add(facility[i].facility);
                        }
                    }

                    e.ListBox.DataSource = data;
                    e.ListBox.DataKeyField = "FacilitySize";
                    e.ListBox.DataTextField = "FacilitySize";
                    e.ListBox.DataValueField = "FacilitySize";
                    e.ListBox.DataBind();
                    break;
                case "CreditRatingModys":
                    data = new DataTable();
                    data.Columns.Add("CreditRatings");

                    loansBll = new LoansBLL();

                    List<CreditRating> creditRatingModdys = loansBll.GetCreditRatingModdys();
                    for (int i = 0; i < creditRatingModdys.Count; i++)
                    {
                        data.Rows.Add(creditRatingModdys[i].Rating);
                    }

                    e.ListBox.DataSource = data;
                    e.ListBox.DataKeyField = "CreditRatings";
                    e.ListBox.DataTextField = "CreditRatings";
                    e.ListBox.DataValueField = "CreditRatings";
                    e.ListBox.DataBind();

                    break;
                case "CreditRatingSPs":
                    data = new DataTable();
                    data.Columns.Add("CreditRatings");

                    loansBll = new LoansBLL();

                    List<CreditRating> creditRatingSPs = loansBll.GetCreditRatingSP();
                    for (int i = 0; i < creditRatingSPs.Count; i++)
                    {
                        data.Rows.Add(creditRatingSPs[i].Rating);
                    }

                    e.ListBox.DataSource = data;
                    e.ListBox.DataKeyField = "CreditRatings";
                    e.ListBox.DataTextField = "CreditRatings";
                    e.ListBox.DataValueField = "CreditRatings";
                    e.ListBox.DataBind();

                    break;
                case "CreditRatingFitch":
                    data = new DataTable();
                    data.Columns.Add("CreditRatings");

                    loansBll = new LoansBLL();

                    List<CreditRating> creditRatingFitch = loansBll.GetCreditRatingFitch();
                    for (int i = 0; i < creditRatingFitch.Count; i++)
                    {
                        data.Rows.Add(creditRatingFitch[i].Rating);
                    }

                    e.ListBox.DataSource = data;
                    e.ListBox.DataKeyField = "CreditRatings";
                    e.ListBox.DataTextField = "CreditRatings";
                    e.ListBox.DataValueField = "CreditRatings";
                    e.ListBox.DataBind();

                    break;
                case "CreditRatingING":
                    data = new DataTable();
                    data.Columns.Add("CreditRatings");

                    loansBll = new LoansBLL();

                    List<CreditRating> creditRatingING = loansBll.GetCreditRatingING();
                    for (int i = 0; i < creditRatingING.Count; i++)
                    {
                        data.Rows.Add(creditRatingING[i].Rating);
                    }

                    e.ListBox.DataSource = data;
                    e.ListBox.DataKeyField = "CreditRatings";
                    e.ListBox.DataTextField = "CreditRatings";
                    e.ListBox.DataValueField = "CreditRatings";
                    e.ListBox.DataBind();

                    break;
                //case "NoOfAmortisation":
                //    data = new DataTable();
                //    data.Columns.Add("NoOfAmortrization");

                //    loansBll = new LoansBLL();
                //    List<BLL.NoOfAmortrization> noOfAmort = loansBll.GetNoOfAmortrization();

                //    for (int i = 0; i < noOfAmort.Count; i++)
                //    {
                //        if (noOfAmort[i] != null)
                //        {
                //            data.Rows.Add(noOfAmort[i].noofAmort);
                //        }
                //    }

                //    e.ListBox.DataSource = data;
                //    e.ListBox.DataKeyField = "noofAmort";
                //    e.ListBox.DataTextField = "noofAmort";
                //    e.ListBox.DataValueField = "noofAmort";
                //    e.ListBox.DataBind();
                //    break;
                case "StructureID":
                    data = new DataTable();
                    data.Columns.Add("StructureID");

                    loansBll = new LoansBLL();
                    List<BLL.StructureID> structure = loansBll.GetStructureID();

                    for (int i = 0; i < structure.Count; i++)
                    {
                        if (structure[i] != null)
                        {
                            data.Rows.Add(structure[i].structureID);
                        }
                    }

                    e.ListBox.DataSource = data;
                    e.ListBox.DataKeyField = "StructureID";
                    e.ListBox.DataTextField = "StructureID";
                    e.ListBox.DataValueField = "StructureID";
                    e.ListBox.DataBind();
                    break;
                default:
                    break;
            }

            //// sector

            //data = new DataTable();
            //data.Columns.Add("CreditRating");

            //CreditRatingsBL CreditRatingsBL = new CreditRatingsBL();
            //List<CreditRating> CreditRating = CreditRatingsBL.GetRatings();
            //for (int i = 0; i < CreditRating.Count - 1; i++)
            //{
            //    data.Rows.Add(CreditRating[i].Rating);
            //}

            //e.ListBox.DataSource = data;
            //e.ListBox.DataKeyField = "CreditRating";
            //e.ListBox.DataTextField = "CreditRating";
            //e.ListBox.DataValueField = "CreditRating";
            //e.ListBox.DataBind();
        }
예제 #3
0
 protected void ddlBorrower_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
 {
     BorrowersBL borrowerBL = new BorrowersBL();
     Borrower borrower = borrowerBL.GetBorrower(ddlBorrower.SelectedItem.Text);
     txtGrid.Text = borrower.Grid;
     txtSummitCredit.Text = borrower.SummitCreditEntity;
     txtGrid.Enabled = false;
     txtSummitCredit.Enabled = false;
 }
        protected void grdBorrower_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
        {
            BorrowersBL bll = new BorrowersBL();
            if (e.CommandName == "RemoveB")
            {
                int id = Convert.ToInt32(e.CommandArgument);
                bll.Delete(id);
                BindBorrowers();
                LogActivity("Borrower Removed", "Borrower has been removed", string.Empty);
            }
            else if (e.CommandName == "EditB")
            {
                int id = Convert.ToInt32(e.CommandArgument);
                Borrower model = bll.GetByID(id);
                txtBorrowerName.Text = model.Name;
                BindRegions();
                ddlBorrowerRegion.SelectedValue = model.Region;
                txtBorrowerType.Text = model.Type;
                txtGrid.Text = model.Grid;
                txtSummitCredit.Text = model.SummitCreditEntity;
                hdnBorrower.Value = model.ID.ToString();
            }

            BindBorrowers();
        }
        protected void btnBorrowerSave_Click(object sender, EventArgs e)
        {
            Borrower model = new Borrower();
            BorrowersBL bl = new BorrowersBL();
            if (txtBorrowerType.Text.Trim() == string.Empty)
            {
                RadWindowManager1.RadAlert("Name is required", 330, 180, "realedge associates", "alertCallBackFn"); return;
            }
            else
            {
                model.Type = txtBorrowerType.Text.Trim();
                model.Name = txtBorrowerName.Text.Trim();
                model.Region = ddlBorrowerRegion.SelectedValue;
                model.Grid = txtGrid.Text.Trim();
                model.SummitCreditEntity = txtSummitCredit.Text.Trim();
                if (!string.IsNullOrEmpty(hdnBorrower.Value))
                {
                    model.ID = Convert.ToInt32(hdnBorrower.Value);
                    LogActivity("Borrower Updated", "Email has been updated", string.Empty);
                }
                else
                {
                    LogActivity("Borrower Created", "Email has been created", string.Empty);
                }

                string str = bl.SaveBorrower(model);
                BindBorrowers();
                if (str != "Entry of the same Name is already exists.")
                {
                    hdnBorrower.Value = string.Empty;
                }

                RadWindowManager1.RadAlert(str, 330, 180, "realedge associates", "alertCallBackFn");
            }
        }
 private void BindBorrowers()
 {
     BorrowersBL bl = new BorrowersBL();
     grdBorrowers.DataSource = bl.GetBorrowers().OrderBy(c => c.Name).ToList();
     grdBorrowers.DataBind();
 }