Example #1
0
        private void button6_Click(object sender, EventArgs e)
        {
            HomeAdminP admin = new HomeAdminP();

            this.Hide();
            admin.Show();
        }
Example #2
0
        private void buttonLogin_Click(object sender, EventArgs e)
        {
            if (textBoxUsername.Text == "" || textBoxPassword.Text == "")
            {
                lblError.Text = "Toate câmpurile trebuie să fie complete!";
            }

            else
            {
                if (radioButton1.Checked)
                {
                    Important.uType = radioButton1.Text;
                }

                else
                {
                    Important.uType = radioButton2.Text;
                }

                SqlCommand check  = new SqlCommand("select COUNT(UserID) from _User where UserName = '******' and Password = '******' and UserType = '" + Important.uType + "'", Important.conex);
                int        result = Convert.ToInt32(check.ExecuteScalar().ToString());

                if (result == 1)
                {
                    if (Important.uType == "Admin")
                    {
                        HomeAdminP admin = new HomeAdminP();
                        this.Hide();
                        Important.uName = textBoxUsername.Text;
                        admin.Show();
                    }

                    else
                    {
                        HomeClientP user = new HomeClientP();
                        this.Hide();
                        Important.uName = textBoxUsername.Text;
                        user.Show();
                    }
                }

                else
                {
                    lblError.Text = "Parolă, nume de utilizator sau tip de utilizator incorecte\nCompletați casetele cu date corecte!";
                }
            }
        }