예제 #1
0
        public SetUserDetailsVar(string username, string password)
        {
            _Username = username;
            _Password = PasswordSecurity.EncryptMD5(password);

            OleDbDataReader dataReader = CreateCommand().ExecuteReader();

            GetIdAndAdmin(dataReader);
        }
        private OleDbCommand GetCommand()
        {
            OleDbCommand oleDbCommand = oleDbConnection.CreateCommand();

            oleDbCommand.CommandText = GetCommandText();
            oleDbCommand.Parameters.AddWithValue("Username", ADMIN);
            oleDbCommand.Parameters.AddWithValue("[Password]", PasswordSecurity.EncryptMD5(ADMIN));
            oleDbCommand.Parameters.AddWithValue("Admin", "-1");
            return(oleDbCommand);
        }
예제 #3
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);
        }
        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());
            }
        }
예제 #5
0
        private OleDbCommand CreateCommand(UserDetails userDetails)
        {
            OleDbCommand oleDbCommand = oleDbConnection.CreateCommand();

            oleDbCommand.CommandText = GetCommandText();
            oleDbCommand.Parameters.AddWithValue("@Password", PasswordSecurity.EncryptMD5(userDetails.TxtboxPassword.Text));
            oleDbCommand.Parameters.AddWithValue("@Username", userDetails.TxtboxUsername.Text);
            oleDbCommand.Parameters.AddWithValue("@Admin", userDetails.checkBox1.Checked);
            oleDbCommand.Parameters.AddWithValue("@WorkerID", UserDetailsVAR.Id);
            return(oleDbCommand);
        }
예제 #6
0
        public ShowUserSecurity(UserDetails userControl)
        {
            OleDbDataReader oleDbDataReader = GetCommand().ExecuteReader();

            while (oleDbDataReader.Read())
            {
                userControl.TxtboxUsername.Text = oleDbDataReader["UserName"].ToString().Trim();
                userControl.TxtboxPassword.Text = PasswordSecurity.DecryptMD5(oleDbDataReader["Password"].ToString().Trim());
                userControl.checkBox1.Checked   = bool.Parse(oleDbDataReader["Admin"].ToString());
            }

            if (!userControl.checkBox1.Checked)
            {
                userControl.checkBox1.Visible = false;
                userControl.label6.Visible    = false;
            }
        }
예제 #7
0
 private string GetHashedPassword()
 {
     return(PasswordSecurity.EncryptMD5(manageWorker.txtBoxPassword.Text));
     //return manageWorker.txtBoxPassword.Text;
 }
예제 #8
0
 public static bool LoginDetailsIsCorrect(string username, string password)
 {
     _Username = username;
     _Password = PasswordSecurity.EncryptMD5(password);
     return(CreateDataReader().HasRows);
 }