private void btnSignIn_Click(object sender, EventArgs e) { try { string empTest = "server=cstnt.tstc.edu;user=group3;database=group3;port=3306;password=password3"; MySqlConnection Conn = new MySqlConnection(empTest); string selectStatement = "SELECT EmployeeName,Password FROM group3.employees WHERE EmployeeName = '" + txtEName.Text.Trim() + "'and Password = '******'"; MySqlCommand selectComm = new MySqlCommand(selectStatement, Conn); MySqlDataAdapter empDA = new MySqlDataAdapter(selectStatement, Conn); DataTable empTable = new DataTable(); empDA.Fill(empTable); //If the manager successfully logs in, they will be greeted by name //before being taken to the manager Interface Screen if (empTable.Rows.Count == 1) { MessageBox.Show("Login Successful! \n Welcome " + txtEName.Text); frmInventory InterfaceScreen = new frmInventory(); InterfaceScreen.Show(); this.Hide(); //if (txtMID.Text != frmMain.nManager.sMIDNum && txtPassword.Text != frmMain.nManager.sMPass && txtMName.Text != frmMain.nManager.sMName) //{ // //error message and clear text boxes to try again // MessageBox.Show("Error, Incorrect Entry"); // txtMID.Text = ""; // txtPassword.Text = ""; //} //else //{ // //open user input screen - RDL // UserInterface UI = new UserInterface(); // UI.Show(); // this.Hide(); //} } else { //error message and clear text boxes to try again MessageBox.Show(" ACCESS DENIED. \n Error, Incorrect Entry"); txtEID.Text = ""; txtEName.Text = ""; txtPass.Text = ""; } } catch (Exception c) { MessageBox.Show(c.Message); } }
private void btnEnter_Click(object sender, EventArgs e) { if (rdoButtonInventory.Checked == true) { //open user inventory screen - RDL frmInventory InventoryScreen = new frmInventory(); InventoryScreen.Show(); this.Hide(); } if (rdoBtnEmployeeList.Checked == true) { //display employee list in listbox - rdl //This has been changed to a DataGridView Control which will display the list of employees currently in the group3.employee table - AC string connection = "server=cstnt.tstc.edu;user=group3;database=group3;port=3306;password=password3"; empConn = new MySqlConnection(connection); empDataAdapt = new MySqlDataAdapter(); empDataSet = new DataSet(); string sqlStatement = "SELECT * FROM group3.employees; UPDATE group3.employees SET Total_Hours = Daily_Hours * 5; UPDATE group3.employees SET Total_Pay = Total_Hours * Pay;"; sqlComm = new MySqlCommand(sqlStatement, empConn); sqlComm.Connection = empConn; empDataAdapt.SelectCommand = sqlComm; empDataAdapt.Fill(empDataSet, "employees"); EmployeesDataGrid.DataSource = empDataSet; EmployeesDataGrid.DataMember = "employees"; btnAddEmployee.Show(); } if (rdoBtnSales.Checked == true) { //display total sales amount for day //Take the user to Report Form (Testing Only) - AC Report reportForm = new Report(); reportForm.Show(); this.Hide(); } if (rdoBtnPass.Checked == true) { //need a manager security login form -rdl //update password for specific employee in same form -rdl //Open the UpdatePassword Interface - AC UpdatePassword resetPWInterface = new UpdatePassword(); resetPWInterface.Show(); this.Hide(); } }