예제 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                AcerLogisics    AL = new AcerLogisics();
                Create_Account  CA = new Create_Account();
                Human_Resources HR = new Human_Resources();
                if (authenticate(txtID.Text, txtPassword.Text, ref UserID))
                {
                    //MessageBox.Show("User at " + CA.getID("SELECT * FROM Login", txtID.Text).ToString());
                    string[] tmp = getUserdet(readAEmpl, CA.getID("SELECT * FROM Login", txtID.Text)).Split(',');

                    if (tmp[2] == "Manager")
                    {
                        AL.lblUsername.Text = HR.lblUsername.Text = "Logged in as " + tmp[0] + " " + tmp[1];
                        AL.ShowDialog();
                        this.Close();
                    }
                    else if (tmp[2] == "HR")
                    {
                        HR.lblUsername.Text = "Logged in as " + tmp[0] + " " + tmp[1];
                        HR.ShowDialog();
                        this.Close();
                    }
                    else if (tmp[2] == "Administrator")
                    {
                        AL.lblUsername.Text = HR.lblUsername.Text = "Logged in as " + tmp[0] + " " + tmp[1];
                        AL.ShowDialog();
                        this.Close();
                    }
                    else if (tmp[2] == "Sales Manager")
                    {
                        (new Sales()).ShowDialog();
                    }
                }
                else
                {
                    if (txtID.Text == "Employee" || txtID.Text == "employee" && txtPassword.Text == "0000")
                    {
                        (new Graphical()).ShowDialog();
                    }
                    else
                    {
                        lblFP.Visible = true;
                        if (txtPassword.Text == string.Empty)
                        {
                            label5.Visible = true;
                        }
                        errorProvider1.SetError(txtPassword, "Invaid password");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
예제 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                AcerLogisics   AL = new AcerLogisics();
                Create_Account CA = new Create_Account();

                if (authenticate(txtID.Text, txtPassword.Text, ref UserID))
                {
                    //MessageBox.Show("User at " + CA.getID("SELECT * FROM Login", txtID.Text).ToString());
                    string[] tmp = getUserdet(readAEmpl, CA.getID("SELECT * FROM Login", txtID.Text)).Split(',');
                    AL.label1.Text = "Logged in as " + tmp[0] + " " + tmp[1];



                    if (tmp[2] == "Manager")
                    {
                        AL.ShowDialog();
                        this.Close();
                    }
                    else if (tmp[2] == "HR")
                    {
                        (new Human_Resources()).ShowDialog();
                        this.Close();
                    }
                }
                else
                {
                    errorProvider1.SetError(txtPassword, "Invaid password");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }