Пример #1
0
        private void login()
        {
            string username = usnTxtBox.Text;
            string password = passTxtBox.Text;

            query = "select * from LoginInfo where Username = N'" + username + "' and Password = N'" + password + "' ";

            config.GetSingleResult(query);
            config.GetRole(query);

            if (config.dt.Rows.Count > 0)
            {
                if (config.role == "manager")
                {
                    MainPage_Manager a = new MainPage_Manager(usnTxtBox.Text);
                    this.Hide();
                    a.ShowDialog();
                    this.Show();
                }
                else if (config.role == "scientist")
                {
                    MainPage_Scientist b = new MainPage_Scientist(usnTxtBox.Text);
                    this.Hide();
                    b.ShowDialog();
                    this.Show();
                }
            }
            else
            {
                MessageBox.Show("Account does not exist! Please contact administrator.", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }