private void BtnBack_Click(object sender, EventArgs e) { Prisijungimas redirect = new Prisijungimas(); this.Hide(); redirect.Show(); }
private void CreateAccount_Click(object sender, EventArgs e) { var query = "Select * from tblLogin Where username = '******'"; var con = new SqlDataAdapter(query, Cnst.SqlCon); var check = new DataTable(); con.Fill(check); if (check.Rows.Count > 0) { MessageBox.Show("Vartotojas tokiu prisijungimo vardu jau yra"); } else { DropList level = comboBox1.SelectedItem as DropList; string pass = txtSignInPassword.Text.Trim(); string hashPass = Cnst.ToMd5(pass); int authorization = Convert.ToInt32(level.Value); if (c) { Cnst.SqlCon.Open(); query = "INSERT INTO tblLogin (username, password, level) VALUES (@username, @password , @level)"; SqlCommand myCommand = new SqlCommand(query, Cnst.SqlCon); myCommand.Parameters.AddWithValue("@username", txtSignInName.Text); myCommand.Parameters.AddWithValue("@password", hashPass); myCommand.Parameters.AddWithValue("@level", authorization); myCommand.ExecuteNonQuery(); Cnst.SqlCon.Close(); Prisijungimas redirect = new Prisijungimas(); this.Hide(); redirect.Show(); MessageBox.Show("Priregistruota"); } } }
private void Atsijungti_Click(object sender, EventArgs e) { Cnst.alevel = -1; Cnst.User = string.Empty; var redirect = new Prisijungimas(); Hide(); redirect.Show(); }
private void button1_Click(object sender, EventArgs e) { switch (Cnst.alevel) { case 0: { var redirect = new PardavejoMeniu(); Hide(); redirect.Show(); break; } case 1: { var redirect = new SandelininkoMeniu(); Hide(); redirect.Show(); break; } case 2: { var redirect = new AdministratoriausMeniu(); Hide(); redirect.Show(); break; } default: { var redirect = new Prisijungimas(); Hide(); redirect.Show(); break; } } }