private void BACK_Click(object sender, EventArgs e) { this.Hide(); AdminMain ad = new AdminMain(); ad.Show(); }
private void SendRequst_Click(object sender, EventArgs e) { command.Connection = conn; conn.Open(); try { command.CommandText = "insert into orders (ID,Name,[T-size],[P-size],State) values (" + textBox2.Text + ",'" + textBox1.Text + "', '" + textBox4.Text + "', '" + textBox5.Text + "', 'W' );"; command.ExecuteNonQuery(); AdminMain ad = new AdminMain(Convert.ToInt32(textBox2.Text), textBox1.Text, textBox4.Text, textBox5.Text); conn.Close(); MessageBox.Show("Requst sent"); } catch (Exception) { conn.Close(); MessageBox.Show("You had ordered already !!!"); } }
private void LG_BUT_Click(object sender, EventArgs e) { SqlConnection conn = new SqlConnection(connectionString); SqlCommand command = new SqlCommand(); command.Connection = conn; conn.Open(); command.CommandText = "Select UserType from emp where username ='******'and Password ='******' ; "; SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { type = reader["UserType"].ToString(); } if (type.Equals("A")) { this.Hide(); AdminMain AD = new AdminMain(); AD.Show(); } else if (type.Equals("E")) { this.Hide(); UserMain2 us = new UserMain2(UserBox.Text); us.Show(); } else { MessageBox.Show("WRONG USERNAME OR PASSWORD"); } conn.Close(); }