Переглянути джерело

Логирование входа пользователей.
Доработка функционала и исправление ошибок.

Вячеслав Терешенко 2 роки тому
батько
коміт
ac87dd371c

+ 2 - 2
ImpulseVision/CardJournal.cs

@@ -12,8 +12,8 @@ namespace ImpulseVision
     public class CardJournal : RPanel
     {
         private RPanel RPanelForImage;
-        private System.Windows.Forms.Label label3;
-        private System.Windows.Forms.Label label1;
+        public System.Windows.Forms.Label label3;
+        public System.Windows.Forms.Label label1;
         public System.Windows.Forms.Label LblCheckTime;
         public System.Windows.Forms.Label LblUserName;
         public System.Windows.Forms.PictureBox PbxImage;

+ 14 - 2
ImpulseVision/FormAutorize.Designer.cs

@@ -34,6 +34,7 @@
             this.BsUsers = new System.Windows.Forms.BindingSource(this.components);
             this.staffsTableAdapter = new ImpulseVision.ImpulseVisionAppDataSetTableAdapters.StaffsTableAdapter();
             this.LblRole = new System.Windows.Forms.Label();
+            this.LblUserID = new System.Windows.Forms.Label();
             this.BtnLogin = new System.Windows.Forms.Button();
             this.PanelAutorize = new ImpulseVision.RPanel();
             this.Card = new ImpulseVision.FDCard();
@@ -68,6 +69,16 @@
             this.LblRole.TabIndex = 11;
             this.LblRole.Text = "role";
             // 
+            // LblUserID
+            // 
+            this.LblUserID.AutoSize = true;
+            this.LblUserID.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.BsUsers, "ID", true));
+            this.LblUserID.Location = new System.Drawing.Point(12, 30);
+            this.LblUserID.Name = "LblUserID";
+            this.LblUserID.Size = new System.Drawing.Size(57, 21);
+            this.LblUserID.TabIndex = 12;
+            this.LblUserID.Text = "UserID";
+            // 
             // BtnLogin
             // 
             this.BtnLogin.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(124)))), ((int)(((byte)(136)))), ((int)(((byte)(144)))));
@@ -128,8 +139,7 @@
             this.Card.Name = "Card";
             this.Card.Size = new System.Drawing.Size(261, 274);
             this.Card.TabIndex = 0;
-            this.Card.Text = "Создать аккаунт";
-            this.Card.TextDescrition = "Здесь могла быть ваша реклама";
+            this.Card.TextDescrition = "...";
             this.Card.TextHeader = "Авторизация";
             // 
             // TbxLogin
@@ -177,6 +187,7 @@
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(24)))), ((int)(((byte)(62)))), ((int)(((byte)(71)))));
             this.ClientSize = new System.Drawing.Size(690, 390);
+            this.Controls.Add(this.LblUserID);
             this.Controls.Add(this.LblRole);
             this.Controls.Add(this.PanelAutorize);
             this.Font = new System.Drawing.Font("Segoe UI", 12F);
@@ -209,5 +220,6 @@
         private System.Windows.Forms.BindingSource BsUsers;
         private ImpulseVisionAppDataSetTableAdapters.StaffsTableAdapter staffsTableAdapter;
         private System.Windows.Forms.Label LblRole;
+        private System.Windows.Forms.Label LblUserID;
     }
 }

+ 85 - 3
ImpulseVision/FormAutorize.cs

@@ -2,8 +2,10 @@
 using System.Collections.Generic;
 using System.ComponentModel;
 using System.Data;
+using System.Data.SqlClient;
 using System.Drawing;
 using System.Drawing.Drawing2D;
+using System.IO;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -20,14 +22,15 @@ namespace ImpulseVision
 
             TbxLogin.Focus();
             TbxLogin.SelectionStart = 0;
-
         }
-
+        #region <Переменные>
+        SqlConnection SCon = new SqlConnection(Properties.Settings.Default.ImpulseVisionAppConnectionString);
+        #endregion
         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);
+                MessageBox.Show("Введите учётные данные и повторите попытку!", "ImpulseVision", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                 return;
             }
 
@@ -40,6 +43,23 @@ namespace ImpulseVision
             }
             else
             {
+                try
+                {
+                    SCon.Open();
+                    string QueryLogining = $@"insert into HistoryLogin (StaffsID, TimeLogin)
+values ('{LblUserID.Text.Trim()}',GETDATE())";
+
+                    SqlCommand Cmd = new SqlCommand(QueryLogining, SCon);
+                    Cmd.ExecuteNonQuery();
+                    SCon.Close();
+                }
+                catch
+                {
+                    MessageBox.Show("Сервер не отвечает..\r\nПовторите попытку позже", "ImpulseVision", MessageBoxButtons
+                        .OK, MessageBoxIcon.Exclamation);
+                    return;
+                }
+
                 if (LblRole.Text == "1")
                 {
                     this.Hide();
@@ -57,6 +77,7 @@ namespace ImpulseVision
                 }
                 TbxLogin.Text = string.Empty;
                 TbxPassword.Text = string.Empty;
+                GetLastTimeLogin();
             }
         }
 
@@ -81,8 +102,69 @@ namespace ImpulseVision
             FormStart FStart = new FormStart();
             FStart.ShowDialog();
 
+            ClearOldRecordInJournal(5);
+
+            GetLastTimeLogin();
+
             LblRole.Hide();
+            LblUserID.Hide();
         }
+        /// <summary>
+        /// получение последнего времени входа
+        /// </summary>
+        private void GetLastTimeLogin()
+        {
+            string LastLogin = string.Empty;
+            SCon.Open();
+            string QueryLastLogin = $@"select Max(TimeLogin) as LastTimeLogin
+from HistoryLogin";
+            SqlCommand Cmd = new SqlCommand(QueryLastLogin, SCon);
+            SqlDataReader Res = Cmd.ExecuteReader();
+            if(Res.HasRows)
+            {
+                Res.Read();
+                LastLogin = "Последнее время входа: " + Res["LastTimeLogin"].ToString();
+            }
+            else
+            {
+                LastLogin = "Здесь будет отображаться последнее время входа в систему.";
+            }
+            SCon.Close();
+
+            Card.TextDescrition = LastLogin;
+        }
+        /// <summary>
+        /// удаление фотографий в журнале,
+        /// которые старше указанного количества дней
+        /// </summary>
+        private void ClearOldRecordInJournal(int CountDay)
+        {
+            DirectoryInfo Dir = new DirectoryInfo(Application.StartupPath + "\\Source\\log\\");
+            FileInfo[] Files = Dir.GetFiles();
+            string Path = string.Empty;
+            foreach (var t in Files)
+            {
+                Path = Application.StartupPath + "\\Source\\log\\" + t;
+                if (!File.Exists(Path))
+                    continue;
+
+                string[] Parts = t.ToString().Split('_');
+                try
+                {
+                    DateTime Tm = DateTime.Parse(Parts[3]);
+                    TimeSpan Span = DateTime.Now - Tm;
+                    int Dif = Span.Days;
+                    if(Dif > CountDay)
+                    {
+                        File.Delete(Path);
+                    }
+                }catch
+                {
+                    continue;
+                }
+            }
+        }
+
         /// <summary>
         /// рисование градиентной заливки на форме
         /// </summary>

+ 367 - 314
ImpulseVision/FormMain.Designer.cs

@@ -54,33 +54,12 @@
             this.TabPages = new System.Windows.Forms.TabControl();
             this.TbUsers = new System.Windows.Forms.TabPage();
             this.TableUsers = new System.Windows.Forms.TableLayoutPanel();
