FormAutorize.cs 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Drawing.Drawing2D;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using System.Windows.Forms;
  11. using System.Windows.Forms.Design;
  12. namespace ImpulseVision
  13. {
  14. public partial class FormAutorize : Form
  15. {
  16. public FormAutorize()
  17. {
  18. InitializeComponent();
  19. }
  20. private void BtnLogin_Click(object sender, EventArgs e)
  21. {
  22. if(TbxLogin.Text.Trim() == string.Empty || TbxPassword.Text.Trim() == string.Empty)
  23. {
  24. MessageBox.Show("Введите учётные данные и повторите попытку!", "Внимание!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
  25. return;
  26. }
  27. BsUsers.Filter = $"Login = '{TbxLogin.Text.Trim()}' and Password = '{TbxPassword.Text.Trim()}'";
  28. if (BsUsers.Count == 0)
  29. {
  30. MessageBox.Show("Пользователя с таким логином или паролем не существует!", "ImpilseVision", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
  31. return;
  32. }
  33. else
  34. {
  35. if (LblRole.Text == "1")
  36. {
  37. this.Hide();
  38. FormMain FMain = new FormMain();
  39. FMain.ShowDialog();
  40. }
  41. else
  42. {
  43. //открыть окно для охраны
  44. }
  45. }
  46. }
  47. private void FormAutorize_FormClosing(object sender, FormClosingEventArgs e)
  48. {
  49. }
  50. private void FormAutorize_Load(object sender, EventArgs e)
  51. {
  52. // TODO: This line of code loads data into the 'impulseVisionAppDataSet1.Staffs' table. You can move, or remove it, as needed.
  53. this.staffsTableAdapter.Fill(this.impulseVisionAppDataSet1.Staffs);
  54. FormStart FStart = new FormStart();
  55. FStart.ShowDialog();
  56. LblRole.Hide();
  57. }
  58. /// <summary>
  59. /// рисование градиентной заливки на форме
  60. /// </summary>
  61. private void FormAutorize_Paint(object sender, PaintEventArgs e)
  62. {
  63. Point PtStart = new Point(0, 0);
  64. Point PtEnd = new Point(Width, Height);
  65. Color ColFirst = ColorTranslator.FromHtml("#0F2834");
  66. Color ColThird = ColorTranslator.FromHtml("#496870");
  67. LinearGradientBrush LGB = new LinearGradientBrush(PtStart, PtEnd, ColFirst, ColThird);
  68. Pen MyPen = new Pen(LGB);
  69. Rectangle Rect = new Rectangle(PtStart,new Size(PtEnd));
  70. //e.Graphics.DrawRectangle(MyPen, 0, 0, Width, Height);
  71. e.Graphics.FillRectangle(LGB, Rect);
  72. }
  73. private void FormAutorize_Resize(object sender, EventArgs e)
  74. {
  75. Invalidate();
  76. }
  77. }
  78. }