public void Button1_Click(System.Object sender, System.EventArgs e) { string sql = default(string); DataTable Log_in = new DataTable(); try { if (txtpin.Text == "") { MessageBox.Show("Pls Enter Your Pin"); } else { // con.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + Application.StartupPath + "\\ATMsystem.accdb"; // sql = "SELECT * FROM tblinfo where pin_code = " + txtpin.Text + ""; Log_in = DataClass.Data(); //DataTable table = Log_in.Tables[0]; if (Log_in.Rows.Count > 0) { Log_in.DefaultView.RowFilter = "pin = '" + lblaccno.Text + "'"; Log_in = Log_in.DefaultView.ToTable(); } if (Log_in.Rows.Count > 0) { string balance = default(string); balance = (string)(Log_in.Rows[0]["balance"]); Receipt.Default.Show(); //Receipt.lblaccno.Text = lblaccno.Text Receipt.Default.lblbal.Text = balance; Receipt.Default.Label4.Hide(); Receipt.Default.Label3.Hide(); Receipt.Default.lbldep.Hide(); Receipt.Default.lblwith.Hide(); Receipt.Default.Label6.Hide(); Receipt.Default.lblnewbal.Hide(); this.Hide(); } else { MessageBox.Show("Pincode is incorrect"); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } txtpin.Text = ""; }
public void Button1_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 + ""; //cmd.Connection = con; //cmd.CommandText = sql; //da.SelectCommand = cmd; //da.Fill(Log_in); //Log_in.Columns.Add("balance", typeof(string)); //Log_in.Rows.Add("20000"); 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) { string balance = default(string); balance = (string)(Log_in.Rows[0]["balance"]); Receipt.Default.Show(); Receipt.Default.lblname.Text = lblname.Text; //Receipt.lblaccno.Text = lblaccno.Text Receipt.Default.lblbal.Text = balance; Receipt.Default.Label4.Hide(); Receipt.Default.Label3.Hide(); Receipt.Default.lbldep.Hide(); Receipt.Default.lblwith.Hide(); Receipt.Default.Label6.Hide(); Receipt.Default.lblnewbal.Hide(); this.Hide(); } else { MessageBox.Show("Pincode is incorrect"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void btnok_Click(System.Object sender, System.EventArgs e) { //sql = "SELECT * FROM tblinfo where Firstname=\'" + txtfname.Text + "\'" + "and Lastname= \'" + txtlname.Text + "\'"; try { //con.Open(); //da = new System.Data.OleDb.OleDbDataAdapter(sql, con); //da.Fill(dt); DataRow[] HRow = dt.Select("account_no = '" + txtAcctNo.Text + "' AND pin = '" + txtPincode.Text + "' "); DataGridView1.DataSource = DataClass.Data(); } catch (Exception ex) { Interaction.MsgBox(ex.Message, MsgBoxStyle.Information, null); } con.Close(); btnok.Enabled = false; }
public void btnupdate_Click(System.Object sender, System.EventArgs e) { //con.Open(); ////Dim ad As New OleDb.OleDbDataAdapter("select * from book", con) //sql = "UPDATE tblinfo SET account_no=\'" + txtAcctNo.Text + "\',pin_code=\'" + txtPincode.Text + "\',Firstname=\'" + txtfnme.Text + "\',Lastname=\'" + txtlnme.Text + "\',Address=\'" + txtaddr.Text + "\',Contact_no=\'" + txtcontact.Text + "\',Gender=\'" + cbGender.Text + "\'where Firstname=\'" + lblhide.Text + "\'"; //cmd.CommandText = sql; //cmd.Connection = con; //cmd.ExecuteNonQuery(); //cmd.Dispose(); MessageBox.Show("success"); //con.Close(); //Button5_Click(sender, e) DataTable dt = DataClass.Data(); DataRow[] HRow = dt.Select("account_no = '" + txtAcctNo.Text + "' AND pin = '" + txtPincode.Text + "' "); DataGridView1.DataSource = dt; DataGridView1.Refresh(); }
public void btnlogin_Click(System.Object sender, System.EventArgs e) { string sql = default(string); DataTable Log_in = new DataTable(); try { if (txtpin.Text == "") { MessageBox.Show("Pls Enter both Fields"); } else { //con.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + Application.StartupPath + "\\ATMsystem.accdb"; //sql = "SELECT * FROM tblinfo where pin_code = " + txtpin.Text + ""; //cmd.Connection = con; //cmd.CommandText = sql; //da.SelectCommand = cmd; //da.Fill(Log_in);c Log_in = DataClass.Data(); //DataTable table = Log_in.Tables[0]; if (Log_in.Rows.Count > 0) { Log_in.DefaultView.RowFilter = "pin = '" + txtpin.Text + "'"; Log_in = Log_in.DefaultView.ToTable(); } if (Log_in.Rows.Count > 0) { string Type; string Fullname = default(string); string accno = default(string); Type = (string)(Log_in.Rows[0]["user"]); Fullname = (string)(Log_in.Rows[0]["Firstname"]); accno = Convert.ToString((Log_in.Rows[0]["account_no"])); if (Type == "admin") { MessageBox.Show("Welcome " + Fullname + " you login as Administrator "); AdminForm.Default.Show(); this.Hide(); } else if (Type == "Block") { MessageBox.Show("Your account is currently Block"); MessageBox.Show("Contact the Administrator for Help"); } else { MessageBox.Show("Welcome " + Fullname); Mainmenu.Default.lblname.Text = Fullname; Mainmenu.Default.lblaccno.Text = accno; Mainmenu.Default.Show(); this.Hide(); } } else { MessageBox.Show("Yuo are Not Registered!!!"); MessageBox.Show("Pls Register if You are New!"); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } txtpin.Text = ""; }
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 + ""; //cmd.Connection = con; //cmd.CommandText = sql; //da.SelectCommand = cmd; //da.Fill(Log_in); //Log_in.Columns.Add("balance", typeof(string)); //Log_in.Rows.Add("20000"); 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 Withdraw Php 25,000"); } else if (num2 < 200) { MessageBox.Show(" Mininum withdrawal is 200"); } else if (num1 < num2) { MessageBox.Show(" Insuffiecient balance"); } else { total = num1 - num2; Receipt.Default.Show(); Receipt.Default.lblbal.Text = balance; Receipt.Default.Label4.Hide(); Receipt.Default.lbldep.Hide(); Receipt.Default.lblwith.Text = num2.ToString(); Receipt.Default.lblnewbal.Text = total.ToString(); Receipt.Default.Label5.Show(); Receipt.Default.Label6.Show(); Receipt.Default.lblbal.Show(); Receipt.Default.Label4.Hide(); Receipt.Default.lbldep.Hide(); Receipt.Default.lblwith.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 = ""; }