+            this.RPanelUser = new ImpulseVision.RPanel();
+            this.label4 = new System.Windows.Forms.Label();
             this.TbMain = new System.Windows.Forms.TabPage();
             this.TableLayoutWorks = new System.Windows.Forms.TableLayoutPanel();
             this.PbxEther = new System.Windows.Forms.PictureBox();
             this.panel1 = new System.Windows.Forms.Panel();
-            this.BtnSave = new System.Windows.Forms.Button();
-            this.TbSettings = new System.Windows.Forms.TabPage();
-            this.label3 = new System.Windows.Forms.Label();
-            this.label2 = new System.Windows.Forms.Label();
-            this.TbVisits = new System.Windows.Forms.TabPage();
-            this.label7 = new System.Windows.Forms.Label();
-            this.PanelHeader = new System.Windows.Forms.Panel();
-            this.TbxFindUser = new System.Windows.Forms.TextBox();
-            this.TabJournal = new System.Windows.Forms.TableLayoutPanel();
-            this.DtpFiniteDate = new System.Windows.Forms.DateTimePicker();
-            this.CmbSortDate = new System.Windows.Forms.ComboBox();
-            this.PanelPeriod = new System.Windows.Forms.Panel();
-            this.DtpDateEnd = new System.Windows.Forms.DateTimePicker();
-            this.DtpDateStart = new System.Windows.Forms.DateTimePicker();
-            this.label6 = new System.Windows.Forms.Label();
-            this.label5 = new System.Windows.Forms.Label();
-            this.TbJournal = new System.Windows.Forms.TabPage();
-            this.TabCard = new System.Windows.Forms.TableLayoutPanel();
-            this.ImList = new System.Windows.Forms.ImageList(this.components);
-            this.TimerSaving = new System.Windows.Forms.Timer(this.components);
-            this.TmAnim = new System.Windows.Forms.Timer(this.components);
-            this.RPanelUser = new ImpulseVision.RPanel();
-            this.label4 = new System.Windows.Forms.Label();
             this.TbxPhone = new ImpulseVision.EgoldsGoogleTextBox();
             this.TbxPasportNum = new ImpulseVision.EgoldsGoogleTextBox();
             this.TbxPasportSeria = new ImpulseVision.EgoldsGoogleTextBox();
@@ -89,10 +68,17 @@
             this.RPanelForAddUser = new ImpulseVision.RPanel();
             this.label1 = new System.Windows.Forms.Label();
             this.TbxLastname = new ImpulseVision.EgoldsGoogleTextBox();
+            this.BtnSave = new System.Windows.Forms.Button();
+            this.TbSettings = new System.Windows.Forms.TabPage();
             this.SwPositionWindow = new ImpulseVision.EgoldsToggleSwitch();
+            this.label3 = new System.Windows.Forms.Label();
+            this.label2 = new System.Windows.Forms.Label();
             this.RPanelSettings = new ImpulseVision.RPanel();
             this.LblTextSettings = new System.Windows.Forms.Label();
             this.SwAutoLoad = new ImpulseVision.EgoldsToggleSwitch();
+            this.TbVisits = new System.Windows.Forms.TabPage();
+            this.label7 = new System.Windows.Forms.Label();
+            this.PanelHeader = new System.Windows.Forms.Panel();
             this.RPanelTitleDate = new ImpulseVision.RPanel();
             this.label13 = new System.Windows.Forms.Label();
             this.RPanelTitleExit = new ImpulseVision.RPanel();
@@ -101,30 +87,48 @@
             this.label8 = new System.Windows.Forms.Label();
             this.RPanelForNameUser = new ImpulseVision.RPanel();
             this.LblTitleNameUser = new System.Windows.Forms.Label();
+            this.TbxFindUser = new System.Windows.Forms.TextBox();
+            this.TabJournal = new System.Windows.Forms.TableLayoutPanel();
+            this.DtpFiniteDate = new System.Windows.Forms.DateTimePicker();
+            this.CmbSortDate = new System.Windows.Forms.ComboBox();
+            this.PanelPeriod = new System.Windows.Forms.Panel();
+            this.DtpDateEnd = new System.Windows.Forms.DateTimePicker();
+            this.DtpDateStart = new System.Windows.Forms.DateTimePicker();
+            this.label6 = new System.Windows.Forms.Label();
+            this.label5 = new System.Windows.Forms.Label();
+            this.TbJournal = new System.Windows.Forms.TabPage();
+            this.TabCard = new System.Windows.Forms.TableLayoutPanel();
             this.RPanelTitleJournal = new ImpulseVision.RPanel();
             this.label9 = new System.Windows.Forms.Label();
+            this.ImList = new System.Windows.Forms.ImageList(this.components);
+            this.TimerSaving = new System.Windows.Forms.Timer(this.components);
+            this.TmAnim = new System.Windows.Forms.Timer(this.components);
+            this.label10 = new System.Windows.Forms.Label();
+            this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
+            this.label11 = new System.Windows.Forms.Label();
             this.menuStrip1.SuspendLayout();
             this.ToolsMenu.SuspendLayout();
             this.statusStrip1.SuspendLayout();
             this.TabPages.SuspendLayout();
             this.TbUsers.SuspendLayout();
+            this.RPanelUser.SuspendLayout();
             this.TbMain.SuspendLayout();
             this.TableLayoutWorks.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.PbxEther)).BeginInit();
             this.panel1.SuspendLayout();
+            this.RPanelForAddUser.SuspendLayout();
             this.TbSettings.SuspendLayout();
+            this.RPanelSettings.SuspendLayout();
             this.TbVisits.SuspendLayout();
             this.PanelHeader.SuspendLayout();
-            this.PanelPeriod.SuspendLayout();
-            this.TbJournal.SuspendLayout();
-            this.RPanelUser.SuspendLayout();
-            this.RPanelForAddUser.SuspendLayout();
-            this.RPanelSettings.SuspendLayout();
             this.RPanelTitleDate.SuspendLayout();
             this.RPanelTitleExit.SuspendLayout();
             this.RPanelTitleEntrance.SuspendLayout();
             this.RPanelForNameUser.SuspendLayout();
+            this.PanelPeriod.SuspendLayout();
+            this.TbJournal.SuspendLayout();
             this.RPanelTitleJournal.SuspendLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
             this.SuspendLayout();
             // 
             // menuStrip1
@@ -337,286 +341,6 @@
             this.TableUsers.Size = new System.Drawing.Size(723, 315);
             this.TableUsers.TabIndex = 7;
             // 
