private void button5_Click(object sender, EventArgs e) { this.Close(); Principle p = new Principle(); p.Show(); }
private void button1_Click(object sender, EventArgs e) { con = new SqlConnection(@"Data Source=31.147.204.119\PISERVER,1433;Initial Catalog=17075i_DB;Persist Security Info=True;User ID=17075i_User;Password=Gjrwxk63"); if (con.State == ConnectionState.Open) { con.Close(); } con.Open(); if (txt_Username.Text != "" && txt_Password.Text != "") { str = "SELECT COUNT(*) FROM [user] WHERE username = '******' AND password = '******'"; utype1 = "SELECT type FROM [user] WHERE username = '******' AND password = '******'"; SqlCommand sc = new SqlCommand(utype1, con); sc.ExecuteNonQuery(); utype = sc.ExecuteScalar().ToString(); sda = new SqlDataAdapter(str, con); dt = new DataTable(); sda.Fill(dt); if (dt.Rows.Count > 0) { if (utype == "administrator") { this.Hide(); Principle it = new Principle(); it.Show(); //MessageBox.Show("Welcome back " + txt_Username.Text); } else { this.Hide(); Client c = new Client(); c.Show(); //MessageBox.Show("Welcome back " + txt_Username.Text); } } else { MessageBox.Show("Username or Password is INCORRECT!!!"); } } else { MessageBox.Show("Please enter a Username and a Password."); } }
private void button5_Click(object sender, EventArgs e) { const string m = "Please confirm closing the Items Form"; const string cap = "EXIT FORM"; var result = MessageBox.Show(m, cap, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { this.Hide(); Principle p = new Principle(); p.Show(); } else { } }
private void button1_Click(object sender, EventArgs e) { if (Form1.utype == "administrator") { this.Hide(); Principle p = new Principle(); p.Show(); } else { const string m = "Please confirm closing the system?"; const string cap = "Closing FORM."; var result = MessageBox.Show(m, cap, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { Application.Exit(); } else { } } }