Parcourir la source

RELEASE (BETA)

Вячеслав Терешенко il y a 2 ans
Parent
commit
36bd37a9e2

+ 2 - 3
ImpulseVision/FormEditUser.Designer.cs

@@ -68,7 +68,6 @@
             // 
             this.BtnSaveEditing.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
             this.BtnSaveEditing.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(124)))), ((int)(((byte)(136)))), ((int)(((byte)(144)))));
-            this.BtnSaveEditing.DialogResult = System.Windows.Forms.DialogResult.OK;
             this.BtnSaveEditing.Font = new System.Drawing.Font("Segoe UI Variable Small Semibol", 12F, System.Drawing.FontStyle.Bold);
             this.BtnSaveEditing.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(246)))), ((int)(((byte)(255)))), ((int)(((byte)(248)))));
             this.BtnSaveEditing.Location = new System.Drawing.Point(195, 325);
@@ -109,8 +108,8 @@
             this.TbxPassportNumber.TextInput = "";
             this.TbxPassportNumber.TextPreview = "Номер паспорта";
             this.TbxPassportNumber.UseSystemPasswordChar = false;
-            this.TbxPassportNumber.TextChanged += new System.EventHandler(this.TbxPassportNumber_TextChanged);
             this.TbxPassportNumber.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.TbxPassportSeria_KeyPress);
+            this.TbxPassportNumber.Validated += new System.EventHandler(this.TbxPassportNumber_Validated);
             // 
             // BsUserInfo
             // 
@@ -142,8 +141,8 @@
             this.TbxPassportSeria.TextInput = "";
             this.TbxPassportSeria.TextPreview = "Серия паспорта";
             this.TbxPassportSeria.UseSystemPasswordChar = false;
-            this.TbxPassportSeria.TextChanged += new System.EventHandler(this.TbxPassportSeria_TextChanged);
             this.TbxPassportSeria.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.TbxPassportSeria_KeyPress);
+            this.TbxPassportSeria.Validated += new System.EventHandler(this.TbxPassportSeria_Validated);
             // 
             // TbxPatronymic
             // 

+ 34 - 20
ImpulseVision/FormEditUser.cs

@@ -32,24 +32,6 @@ namespace ImpulseVision
 
         }
 