-            // TbMain
-            // 
-            this.TbMain.BackColor = System.Drawing.Color.White;
-            this.TbMain.Controls.Add(this.TableLayoutWorks);
-            this.TbMain.Location = new System.Drawing.Point(4, 30);
-            this.TbMain.Name = "TbMain";
-            this.TbMain.Padding = new System.Windows.Forms.Padding(3);
-            this.TbMain.Size = new System.Drawing.Size(723, 357);
-            this.TbMain.TabIndex = 0;
-            this.TbMain.Text = "tabPage1";
-            // 
-            // TableLayoutWorks
-            // 
-            this.TableLayoutWorks.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(253)))), ((int)(((byte)(255)))), ((int)(((byte)(252)))));
-            this.TableLayoutWorks.ColumnCount = 2;
-            this.TableLayoutWorks.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 256F));
-            this.TableLayoutWorks.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 473F));
-            this.TableLayoutWorks.Controls.Add(this.PbxEther, 1, 0);
-            this.TableLayoutWorks.Controls.Add(this.panel1, 0, 0);
-            this.TableLayoutWorks.Dock = System.Windows.Forms.DockStyle.Fill;
-            this.TableLayoutWorks.Location = new System.Drawing.Point(3, 3);
-            this.TableLayoutWorks.Name = "TableLayoutWorks";
-            this.TableLayoutWorks.RowCount = 1;
-            this.TableLayoutWorks.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
-            this.TableLayoutWorks.Size = new System.Drawing.Size(717, 359);
-            this.TableLayoutWorks.TabIndex = 6;
-            // 
-            // PbxEther
-            // 
-            this.PbxEther.BackColor = System.Drawing.Color.Transparent;
-            this.PbxEther.Dock = System.Windows.Forms.DockStyle.Fill;
-            this.PbxEther.Location = new System.Drawing.Point(258, 3);
-            this.PbxEther.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3);
-            this.PbxEther.Name = "PbxEther";
-            this.PbxEther.Size = new System.Drawing.Size(469, 353);
-            this.PbxEther.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
-            this.PbxEther.TabIndex = 2;
-            this.PbxEther.TabStop = false;
-            this.PbxEther.Click += new System.EventHandler(this.PbxEther_Click_1);
-            // 
-            // panel1
-            // 
-            this.panel1.BackColor = System.Drawing.Color.White;
-            this.panel1.Controls.Add(this.TbxPhone);
-            this.panel1.Controls.Add(this.TbxPasportNum);
-            this.panel1.Controls.Add(this.TbxPasportSeria);
-            this.panel1.Controls.Add(this.TbxPatronymic);
-            this.panel1.Controls.Add(this.TbxFirstname);
-            this.panel1.Controls.Add(this.RPanelForAddUser);
-            this.panel1.Controls.Add(this.TbxLastname);
-            this.panel1.Controls.Add(this.BtnSave);
-            this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
-            this.panel1.Location = new System.Drawing.Point(3, 3);
-            this.panel1.Name = "panel1";
-            this.panel1.Size = new System.Drawing.Size(250, 353);
-            this.panel1.TabIndex = 0;
-            // 
-            // BtnSave
-            // 
-            this.BtnSave.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(124)))), ((int)(((byte)(136)))), ((int)(((byte)(144)))));
-            this.BtnSave.Font = new System.Drawing.Font("Segoe UI Variable Small Semibol", 12F, System.Drawing.FontStyle.Bold);
-            this.BtnSave.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(246)))), ((int)(((byte)(255)))), ((int)(((byte)(248)))));
-            this.BtnSave.Location = new System.Drawing.Point(7, 307);
-            this.BtnSave.Name = "BtnSave";
-            this.BtnSave.Size = new System.Drawing.Size(236, 35);
-            this.BtnSave.TabIndex = 3;
-            this.BtnSave.Text = "Добавить";
-            this.BtnSave.UseVisualStyleBackColor = false;
-            this.BtnSave.Click += new System.EventHandler(this.BtnSave_Click);
-            // 
-            // TbSettings
-            // 
-            this.TbSettings.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(253)))), ((int)(((byte)(255)))), ((int)(((byte)(252)))));
-            this.TbSettings.Controls.Add(this.SwPositionWindow);
-            this.TbSettings.Controls.Add(this.label3);
-            this.TbSettings.Controls.Add(this.label2);
-            this.TbSettings.Controls.Add(this.RPanelSettings);
-            this.TbSettings.Controls.Add(this.SwAutoLoad);
-            this.TbSettings.Font = new System.Drawing.Font("Segoe UI Variable Small Semibol", 12F, System.Drawing.FontStyle.Bold);
-            this.TbSettings.Location = new System.Drawing.Point(4, 30);
-            this.TbSettings.Name = "TbSettings";
-            this.TbSettings.Padding = new System.Windows.Forms.Padding(3);
-            this.TbSettings.Size = new System.Drawing.Size(723, 357);
-            this.TbSettings.TabIndex = 1;
-            this.TbSettings.Text = "tabPage2";
-            // 
-            // label3
-            // 
-            this.label3.AutoSize = true;
-            this.label3.Location = new System.Drawing.Point(8, 83);
-            this.label3.Name = "label3";
-            this.label3.Size = new System.Drawing.Size(365, 21);
-            this.label3.TabIndex = 4;
-            this.label3.Text = "Сохранять положение окна при перезапуске";
-            // 
-            // label2
-            // 
-            this.label2.AutoSize = true;
-            this.label2.Location = new System.Drawing.Point(8, 46);
-            this.label2.Name = "label2";
-            this.label2.Size = new System.Drawing.Size(340, 21);
-            this.label2.TabIndex = 3;
-            this.label2.Text = "Запускать приложение вместе с системой";
-            // 
-            // TbVisits
-            // 
-            this.TbVisits.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(253)))), ((int)(((byte)(255)))), ((int)(((byte)(252)))));
-            this.TbVisits.Controls.Add(this.label7);
-            this.TbVisits.Controls.Add(this.PanelHeader);
-            this.TbVisits.Controls.Add(this.TbxFindUser);
-            this.TbVisits.Controls.Add(this.TabJournal);
-            this.TbVisits.Controls.Add(this.DtpFiniteDate);
-            this.TbVisits.Controls.Add(this.CmbSortDate);
-            this.TbVisits.Controls.Add(this.PanelPeriod);
-            this.TbVisits.Font = new System.Drawing.Font("Segoe UI Variable Small Semibol", 12F, System.Drawing.FontStyle.Bold);
-            this.TbVisits.Location = new System.Drawing.Point(4, 30);
-            this.TbVisits.Name = "TbVisits";
-            this.TbVisits.Size = new System.Drawing.Size(723, 357);
-            this.TbVisits.TabIndex = 3;
-            this.TbVisits.Text = "tabPage1";
-            // 
-            // label7
-            // 
-            this.label7.AutoSize = true;
-            this.label7.Location = new System.Drawing.Point(8, 44);
-            this.label7.Name = "label7";
-            this.label7.Size = new System.Drawing.Size(128, 21);
-            this.label7.TabIndex = 6;
-            this.label7.Text = "Поиск по ФИО:";
-            // 
-            // PanelHeader
-            // 
-            this.PanelHeader.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
-            | System.Windows.Forms.AnchorStyles.Right)));
-            this.PanelHeader.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(253)))), ((int)(((byte)(255)))), ((int)(((byte)(252)))));
-            this.PanelHeader.Controls.Add(this.RPanelTitleDate);
-            this.PanelHeader.Controls.Add(this.RPanelTitleExit);
-            this.PanelHeader.Controls.Add(this.RPanelTitleEntrance);
-            this.PanelHeader.Controls.Add(this.RPanelForNameUser);
-            this.PanelHeader.Location = new System.Drawing.Point(0, 76);
-            this.PanelHeader.Name = "PanelHeader";
-            this.PanelHeader.Size = new System.Drawing.Size(723, 32);
-            this.PanelHeader.TabIndex = 8;
-            // 
-            // TbxFindUser
-            // 
-            this.TbxFindUser.Location = new System.Drawing.Point(142, 41);
-            this.TbxFindUser.Name = "TbxFindUser";
-            this.TbxFindUser.Size = new System.Drawing.Size(221, 29);
-            this.TbxFindUser.TabIndex = 7;
-            this.TbxFindUser.TextChanged += new System.EventHandler(this.TbxFindUser_TextChanged);
-            // 
-            // TabJournal
-            // 
-            this.TabJournal.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
-            | System.Windows.Forms.AnchorStyles.Left) 
-            | System.Windows.Forms.AnchorStyles.Right)));
-            this.TabJournal.AutoScroll = true;
-            this.TabJournal.ColumnCount = 1;
-            this.TabJournal.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
-            this.TabJournal.Location = new System.Drawing.Point(0, 110);
-            this.TabJournal.Name = "TabJournal";
-            this.TabJournal.RowCount = 1;
-            this.TabJournal.RowStyles.Add(new System.Windows.Forms.RowStyle());
-            this.TabJournal.Size = new System.Drawing.Size(723, 252);
-            this.TabJournal.TabIndex = 5;
-            // 
-            // DtpFiniteDate
-            // 
-            this.DtpFiniteDate.Location = new System.Drawing.Point(182, 3);
-            this.DtpFiniteDate.Name = "DtpFiniteDate";
-            this.DtpFiniteDate.Size = new System.Drawing.Size(199, 29);
-            this.DtpFiniteDate.TabIndex = 1;
-            this.DtpFiniteDate.ValueChanged += new System.EventHandler(this.DtpFiniteDate_ValueChanged);
-            // 
-            // CmbSortDate
-            // 
-            this.CmbSortDate.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
-            this.CmbSortDate.FormattingEnabled = true;
-            this.CmbSortDate.Items.AddRange(new object[] {
-            "Дата",
-            "Период"});
-            this.CmbSortDate.Location = new System.Drawing.Point(8, 3);
-            this.CmbSortDate.Name = "CmbSortDate";
-            this.CmbSortDate.Size = new System.Drawing.Size(168, 29);
-            this.CmbSortDate.TabIndex = 0;
-            this.CmbSortDate.SelectedIndexChanged += new System.EventHandler(this.CmbSortDate_SelectedIndexChanged);
-            // 
-            // PanelPeriod
-            // 
-            this.PanelPeriod.Controls.Add(this.DtpDateEnd);
-            this.PanelPeriod.Controls.Add(this.DtpDateStart);
-            this.PanelPeriod.Controls.Add(this.label6);
-            this.PanelPeriod.Controls.Add(this.label5);
-            this.PanelPeriod.Location = new System.Drawing.Point(168, -8);
-            this.PanelPeriod.Name = "PanelPeriod";
-            this.PanelPeriod.Size = new System.Drawing.Size(488, 51);
-            this.PanelPeriod.TabIndex = 3;
-            // 
-            // DtpDateEnd
-            // 
-            this.DtpDateEnd.Location = new System.Drawing.Point(279, 11);
-            this.DtpDateEnd.Name = "DtpDateEnd";
-            this.DtpDateEnd.Size = new System.Drawing.Size(199, 29);
-            this.DtpDateEnd.TabIndex = 7;
-            this.DtpDateEnd.ValueChanged += new System.EventHandler(this.DtpDateEnd_ValueChanged);
-            // 
-            // DtpDateStart
-            // 
-            this.DtpDateStart.Location = new System.Drawing.Point(36, 11);
-            this.DtpDateStart.Name = "DtpDateStart";
-            this.DtpDateStart.Size = new System.Drawing.Size(199, 29);
-            this.DtpDateStart.TabIndex = 6;
-            this.DtpDateStart.ValueChanged += new System.EventHandler(this.DtpDateStart_ValueChanged);
-            // 
-            // label6
-            // 
-            this.label6.AutoSize = true;
-            this.label6.Location = new System.Drawing.Point(10, 17);
-            this.label6.Name = "label6";
-            this.label6.Size = new System.Drawing.Size(20, 21);
-            this.label6.TabIndex = 4;
-            this.label6.Text = "С";
-            // 
-            // label5
-            // 
-            this.label5.AutoSize = true;
-            this.label5.Location = new System.Drawing.Point(241, 17);
-            this.label5.Name = "label5";
-            this.label5.Size = new System.Drawing.Size(32, 21);
-            this.label5.TabIndex = 5;
-            this.label5.Text = "По";
-            // 
-            // TbJournal
-            // 
-            this.TbJournal.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(253)))), ((int)(((byte)(255)))), ((int)(((byte)(252)))));
-            this.TbJournal.Controls.Add(this.TabCard);
-            this.TbJournal.Controls.Add(this.RPanelTitleJournal);
-            this.TbJournal.Font = new System.Drawing.Font("Segoe UI Variable Small Semibol", 12F, System.Drawing.FontStyle.Bold);
-            this.TbJournal.Location = new System.Drawing.Point(4, 30);
-            this.TbJournal.Name = "TbJournal";
-            this.TbJournal.Size = new System.Drawing.Size(723, 357);
-            this.TbJournal.TabIndex = 4;
-            this.TbJournal.Text = "tabPage1";
-            // 
-            // TabCard
-            // 
-            this.TabCard.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
-            | System.Windows.Forms.AnchorStyles.Left) 
-            | System.Windows.Forms.AnchorStyles.Right)));
-            this.TabCard.AutoScroll = true;
-            this.TabCard.ColumnCount = 5;
-            this.TabCard.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
-            this.TabCard.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
-            this.TabCard.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
-            this.TabCard.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
-            this.TabCard.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
-            this.TabCard.Location = new System.Drawing.Point(3, 31);
-            this.TabCard.Name = "TabCard";
-            this.TabCard.RowCount = 1;
-            this.TabCard.RowStyles.Add(new System.Windows.Forms.RowStyle());
-            this.TabCard.Size = new System.Drawing.Size(717, 331);
-            this.TabCard.TabIndex = 8;
-            // 
-            // ImList
-            // 
-            this.ImList.ColorDepth = System.Windows.Forms.ColorDepth.Depth32Bit;
-            this.ImList.ImageSize = new System.Drawing.Size(100, 100);
-            this.ImList.TransparentColor = System.Drawing.Color.Transparent;
-            // 
-            // TimerSaving
-            // 
-            this.TimerSaving.Interval = 500;
-            this.TimerSaving.Tick += new System.EventHandler(this.TimerSaving_Tick);
-            // 
-            // TmAnim
-            // 
-            this.TmAnim.Interval = 25;
-            this.TmAnim.Tick += new System.EventHandler(this.TmAnim_Tick);
-            // 
             // RPanelUser
             // 
             this.RPanelUser.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
