コード例 #1
0
 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));
 }
コード例 #2
0
        public SearchWorkerByName(SeeTeam seeTeam)
        {
            this.seeTeam = seeTeam;
            OleDbCommand oleDbCommand = CreateCommand();

            ExecuteCommand(oleDbCommand);
            seeTeam.dataGridView1.DataSource = SetDataSource(oleDbCommand);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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());
            }
        }
コード例 #6
0
 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);
     }
 }
コード例 #7
0
        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);
        }
コード例 #8
0
 public ShowUserDetailsFromDataGrid(SeeTeam seeTeam)
 {
     ShowSelectedData(seeTeam);
 }
コード例 #9
0
 private byte[] GetByteImage(SeeTeam seeTeam)
 {
     return((Byte[])seeTeam.dataGridView1.SelectedRows[0].Cells[5].Value);
 }
コード例 #10
0
 public UpdateUserSecurity(SeeTeam seeTeam)
 {
     ExecuteCommand(CreateCommand(seeTeam));
 }
コード例 #11
0
 public UpdateWorkerDetails(SeeTeam seeTeam)
 {
     ExecuteCommand(CreateCommand(seeTeam));
     MessageBox.Show("The worker has been successfully updated", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
 }