Пример #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            string username    = txtusername.Text;
            string password    = txtpassword.Text;
            Form1  Application = new Form1();
            Login  LoginForm   = new Login();
            Dictionary <String, object> param = new Dictionary <string, object>();

            param.Add("Employee_login", username);
            DatabaseTable <Employees> empl = EmployeeData.getEmployees(param);

            if (!empl.Any())
            {
                MessageBox.Show("Login or password is empty");
            }
            else
            {
                var login   = empl[0].Employee_login;
                var pass    = empl[0].Employee_password;
                var isAdmin = empl[0].isAdmin;
                if (username == login && password == pass)
                {
                    emp = empl[0];
                    Close();
                }
                else
                {
                    MessageBox.Show("Login or password is incorrect");
                }
            }
        }
Пример #2
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            String     name                   = TextBox1.Text;
            String     password               = TextBox2.Text;
            AddToShift Application            = new AddToShift();
            Login      LoginForm              = new Login();
            Dictionary <String, object> param = new Dictionary <string, object>();

            param.Add("Employee_login", name);
            DatabaseTable <Employees> empl = EmployeeData.getEmployees(param);

            if (!empl.Any())
            {
                MsgBox("Add your login and password, please", this.Page, this);
            }
            else
            {
                var login   = empl[0].Employee_login;
                var pass    = empl[0].Employee_password;
                var isAdmin = empl[0].isAdmin;
                if (name == login && password == pass)
                {
                    if (isAdmin)
                    {
                        Session["employee"] = empl[0];
                        Response.Redirect("/AddToShift.aspx");
                    }
                    else
                    {
                        MsgBox("Your are not Mistr!", this.Page, this);
                    }
                }
                else
                {
                    MsgBox("Incorrect loing or password", this.Page, this);
                }
            }
        }