@@ -657,6 +381,63 @@
             this.label4.Text = "<Пользователи>";
             this.label4.TextAlign = System.Drawing.ContentAlignment.TopCenter;
             // 
+            // TbMain
+            // 
+            this.TbMain.BackColor = System.Drawing.Color.White;
+            this.TbMain.Controls.Add(this.TableLayoutWorks);
+            this.TbMain.Location = new System.Drawing.Point(4, 30);
+            this.TbMain.Name = "TbMain";
+            this.TbMain.Padding = new System.Windows.Forms.Padding(3);
+            this.TbMain.Size = new System.Drawing.Size(723, 357);
+            this.TbMain.TabIndex = 0;
+            this.TbMain.Text = "tabPage1";
+            // 
+            // TableLayoutWorks
+            // 
+            this.TableLayoutWorks.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(253)))), ((int)(((byte)(255)))), ((int)(((byte)(252)))));
+            this.TableLayoutWorks.ColumnCount = 2;
+            this.TableLayoutWorks.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 256F));
+            this.TableLayoutWorks.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 473F));
+            this.TableLayoutWorks.Controls.Add(this.PbxEther, 1, 0);
+            this.TableLayoutWorks.Controls.Add(this.panel1, 0, 0);
+            this.TableLayoutWorks.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.TableLayoutWorks.Location = new System.Drawing.Point(3, 3);
+            this.TableLayoutWorks.Name = "TableLayoutWorks";
+            this.TableLayoutWorks.RowCount = 1;
+            this.TableLayoutWorks.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
+            this.TableLayoutWorks.Size = new System.Drawing.Size(717, 351);
+            this.TableLayoutWorks.TabIndex = 6;
+            // 
+            // PbxEther
+            // 
+            this.PbxEther.BackColor = System.Drawing.Color.Transparent;
+            this.PbxEther.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.PbxEther.Location = new System.Drawing.Point(258, 3);
+            this.PbxEther.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3);
+            this.PbxEther.Name = "PbxEther";
+            this.PbxEther.Size = new System.Drawing.Size(469, 345);
+            this.PbxEther.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
+            this.PbxEther.TabIndex = 2;
+            this.PbxEther.TabStop = false;
+            this.PbxEther.Click += new System.EventHandler(this.PbxEther_Click_1);
+            // 
+            // panel1
+            // 
+            this.panel1.BackColor = System.Drawing.Color.White;
+            this.panel1.Controls.Add(this.TbxPhone);
+            this.panel1.Controls.Add(this.TbxPasportNum);
+            this.panel1.Controls.Add(this.TbxPasportSeria);
+            this.panel1.Controls.Add(this.TbxPatronymic);
+            this.panel1.Controls.Add(this.TbxFirstname);
+            this.panel1.Controls.Add(this.RPanelForAddUser);
+            this.panel1.Controls.Add(this.TbxLastname);
+            this.panel1.Controls.Add(this.BtnSave);
+            this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.panel1.Location = new System.Drawing.Point(3, 3);
+            this.panel1.Name = "panel1";
+            this.panel1.Size = new System.Drawing.Size(250, 345);
+            this.panel1.TabIndex = 0;
+            // 
             // TbxPhone
             // 
             this.TbxPhone.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(253)))), ((int)(((byte)(255)))), ((int)(((byte)(252)))));
