Ejemplo n.º 1
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            //check if the user has provided all the input fields, if not set error.
            if (txtUserName.Text.Trim() == "" || txtPassword.Text.Trim() == "")
            {
                if (txtUserName.Text.Trim() == "")
                {
                    errLogin.SetError(txtUserName, "Cannot be empty");
                }
                if (txtPassword.Text.Trim() == "")
                {
                    errLogin.SetError(txtPassword, "Cannot be empty");
                }
            }
            else
            {
                //if user has provided both fields
                DataTable dt = new DataTable();

                //Check from the database if the username and passeord exist
                dt = infinitrack_userTableAdapter.GetUser(txtUserName.Text.Trim(), txtPassword.Text.Trim());

                //if exists get the access level and employee number and show user dashboard
                if (dt.Rows.Count == 1)
                {
                    Employee.SetAccess(dt.Rows[0]["Access_Level"].ToString().ToUpper());
                    Employee.SetEmployeeID(dt.Rows[0]["Employee_ID"].ToString().ToUpper());
                    this.Close();
                    frmUserDashboard userDashboard = new frmUserDashboard();
                    userDashboard.Show();
                }
                else
                {
                    //show error panel
                    pnlError.Show();
                }
            }
        }
Ejemplo n.º 2
0
 //public async Task ClosePreviousAsync(Form form)
 //{
 //    await Task.Delay(1);
 //    form.Close();
 //}
 //Navigate to other pages based in menuselection
 internal static void Navigate(Form source, string menuSelection)
 {
     if (menuSelection.ToUpper() == USER_DASHBOARD.ToUpper())
     {
         FadeOut(source, 50);
         frmUserDashboard userDashboard = new frmUserDashboard();
         userDashboard.Show();
     }
     else if (menuSelection.ToUpper() == USERWISE_REPORT.ToUpper())
     {
         FadeOut(source, 50);
         frmUserwiseReport userwiseReport = new frmUserwiseReport();
         userwiseReport.Show();
     }
     else if (menuSelection.ToUpper() == PROJECTWISE_REPORT.ToUpper())
     {
         FadeOut(source, 50);
         frmProjectwiseReport projectwiseReport = new frmProjectwiseReport();
         projectwiseReport.Show();
     }
     else if (menuSelection.ToUpper() == LOGIN.ToUpper())
     {
         FadeOut(source, 50);
         frmLogin login = new frmLogin();
         login.Show();
     }
     else if (menuSelection.ToUpper() == CLOCK.ToUpper())
     {
         FadeOut(source, 50);
         frmEmployeeClock employeeClock = new frmEmployeeClock();
         employeeClock.Show();
     }
     else if (menuSelection.ToUpper() == PROJECT_BULKCREATION.ToUpper())
     {
         FadeOut(source, 50);
         frmProjectBulkCreation projectBulkCreation = new frmProjectBulkCreation();
         projectBulkCreation.Show();
     }
     else if (menuSelection.ToUpper() == PROJECT_CREATION.ToUpper())
     {
         FadeOut(source, 50);
         frmProjectCreation projectCreation = new frmProjectCreation();
         projectCreation.Show();
     }
     else if (menuSelection.ToUpper() == ACCESS_DENIED.ToUpper())
     {
         FadeOut(source, 50);
         frmAccessDenied accessDenied = new frmAccessDenied();
         accessDenied.Show();
     }
     else if (menuSelection.ToUpper() == PROJECT_DASHBOARD.ToUpper())
     {
         FadeOut(source, 50);
         frmProjectDashboard projectDashboard = new frmProjectDashboard();
         projectDashboard.Show();
     }
     else
     {
         //Do nothing
     }
 }