Example #1
0
 private void btnLogin_Click(object sender, EventArgs e)
 {
     if (cbDepartment.Text != "")
     {
         if (cbDepartment.Text == "Sales" && txtPassword.Text == "Jberger")
         {
             frmSales frmsales = new frmSales();
             frmsales.Show();
         }
         else if (cbDepartment.Text == "Finance" && txtPassword.Text == "Wvortelaars")
         {
             frmFinance frmFinance = new frmFinance();
             frmFinance.Show();
         }
         else if (cbDepartment.Text == "Development" && txtPassword.Text == "Hvanderhoek")
         {
             frmDevelopment frmdevelopment = new frmDevelopment();
             frmdevelopment.Show();
         }
         else if (cbDepartment.Text == "Admin")
         {
         }
         else
         {
             MessageBox.Show("Please enter the correct password. If you have forgotten your departments password ask one of your coworkers.");
         }
     }
     else
     {
         MessageBox.Show("Please choose your department");
     }
 }
Example #2
0
        //Initialize the data in the datagridview for the finance form.
        public void initFinance(frmFinance frmF)
        {
            //try to open a connection and execute a query
            try
            {
                //make and execute query
                string         query   = "SELECT * FROM tbl_Financial,tbl_Sales";
                SqlDataAdapter adapter = new SqlDataAdapter(query, con);

                //fill the datagridview with the results from the query
                adapter.Fill(dbSet);
                frmF.barrocDGV.DataSource          = dbSet.Tables[0];
                frmF.barrocDGV.Columns[0].ReadOnly = true;
                SetHeaderNum(frmF.barrocDGV);
            }
            //catch the exception if the connection or query fails
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
        }
Example #3
0
 private void btnLogin_Click(object sender, EventArgs e)
 {
     if (cbDepartment.Text != "")
     {
         if (cbDepartment.Text == "Sales" && txtPassword.Text == "test" && isActiveSales == false)
         {
             isActiveSales = true;
             frmSales frmsales = new frmSales();
             frmsales.Show();
             txtPassword.Text = "";
         }
         else if (cbDepartment.Text == "Finance" && txtPassword.Text == "test")
         {
             isActiveFinance = true;
             frmFinance frmFinance = new frmFinance();
             frmFinance.Show();
             txtPassword.Text = "";
         }
         else if (cbDepartment.Text == "Development" && txtPassword.Text == "test")
         {
             isActiveDevelopment = true;
             frmDevelopment frmdevelopment = new frmDevelopment();
             frmdevelopment.Show();
             txtPassword.Text = "";
         }
         else if (cbDepartment.Text == "Admin")
         {
         }
         else
         {
             MessageBox.Show("Please enter the correct password. If you have forgotten your departments password ask one of your coworkers.");
         }
     }
     else
     {
         MessageBox.Show("Please choose your department");
     }
 }