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(); } /// /// рисование градиентной заливки на форме /// 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(); } } }