Пример #1
0
        private void loginButton_Click(object sender, EventArgs e)
        {
            //connect to SQL database
            SqlConnection  con = new SqlConnection("Data Source=LAPTOP-0RU2PM09;Initial Catalog=Stock;Integrated Security=True");
            SqlDataAdapter sda = new SqlDataAdapter(@"SELECT *
                                                   FROM [dbo].[Login] where UserName = '******' and Password = '******' ", con);
            DataTable      dt  = new DataTable();

            sda.Fill(dt);
            //if the username and password is wrong, the dt has a value of null

            //TO-DO: ckecklogin detail
            if (dt.Rows.Count == 1)
            {
                this.Hide();
                StockMain main = new StockMain();
                main.Show();
            }
            else
            {
                UserNameTextBox.Clear();
                passwordTextBox.Clear();
                MessageBox.Show("Incorrect username and password", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            //TO-DO check user pass
            string hostname;

            hostname = System.Net.Dns.GetHostName();
            string         connection = "Data Source=" + hostname + "\\SQLEXPRESS;Initial Catalog=Stock;Integrated Security=True";
            SqlConnection  con        = new SqlConnection(connection);
            SqlDataAdapter sda        = new SqlDataAdapter(@"SELECT * 
                     FROM [dbo].[Login] Where userName='******' and Password='******'", con);
            DataTable      dt         = new DataTable();

            sda.Fill(dt);
            if (dt.Rows.Count == 1)
            {
                this.Hide();
                StockMain main = new StockMain();
                main.Show();
            }
            else
            {
                MessageBox.Show("Wrong Username or Password", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                button1_Click(sender, e);
            }
        }
Пример #3
0
        private void LoginButton_Click(object sender, EventArgs e)
        {
            //TO DO: Check Login UserName & Password

            SqlConnection con = new SqlConnection("Data Source = .\\SQLEXPRESS;Initial Catalog=Stock;Integrated Security=True");

            SqlDataAdapter sda = new SqlDataAdapter(@"SELECT *
                                                     FROM [dbo].[Login] where UserName = '******' and Password = '******'", con);

            DataTable dt = new DataTable();

            sda.Fill(dt);

            if (dt.Rows.Count == 1)
            {
                this.Hide();
                StockMain main = new StockMain();
                main.Show();
            }

            else
            {
                MessageBox.Show("Invalid Username & Password..", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                ClearButton_Click(sender, e);
            }
        }
        private void galvenāLapaToolStripMenuItem_Click(object sender, EventArgs e)
        {
            StockMain pro = new StockMain();

            this.Hide();
            pro.Show();
        }
Пример #5
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            SqlConnection con = new SqlConnection(@"Data Source=w10\SQLEXPRESS;Initial Catalog=Stock;Integrated Security=True");

            if (con.State == ConnectionState.Closed)
            {
                con.Open();
            }

            SqlDataAdapter sda = new SqlDataAdapter(@"SELECT *
                FROM [Stock].[dbo].[Login] Where UserName='******' and Password='******'", con);
            DataTable      dt  = new DataTable();

            sda.Fill(dt);
            if (dt.Rows.Count > 0)
            {
                this.Hide();
                StockMain main = new StockMain();
                main.Show();
            }
            else
            {
                MessageBox.Show("Invalid UserName & Password", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            if (con.State == ConnectionState.Open)
            {
                con.Close();
            }
        }
Пример #6
0
        private void btn_Login_Click(object sender, EventArgs e)
        {
            try
            {
                SqlConnection  con = new SqlConnection("Data Source=.;Initial Catalog=Stock;Integrated Security=True");
                SqlDataAdapter sda = new SqlDataAdapter(@"Select * from Login
                                                     where username='******' and userpassword = '******'", con);

                DataTable dt = new DataTable();
                sda.Fill(dt);

                if (dt.Rows.Count == 1)
                {
                    StockMain sm = new StockMain();
                    sm.Show();
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("Invalid User Name Or Password.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    btn_Clear_Click(sender, e);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #7
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            //To-DO: Check UserName and Password
            SqlConnection con = Connection.GetConnection();

            //SqlDataAdapter automatically opens and closes a connection
            SqlDataAdapter sda = new SqlDataAdapter(@"SELECT * FROM [dbo].[Login] 
                                                    Where [UserName] = '" + txtUserName.Text + "' and [Passsword] = '" + txtPassword.Text + "'", con);
            DataTable      dt  = new DataTable();

            sda.Fill(dt);
            if (dt.Rows.Count == 1)
            {
                this.Hide();//this will hide Login Form

                //This will open Stock Main Form
                StockMain main = new StockMain();
                main.Show();
            }
            else
            {
                MessageBox.Show("Invalid UserName and Password..!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                btnClear_Click(sender, e);
            }
        }
Пример #8
0
        private void button2_Click(object sender, EventArgs e)
        {
            //to do validation from database
            MySqlConnection con = new MySqlConnection("server = localhost; user id = root; database = stock; password= admin");

            con.Open();
            MySqlCommand     cmd = new MySqlCommand("select * from login where username ='******' and password='******'", con);
            MySqlDataAdapter adp = new MySqlDataAdapter(cmd);
            DataTable        dt  = new DataTable();

            adp.Fill(dt);

            if (dt.Rows.Count == 1)
            {
                this.Hide();
                StockMain main = new StockMain();
                main.Show();
            }
            else
            {
                MessageBox.Show("Invalid username & password", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                button1_Click(sender, e); // after clicking ok textbox will be reset
            }
            con.Close();
        }
Пример #9
0
        private void bunifuThinButton21_Click(object sender, EventArgs e)
        {
            StockMain main = new StockMain();

            main.StartPosition = FormStartPosition.CenterScreen;
            main.Show();
            this.Hide();
        }
Пример #10
0
        private void button2_Click(object sender, EventArgs e)
        {
            SqlConnection  con = new SqlConnection("Data Source=,;Initial Catalog=Stock;Integrated Security=True");
            SqlDataAdapter sda = new SqlDataAdapter(@"SELECT * FROM [Stock].[dbo].[Login] where UserName ='******'and Password ='******'", con);
            DataTable      dt  = new DataTable();

            sda.Fill(dt);
            this.Hide();
            StockMain main = new StockMain();

            main.Show();
        }
Пример #11
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            //to check login username and password



            if (txtUsername.Text == "admin" && txtPassword.Text == "admin@123")
            {
                this.Hide();
                StockMain main = new StockMain();
                main.Show();
            }
            else
            {
                MessageBox.Show("Invalid Username and Password!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #12
0
        private void button2_Click(object sender, EventArgs e)
        {
            con = Connection.GetConnection();
            SqlDataAdapter sql = new SqlDataAdapter("Select * From Stock.dbo.Login Where Username = '******' and Password ='******'", con);
            DataTable      dt  = new DataTable();

            sql.Fill(dt);
            if (dt.Rows.Count == 1)
            {
                this.Hide();
                StockMain stockMain = new StockMain();
                stockMain.Show();
            }
            else
            {
                MessageBox.Show("Hatalı kullanıcı giris ya da şifre", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error);
                button1_Click(sender, e);
            }
        }
Пример #13
0
        private void button2_Click(object sender, EventArgs e)
        {
            SqlConnection  conn    = StockMain.conn;
            SqlDataAdapter adaptor = new SqlDataAdapter(@"SELECT [Username],[Password] FROM[dbo].[Login] WHERE Username='******' AND Password='******'", conn);
            DataTable      dt      = new DataTable();

            adaptor.Fill(dt);
            if (dt.Rows.Count == 1)
            {
                this.Hide();
                StockMain main = new StockMain();
                main.Show();
            }
            else
            {
                MessageBox.Show("User Not found!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                button1_Click(sender, e);
            }
        }
Пример #14
0
        private void button2_Click(object sender, EventArgs e)
        {
            SqlConnection  con = new SqlConnection(@"Data Source=DESKTOP-EHPHUUP\SQLEXPRESS;Initial Catalog=Stock;Integrated Security=True");
            SqlDataAdapter sda = new SqlDataAdapter(@"SELECT * FROM[Stock].[dbo].[Login] WHERE UserName = '******' and Password = '******'", con);
            DataTable      dt  = new DataTable();

            sda.Fill(dt);
            if (dt.Rows.Count == 1)
            {
                this.Hide();
                StockMain main = new StockMain();
                main.Show();
            }
            else
            {
                MessageBox.Show("Invalid User Name & Password...!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                button1_Click(sender, e);
            }
        }
Пример #15
0
        private void button2_Click(object sender, EventArgs e)
        {
            //TO-DO : check login username and password;
            SqlConnection  conn = new SqlConnection("Data Source=.;Initial Catalog=Stock;Integrated Security=True");
            SqlDataAdapter sda  = new SqlDataAdapter(@"SELECT * FROM[Stock].[dbo].[Login] WHERE Username = '******' and Password = '******'", conn);
            DataTable      dt   = new DataTable();

            sda.Fill(dt);
            if (dt.Rows.Count == 1)
            {
                this.Hide();
                StockMain main = new StockMain();
                main.Show();
            }
            else
            {
                MessageBox.Show("Invalid Username & Password ..!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #16
0
        private void button1_Click(object sender, EventArgs e)
        {
            SqlConnection  conn = new SqlConnection("Data Source=DESKTOP-AV3FS03\\REDASQL;Initial Catalog=Stock;Integrated Security=True");
            SqlDataAdapter sda  = new SqlDataAdapter("SELECT * FROM Login WHERE UserName='******' AND PassWord='******'", conn);
            DataTable      dt   = new DataTable();

            sda.Fill(dt);
            if (dt.Rows.Count == 1)
            {
                this.Hide();
                StockMain main = new StockMain();
                main.Show();
            }
            else
            {
                MessageBox.Show("vérifier votre login or password", "Ereur", MessageBoxButtons.OK, MessageBoxIcon.Error);
                button2_Click(sender, e);
            }
        }
Пример #17
0
        private void BtnLogin_Click(object sender, EventArgs e)
        {
            SqlConnection  con = new SqlConnection("Data Source=DESKTOP-NB4JB3D;Initial Catalog=Stock;Integrated Security=True");
            SqlDataAdapter sda = new SqlDataAdapter(@"SELECT * FROM [Stock].[dbo].[Login] Where UserName = '******' and Password = '******'", con);
            DataTable      dt  = new DataTable();

            sda.Fill(dt);
            if (dt.Rows.Count == 1)
            {
                this.Hide();
                StockMain main = new StockMain();
                main.Show();
            }
            else
            {
                MessageBox.Show("Invalid User Name Or Password", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                BtnClear_Click(sender, e);
            }
        }
Пример #18
0
        private void loginButton_Click(object sender, EventArgs e)
        {
            //TODO: Check login username & Password
            SqlConnection  con = new SqlConnection("Data Source = localhost; Initial Catalog = Stock; Integrated Security = True");
            SqlDataAdapter sda = new SqlDataAdapter(@"SELECT * FROM [dbo].[Login] Where UserName='******' and Password='******'", con);
            DataTable      dt  = new DataTable();

            sda.Fill(dt);
            if (dt.Rows.Count == 1)
            {
                this.Hide();
                StockMain main = new StockMain();
                main.Show();
            }
            else
            {
                MessageBox.Show("Nepareizs lietotājvārds un/vai parole", "Pieslēgšanās neveiksmīga", MessageBoxButtons.OK, MessageBoxIcon.Error);
                clearButton_Click(sender, e);
            }
        }
Пример #19
0
        private void button2_Click(object sender, EventArgs e)
        {
            SqlConnection  con = Connection.GetConnection();
            SqlDataAdapter sda = new SqlDataAdapter(@"SELECT *
  FROM[dbo].[Login] WHERE UserName = '******' and Password = '******'", con);
            DataTable      dt  = new DataTable();

            sda.Fill(dt);
            if (dt.Rows.Count == 1)
            {
                this.Hide();
                StockMain main = new StockMain();
                main.Show();
            }
            else
            {
                MessageBox.Show("Invalid Username & Password..!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                button1_Click(sender, e);
            }
        }
Пример #20
0
        private void button2_Click(object sender, EventArgs e)
        {//check login  Username and Passward
            SqlConnection  con = new SqlConnection("Data Source=LIN330168;Initial Catalog=Stock;Integrated Security=True");
            SqlDataAdapter sda = new SqlDataAdapter(@"SELECT* FROM [Stock].[dbo].[Login] Where UserName='******' and Passward='" + tb_Pass.Text + "'", con);

            DataTable dt = new DataTable();

            sda.Fill(dt);
            if (dt.Rows.Count == 1)
            {
                this.Hide();
                StockMain main = new StockMain();
                main.Show();
            }
            else
            {
                MessageBox.Show("Invalid UserName or Passward", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                button1_Click(sender, e);
            }
        }
Пример #21
0
        private void button2_Click(object sender, EventArgs e)
        {
            // TO-DO: Check Login username & password
            SqlConnection  con = new SqlConnection("Data Source =.; Initial Catalog = Stock; Integrated Security = True");
            SqlDataAdapter sda = new SqlDataAdapter("SELECT * FROM[dbo].[Login] WHERE[UserName] = '" + textBox1.Text + "' AND[Password] = '" + textBox2.Text + "'", con);
            DataTable      dt  = new DataTable();

            sda.Fill(dt);

            if (dt.Rows.Count == 1)
            {
                this.Hide();
                StockMain main = new StockMain();
                main.Show();
            }
            else
            {
                MessageBox.Show("Invalid username & password", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Clear();
            }
        }
Пример #22
0
        private void button2_Click(object sender, EventArgs e)
        {
            //First Validation of UserName And Password
            SqlConnection  con = new SqlConnection("Data Source=(local);Initial Catalog=Stock;Integrated Security=True");
            SqlDataAdapter sda = new SqlDataAdapter("select * from [Stock].[dbo].[Login] where UserName='******' and Password='******'", con);
            DataTable      dt  = new DataTable();

            sda.Fill(dt);
            if (dt.Rows.Count == 1)
            //After Connection
            {
                this.Hide();
                StockMain main = new StockMain();
                main.Show();
            }
            else
            {
                MessageBox.Show("Invalid User Name or Password...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                button1_Click(sender, e);
            }
        }
Пример #23
0
        private void btn_login_Click(object sender, EventArgs e)
        {
            //check login username and password
            SqlConnection  con = new SqlConnection("Data Source = HP_07; Initial Catalog = test; Integrated Security = True");
            SqlDataAdapter sda = new SqlDataAdapter(@"SELECT * FROM [test].[dbo].[Login] Where UserName = '******' and Password = '******'", con);

            DataTable dt = new DataTable();

            sda.Fill(dt);
            if (dt.Rows.Count == 1)
            {
                this.Hide();
                StockMain main = new StockMain();
                main.Show();
            }
            else
            {
                MessageBox.Show("등록되지않은 아이디와 비밀번호입니다.", "error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                btn_Clear_Click(sender, e);//클리어처리
            }
        }
Пример #24
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            //TO-DO check login user name & password
            SqlConnection  con = new SqlConnection("Data Source=.;Initial Catalog=Stock;Integrated Security=True");
            SqlDataAdapter sda = new SqlDataAdapter(@"SELECT * FROM [Stock].[dbo].[Login] Where UserName = '******' and Password = '******'", con);
            DataTable      dt  = new DataTable();

            sda.Fill(dt);

            //Check condition access
            if (dt.Rows.Count == 1 || dt.Rows.Count == 2 || dt.Rows.Count == 3)
            {
                this.Hide();
                StockMain main = new StockMain();
                main.Show(); //Go to stock main page
            }
            else
            {
                MessageBox.Show("Invalid User Name & Password...!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #25
0
        private void button2_Click(object sender, EventArgs e)
        {
            //to do Check whether login & password are correct or not
            SqlConnection  con = new SqlConnection(@"Data Source=.\SQLEXPRESS;Initial Catalog=stock;Integrated Security=True");
            SqlDataAdapter sda = new SqlDataAdapter(@"SELECT *
                                 FROM[dbo].[Login] where UserName = '******' and Password = '******'", con);
            DataTable      dt  = new DataTable();

            sda.Fill(dt);
            if (dt.Rows.Count == 1)
            {
                this.Hide();
                StockMain main = new StockMain();
                main.Show();
            }
            else
            {
                MessageBox.Show("Invalid Login ID and Password", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                button1_Click(sender, e);
            }
        }
Пример #26
0
        private void Login_btn_Click(object sender, EventArgs e)
        {
            //TO-DO: Check login username & password
            SqlConnection  con = new SqlConnection("Data Source=DESKTOP-HL4H91B\\HILLEYSTONE;Initial Catalog=Stock;Integrated Security=True");
            SqlDataAdapter sda = new SqlDataAdapter(@"SELECT *
                FROM [Stock].[dbo].[Login] Where UserName='******' and Password='******'", con);
            DataTable      dt  = new DataTable();

            sda.Fill(dt);
            if (dt.Rows.Count == 1)
            {
                this.Hide();
                StockMain main = new StockMain();
                main.Show();
            }
            else
            {
                MessageBox.Show("Invalid User Password..!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Clear_btn_Click(sender, e);
            }
        }
Пример #27
0
        private void login_btn_Click(object sender, EventArgs e)
        {
            //SqlConnection con = new SqlConnection(@"Data Source=DESKTOP-BJH69LU\ASHISSQL;Initial Catalog=Stock;Integrated Security=True");
            SqlConnection  con = MyConnection.GetConnection();
            SqlDataAdapter sda = new SqlDataAdapter(@"SELECT * FROM[dbo].[tbl_login] WHERE username = '******' AND password = '******'", con);
            DataTable      dt  = new DataTable();

            sda.Fill(dt);
            //CTRL + KD To align
            if (dt.Rows.Count == 1)
            {
                this.Hide();
                StockMain main = new StockMain();
                main.Show();
            }
            else
            {
                MessageBox.Show("Invalid login details", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                clear_btn_Click(sender, e);
            }
        }
Пример #28
0
        private void button2_Click(object sender, EventArgs e)
        {
            //TO-DO: Check login username & Password
            SqlConnection  connection     = Connection.GetConnection();
            SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(@"SELECT *
                FROM [Stock].[dbo].[Login] Where UserName='******' and Password='******'", connection);
            DataTable      dataTable      = new DataTable();

            sqlDataAdapter.Fill(dataTable);
            if (dataTable.Rows.Count == 1)
            {
                this.Hide();
                StockMain main = new StockMain();
                main.Show();
            }
            else
            {
                MessageBox.Show("Insertar un usuario o constraseña valida..!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                button1_Click(sender, e);
            }
        }
Пример #29
0
        private void button2_Click(object sender, EventArgs e)
        {
            //TO-DO: Check login username & Password
            SqlConnection  con = new SqlConnection("Data Source=DESKTOP-SAS60FL;Initial Catalog=Stock;Integrated Security=True");
            SqlDataAdapter sda = new SqlDataAdapter(@"SELECT *
                FROM[dbo].[Login] where UserName = '******' and Password = '******'", con);
            DataTable      dt  = new DataTable();

            sda.Fill(dt);
            if (dt.Rows.Count == 1)
            {
                Hide();
                StockMain main = new StockMain();
                main.Show();
            }
            else
            {
                MessageBox.Show("Invalid UserName & Password/用户名&密码错误!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                button1_Click(sender, e);
            }
        }
Пример #30
0
        private void button2_Click(object sender, EventArgs e)
        {
            //TO.DO: Check login username & password. Utilisateur et le mot de passe de l'administrateur
            SqlConnection  con = Connection.GetConnection();
            SqlDataAdapter sda = new SqlDataAdapter(@"SELECT *
               FROM[dbo].[Login] WHERE UserName ='******' AND Password ='******'", con);
            DataTable      dt  = new DataTable();

            sda.Fill(dt);
            if (dt.Rows.Count == 1) // si la condition est juste cela renvoie la reponse 1 soit le booleen true qui est egal 1
            {
                this.Hide();        // la meme fonction qui indique ou se on se trouve dans le projet
                StockMain main = new StockMain();
                main.Show();
            }
            else
            {
                MessageBox.Show("Invalide Username & Password..!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                button1_Click(sender, e);
            }
        }