@@ -805,6 +586,38 @@
             this.TbxLastname.TextPreview = "Фамилия";
             this.TbxLastname.UseSystemPasswordChar = false;
             // 
+            // BtnSave
+            // 
+            this.BtnSave.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(124)))), ((int)(((byte)(136)))), ((int)(((byte)(144)))));
+            this.BtnSave.Font = new System.Drawing.Font("Segoe UI Variable Small Semibol", 12F, System.Drawing.FontStyle.Bold);
+            this.BtnSave.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(246)))), ((int)(((byte)(255)))), ((int)(((byte)(248)))));
+            this.BtnSave.Location = new System.Drawing.Point(7, 307);
+            this.BtnSave.Name = "BtnSave";
+            this.BtnSave.Size = new System.Drawing.Size(236, 35);
+            this.BtnSave.TabIndex = 3;
+            this.BtnSave.Text = "Добавить";
+            this.BtnSave.UseVisualStyleBackColor = false;
+            this.BtnSave.Click += new System.EventHandler(this.BtnSave_Click);
+            // 
+            // TbSettings
+            // 
+            this.TbSettings.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(253)))), ((int)(((byte)(255)))), ((int)(((byte)(252)))));
+            this.TbSettings.Controls.Add(this.label11);
+            this.TbSettings.Controls.Add(this.numericUpDown1);
+            this.TbSettings.Controls.Add(this.label10);
+            this.TbSettings.Controls.Add(this.SwPositionWindow);
+            this.TbSettings.Controls.Add(this.label3);
+            this.TbSettings.Controls.Add(this.label2);
+            this.TbSettings.Controls.Add(this.RPanelSettings);
+            this.TbSettings.Controls.Add(this.SwAutoLoad);
+            this.TbSettings.Font = new System.Drawing.Font("Segoe UI Variable Small Semibol", 12F, System.Drawing.FontStyle.Bold);
+            this.TbSettings.Location = new System.Drawing.Point(4, 30);
+            this.TbSettings.Name = "TbSettings";
+            this.TbSettings.Padding = new System.Windows.Forms.Padding(3);
+            this.TbSettings.Size = new System.Drawing.Size(723, 357);
+            this.TbSettings.TabIndex = 1;
+            this.TbSettings.Text = "tabPage2";
+            // 
             // SwPositionWindow
             // 
             this.SwPositionWindow.BackColor = System.Drawing.Color.White;
@@ -819,6 +632,24 @@
             this.SwPositionWindow.TabIndex = 5;
             this.SwPositionWindow.TextOnChecked = "";
             // 
+            // label3
+            // 
+            this.label3.AutoSize = true;
+            this.label3.Location = new System.Drawing.Point(8, 83);
+            this.label3.Name = "label3";
+            this.label3.Size = new System.Drawing.Size(365, 21);
+            this.label3.TabIndex = 4;
+            this.label3.Text = "Сохранять положение окна при перезапуске";
+            // 
+            // label2
+            // 
+            this.label2.AutoSize = true;
+            this.label2.Location = new System.Drawing.Point(8, 46);
+            this.label2.Name = "label2";
+            this.label2.Size = new System.Drawing.Size(340, 21);
+            this.label2.TabIndex = 3;
+            this.label2.Text = "Запускать приложение вместе с системой";
+            // 
             // RPanelSettings
             // 
             this.RPanelSettings.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
@@ -873,6 +704,46 @@
             this.SwAutoLoad.TabIndex = 1;
             this.SwAutoLoad.TextOnChecked = "";
             // 
+            // TbVisits
+            // 
+            this.TbVisits.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(253)))), ((int)(((byte)(255)))), ((int)(((byte)(252)))));
+            this.TbVisits.Controls.Add(this.label7);
+            this.TbVisits.Controls.Add(this.PanelHeader);
+            this.TbVisits.Controls.Add(this.TbxFindUser);
+            this.TbVisits.Controls.Add(this.TabJournal);
+            this.TbVisits.Controls.Add(this.DtpFiniteDate);
+            this.TbVisits.Controls.Add(this.CmbSortDate);
+            this.TbVisits.Controls.Add(this.PanelPeriod);
+            this.TbVisits.Font = new System.Drawing.Font("Segoe UI Variable Small Semibol", 12F, System.Drawing.FontStyle.Bold);
+            this.TbVisits.Location = new System.Drawing.Point(4, 30);
+            this.TbVisits.Name = "TbVisits";
+            this.TbVisits.Size = new System.Drawing.Size(723, 357);
+            this.TbVisits.TabIndex = 3;
+            this.TbVisits.Text = "tabPage1";
+            // 
+            // label7
+            // 
+            this.label7.AutoSize = true;
+            this.label7.Location = new System.Drawing.Point(8, 44);
+            this.label7.Name = "label7";
+            this.label7.Size = new System.Drawing.Size(128, 21);
+            this.label7.TabIndex = 6;
+            this.label7.Text = "Поиск по ФИО:";
+            // 
+            // PanelHeader
+            // 
+            this.PanelHeader.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
+            | System.Windows.Forms.AnchorStyles.Right)));
+            this.PanelHeader.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(253)))), ((int)(((byte)(255)))), ((int)(((byte)(252)))));
+            this.PanelHeader.Controls.Add(this.RPanelTitleDate);
+            this.PanelHeader.Controls.Add(this.RPanelTitleExit);
+            this.PanelHeader.Controls.Add(this.RPanelTitleEntrance);
+            this.PanelHeader.Controls.Add(this.RPanelForNameUser);
+            this.PanelHeader.Location = new System.Drawing.Point(0, 76);
+            this.PanelHeader.Name = "PanelHeader";
+            this.PanelHeader.Size = new System.Drawing.Size(723, 32);
+            this.PanelHeader.TabIndex = 8;
+            // 
             // RPanelTitleDate
             // 
             this.RPanelTitleDate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
