Beispiel #1
0
        public void login_Click(object sender, EventArgs e)
        {
            UserLogin     UL  = new UserLogin();
            PassLogin     PL  = new PassLogin();
            SqlConnection log = new SqlConnection();

            log.ConnectionString = @"Data Source=(localdb)\.;Initial Catalog=efloordb";
            SqlCommand logcmd = new SqlCommand("select count (*) from login where loginname=@usr and password=@pwd", log);

            logcmd.Parameters.Clear();
            logcmd.Parameters.AddWithValue("@usr", UL.userN.Text);
            logcmd.Parameters.AddWithValue("@pwd", PL.passW.Text);
            log.Open();

            if (logcmd.ExecuteScalar().ToString() == "1")
            {
                this.Hide();
                MainPage mainpage = new MainPage();
                mainpage.Show();
            }
            else
            {
                MessageBox.Show("YOU ARE NOT GRANTED WITH ACCESS");
                UL.userN.Clear();
                PL.passW.Clear();
            }
            log.Close();
        }
Beispiel #2
0
        public LoginPage()
        {
            Size                 = new Size(800, 600);
            StartPosition        = FormStartPosition.CenterScreen;
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;                   // remove title bar

            CloseButton CB = new LayoutInit.CloseButton();

            CB.closeLabel();
            this.Controls.Add(CB.closeAp);

            //UserBlock
            UserLogin UL = new UserLogin();

            UL.label();
            UL.userBox();
            Controls.Add(UL.userN);
            Controls.Add(UL.userL);
            //UserBlock end

            //PasswordBlock
            PassLogin PL = new PassLogin();

            PL.label();
            PL.passBox();
            Controls.Add(PL.passW);
            Controls.Add(PL.passWL);
            //PasswordBlock end

            //LoginButton
            LoginButton LB = new LoginButton();

            LB.loginButton();
            Controls.Add(LB.loginB);
            //LoginButton end

            ConnectButton ConnB = new ConnectButton();

            ConnB.connectButton();
            this.Controls.Add(ConnB.connectBut);
        }