FormProfile.cs 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. using DLLPass;
  11. namespace СУБД_Швейная_фабрика
  12. {
  13. public partial class FormProfile : Form
  14. {
  15. public FormProfile()
  16. {
  17. InitializeComponent();
  18. }
  19. private void FormProfile_Load(object sender, EventArgs e)
  20. {
  21. // TODO: This line of code loads data into the 'fab2021DataSet1.Users' table. You can move, or remove it, as needed.
  22. this.usersTableAdapter.Fill(this.fab2021DataSet1.Users);
  23. }
  24. private void BtnSave_Click(object sender, EventArgs e)
  25. {
  26. if (TbxOldPass.Text != LblPass.Text)
  27. {
  28. MessageBox.Show("Вы ввели неверный текущий пароль!", "Внимание",
  29. MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
  30. return;
  31. }
  32. if (TbxNewPass.Text != "") // изменяется пароль
  33. {
  34. if (!ClassCheckPass.CheckPass(TbxNewPass.Text))
  35. {
  36. MessageBox.Show("Новый пароль не соответствует требованиям!",
  37. "Внимание", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
  38. return;
  39. }
  40. // поместить в БД новый пароль
  41. LblPass.Text = TbxNewPass.Text;
  42. }
  43. BsUsers.EndEdit();
  44. this.usersTableAdapter.Update(this.fab2021DataSet1.Users);
  45. this.DialogResult = DialogResult.OK;
  46. Close();
  47. }
  48. private void CbxShowPass_CheckedChanged(object sender, EventArgs e)
  49. {
  50. TbxNewPass.UseSystemPasswordChar = !TbxNewPass.UseSystemPasswordChar;
  51. TbxOldPass.UseSystemPasswordChar = !TbxOldPass.UseSystemPasswordChar;
  52. }
  53. }
  54. }