@@ -1022,6 +893,126 @@
             this.LblTitleNameUser.Text = "Имя пользователя";
             this.LblTitleNameUser.TextAlign = System.Drawing.ContentAlignment.TopCenter;
             // 
+            // TbxFindUser
+            // 
+            this.TbxFindUser.Location = new System.Drawing.Point(142, 41);
+            this.TbxFindUser.Name = "TbxFindUser";
+            this.TbxFindUser.Size = new System.Drawing.Size(221, 29);
+            this.TbxFindUser.TabIndex = 7;
+            this.TbxFindUser.TextChanged += new System.EventHandler(this.TbxFindUser_TextChanged);
+            // 
+            // TabJournal
+            // 
+            this.TabJournal.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
+            | System.Windows.Forms.AnchorStyles.Left) 
+            | System.Windows.Forms.AnchorStyles.Right)));
+            this.TabJournal.AutoScroll = true;
+            this.TabJournal.ColumnCount = 1;
+            this.TabJournal.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
+            this.TabJournal.Location = new System.Drawing.Point(0, 110);
+            this.TabJournal.Name = "TabJournal";
+            this.TabJournal.RowCount = 1;
+            this.TabJournal.RowStyles.Add(new System.Windows.Forms.RowStyle());
+            this.TabJournal.Size = new System.Drawing.Size(723, 252);
+            this.TabJournal.TabIndex = 5;
+            // 
+            // DtpFiniteDate
+            // 
+            this.DtpFiniteDate.Location = new System.Drawing.Point(182, 3);
+            this.DtpFiniteDate.Name = "DtpFiniteDate";
+            this.DtpFiniteDate.Size = new System.Drawing.Size(199, 29);
+            this.DtpFiniteDate.TabIndex = 1;
+            this.DtpFiniteDate.ValueChanged += new System.EventHandler(this.DtpFiniteDate_ValueChanged);
+            // 
+            // CmbSortDate
+            // 
+            this.CmbSortDate.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+            this.CmbSortDate.FormattingEnabled = true;
+            this.CmbSortDate.Items.AddRange(new object[] {
+            "Дата",
+            "Период"});
+            this.CmbSortDate.Location = new System.Drawing.Point(8, 3);
+            this.CmbSortDate.Name = "CmbSortDate";
+            this.CmbSortDate.Size = new System.Drawing.Size(168, 29);
+            this.CmbSortDate.TabIndex = 0;
+            this.CmbSortDate.SelectedIndexChanged += new System.EventHandler(this.CmbSortDate_SelectedIndexChanged);
+            // 
+            // PanelPeriod
+            // 
+            this.PanelPeriod.Controls.Add(this.DtpDateEnd);
+            this.PanelPeriod.Controls.Add(this.DtpDateStart);
+            this.PanelPeriod.Controls.Add(this.label6);
+            this.PanelPeriod.Controls.Add(this.label5);
+            this.PanelPeriod.Location = new System.Drawing.Point(168, -8);
+            this.PanelPeriod.Name = "PanelPeriod";
+            this.PanelPeriod.Size = new System.Drawing.Size(488, 51);
+            this.PanelPeriod.TabIndex = 3;
+            // 
+            // DtpDateEnd
+            // 
+            this.DtpDateEnd.Location = new System.Drawing.Point(279, 11);
+            this.DtpDateEnd.Name = "DtpDateEnd";
+            this.DtpDateEnd.Size = new System.Drawing.Size(199, 29);
+            this.DtpDateEnd.TabIndex = 7;
+            this.DtpDateEnd.ValueChanged += new System.EventHandler(this.DtpDateEnd_ValueChanged);
+            // 
+            // DtpDateStart
+            // 
+            this.DtpDateStart.Location = new System.Drawing.Point(36, 11);
+            this.DtpDateStart.Name = "DtpDateStart";
+            this.DtpDateStart.Size = new System.Drawing.Size(199, 29);
+            this.DtpDateStart.TabIndex = 6;
+            this.DtpDateStart.ValueChanged += new System.EventHandler(this.DtpDateStart_ValueChanged);
+            // 
+            // label6
+            // 
+            this.label6.AutoSize = true;
+            this.label6.Location = new System.Drawing.Point(10, 17);
+            this.label6.Name = "label6";
+            this.label6.Size = new System.Drawing.Size(20, 21);
+            this.label6.TabIndex = 4;
+            this.label6.Text = "С";
+            // 
+            // label5
+            // 
+            this.label5.AutoSize = true;
+            this.label5.Location = new System.Drawing.Point(241, 17);
+            this.label5.Name = "label5";
+            this.label5.Size = new System.Drawing.Size(32, 21);
+            this.label5.TabIndex = 5;
+            this.label5.Text = "По";
+            // 
+            // TbJournal
+            // 
+            this.TbJournal.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(253)))), ((int)(((byte)(255)))), ((int)(((byte)(252)))));
+            this.TbJournal.Controls.Add(this.TabCard);
+            this.TbJournal.Controls.Add(this.RPanelTitleJournal);
+            this.TbJournal.Font = new System.Drawing.Font("Segoe UI Variable Small Semibol", 12F, System.Drawing.FontStyle.Bold);
+            this.TbJournal.Location = new System.Drawing.Point(4, 30);
+            this.TbJournal.Name = "TbJournal";
+            this.TbJournal.Size = new System.Drawing.Size(723, 357);
+            this.TbJournal.TabIndex = 4;
+            this.TbJournal.Text = "tabPage1";
+            // 
+            // TabCard
+            // 
+            this.TabCard.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
+            | System.Windows.Forms.AnchorStyles.Left) 
+            | System.Windows.Forms.AnchorStyles.Right)));
+            this.TabCard.AutoScroll = true;
+            this.TabCard.ColumnCount = 5;
+            this.TabCard.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
+            this.TabCard.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
+            this.TabCard.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
+            this.TabCard.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
+            this.TabCard.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
+            this.TabCard.Location = new System.Drawing.Point(3, 31);
+            this.TabCard.Name = "TabCard";
+            this.TabCard.RowCount = 1;
+            this.TabCard.RowStyles.Add(new System.Windows.Forms.RowStyle());
+            this.TabCard.Size = new System.Drawing.Size(717, 331);
+            this.TabCard.TabIndex = 8;
+            // 
             // RPanelTitleJournal
             // 
             this.RPanelTitleJournal.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
@@ -1062,6 +1053,64 @@
             this.label9.Text = "<Журнал отклонённых>";
             this.label9.TextAlign = System.Drawing.ContentAlignment.TopCenter;
             // 
