private void btnEnter_Click(object sender, EventArgs e) { try { Human_Resources HR = new Human_Resources(); // Create an object for the HR class string userNm = txtUsername.Text; string userPass = txtPassword.Text; string confirm = txtConfirm.Text; string writeLoginTable = "INSERT INTO Login VALUES(@Username, @Password, @Question, @Answer)"; string readLogintable = "SELECT * FROM Login"; if (validateUserInput(userNm, userPass, confirm)) { int x = createUser(writeLoginTable, readLogintable, userNm, userPass); string updateQueiry = "UPDATE Employees SET UserID = '" + x.ToString() + "' WHERE Id = '" + int.Parse(txtId.Text) + "'"; HR.updatedata(updateQueiry); MessageBox.Show("User Successfully created!"); this.Close(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); } }
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); } }
private void button1_Click(object sender, EventArgs e) { if (tmp[2] == textBox1.Text) { Human_Resources HR = new Human_Resources(); New_password NP = new New_password(); NP.ShowDialog(); MessageBox.Show(NP.getPass); string updateQueiry = "UPDATE Login SET Password = '******' WHERE Id = '" + int.Parse(tmp[0]) + "'"; HR.updatedata(updateQueiry); MessageBox.Show("New Password Created"); this.Close(); } else { errorProvider1.SetError(textBox1, "Wrong answer!"); } }
private void hRToolStripMenuItem_Click(object sender, EventArgs e) { Human_Resources HR = new Human_Resources(); HR.ShowDialog(); }
private void Sales_Load(object sender, EventArgs e) { readAll(); HR = new Human_Resources(); }