private void buttonEditCont_Click(object sender, EventArgs e) { if (textBoxEditPass.Text != textBoxEditReType.Text) { MessageBox.Show("Password don't Match"); textBoxEditPass.Text = string.Empty; textBoxEditReType.Text = string.Empty; } else if (textBoxEditUser.Text == "" || textBoxEditReType.Text == "" || textBoxEditPass.Text == "" || comboBoxEditSecQuest.Text == "" || textBoxEditAns.Text == "") { MessageBox.Show("Please fill the empty fields"); } else { con.Open(); SqlCommand cmd = con.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "UPDATE authenTab SET Username = '******', Password = '******', SecurrityQuestion = '" + comboBoxEditSecQuest.Text + "', Answer = '" + textBoxEditAns.Text + "' WHERE EmployeeID = '" + labelEditEmpId.Text + "'"; cmd.ExecuteNonQuery(); con.Close(); MessageBox.Show("Done...."); this.Visible = false; ShowInTaskbar = false; FormAdminDash add = new FormAdminDash(); add.Show(); } }
private void button1_Click(object sender, EventArgs e) { this.Visible = false; ShowInTaskbar = false; FormAdminDash dash = new FormAdminDash(); dash.Show(); }
private void buttonCont_Click(object sender, EventArgs e) { SqlCommand cm = new SqlCommand("Select * from authenTab where Username = @Username", con); cm.Parameters.AddWithValue("@Username", textBoxUser.Text); con.Open(); SqlDataAdapter adapt = new SqlDataAdapter(cm); DataSet ds = new DataSet(); adapt.Fill(ds); con.Close(); int count = ds.Tables[0].Rows.Count; if (count == 1) { MessageBox.Show("Username already exist!"); con.Close(); textBoxUser.Text = string.Empty; textBoxUser.Focus(); } else if (textBoxPass.Text != textBoxReType.Text) { MessageBox.Show("Password don't Match"); textBoxPass.Text = string.Empty; textBoxReType.Text = string.Empty; } else if (textBoxUser.Text == "" || textBoxReType.Text == "" || textBoxPass.Text == "" || comboBoxSecQuest.Text == "" || textBoxAns.Text == "") { MessageBox.Show("Please fill the empty fields"); } else { con.Open(); SqlCommand cmd = con.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "INSERT INTO authenTab VALUES ( '" + labelEmpId.Text + "', '" + labelFullname.Text + "', '" + textBoxUser.Text + "', '" + textBoxPass.Text + "' , '" + comboBoxSecQuest.Text + "', '" + textBoxAns.Text + "')"; cmd.ExecuteNonQuery(); con.Close(); MessageBox.Show("Done...."); this.Visible = false; ShowInTaskbar = false; FormAdminDash add = new FormAdminDash(); add.Show(); } }
private void buttonLog_Click(object sender, EventArgs e) { if (labelType.Text == "Admin") { this.Hide(); ShowInTaskbar = false; FormAdminDash admin = new FormAdminDash(); admin.Show(); } else if (labelType.Text == "Cashier") { this.Hide(); ShowInTaskbar = false; FormUserProfile wel = new FormUserProfile(); wel.Show(); } }
private void button1_Click_1(object sender, EventArgs e) { if (textBox1.Text == "") { MessageBox.Show("Please Input your Id Number"); textBox1.Focus(); return; } try { SqlConnection con = new SqlConnection(cs); SqlCommand cmd = new SqlCommand("Select * from addEmp2 where EmployeeId = @EmployeeId", con); cmd.Parameters.AddWithValue("@EmployeeId", textBox1.Text); con.Open(); SqlDataAdapter adapt = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); adapt.Fill(ds); con.Close(); int count = ds.Tables[0].Rows.Count; if (count == 1) { attempt = 0; passingId = textBox1.Text; this.Visible = false; ShowInTaskbar = false; introForm use = new introForm(); use.Show(); } else if (textBox1.Text == "10") { this.Visible = false; ShowInTaskbar = false; FormAdminDash ad = new FormAdminDash(); ad.Show(); } else if ((attempt == 3) && (attempt > 0)) { MessageBox.Show("Record Not Found!"); MessageBox.Show("You Have Only " + Convert.ToString(attempt) + " Attempt Left To Try"); --attempt; textBox1.Text = string.Empty; textBox1.Focus(); } else if (attempt <= 0) { this.Visible = false; ShowInTaskbar = false; timerForm time = new timerForm(); time.Show(); } else { MessageBox.Show("Record not found!"); MessageBox.Show("You Have Only " + Convert.ToString(attempt) + " Attempt Left To Try"); --attempt; textBox1.Text = string.Empty; textBox1.Focus(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }