Пример #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");
     }
 }
Пример #2
0
        //Initialize the data in the datagridview for the sales form.
        public void initSales(frmSales frmS)
        {
            //try to open a connection and execute a query
            try
            {
                //make and execute query
                string         query   = "SELECT * FROM tbl_Sales";
                SqlDataAdapter adapter = new SqlDataAdapter(query, con);

                //fill the datagridview with the results from the query
                adapter.Fill(dbSet);
                frmS.barrocDGV.DataSource          = dbSet.Tables[0];
                frmS.barrocDGV.Columns[0].ReadOnly = true;
                SetHeaderNum(frmS.barrocDGV);
            }
            //catch the exception if the connection or query fails
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
        }
Пример #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");
     }
 }