Esempio n. 1
0
        public void btnok_Click(System.Object sender, System.EventArgs e)
        {
            string    sql    = default(string);
            DataTable Log_in = new DataTable();

            try
            {
                //con.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + Application.StartupPath + "\\ATMsystem.accdb";
                //sql = "SELECT * FROM tblinfo where  account_no = " + lblaccno.Text + "";

                Log_in = DataClass.Data();

                //DataTable table = Log_in.Tables[0];
                if (Log_in.Rows.Count > 0)
                {
                    Log_in.DefaultView.RowFilter = "account_no = '" + lblaccno.Text + "'";
                    Log_in = Log_in.DefaultView.ToTable();
                }

                if (Log_in.Rows.Count > 0)
                {
                    balance = (string)(Log_in.Rows[0]["balance"]);
                    num1    = int.Parse(balance);
                    num2    = int.Parse(txtamount.Text);

                    if (num2 > 25000)
                    {
                        MessageBox.Show("You can Only Deposit Php 25,000!");
                    }
                    else if (num2 < 200)
                    {
                        MessageBox.Show(" Mininum Deposit is 200");
                    }
                    else
                    {
                        total = num1 + num2;

                        Receipt.Default.Show();

                        Receipt.Default.lblbal.Text = balance;
                        Receipt.Default.Label3.Hide();
                        Receipt.Default.lblwith.Hide();
                        Receipt.Default.lbldep.Text    = num2.ToString();
                        Receipt.Default.lblnewbal.Text = total.ToString();

                        Receipt.Default.Label5.Show();
                        Receipt.Default.Label6.Show();


                        Receipt.Default.lblbal.Show();
                        Receipt.Default.Label3.Hide();
                        Receipt.Default.lblwith.Hide();
                        Receipt.Default.lbldep.Show();
                        Receipt.Default.lblnewbal.Show();
                        //MsgBox("success")
                        Receipt.Default.lblname.Text = Mainmenu.Default.lblname.Text;
                        this.Hide();
                    }
                }
                else
                {
                }
            }
            catch (Exception)
            {
                MessageBox.Show(" Pls. Enter Ammount!");
                //MsgBox(ex.Message)
            }
            txtamount.Text = "";
        }