예제 #1
0
        private void BtnBack_Click(object sender, EventArgs e)
        {
            Prisijungimas redirect = new Prisijungimas();

            this.Hide();
            redirect.Show();
        }
예제 #2
0
        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");
                }
            }
        }
예제 #3
0
        private void Atsijungti_Click(object sender, EventArgs e)
        {
            Cnst.alevel = -1;
            Cnst.User   = string.Empty;
            var redirect = new Prisijungimas();

            Hide();
            redirect.Show();
        }
예제 #4
0
        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;
            }
            }
        }