Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string custId = string.Empty;

            if (!Page.IsPostBack)
            {
                // Assign session variables for customer Id and Name
                if (Session["SScustId"] != null)
                {
                    LblCustId.Text   = Session["SScustId"].ToString();
                    LblCustname.Text = Session["SScustName"].ToString();
                }

                // Instantiate the TDRate class to invoke the GetCurrentRate() method.
                // Instantiate a list to store the TDRate records.
                TDRate        tdRate   = new TDRate();
                List <TDRate> rateList = tdRate.GetCurrentRate();

                DdlTerm.Items.Clear();
                DdlTerm.Items.Insert(0, new ListItem("--Select--", "0"));
                //AppendDataBoundItems property allows you to add items to the ListControl object before data binding occurs.
                DdlTerm.AppendDataBoundItems = true;

                // set Term as the dropdown list text and intRate as the dropdown list values
                // set the rateList as the DataSource and invoked the DataBind() method.
                DdlTerm.DataTextField  = "Term";
                DdlTerm.DataValueField = "IntRate";
                DdlTerm.DataSource     = rateList;
                DdlTerm.DataBind();
            }
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string custId = string.Empty;

            if (Page.IsPostBack == false)
            {
                // step 1: Assign session variables to the respective label for customer NRIC and Name
                // compete the code
                if (Session["SScustId"] != null)
                {
                    LblCustId.Text   = Session["SScustId"].ToString();
                    LblCustname.Text = Session["SScustName"].ToString();
                }

                // step 2: Instantiate the interestRte class to a new instance named as fmTdRte
                //         Instantiate the array list to hold list of TD term and rate
                //         Invole getCurrentTdRte method to obtain the interest rate by term
                // complete the code
                InterestRteDAO     fmTdRte   = new InterestRteDAO();
                List <interestRte> TdRteList = new List <interestRte>();



                // Step 3: propogate tdTerm as dropdown list text , propogate intRte as dropdown list value
                DdlTerm.Items.Clear();
                DdlTerm.Items.Insert(0, new ListItem("--Select--", "0"));
                //AppendDataBoundItems property allows you to add items to the ListControl object before data binding occurs.
                DdlTerm.AppendDataBoundItems = true;

                DdlTerm.DataTextField  = "tdTerm";
                DdlTerm.DataValueField = "intRte";
                DdlTerm.DataSource     = TdRteList;
                DdlTerm.DataBind();
            }
        }