-        private void TbxPassportNumber_TextChanged(object sender, EventArgs e)
-        {
-            if(TbxPassportNumber.Text.Trim().Length > 6)
-            {
-                string txt = TbxPassportNumber.Text.Trim().Substring(0, 6);
-                TbxPassportNumber.Text = txt;
-            }
-        }
-
-        private void TbxPassportSeria_TextChanged(object sender, EventArgs e)
-        {
-            if (TbxPassportSeria.Text.Trim().Length > 4)
-            {
-                string txt = TbxPassportSeria.Text.Trim().Substring(0, 4);
-                TbxPassportSeria.Text = txt;
-            }
-        }
-
         private void FormEditUser_Load(object sender, EventArgs e)
         {
             // TODO: This line of code loads data into the 'impulseVisionAppDataSet1.Users' table. You can move, or remove it, as needed.
@@ -57,15 +39,47 @@ namespace ImpulseVision
 
             LblSelectUserID.Hide();
             BsUserInfo.Filter = $"ID = '{LblSelectUserID.Text.Trim()}'";
-
-
         }
 
         private void BtnSaveEditing_Click(object sender, EventArgs e)
         {
+            BtnSaveEditing.DialogResult = DialogResult.None;
+            if (TbxPassportSeria.Text.Trim().Length < 4)
+            {
+                MessageBox.Show("Серия паспорта не может быть короче 4-х чисел!", "ImpulseVision", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
+                return;
+            }
+            if (TbxPassportNumber.Text.Trim().Length < 6)
+            {
+                MessageBox.Show("Номер паспорта не может быть короче 6-ти чисел!", "ImpulseVision", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
+                return;
+            }
+            if (TbxPhone.Text.Trim().Length < 10)
+            {
+                MessageBox.Show("Номер телефона не может быть короче 10-ти чисел!", "ImpulseVision", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
+                return;
+            }
+            BtnSaveEditing.DialogResult = DialogResult.OK;
+
             BsUserInfo.EndEdit();
             this.usersTableAdapter.Update(this.impulseVisionAppDataSet1.Users);
             Close();
         }
+
+        private void TbxPassportSeria_Validated(object sender, EventArgs e)
+        {
+            if (TbxPassportSeria.Text.Trim().Length > 4)
+            {
+                TbxPassportSeria.Text = TbxPassportSeria.Text.Trim().Substring(0, 4);
+            }
+        }
+
+        private void TbxPassportNumber_Validated(object sender, EventArgs e)
+        {
+            if (TbxPassportNumber.Text.Trim().Length > 6)
+            {
+                TbxPassportNumber.Text = TbxPassportNumber.Text.Trim().Substring(0, 6);
+            }
+        }
     }
 }

+ 33 - 29
ImpulseVision/FormMain.Designer.cs

@@ -71,13 +71,14 @@
             this.BtnSave = new System.Windows.Forms.Button();
             this.TbSettings = new System.Windows.Forms.TabPage();
             this.GbxUserParameters = new System.Windows.Forms.GroupBox();
+            this.LblAdminID = new System.Windows.Forms.Label();
+            this.BsAdministrator = new System.Windows.Forms.BindingSource(this.components);
+            this.impulseVisionAppDataSet1 = new ImpulseVision.ImpulseVisionAppDataSet();
             this.BtnEditUserParameters = new System.Windows.Forms.Button();
             this.TbxConfirmNewPass = new ImpulseVision.EgoldsGoogleTextBox();
             this.TbxNewPass = new ImpulseVision.EgoldsGoogleTextBox();
             this.TbxOldPass = new ImpulseVision.EgoldsGoogleTextBox();
             this.TbxLogin = new ImpulseVision.EgoldsGoogleTextBox();
-            this.BsAdministrator = new System.Windows.Forms.BindingSource(this.components);
-            this.impulseVisionAppDataSet1 = new ImpulseVision.ImpulseVisionAppDataSet();
             this.GbxSystemParameters = new System.Windows.Forms.GroupBox();
             this.SwSaveSizeWindow = new ImpulseVision.EgoldsToggleSwitch();
             this.SwAutoRun = new ImpulseVision.EgoldsToggleSwitch();
@@ -120,7 +121,6 @@
             this.TimerSaving = new System.Windows.Forms.Timer(this.components);
             this.TmAnim = new System.Windows.Forms.Timer(this.components);
             this.staffsTableAdapter = new ImpulseVision.ImpulseVisionAppDataSetTableAdapters.StaffsTableAdapter();
-            this.LblAdminID = new System.Windows.Forms.Label();
             this.menuStrip1.SuspendLayout();
             this.ToolsMenu.SuspendLayout();
             this.statusStrip1.SuspendLayout();
@@ -358,7 +358,7 @@
             this.TableUsers.Name = "TableUsers";
             this.TableUsers.RowCount = 1;
             this.TableUsers.RowStyles.Add(new System.Windows.Forms.RowStyle());
-            this.TableUsers.Size = new System.Drawing.Size(781, 291);
+            this.TableUsers.Size = new System.Drawing.Size(781, 283);
             this.TableUsers.TabIndex = 7;
             // 
             // RPanelUser
@@ -492,6 +492,8 @@
             this.TbxPasportNum.TextInput = "";
             this.TbxPasportNum.TextPreview = "Номер паспорта";
             this.TbxPasportNum.UseSystemPasswordChar = false;
+            this.TbxPasportNum.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.TbxPasportSeria_KeyPress);
+            this.TbxPasportNum.Validated += new System.EventHandler(this.TbxPasportNum_Validated);
             // 
             // TbxPasportSeria
             // 
@@ -510,6 +512,8 @@
             this.TbxPasportSeria.TextInput = "";
             this.TbxPasportSeria.TextPreview = "Серия паспорта";
             this.TbxPasportSeria.UseSystemPasswordChar = false;
+            this.TbxPasportSeria.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.TbxPasportSeria_KeyPress);
+            this.TbxPasportSeria.Validated += new System.EventHandler(this.TbxPasportSeria_Validated);
             // 
             // TbxPatronymic
             // 
