public FormDeleteUser(Form10 form10, Form2 form2) { InitializeComponent(); f10 = form10 as Form10; f2 = form2 as Form2; serialPort1.BaudRate = 9600; serialPort1.PortName = "COM3"; serialPort1.Open(); }
private void BtnLogin_Click(object sender, EventArgs e) { if (txtName.Text == "") { MessageBox.Show("Name cannot be empty", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly); } else if (txtPassword.Text == "") { MessageBox.Show("Password cannot be empty", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly); } else { try { SqlConnection con = new SqlConnection("Data Source=(LocalDB)\\MSSQLLocalDB;AttachDbFilename=C:\\Users\\Pbs\\source\\repos\\CorporateCoders\\CorporateCoders\\Database1.mdf;Integrated Security=True"); con.Open(); SqlCommand cmd = new SqlCommand("select *from [Admin] where Name = @name COLLATE SQL_Latin1_General_CP1_CS_AS and Password = @password COLLATE SQL_Latin1_General_CP1_CS_AS", con); cmd.Parameters.AddWithValue("@name", txtName.Text.ToString()); cmd.Parameters.AddWithValue("@password", txtPassword.Text.ToString()); SqlDataReader dr = cmd.ExecuteReader(); if (dr.HasRows) { con.Close(); uname = txtName.Text.ToString(); psd = txtPassword.Text.ToString(); Form10 form = new Form10(this); form.Show(); } else { MessageBox.Show("Invalid Admin Name or Password", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly); } con.Close(); } catch (Exception ex) { MessageBox.Show("UNFORTUNATELY STOPPED!\nAN UNEXPECTED ERROR OCCURED DURING LOGIN.", "PLEASE TRY AGAIN", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly); } } }
public ViewAttendance(Form10 form10, Form2 form2) { f10 = form10 as Form10; f2 = form2 as Form2; InitializeComponent(); }
public ViewAdmin(Form10 form10) { f10 = form10 as Form10; InitializeComponent(); }
public Form11(Form10 form10, Form2 form2) { f10 = form10 as Form10; f2 = form2 as Form2; InitializeComponent(); }
public FormNewAdmin(Form form2, Form form10) { f2 = form2 as Form2; f10 = form10 as Form10; InitializeComponent(); }
public DeleteAdmin(Form10 form10, Form2 form2) { InitializeComponent(); f10 = form10 as Form10; f2 = form2 as Form2; }