+            // ImList
+            // 
+            this.ImList.ColorDepth = System.Windows.Forms.ColorDepth.Depth32Bit;
+            this.ImList.ImageSize = new System.Drawing.Size(100, 100);
+            this.ImList.TransparentColor = System.Drawing.Color.Transparent;
+            // 
+            // TimerSaving
+            // 
+            this.TimerSaving.Interval = 500;
+            this.TimerSaving.Tick += new System.EventHandler(this.TimerSaving_Tick);
+            // 
+            // TmAnim
+            // 
+            this.TmAnim.Interval = 25;
+            this.TmAnim.Tick += new System.EventHandler(this.TmAnim_Tick);
+            // 
+            // label10
+            // 
+            this.label10.AutoSize = true;
+            this.label10.Location = new System.Drawing.Point(8, 118);
+            this.label10.Name = "label10";
+            this.label10.Size = new System.Drawing.Size(203, 21);
+            this.label10.TabIndex = 6;
+            this.label10.Text = "Хранить файлы журнала";
+            // 
+            // numericUpDown1
+            // 
+            this.numericUpDown1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+            this.numericUpDown1.Location = new System.Drawing.Point(403, 116);
+            this.numericUpDown1.Maximum = new decimal(new int[] {
+            30,
+            0,
+            0,
+            0});
+            this.numericUpDown1.Minimum = new decimal(new int[] {
+            2,
+            0,
+            0,
+            0});
+            this.numericUpDown1.Name = "numericUpDown1";
+            this.numericUpDown1.ReadOnly = true;
+            this.numericUpDown1.Size = new System.Drawing.Size(63, 29);
+            this.numericUpDown1.TabIndex = 7;
+            this.numericUpDown1.Value = new decimal(new int[] {
+            2,
+            0,
+            0,
+            0});
+            // 
+            // label11
+            // 
+            this.label11.AutoSize = true;
+            this.label11.Location = new System.Drawing.Point(472, 118);
+            this.label11.Name = "label11";
+            this.label11.Size = new System.Drawing.Size(49, 21);
+            this.label11.TabIndex = 8;
+            this.label11.Text = "дней";
+            // 
             // FormMain
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 21F);
@@ -1091,26 +1140,27 @@
             this.statusStrip1.PerformLayout();
             this.TabPages.ResumeLayout(false);
             this.TbUsers.ResumeLayout(false);
+            this.RPanelUser.ResumeLayout(false);
             this.TbMain.ResumeLayout(false);
             this.TableLayoutWorks.ResumeLayout(false);
             ((System.ComponentModel.ISupportInitialize)(this.PbxEther)).EndInit();
             this.panel1.ResumeLayout(false);
+            this.RPanelForAddUser.ResumeLayout(false);
             this.TbSettings.ResumeLayout(false);
             this.TbSettings.PerformLayout();
+            this.RPanelSettings.ResumeLayout(false);
             this.TbVisits.ResumeLayout(false);
             this.TbVisits.PerformLayout();
             this.PanelHeader.ResumeLayout(false);
-            this.PanelPeriod.ResumeLayout(false);
-            this.PanelPeriod.PerformLayout();
-            this.TbJournal.ResumeLayout(false);
-            this.RPanelUser.ResumeLayout(false);
-            this.RPanelForAddUser.ResumeLayout(false);
-            this.RPanelSettings.ResumeLayout(false);
             this.RPanelTitleDate.ResumeLayout(false);
             this.RPanelTitleExit.ResumeLayout(false);
             this.RPanelTitleEntrance.ResumeLayout(false);
             this.RPanelForNameUser.ResumeLayout(false);
+            this.PanelPeriod.ResumeLayout(false);
+            this.PanelPeriod.PerformLayout();
+            this.TbJournal.ResumeLayout(false);
             this.RPanelTitleJournal.ResumeLayout(false);
+            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
             this.ResumeLayout(false);
             this.PerformLayout();
 
@@ -1191,6 +1241,9 @@
         private RPanel RPanelTitleJournal;
         private System.Windows.Forms.Label label9;
         private System.Windows.Forms.TableLayoutPanel TabCard;
+        private System.Windows.Forms.Label label11;
+        private System.Windows.Forms.NumericUpDown numericUpDown1;
+        private System.Windows.Forms.Label label10;
     }
 }
 

+ 86 - 17
ImpulseVision/FormMain.cs

@@ -82,8 +82,6 @@ namespace ImpulseVision
             set
             {
                 cameraCaptureFace = value;
-                //imgDetectFace.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => { imgDetectFace.Source = BitmapToImageSource(cameraCaptureFace); }));
-                //PbxFaces.Image = BitmapToImageSource(cameraCapture);
                 PbxEther.Image = cameraCapture;
 
                 NotifyPropertyChanged();
@@ -103,10 +101,18 @@ namespace ImpulseVision
 
         public static string TxtCon = $@"Data Source=213.155.192.79,3002;Initial Catalog=ImpulseVisionApp;Persist Security Info=True;User ID=u20teresh;Password=bfg2";
 
-        //хранение информации о выбранном пользователе
+        /// <summary>
+        /// текущий выбранный пользователь из списка
+        /// </summary>
         UserItem CurrentUser = null;
-
+        /// <summary>
+        /// выбранная плитка в окне "посещения"
+        /// </summary>
         TileOvals CurrentOvals = null;
+        /// <summary>
+        /// выбранная плитка в окне "журнал отклонённых"
+        /// </summary>
+        CardJournal CurrentCard = null;
 
         SqlConnection SCon = new SqlConnection(Properties.Settings.Default.ImpulseVisionAppConnectionString);
         //список с пользователями системы
@@ -143,7 +149,7 @@ namespace ImpulseVision
         }
 
         /// <summary>
