123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Drawing.Drawing2D;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using System.Windows.Forms.Design;
- namespace ImpulseVision
- {
- public partial class FormAutorize : Form
- {
- public FormAutorize()
- {
- InitializeComponent();
- }
- private void BtnLogin_Click(object sender, EventArgs e)
- {
- if(TbxLogin.Text.Trim() == string.Empty || TbxPassword.Text.Trim() == string.Empty)
- {
- MessageBox.Show("Введите учётные данные и повторите попытку!", "Внимание!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
- return;
- }
- BsUsers.Filter = $"Login = '{TbxLogin.Text.Trim()}' and Password = '{TbxPassword.Text.Trim()}'";
- if (BsUsers.Count == 0)
- {
- MessageBox.Show("Пользователя с таким логином или паролем не существует!", "ImpilseVision", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
- return;
- }
- else
- {
- if (LblRole.Text == "1")
- {
- this.Hide();
- FormMain FMain = new FormMain();
- FMain.ShowDialog();
- }
- else
- {
- //открыть окно для охраны
- }
- }
- }
- private void FormAutorize_FormClosing(object sender, FormClosingEventArgs e)
- {
-
- }
- private void FormAutorize_Load(object sender, EventArgs e)
- {
- // TODO: This line of code loads data into the 'impulseVisionAppDataSet1.Staffs' table. You can move, or remove it, as needed.
- this.staffsTableAdapter.Fill(this.impulseVisionAppDataSet1.Staffs);
- FormStart FStart = new FormStart();
- FStart.ShowDialog();
- LblRole.Hide();
- }
- /// <summary>
- /// рисование градиентной заливки на форме
- /// </summary>
- private void FormAutorize_Paint(object sender, PaintEventArgs e)
- {
- Point PtStart = new Point(0, 0);
- Point PtEnd = new Point(Width, Height);
- Color ColFirst = ColorTranslator.FromHtml("#0F2834");
- Color ColThird = ColorTranslator.FromHtml("#496870");
- LinearGradientBrush LGB = new LinearGradientBrush(PtStart, PtEnd, ColFirst, ColThird);
- Pen MyPen = new Pen(LGB);
- Rectangle Rect = new Rectangle(PtStart,new Size(PtEnd));
- //e.Graphics.DrawRectangle(MyPen, 0, 0, Width, Height);
- e.Graphics.FillRectangle(LGB, Rect);
- }
- private void FormAutorize_Resize(object sender, EventArgs e)
- {
- Invalidate();
- }
- }
- }
|