コード例 #1
0
ファイル: Form1.cs プロジェクト: GroupRadius2/Barroc-IT
        private void button1_Click(object sender, EventArgs e)
        {
            Database.GetInstance().CloseConnection();
            Database.GetInstance().OpenConnection();

            switch (comboBox1.Text)
            {
            case "Finance":
                if (textBox2.Text == psF)
                {
                    FormFinance finance = new FormFinance();
                    finance.Show();
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("Invalid login credentials");
                }
                break;

            case "Development":
                if (textBox2.Text == psD)
                {
                    Development d = new Development();
                    d.Show();
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("Invalid login credentials");
                }
                break;

            case "Sales":
                if (textBox2.Text == psS)
                {
                    Sales_dash SD = new Sales_dash();
                    SD.Show();
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("Invalid login credentials");
                }
                break;

            default:
                MessageBox.Show("Invalid login credentials");
                break;
            }
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: GroupRadius2/Barroc-IT
        private void textBox2_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                switch (comboBox1.Text)
                {
                case "Finance":
                    if (textBox2.Text == psF)
                    {
                        MainForm mf = new MainForm();
                        mf.Show();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("Invalid login credentials");
                    }
                    break;

                case "Development":
                    if (textBox2.Text == psD)
                    {
                        Development d = new Development();
                        d.Show();
                        this.Hide();
                    }
                    else
                    {
                        MessageBox.Show("Invalid login credentials");
                    }
                    break;

                case "Sales":
                    if (textBox2.Text == psS)
                    {
                        Sales_dash SD = new Sales_dash();
                        SD.Show();
                        this.Hide();
                    }
                    else
                    {
                        MessageBox.Show("Invalid login credentials");
                    }
                    break;

                default:
                    MessageBox.Show("Invalid login credentials");
                    break;
                }
            }
        }
コード例 #3
0
ファイル: FormLogin.cs プロジェクト: GroupRadius2/Barroc-IT
        private void CheckLogin()
        {
            //database.Query("SELECT HASHBYTES('SHA', @a_password)");
            //database.AddParameter("@a_password", textBoxPassword.Text);

            database.Query("SELECT COUNT(*) FROM tbl_accounts WHERE a_username = @a_username AND a_password = @a_password;");
            database.AddParameter("@a_username", comboBoxDepartments.SelectedItem.ToString());
            database.AddParameter("@a_password", textBoxPassword.Text);

            if ((int)database.ExecuteQuery() > 0)
            {
                switch (comboBoxDepartments.SelectedItem.ToString().ToUpper())
                {
                case "FINANCE":
                    FormFinance finance = new FormFinance();
                    finance.Show();
                    break;

                case "SALES":
                    Sales_dash sales = new Sales_dash();
                    sales.Show();
                    break;

                case "DEVELOPMENT":
                    Development dev = new Development();
                    dev.Show();
                    break;

                default:
                    break;
                }
            }
            else
            {
                MessageBox.Show("Invalid login details...");
            }
        }