-        /// получение данных с камеры и обработка изображени
+        /// получение данных с камеры и обработка изображений
         /// </summary>
         private void ProcessFrame()
         {
@@ -152,7 +158,7 @@ namespace ImpulseVision
             if (BgrFrame != null)
             {
                 try
-                {//for emgu cv bug
+                {
                     Image<Gray, byte> grayframe = BgrFrame.Convert<Gray, byte>();
 
                     Rectangle[] Faces = HaarCascade.DetectMultiScale(grayframe, 1.2, 10, new System.Drawing.Size(50, 50), new System.Drawing.Size(200, 200));
@@ -950,6 +956,42 @@ from UserTraffic ut join Users on ut.UserID = Users.ID
             TabCard.Controls.Clear();
             DirectoryInfo Dir = new DirectoryInfo(Application.StartupPath + "\\Source\\log\\");
             FileInfo[] Files = Dir.GetFiles();
+
+            Dictionary<string, string> Keys = new Dictionary<string, string>();
+            List<string> LstID = new List<string>();
+            foreach (var t in Files)
+            {
+                string[] Parts = t.ToString().Split('_');
+                //добавить ID очередного пользователя в список
+                LstID.Add(Parts[1]);
+            }
+            try
+            {
+                SCon.Open();
+                string QueryGetUserName = $@"select ID, Lastname + ' '+Firstname + ' ' + Patronymic as FIO from Users where ID in ({string.Join(", ", LstID)}) ";
+                SqlCommand Cmd = new SqlCommand(QueryGetUserName, SCon);
+                SqlDataReader Res = Cmd.ExecuteReader();
+                if (Res.HasRows)
+                {
+                    while (Res.Read())
+                    {
+                        Keys[Res["ID"].ToString()] = Res["FIO"].ToString();
+                    }
+                }
+                else
+                {
+                    MessageBox.Show("В данный момент журнал отклонённых пуст!", "ImpulseVision", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
+                    SCon.Close();
+                    return;
+                }
+                SCon.Close();
+            }
+            catch
+            {
+                MessageBox.Show("Ошибка получени данных журнала, повторите попытку позже!", "ImpulseVision", MessageBoxButtons.OK, MessageBoxIcon.Error);
+                SCon.Close();
+                return;
+            }
             foreach (var t in Files)
             {
                 CardJournal card = new CardJournal();
@@ -964,27 +1006,54 @@ from UserTraffic ut join Users on ut.UserID = Users.ID
 
                 string[] Parts = t.ToString().Split('_');
                 string Name = "";
-                SCon.Open();
-                string QueryGetUserName = $"select Lastname + ' '+Firstname + ' ' + Patronymic as FIO\r\nfrom Users\r\nwhere ID = '{Parts[1]}'";
-                SqlCommand Cmd = new SqlCommand(QueryGetUserName, SCon);
-                SqlDataReader Res = Cmd.ExecuteReader();
-                if (Res.HasRows)
+
+                try
                 {
-                    Res.Read();
-                    Name = Res["FIO"].ToString();
+                    Name = Keys[Parts[1]];
                 }
-                else
+                catch
                 {
                     Name = "Неизвестно";
                 }
-                SCon.Close();
 
                 card.LblUserName.Text = Name;
-                card.LblCheckTime.Text = $"{Parts[2].ToString().Substring(0,2)}:{Parts[2].ToString().Substring(2, 2)}" + " " + Parts[3];
+                card.LblCheckTime.Text = $"{Parts[2].ToString().Substring(0, 2)}:{Parts[2].ToString().Substring(2, 2)}" + " " + Parts[3];
 
-                TabCard.Controls.Add(card);
+                card.Click += Card_Click;
+                card.LblUserName.Click += Card_ObjectClick;
+                card.LblCheckTime.Click += Card_ObjectClick;
+                card.PbxImage.Click += OpenFullView;
+                card.label1.Click += Card_ObjectClick;
+                card.label3.Click += Card_ObjectClick;
 
+                TabCard.Controls.Add(card);
+                if (TabCard.Controls.Count == 1)
+                {
+                    CurrentCard = card;
+                    CurrentCard.BackColor = Color.FromArgb(195, 235, 120);
+                }
             }
         }
+
+        private void OpenFullView(object sender, EventArgs e)
+        {
+            FormViewPhoto Fv = new FormViewPhoto();
+            Fv.PbxImage.Image = (sender as PictureBox).Image;
+            Fv.ShowDialog();
+        }
+
+        private void Card_ObjectClick(object sender, EventArgs e)
+        {
+            CurrentCard.BackColor = Color.FromArgb(184, 184, 255);
+            CurrentCard = (sender as Control).Parent as CardJournal;
+            CurrentCard.BackColor = Color.FromArgb(195, 235, 120);
+        }
+
+        private void Card_Click(object sender, EventArgs e)
+        {
+            CurrentCard.BackColor = Color.FromArgb(184, 184, 255);
+            CurrentCard = sender as CardJournal;
+            CurrentCard.BackColor = Color.FromArgb(195, 235, 120);
+        }
     }
 }

+ 68 - 0
ImpulseVision/FormViewPhoto.Designer.cs

@@ -0,0 +1,68 @@
+namespace ImpulseVision
+{
+    partial class FormViewPhoto
+    {
+        /// <summary>
+        /// Required designer variable.
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary>
+        /// Clean up any resources being used.
+        /// </summary>
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Windows Form Designer generated code
+
+        /// <summary>
+        /// Required method for Designer support - do not modify
+        /// the contents of this method with the code editor.
+        /// </summary>
+        private void InitializeComponent()
+        {
+            this.PbxImage = new System.Windows.Forms.PictureBox();
+            ((System.ComponentModel.ISupportInitialize)(this.PbxImage)).BeginInit();
+            this.SuspendLayout();
+            // 
+            // PbxImage
+            // 
+            this.PbxImage.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.PbxImage.Location = new System.Drawing.Point(0, 0);
+            this.PbxImage.Name = "PbxImage";
+            this.PbxImage.Size = new System.Drawing.Size(659, 385);
+            this.PbxImage.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
+            this.PbxImage.TabIndex = 0;
+            this.PbxImage.TabStop = false;
+            this.PbxImage.Click += new System.EventHandler(this.PbxImage_Click);
+            // 
+            // FormViewPhoto
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.BackColor = System.Drawing.Color.Black;
+            this.ClientSize = new System.Drawing.Size(659, 385);
+            this.Controls.Add(this.PbxImage);
+            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
+            this.Name = "FormViewPhoto";
+            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
+            this.Text = "FormViewPhoto";
+            this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
+            this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.FormViewPhoto_KeyDown);
+            ((System.ComponentModel.ISupportInitialize)(this.PbxImage)).EndInit();
+            this.ResumeLayout(false);
+
+        }
+
+        #endregion
+
+        public System.Windows.Forms.PictureBox PbxImage;
+    }
+}

+ 33 - 0
ImpulseVision/FormViewPhoto.cs

@@ -0,0 +1,33 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace ImpulseVision
+{
+    public partial class FormViewPhoto : Form
+    {
+        public FormViewPhoto()
+        {
+            InitializeComponent();
+        }
+
+        private void FormViewPhoto_KeyDown(object sender, KeyEventArgs e)
+        {
+            if(e.KeyCode == Keys.Escape)
+            {
+                this.Close();
+            }
+        }
+
+        private void PbxImage_Click(object sender, EventArgs e)
+        {
+            this.Close();
+        }
+    }
+}

+ 120 - 0
ImpulseVision/FormViewPhoto.resx

@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>

+ 9 - 0
ImpulseVision/ImpulseVision.csproj

@@ -177,6 +177,12 @@
     <Compile Include="FormTemp.Designer.cs">
       <DependentUpon>FormTemp.cs</DependentUpon>
     </Compile>
+    <Compile Include="FormViewPhoto.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="FormViewPhoto.Designer.cs">
+      <DependentUpon>FormViewPhoto.cs</DependentUpon>
+    </Compile>
     <Compile Include="GTextBox.cs">
       <SubType>Component</SubType>
     </Compile>
@@ -238,6 +244,9 @@
     <EmbeddedResource Include="FormTemp.resx">
       <DependentUpon>FormTemp.cs</DependentUpon>
     </EmbeddedResource>
+    <EmbeddedResource Include="FormViewPhoto.resx">
+      <DependentUpon>FormViewPhoto.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="Properties\Resources.resx">
       <Generator>ResXFileCodeGenerator</Generator>
       <LastGenOutput>Resources.Designer.cs</LastGenOutput>

+ 0 - 10
ImpulseVision/Properties/Resources.Designer.cs

@@ -262,15 +262,5 @@ namespace ImpulseVision.Properties {
                 return ((System.Drawing.Bitmap)(obj));
             }
         }
-        
-        /// <summary>
-        ///   Looks up a localized resource of type System.Drawing.Bitmap.
-        /// </summary>
-        internal static System.Drawing.Bitmap User_9_180841_25_04_2023_5b33 {
-            get {
-                object obj = ResourceManager.GetObject("User_9_180841_25.04.2023_5b33", resourceCulture);
-                return ((System.Drawing.Bitmap)(obj));
-            }
-        }
     }
 }

+ 0 - 3
ImpulseVision/Properties/Resources.resx

@@ -142,9 +142,6 @@
   <data name="8666656_check_circle_icon" type="System.Resources.ResXFileRef, System.Windows.Forms">
     <value>..\Resources\8666656_check_circle_icon.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
   </data>
-  <data name="User_9_180841_25.04.2023_5b33" type="System.Resources.ResXFileRef, System.Windows.Forms">
-    <value>..\bin\Debug\Source\log\User_9_180841_25.04.2023_5b33.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
-  </data>
   <data name="loading_7" type="System.Resources.ResXFileRef, System.Windows.Forms">
     <value>..\Resources\loading-7.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
   </data>

BIN
ImpulseVision/bin/Debug/ImpulseVision.exe