private Database() { csGroep01DataSet = new CSGroep01DataSet(); uta = new userTableAdapter(); sta = new signupTableAdapter(); eta = new eventsTableAdapter(); }
private void btnOK_Click(object sender, EventArgs e) { DataTable table = DBclass.DS.user; string hash = CalculateMD5Hash(CalculateMD5Hash(tbxOldPass.Text)); DataRow[] rows = table.Select("IDUser="******" and password='******' and role='user'"); if (rows.Length != 0) { if (tbxNewPass.Text == tbxNewRePass.Text) { DataSetTpos.userRow userRow = (DataSetTpos.userRow)rows[0]; userRow.password = CalculateMD5Hash(CalculateMD5Hash(tbxNewPass.Text)); userTableAdapter utba = new userTableAdapter(); utba.Update(userRow); this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); return; } else { lblErr.Text = "Пароли несоответствуют."; lblErr.Visible = true; } } else { lblErr.Text = "Пароль несоотвествует текущему."; lblErr.Visible = true; } }
public FormLogin() { InitializeComponent(); lang = Program.Lang; int w = this.Size.Width; int h = this.Size.Height; this.Icon = tposDesktop.Properties.Resources.mainIcon; //tbxLogin.Location = new Point(w / 2-tbxLogin.Width/2, tbxLogin.Location.Y); //tbxPass.Location = new Point(w / 2 - tbxPass.Width / 2, tbxPass.Location.Y); //btnLogin.Location = new Point(w / 2 - btnLogin.Width / 2, btnLogin.Location.Y); try { dbclass = new DBclass(); userTableAdapter uTba = new userTableAdapter(); uTba.Fill(DBclass.DS.user); } catch (Exception ex) { isMessage = true; MessageBox.Show("Нет подключения к Базе данных, " + ex.Message); } tbxLogin.Text = lang.Value("Login"); tbxPass.Text = lang.Value("Pass"); lblErr.Text = lang.Value("Err_Login"); lblErr.BackColor = Color.FromArgb(144, 127, 255); }