private void button1_Click(object sender, System.EventArgs e)
 {
     string login = loginBX.Text;
     string password = passBX.Text;
     string MyConString = "SERVER=localhost;" +
         "DATABASE=baza;" +
         "UID=root;";
     MySqlConnection connection = new MySqlConnection(MyConString);
     string command = "select ID, posada from pracownicy where login='******' and haslo='" + password + "';";
     MySqlDataAdapter da = new MySqlDataAdapter(command, connection);
     DataTable dt = new DataTable();
     da.Fill(dt);
     if (dt.Rows.Count > 0)
     {
         if (Convert.ToInt32(dt.Rows[0][1]) == 1)
         {
             Serw serw = new Serw(login);
             serw.Show();
             this.Hide();
         }
         else
         {
             Admin admin = new Admin();
             admin.Show();
             this.Hide();
         }
     }
 }
        private void button1_Click(object sender, EventArgs e)
        {
            f = c.login(textBox1, textBox2);                        //Login Validation
            if (f == 1)
            {
                ActiveForm.Hide();
                Admin form = new Admin();                           //Admin Login
                form.Show();
            }
            else if (f == 2)
            {
                ActiveForm.Hide();
                Booking form = new Booking(textBox1);               //Customer Login
                form.Show();
            }
            else
            {
                MessageBox.Show("Invalid Username/Password", "Login Page");
                if (textBox1.Text.Length != 0)
                {
                    textBox2.ResetText();
                    textBox2.Focus();
                }
                else
                {
                    textBox1.Focus();
                }
                using (StreamWriter w = File.AppendText("log.txt"))
                {
                    c.Log("Invalid Username/Password", w);
                }

                using (StreamReader r = File.OpenText("log.txt"))
                {
                    c.DumpLog(r);
                }
            }
        }
Ejemplo n.º 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            OleDbConnection con = new OleDbConnection();

            con.ConnectionString = ConfigurationManager.ConnectionStrings["WindowsFormsApplication2.Properties.Settings.DBfileConnectionString"].ToString();
            con.Open();
            OleDbDataAdapter da = new OleDbDataAdapter("SELECT * FROM [Admin] where [Username]='" + textBox1.Text + "' and [Password]='" + textBox2.Text + "'", con);


            da.Fill(dt);

            if (dt.Rows.Count <= 0)
            {
                MessageBox.Show("Username or Password Invalid !!");
            }

            else
            {
                MessageBox.Show("Login Successful !!");
                Admin admin_page = new Admin();
                admin_page.Show();
                this.Hide();
            }
        }
        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            Admin f = new Admin();

            f.Show();
        }
        private void Add_Gift_FormClosing(object sender, FormClosingEventArgs e)
        {
            Admin form = new Admin();

            form.Show();
        }
Ejemplo n.º 6
0
        private void Update_Search_FormClosing(object sender, FormClosingEventArgs e)
        {
            Admin form = new Admin();

            form.Show();
        }