Example #1
0
        protected void BtnUpdate_Click(object sender, EventArgs e)
        {
            timeDeposit    selTD = new timeDeposit();
            timeDepositDAO updTD = new timeDepositDAO();
            int            updCnt;
            int            updRenewMode = 0;
            int            currMode     = Convert.ToInt16(ViewState["currRenewMode"]);

            if (DdlRenew.SelectedIndex == -1)
            {
                LblResult.Text      = "Please select a value";
                LblResult.ForeColor = System.Drawing.Color.Red;
            }
            else if (DdlRenew.SelectedValue == currMode.ToString())
            {
                LblResult.Text      = "You have not changed the renewal mode";
                LblResult.ForeColor = System.Drawing.Color.Red;
                BtnUpdate.Enabled   = false;
            }
            else
            {
                updRenewMode = DdlRenew.SelectedIndex;

                updCnt = updTD.updateTD(LblAcno.Text, updRenewMode);
                if (updCnt == 1)
                {
                    LblResult.Text      = "TD Renew Mode has been changed!";
                    LblResult.ForeColor = System.Drawing.Color.Black;
                }
            }
        }
Example #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Page.IsPostBack == false)
     {
         if (Session["AdminNo"] != null)
         {
             LblCustId.Text   = Session["SScustId"].ToString();
             LblCustname.Text = Session["SSCustName"].ToString();
             LblAcno.Text     = Session["SSTDAcNo"].ToString();
             timeDeposit    selTD = new timeDeposit();
             timeDepositDAO updTD = new timeDepositDAO();
             selTD                      = updTD.getTDbyAccount(LblAcno.Text);
             LblPrincipal.Text          = selTD.tdPrincipal.ToString();
             LblCustId.Text             = selTD.tdMaturedAmt.ToString();
             LblCustId.Text             = selTD.tdMaturityDte.ToString();
             DdlRenew.SelectedIndex     = selTD.tdRenewMode;
             ViewState["currRenewMode"] = selTD.tdRenewMode;
         }
         else
         {
             Response.Redirect("TermDeposit.aspx");
         }
     }
 }
Example #3
0
        protected void BtnConfirm_Click(object sender, EventArgs e)
        {
            // formulate the variables required from web form controls
            // These variables are used to assign the parameters of InsertTD method
            String tdAccount   = TbNewAcno.Text.ToString();
            String tdCustId    = LblCustId.Text.ToString();
            double tdPrincipal = Convert.ToDouble(TbPrincipal.Text.ToString());
            int    tdTerm      = Convert.ToInt32(DdlTerm.SelectedItem.Text.ToString());

            DateTime tdMaturityDte = Convert.ToDateTime(LblMaturedDte.Text);
            double   tdInterest    = Convert.ToDouble(LblInterest.Text.ToString());
            double   tdMaturedAmt  = Convert.ToDouble(LblMaturedAmt.Text);
            float    tdIntRte      = Convert.ToSingle(DdlTerm.SelectedValue);

            // complete the code

            try
            {
                int            tdRenewMode = Convert.ToInt16(DdlRenew.SelectedValue);
                timeDepositDAO fmTd        = new timeDepositDAO();
                int            insCnt      = fmTd.InsertTD(tdAccount, tdCustId, tdPrincipal, tdTerm, tdIntRte, tdMaturityDte, tdMaturedAmt, tdInterest, tdRenewMode);
                if (insCnt == 1)
                {
                    LblResult.Text = "Time Deposit Created!";
                }
                else
                {
                    LblResult.Text = "Unable to insert time deposit, please inform system administrator!";
                }
                BtnConfirm.Enabled = false;
            }
            catch (FormatException)
            {
                LblResult.Text = "Select a renewal option!";
            }
        }