Exemplo n.º 1
0
 private void RbnCheckAttendance_CheckedChanged(object sender, EventArgs e)
 {
     if (rbnCheckAttendance.Checked == true)
     {
         Form15 f15 = new Form15(this);
         f15.Show();
         rbnCheckAttendance.Checked = false;
     }
 }
Exemplo n.º 2
0
 private void BtnView_Click(object sender, EventArgs e)
 {
     if (txtUid.Text.Equals(""))
     {
         MessageBox.Show("User ID cannot be empty", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
     }
     else if (txtName.Text.Equals(""))
     {
         MessageBox.Show("User Name cannot be empty", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
     }
     else
     {
         name = txtName.Text;
         id   = txtUid.Text;
         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 [User] where id = @id and name = @name COLLATE SQL_Latin1_General_CP1_CS_AS", con);
             cmd.Parameters.AddWithValue("@name", txtName.Text.ToString());
             cmd.Parameters.AddWithValue("@id", txtUid.Text.ToString());
             SqlDataReader dr = cmd.ExecuteReader();
             if (dr.HasRows)
             {
                 Form15 f15 = new Form15(this);
                 f15.Show();
                 txtName.Clear();
                 txtUid.Clear();
                 con.Close();
             }
             else
             {
                 MessageBox.Show("Invalid User ID or name", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
                 con.Close();
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show("UNFORTUNATELY STOPPED!\nSORRY, AN UNEXPECTED ERROR OCCURED WHILE COLLECTING DATA.", "PLEASE TRY AGAIN", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
         }
     }
 }