private void ShowSelectedData(SeeTeam seeTeam) { seeTeam.TxtBoxName.Text = seeTeam.dataGridView1.SelectedRows[0].Cells[1].Value.ToString().Trim(); seeTeam.TxtBoxSurname.Text = seeTeam.dataGridView1.SelectedRows[0].Cells[2].Value.ToString().Trim(); seeTeam.TxtBoxAge.Text = seeTeam.dataGridView1.SelectedRows[0].Cells[3].Value.ToString().Trim(); seeTeam.TxtBoxGender.Text = seeTeam.dataGridView1.SelectedRows[0].Cells[4].Value.ToString().Trim(); seeTeam.WorkerPicture.Image = ConvertByteToImage(GetByteImage(seeTeam)); }
public SearchWorkerByName(SeeTeam seeTeam) { this.seeTeam = seeTeam; OleDbCommand oleDbCommand = CreateCommand(); ExecuteCommand(oleDbCommand); seeTeam.dataGridView1.DataSource = SetDataSource(oleDbCommand); }
private OleDbCommand GetCommand(SeeTeam seeTeam) { OpenOleDbConnection(); OleDbCommand oleDbCommand = oleDbConnection.CreateCommand(); oleDbCommand.CommandText = GetCommandText(); oleDbCommand.Parameters.AddWithValue("WorkerID", seeTeam.dataGridView1.SelectedRows[0].Cells[0].Value.ToString()); return(oleDbCommand); }
private OleDbCommand CreateCommand(SeeTeam seeTeam) { OleDbCommand oleDbCommand = oleDbConnection.CreateCommand(); oleDbCommand.CommandText = GetCommandText(); oleDbCommand.Parameters.AddWithValue("@Username", seeTeam.TxtBoxUsername.Text); oleDbCommand.Parameters.AddWithValue("@Password", PasswordSecurity.EncryptMD5(seeTeam.TxtBoxPassword.Text)); oleDbCommand.Parameters.AddWithValue("@Admin", seeTeam.checkBox1.Checked); oleDbCommand.Parameters.AddWithValue("@WorkerID", seeTeam.dataGridView1.SelectedRows[0].Cells[0].Value.ToString()); return(oleDbCommand); }
public ShowUserSecurityFromDataGrid(SeeTeam seeTeam) { OleDbDataReader oleDbDataReader = GetCommand(seeTeam).ExecuteReader(); while (oleDbDataReader.Read()) { seeTeam.TxtBoxUsername.Text = oleDbDataReader["UserName"].ToString().Trim(); seeTeam.TxtBoxPassword.Text = PasswordSecurity.DecryptMD5(oleDbDataReader["Password"].ToString().Trim()); seeTeam.checkBox1.Checked = bool.Parse(oleDbDataReader["Admin"].ToString()); } }
public static bool CheckUserName(SeeTeam seeTeam) { _Username = seeTeam.TxtBoxUsername.Text; if (CreateDataReader().HasRows&& seeTeam.dataGridView1.SelectedRows[0].Cells[0].Value.ToString() != _ID) { MessageBox.Show("Username already taken", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(true); } else { return(false); } }
private OleDbCommand CreateCommand(SeeTeam seeTeam) { OleDbCommand oleDbCommand = oleDbConnection.CreateCommand(); oleDbCommand.CommandText = GetCommandText(); oleDbCommand.Parameters.AddWithValue("@WorkerName", seeTeam.TxtBoxName.Text); oleDbCommand.Parameters.AddWithValue("@WorkerSurname", seeTeam.TxtBoxSurname.Text); oleDbCommand.Parameters.AddWithValue("@Age", seeTeam.TxtBoxAge.Text); oleDbCommand.Parameters.AddWithValue("@Gender", seeTeam.TxtBoxGender.Text); oleDbCommand.Parameters.AddWithValue("@WorkerPhoto", ConvertImageToByte(seeTeam.WorkerPicture.Image)); oleDbCommand.Parameters.AddWithValue("@WorkerID", seeTeam.dataGridView1.SelectedRows[0].Cells[0].Value); return(oleDbCommand); }
public ShowUserDetailsFromDataGrid(SeeTeam seeTeam) { ShowSelectedData(seeTeam); }
private byte[] GetByteImage(SeeTeam seeTeam) { return((Byte[])seeTeam.dataGridView1.SelectedRows[0].Cells[5].Value); }
public UpdateUserSecurity(SeeTeam seeTeam) { ExecuteCommand(CreateCommand(seeTeam)); }
public UpdateWorkerDetails(SeeTeam seeTeam) { ExecuteCommand(CreateCommand(seeTeam)); MessageBox.Show("The worker has been successfully updated", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information); }