@@ -645,18 +649,38 @@
             this.GbxUserParameters.Controls.Add(this.TbxLogin);
             this.GbxUserParameters.Location = new System.Drawing.Point(543, 37);
             this.GbxUserParameters.Name = "GbxUserParameters";
-            this.GbxUserParameters.Size = new System.Drawing.Size(232, 314);
+            this.GbxUserParameters.Size = new System.Drawing.Size(232, 322);
             this.GbxUserParameters.TabIndex = 12;
             this.GbxUserParameters.TabStop = false;
             this.GbxUserParameters.Text = "Параметры пользователя";
             // 
+            // LblAdminID
+            // 
+            this.LblAdminID.AutoSize = true;
+            this.LblAdminID.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.BsAdministrator, "ID", true));
+            this.LblAdminID.Location = new System.Drawing.Point(6, 209);
+            this.LblAdminID.Name = "LblAdminID";
+            this.LblAdminID.Size = new System.Drawing.Size(77, 21);
+            this.LblAdminID.TabIndex = 12;
+            this.LblAdminID.Text = "AdminID";
+            // 
+            // BsAdministrator
+            // 
+            this.BsAdministrator.DataMember = "Staffs";
+            this.BsAdministrator.DataSource = this.impulseVisionAppDataSet1;
+            // 
+            // impulseVisionAppDataSet1
+            // 
+            this.impulseVisionAppDataSet1.DataSetName = "ImpulseVisionAppDataSet";
+            this.impulseVisionAppDataSet1.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema;
+            // 
             // BtnEditUserParameters
             // 
             this.BtnEditUserParameters.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
             this.BtnEditUserParameters.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(124)))), ((int)(((byte)(136)))), ((int)(((byte)(144)))));
             this.BtnEditUserParameters.Font = new System.Drawing.Font("Segoe UI Variable Small Semibol", 12F, System.Drawing.FontStyle.Bold);
             this.BtnEditUserParameters.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(246)))), ((int)(((byte)(255)))), ((int)(((byte)(248)))));
-            this.BtnEditUserParameters.Location = new System.Drawing.Point(6, 273);
+            this.BtnEditUserParameters.Location = new System.Drawing.Point(6, 281);
             this.BtnEditUserParameters.Name = "BtnEditUserParameters";
             this.BtnEditUserParameters.Size = new System.Drawing.Size(220, 35);
             this.BtnEditUserParameters.TabIndex = 11;
@@ -745,16 +769,6 @@
             this.TbxLogin.TextPreview = "Логин";
             this.TbxLogin.UseSystemPasswordChar = false;
             // 
-            // BsAdministrator
-            // 
-            this.BsAdministrator.DataMember = "Staffs";
-            this.BsAdministrator.DataSource = this.impulseVisionAppDataSet1;
-            // 
-            // impulseVisionAppDataSet1
-            // 
-            this.impulseVisionAppDataSet1.DataSetName = "ImpulseVisionAppDataSet";
-            this.impulseVisionAppDataSet1.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema;
-            // 
             // GbxSystemParameters
             // 
             this.GbxSystemParameters.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
@@ -770,7 +784,7 @@
             this.GbxSystemParameters.Controls.Add(this.label10);
             this.GbxSystemParameters.Location = new System.Drawing.Point(8, 37);
             this.GbxSystemParameters.Name = "GbxSystemParameters";
-            this.GbxSystemParameters.Size = new System.Drawing.Size(529, 314);
+            this.GbxSystemParameters.Size = new System.Drawing.Size(529, 322);
             this.GbxSystemParameters.TabIndex = 11;
             this.GbxSystemParameters.TabStop = false;
             this.GbxSystemParameters.Text = "Параметры системы";
@@ -1163,7 +1177,7 @@
             this.TabJournal.Name = "TabJournal";
             this.TabJournal.RowCount = 1;
             this.TabJournal.RowStyles.Add(new System.Windows.Forms.RowStyle());
-            this.TabJournal.Size = new System.Drawing.Size(781, 276);
+            this.TabJournal.Size = new System.Drawing.Size(781, 284);
             this.TabJournal.TabIndex = 5;
             // 
             // DtpFiniteDate
