FormEditUser.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. namespace ImpulseVision
  11. {
  12. public partial class FormEditUser : Form
  13. {
  14. public FormEditUser()
  15. {
  16. InitializeComponent();
  17. }
  18. private void TbxPassportSeria_KeyPress(object sender, KeyPressEventArgs e)
  19. {
  20. e.Handled = true;
  21. if (e.KeyChar == (char)Keys.Back)
  22. {
  23. e.Handled = false;
  24. }
  25. if(char.IsDigit(e.KeyChar))
  26. {
  27. e.Handled = false;
  28. }
  29. }
  30. private void TbxPassportNumber_TextChanged(object sender, EventArgs e)
  31. {
  32. if(TbxPassportNumber.Text.Trim().Length > 6)
  33. {
  34. string txt = TbxPassportNumber.Text.Trim().Substring(0, 6);
  35. TbxPassportNumber.Text = txt;
  36. }
  37. }
  38. private void TbxPassportSeria_TextChanged(object sender, EventArgs e)
  39. {
  40. if (TbxPassportSeria.Text.Trim().Length > 4)
  41. {
  42. string txt = TbxPassportSeria.Text.Trim().Substring(0, 4);
  43. TbxPassportSeria.Text = txt;
  44. }
  45. }
  46. private void FormEditUser_Load(object sender, EventArgs e)
  47. {
  48. // TODO: This line of code loads data into the 'impulseVisionAppDataSet1.Users' table. You can move, or remove it, as needed.
  49. this.usersTableAdapter.Fill(this.impulseVisionAppDataSet1.Users);
  50. LblSelectUserID.Hide();
  51. BsUserInfo.Filter = $"ID = '{LblSelectUserID.Text.Trim()}'";
  52. }
  53. private void BtnSaveEditing_Click(object sender, EventArgs e)
  54. {
  55. BsUserInfo.EndEdit();
  56. this.usersTableAdapter.Update(this.impulseVisionAppDataSet1.Users);
  57. Close();
  58. }
  59. }
  60. }