private void picLocker_Click(object sender, EventArgs e) { if (Lock) // UnLock { if (txtUser.Text != "" && txtPass.Text != "") { var db = new LINQ_UserPassDataContext(); var arrAdmin = (from adminUser in db.User_Passwords where adminUser.UserName == @"#admin#" select adminUser).ToArray(); User_Password admin = new User_Password(); if (arrAdmin.Length > 0) { admin = arrAdmin[0]; } else { return; } string Password = CreateMD5Hash(txtPass.Text); if (txtUser.Text.ToLower() == admin.UserName.ToLower() && Password == admin.Password) { Lock = false; picLocker.Image = global::MakeClassSchedule.Properties.Resources.unlock; dgvUserPass.DataSource = db.User_Passwords; // dgvUserPass.Columns[0].HeaderText = "User Name"; dgvUserPass.Columns[0].Width = 120; dgvUserPass.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dgvUserPass.Columns[0].ReadOnly = true; // dgvUserPass.Columns[1].HeaderText = "Password"; dgvUserPass.Columns[1].Width = 100; dgvUserPass.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; // dgvUserPass.Columns[2].HeaderText = "Password Hint"; dgvUserPass.Columns[2].Width = 100; // dgvUserPass.Columns[3].HeaderText = "Modifiers"; dgvUserPass.Columns[3].Width = 100; // this.Size = new Size(800, 300); } } } else // Lock { dgvUserPass.Columns.Clear(); dgvUserPass.Rows.Clear(); this.Size = new Size(300, 300); picLocker.Image = global::MakeClassSchedule.Properties.Resources._lock; txtUser.Text = string.Empty; txtPass.Text = string.Empty; txtRePass.Text = string.Empty; txtPassHint.Text = string.Empty; txtModifiers.Text = string.Empty; txtUser.Focus(); Lock = true; } }
partial void UpdateUser_Password(User_Password instance);
partial void DeleteUser_Password(User_Password instance);
partial void InsertUser_Password(User_Password instance);