@@ -1260,7 +1274,7 @@
             this.TabCard.Name = "TabCard";
             this.TabCard.RowCount = 1;
             this.TabCard.RowStyles.Add(new System.Windows.Forms.RowStyle());
-            this.TabCard.Size = new System.Drawing.Size(775, 355);
+            this.TabCard.Size = new System.Drawing.Size(775, 363);
             this.TabCard.TabIndex = 8;
             // 
             // RPanelTitleJournal
@@ -1322,16 +1336,6 @@
             // 
             this.staffsTableAdapter.ClearBeforeFill = true;
             // 
-            // LblAdminID
-            // 
-            this.LblAdminID.AutoSize = true;
-            this.LblAdminID.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.BsAdministrator, "ID", true));
-            this.LblAdminID.Location = new System.Drawing.Point(6, 209);
-            this.LblAdminID.Name = "LblAdminID";
-            this.LblAdminID.Size = new System.Drawing.Size(77, 21);
-            this.LblAdminID.TabIndex = 12;
-            this.LblAdminID.Text = "AdminID";
-            // 
             // FormMain
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 21F);

+ 52 - 1
ImpulseVision/FormMain.cs

@@ -249,6 +249,7 @@ namespace ImpulseVision
 
             CmbCams.Visible = false;
             TslSelCamText.Visible = false;
+            LblAdminID.Hide();
 
             CmbSortDate.SelectedIndex = 0;
             DtpFiniteDate.Value = DateTime.Now.Date;
@@ -461,11 +462,27 @@ where ID = '{IdUser}'";
 
             bool Flag = TbxLastname.Text.Trim() == "" || TbxFirstname.Text.Trim() == "" || TbxPasportSeria.Text.Trim() == "" || TbxPasportNum.Text.Trim() == "" || TbxPhone.Text.Trim() == "";
 
-            if(Flag)
+
+            if (Flag)
             {
                 MessageBox.Show("Заполните все поля и повторите попытку!", "Ошибка добавления!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                 return;
             }
+            if (TbxPasportSeria.Text.Trim().Length < 4)
+            {
+                MessageBox.Show("Серия паспорта не может быть короче 4-х чисел!", "ImpulseVision", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
+                return;
+            }
+            if (TbxPasportNum.Text.Trim().Length < 6)
+            {
+                MessageBox.Show("Номер паспорта не может быть короче 6-ти чисел!", "ImpulseVision", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
+                return;
+            }
+            if (TbxPhone.Text.Trim().Length < 10)
+            {
+                MessageBox.Show("Номер телефона не может быть короче 10-ти чисел!", "ImpulseVision", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
+                return;
+            }
 
             SCon.Open();
             string QueryCheckPassport = $@"select PassportSeria,PassportNum
@@ -964,6 +981,11 @@ 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();
+            if(Files.Length == 0)
+            {
+                MessageBox.Show("Файлы журнала отсутствуют!", "ImpulseVision", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
+                return;
+            }
 
             Dictionary<string, string> Keys = new Dictionary<string, string>();
             List<string> LstID = new List<string>();
@@ -1160,5 +1182,34 @@ where [Login] = '{login}'";
 
             return Pass;
         }
+
+        private void TbxPasportSeria_KeyPress(object sender, KeyPressEventArgs e)
+        {
+            e.Handled = true;
+            if (char.IsDigit(e.KeyChar))
+                e.Handled = false;
+
+            if (e.KeyChar == (char)Keys.Back)
+            {
+                e.Handled = false;
+            }
+        }
+
+        private void TbxPasportSeria_Validated(object sender, EventArgs e)
+        {
+            if (TbxPasportSeria.Text.Trim().Length > 4)
+            {
+                TbxPasportSeria.Text = TbxPasportSeria.Text.Trim().Substring(0, 4);
+            }
+        }
+
+        private void TbxPasportNum_Validated(object sender, EventArgs e)
+        {
+            if (TbxPasportNum.Text.Trim().Length > 6)
+            {
+                TbxPasportNum.Text = TbxPasportNum.Text.Trim().Substring(0, 6);
+            }
+
+        }
     }
 }

BIN
ImpulseVision/bin/Debug/ImpulseVision.exe