diff --git a/.vs/Diplom O/v16/.suo b/.vs/Diplom O/v16/.suo
index 146d54c..3157c9b 100644
Binary files a/.vs/Diplom O/v16/.suo and b/.vs/Diplom O/v16/.suo differ
diff --git a/DataBase/ConnectDB.cs b/DataBase/ConnectDB.cs
index 2c507cc..03b2660 100644
--- a/DataBase/ConnectDB.cs
+++ b/DataBase/ConnectDB.cs
@@ -32,10 +32,10 @@ namespace Diplom_O.DataBase
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
- [ForeignKey("Dogovor")]
+ [ForeignKey("Chel")]
public int ChelId { get; set; }
public Chel Chel { get; set; }
- [ForeignKey("Dogovor")]
+ [ForeignKey("Shtat")]
public int ShtatId { get; set; }
public Shtat Shtat { get; set; }
diff --git a/DataBase/FuncDB.cs b/DataBase/FuncDB.cs
index f8c1d3d..9315bfe 100644
--- a/DataBase/FuncDB.cs
+++ b/DataBase/FuncDB.cs
@@ -47,7 +47,7 @@ namespace Diplom_O.DataBase
where a.Doljnost.ToLower().Contains(f) && a.Active
select a).ToArray();
var res = new List<(Shtat shtat, int ost)>();
- for(var i = 0; i < shtat.Length; i++)
+ for (var i = 0; i < shtat.Length; i++)
res.Add((shtat[i], shtat[i].Size - BusySizeShtat(shtat[i].Id)));
return res.ToArray();
}
@@ -129,5 +129,61 @@ namespace Diplom_O.DataBase
}
catch { throw; }
}
+
+ public static Chel GetChel(int id)
+ {
+ try
+ {
+ using (var db = new MainDB())
+ {
+ var res = from a in db.Chely
+ where a.Id == id
+ select a;
+ try { return res.Single(); }
+ catch { return null; }
+ }
+ }
+ catch { throw; }
+ }
+ public static Chel[] ListChel(string filter = null)
+ {
+ try
+ {
+ using (var db = new MainDB())
+ {
+ var f = (string.IsNullOrEmpty(filter)) ? "" : filter.ToLower();
+ return (string.IsNullOrEmpty(f)) ?
+ (from a in db.Chely
+ select a).ToArray() :
+ (from a in db.Chely
+ where
+ a.FName.ToLower().Contains(f) ||
+ a.SName.ToLower().Contains(f) ||
+ a.TName.ToLower().Contains(f) ||
+ a.Birthday.ToString("yyyy.MM.dd").ToLower().Contains(f) ||
+ a.Address.ToLower().Contains(f) ||
+ a.INN.ToLower().Contains(f) ||
+ a.SNILS.ToLower().Contains(f) ||
+ a.Pasport.ToLower().Contains(f)
+ select a).ToArray();
+ }
+ }
+ catch { throw; }
+ }
+ public static bool HaveChelFromRabotniky(int id, bool all=false)
+ {
+ try
+ {
+ using (var db = new MainDB())
+ {
+ var res = (from a in db.Rabotniky
+ where a.ChelId == id && (all || !a.End.HasValue)
+ select a).ToArray();
+ return res.Length > 0;
+ }
+ }
+ catch { throw; }
+ }
+
}
}
diff --git a/Diplom O.csproj b/Diplom O.csproj
index f696482..b5b3bda 100644
--- a/Diplom O.csproj
+++ b/Diplom O.csproj
@@ -283,6 +283,12 @@
+
+ Form
+
+
+ WorkChelForm.cs
+
Form
@@ -304,6 +310,9 @@
True
Resources.resx
+
+ WorkChelForm.cs
+
WorkShtatForm.cs
diff --git a/MainForms/ChelForm.Designer.cs b/MainForms/ChelForm.Designer.cs
index 62436ba..020c963 100644
--- a/MainForms/ChelForm.Designer.cs
+++ b/MainForms/ChelForm.Designer.cs
@@ -36,18 +36,28 @@ namespace Diplom_O
this.chelRodMI = new System.Windows.Forms.ToolStripMenuItem();
this.errorLabel = new System.Windows.Forms.ToolStripStatusLabel();
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
- this.shtatGridView = new System.Windows.Forms.DataGridView();
+ this.groupBox1 = new System.Windows.Forms.GroupBox();
+ this.button1 = new System.Windows.Forms.Button();
+ this.delRodButton = new System.Windows.Forms.Button();
+ this.changeRodButton = new System.Windows.Forms.Button();
+ this.addRodButton = new System.Windows.Forms.Button();
+ this.linkLabel1 = new System.Windows.Forms.LinkLabel();
+ this.comboBox1 = new System.Windows.Forms.ComboBox();
+ this.rodGridView = new System.Windows.Forms.DataGridView();
+ this.chelGridView = new System.Windows.Forms.DataGridView();
this.selectButton = new System.Windows.Forms.Button();
this.delButton = new System.Windows.Forms.Button();
this.changeButton = new System.Windows.Forms.Button();
this.addButton = new System.Windows.Forms.Button();
- this.freeShtatCheckBox = new System.Windows.Forms.CheckBox();
+ this.showWorkerCheckBox = new System.Windows.Forms.CheckBox();
this.dropFindButton = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.findBox = new System.Windows.Forms.TextBox();
this.menuStrip.SuspendLayout();
this.statusStrip1.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.shtatGridView)).BeginInit();
+ this.groupBox1.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.rodGridView)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.chelGridView)).BeginInit();
this.SuspendLayout();
//
// menuStrip
@@ -59,7 +69,7 @@ namespace Diplom_O
this.chelRodMI});
this.menuStrip.Location = new System.Drawing.Point(0, 0);
this.menuStrip.Name = "menuStrip";
- this.menuStrip.Size = new System.Drawing.Size(1055, 24);
+ this.menuStrip.Size = new System.Drawing.Size(1102, 24);
this.menuStrip.TabIndex = 1;
this.menuStrip.Text = "menuStrip1";
//
@@ -102,123 +112,225 @@ namespace Diplom_O
this.errorLabel});
this.statusStrip1.Location = new System.Drawing.Point(0, 545);
this.statusStrip1.Name = "statusStrip1";
- this.statusStrip1.Size = new System.Drawing.Size(1055, 22);
+ this.statusStrip1.Size = new System.Drawing.Size(1102, 22);
this.statusStrip1.TabIndex = 16;
this.statusStrip1.Text = "statusStrip1";
//
- // shtatGridView
+ // groupBox1
//
- this.shtatGridView.AllowUserToAddRows = false;
- this.shtatGridView.AllowUserToDeleteRows = false;
- this.shtatGridView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ this.groupBox1.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.shtatGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
- this.shtatGridView.Location = new System.Drawing.Point(12, 112);
- this.shtatGridView.MultiSelect = false;
- this.shtatGridView.Name = "shtatGridView";
- this.shtatGridView.ReadOnly = true;
- this.shtatGridView.RowHeadersVisible = false;
- this.shtatGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
- this.shtatGridView.Size = new System.Drawing.Size(318, 430);
- this.shtatGridView.TabIndex = 25;
+ this.groupBox1.Controls.Add(this.rodGridView);
+ this.groupBox1.Controls.Add(this.comboBox1);
+ this.groupBox1.Controls.Add(this.linkLabel1);
+ this.groupBox1.Controls.Add(this.delRodButton);
+ this.groupBox1.Controls.Add(this.button1);
+ this.groupBox1.Controls.Add(this.changeRodButton);
+ this.groupBox1.Controls.Add(this.addRodButton);
+ this.groupBox1.Location = new System.Drawing.Point(760, 27);
+ this.groupBox1.Name = "groupBox1";
+ this.groupBox1.Size = new System.Drawing.Size(330, 515);
+ this.groupBox1.TabIndex = 26;
+ this.groupBox1.TabStop = false;
+ this.groupBox1.Text = "Родственники";
+ //
+ // button1
+ //
+ this.button1.Location = new System.Drawing.Point(6, 19);
+ this.button1.Name = "button1";
+ this.button1.Size = new System.Drawing.Size(25, 23);
+ this.button1.TabIndex = 27;
+ this.button1.Text = "...";
+ this.button1.UseVisualStyleBackColor = true;
+ //
+ // delRodButton
+ //
+ this.delRodButton.Location = new System.Drawing.Point(168, 56);
+ this.delRodButton.Name = "delRodButton";
+ this.delRodButton.Size = new System.Drawing.Size(75, 23);
+ this.delRodButton.TabIndex = 29;
+ this.delRodButton.Text = "Удалить";
+ this.delRodButton.UseVisualStyleBackColor = true;
+ //
+ // changeRodButton
+ //
+ this.changeRodButton.Location = new System.Drawing.Point(87, 56);
+ this.changeRodButton.Name = "changeRodButton";
+ this.changeRodButton.Size = new System.Drawing.Size(75, 23);
+ this.changeRodButton.TabIndex = 28;
+ this.changeRodButton.Text = "Изменить";
+ this.changeRodButton.UseVisualStyleBackColor = true;
+ //
+ // addRodButton
+ //
+ this.addRodButton.Location = new System.Drawing.Point(6, 56);
+ this.addRodButton.Name = "addRodButton";
+ this.addRodButton.Size = new System.Drawing.Size(75, 23);
+ this.addRodButton.TabIndex = 27;
+ this.addRodButton.Text = "Добавить";
+ this.addRodButton.UseVisualStyleBackColor = true;
+ //
+ // linkLabel1
+ //
+ this.linkLabel1.AutoSize = true;
+ this.linkLabel1.Location = new System.Drawing.Point(37, 24);
+ this.linkLabel1.Name = "linkLabel1";
+ this.linkLabel1.Size = new System.Drawing.Size(81, 13);
+ this.linkLabel1.TabIndex = 30;
+ this.linkLabel1.TabStop = true;
+ this.linkLabel1.Text = "Фамилия И.О.";
+ //
+ // comboBox1
+ //
+ this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.comboBox1.FormattingEnabled = true;
+ this.comboBox1.Items.AddRange(new object[] {
+ "Родственная связь"});
+ this.comboBox1.Location = new System.Drawing.Point(168, 21);
+ this.comboBox1.Name = "comboBox1";
+ this.comboBox1.Size = new System.Drawing.Size(156, 21);
+ this.comboBox1.TabIndex = 31;
+ //
+ // rodGridView
+ //
+ this.rodGridView.AllowUserToAddRows = false;
+ this.rodGridView.AllowUserToDeleteRows = false;
+ this.rodGridView.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.rodGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ this.rodGridView.Location = new System.Drawing.Point(6, 85);
+ this.rodGridView.MultiSelect = false;
+ this.rodGridView.Name = "rodGridView";
+ this.rodGridView.ReadOnly = true;
+ this.rodGridView.RowHeadersVisible = false;
+ this.rodGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
+ this.rodGridView.Size = new System.Drawing.Size(318, 424);
+ this.rodGridView.TabIndex = 32;
+ //
+ // chelGridView
+ //
+ this.chelGridView.AllowUserToAddRows = false;
+ this.chelGridView.AllowUserToDeleteRows = false;
+ this.chelGridView.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.chelGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ this.chelGridView.Location = new System.Drawing.Point(12, 79);
+ this.chelGridView.MultiSelect = false;
+ this.chelGridView.Name = "chelGridView";
+ this.chelGridView.ReadOnly = true;
+ this.chelGridView.RowHeadersVisible = false;
+ this.chelGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
+ this.chelGridView.Size = new System.Drawing.Size(742, 434);
+ this.chelGridView.TabIndex = 35;
//
// selectButton
//
- this.selectButton.Location = new System.Drawing.Point(255, 83);
+ this.selectButton.Location = new System.Drawing.Point(12, 27);
this.selectButton.Name = "selectButton";
this.selectButton.Size = new System.Drawing.Size(75, 23);
- this.selectButton.TabIndex = 24;
+ this.selectButton.TabIndex = 34;
this.selectButton.Text = "Выбрать";
this.selectButton.UseVisualStyleBackColor = true;
+ this.selectButton.Visible = false;
//
// delButton
//
- this.delButton.Location = new System.Drawing.Point(174, 83);
+ this.delButton.Location = new System.Drawing.Point(255, 27);
this.delButton.Name = "delButton";
this.delButton.Size = new System.Drawing.Size(75, 23);
- this.delButton.TabIndex = 23;
+ this.delButton.TabIndex = 33;
this.delButton.Text = "Удалить";
this.delButton.UseVisualStyleBackColor = true;
//
// changeButton
//
- this.changeButton.Location = new System.Drawing.Point(93, 83);
+ this.changeButton.Location = new System.Drawing.Point(174, 27);
this.changeButton.Name = "changeButton";
this.changeButton.Size = new System.Drawing.Size(75, 23);
- this.changeButton.TabIndex = 22;
+ this.changeButton.TabIndex = 32;
this.changeButton.Text = "Изменить";
this.changeButton.UseVisualStyleBackColor = true;
//
// addButton
//
- this.addButton.Location = new System.Drawing.Point(12, 83);
+ this.addButton.Location = new System.Drawing.Point(93, 27);
this.addButton.Name = "addButton";
this.addButton.Size = new System.Drawing.Size(75, 23);
- this.addButton.TabIndex = 21;
+ this.addButton.TabIndex = 31;
this.addButton.Text = "Добавить";
this.addButton.UseVisualStyleBackColor = true;
//
- // freeShtatCheckBox
+ // showWorkerCheckBox
//
- this.freeShtatCheckBox.AutoSize = true;
- this.freeShtatCheckBox.Checked = true;
- this.freeShtatCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
- this.freeShtatCheckBox.Location = new System.Drawing.Point(15, 58);
- this.freeShtatCheckBox.Name = "freeShtatCheckBox";
- this.freeShtatCheckBox.Size = new System.Drawing.Size(218, 17);
- this.freeShtatCheckBox.TabIndex = 20;
- this.freeShtatCheckBox.Text = "Поrазать/скрыть занятые должности";
- this.freeShtatCheckBox.UseVisualStyleBackColor = true;
+ this.showWorkerCheckBox.AutoSize = true;
+ this.showWorkerCheckBox.Checked = true;
+ this.showWorkerCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
+ this.showWorkerCheckBox.Location = new System.Drawing.Point(12, 56);
+ this.showWorkerCheckBox.Name = "showWorkerCheckBox";
+ this.showWorkerCheckBox.Size = new System.Drawing.Size(204, 17);
+ this.showWorkerCheckBox.TabIndex = 30;
+ this.showWorkerCheckBox.Text = "Поrазать/скрыть трудоустроенных";
+ this.showWorkerCheckBox.UseVisualStyleBackColor = true;
//
// dropFindButton
//
- this.dropFindButton.Location = new System.Drawing.Point(255, 25);
+ this.dropFindButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.dropFindButton.Location = new System.Drawing.Point(679, 519);
this.dropFindButton.Name = "dropFindButton";
this.dropFindButton.Size = new System.Drawing.Size(75, 23);
- this.dropFindButton.TabIndex = 19;
+ this.dropFindButton.TabIndex = 29;
this.dropFindButton.Text = "Сбросить";
this.dropFindButton.UseVisualStyleBackColor = true;
//
// label1
//
+ this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.label1.AutoSize = true;
- this.label1.Location = new System.Drawing.Point(12, 30);
+ this.label1.Location = new System.Drawing.Point(12, 524);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(39, 13);
- this.label1.TabIndex = 18;
+ this.label1.TabIndex = 28;
this.label1.Text = "Поиск";
//
// findBox
//
- this.findBox.Location = new System.Drawing.Point(57, 27);
+ this.findBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.findBox.Location = new System.Drawing.Point(57, 521);
this.findBox.Name = "findBox";
- this.findBox.Size = new System.Drawing.Size(192, 20);
- this.findBox.TabIndex = 17;
+ this.findBox.Size = new System.Drawing.Size(616, 20);
+ this.findBox.TabIndex = 27;
//
// ChelForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(1055, 567);
- this.Controls.Add(this.shtatGridView);
+ this.ClientSize = new System.Drawing.Size(1102, 567);
+ this.Controls.Add(this.chelGridView);
this.Controls.Add(this.selectButton);
this.Controls.Add(this.delButton);
this.Controls.Add(this.changeButton);
this.Controls.Add(this.addButton);
- this.Controls.Add(this.freeShtatCheckBox);
+ this.Controls.Add(this.showWorkerCheckBox);
this.Controls.Add(this.dropFindButton);
this.Controls.Add(this.label1);
this.Controls.Add(this.findBox);
+ this.Controls.Add(this.groupBox1);
this.Controls.Add(this.statusStrip1);
this.Controls.Add(this.menuStrip);
this.Name = "ChelForm";
- this.Text = "ChelForm";
+ this.Text = "Люди / Родственники";
this.menuStrip.ResumeLayout(false);
this.menuStrip.PerformLayout();
this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)(this.shtatGridView)).EndInit();
+ this.groupBox1.ResumeLayout(false);
+ this.groupBox1.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.rodGridView)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.chelGridView)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@@ -233,12 +345,20 @@ namespace Diplom_O
private System.Windows.Forms.ToolStripMenuItem chelRodMI;
private System.Windows.Forms.ToolStripStatusLabel errorLabel;
private System.Windows.Forms.StatusStrip statusStrip1;
- private System.Windows.Forms.DataGridView shtatGridView;
+ private System.Windows.Forms.GroupBox groupBox1;
+ private System.Windows.Forms.DataGridView rodGridView;
+ private System.Windows.Forms.ComboBox comboBox1;
+ private System.Windows.Forms.LinkLabel linkLabel1;
+ private System.Windows.Forms.Button delRodButton;
+ private System.Windows.Forms.Button button1;
+ private System.Windows.Forms.Button changeRodButton;
+ private System.Windows.Forms.Button addRodButton;
+ private System.Windows.Forms.DataGridView chelGridView;
private System.Windows.Forms.Button selectButton;
private System.Windows.Forms.Button delButton;
private System.Windows.Forms.Button changeButton;
private System.Windows.Forms.Button addButton;
- private System.Windows.Forms.CheckBox freeShtatCheckBox;
+ private System.Windows.Forms.CheckBox showWorkerCheckBox;
private System.Windows.Forms.Button dropFindButton;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox findBox;
diff --git a/MainForms/ChelForm.cs b/MainForms/ChelForm.cs
index 33435a8..04b299a 100644
--- a/MainForms/ChelForm.cs
+++ b/MainForms/ChelForm.cs
@@ -1,4 +1,5 @@
-using System;
+using Diplom_O.DataBase;
+using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
@@ -12,39 +13,174 @@ namespace Diplom_O
{
public partial class ChelForm : Form
{
- public ChelForm()
+ private Task errDrop;
+ private void ShowError(string msg = null)
{
- InitializeComponent();
+ errorLabel.Text = string.IsNullOrEmpty(msg) ? "Неизвестная ошибка." : msg;
+ errorLabel.Visible = true;
+ errDrop = new Task(() =>
+ {
+ var fd = errDrop.Id;
+ Task.Delay(5000).Wait();
+ if (errDrop.Id == fd)
+ if (InvokeRequired) Invoke((Action)(() => { errorLabel.Visible = false; }));
+ else errorLabel.Visible = false;
+ });
+ errDrop.Start();
}
- private void delButton_Click(object sender, EventArgs e)
+ private Task filterDrop;
+ private void findBox_TextChanged(object sender, EventArgs e)
{
-
- }
-
- private void changeButton_Click(object sender, EventArgs e)
- {
-
- }
-
- private void addButton_Click(object sender, EventArgs e)
- {
-
- }
-
- private void freeShtatCheckBox_CheckedChanged(object sender, EventArgs e)
- {
-
+ filterDrop = new Task(() =>
+ {
+ var fd = filterDrop.Id;
+ Task.Delay(1000).Wait();
+ if (filterDrop.Id == fd)
+ if (InvokeRequired) Invoke((Action)(() => { resetShatTable(); }));
+ else resetShatTable();
+ });
+ filterDrop.Start();
}
private void dropFindButton_Click(object sender, EventArgs e)
{
-
+ findBox.Text = "";
+ filterDrop = new Task(() => { return; });
+ resetShatTable();
}
- private void findBox_TextChanged(object sender, EventArgs e)
+ private void resetChelTable()
{
+ try
+ {
+ {
+ chelGridView.Rows.Clear();
+ chelGridView.Columns.Clear();
+ var c = chelGridView.Columns;
+ c.Add("Id", "№");
+ c.Add("FIO", "Должность");
+ c.Add("Male", "Пол");
+ c.Add("Birthday", "Дата рождения");
+ c.Add("Adress", "Адрес");
+ c.Add("INN", "ИНН");
+ c.Add("SNILS", "СНИЛС");
+ c.Add("Pasport", "Паспорт");
+ c[0].Width = 40;
+ c[1].Width = 120;
+ c[2].Width = 40;
+ c[3].Width = 40;
+ c[4].Width = 120;
+ c[5].Width = 40;
+ c[6].Width = 40;
+ c[7].Width = 120;
+ c[4].DefaultCellStyle.WrapMode = DataGridViewTriState.True;
+ c[7].DefaultCellStyle.WrapMode = DataGridViewTriState.True;
+ }
+ {
+ var arr = FuncDB.ListChel(findBox.Text);
+ var r = chelGridView.Rows;
+ foreach (var chel in arr)
+ if (showWorkerCheckBox.Checked || !FuncDB.HaveChelFromRabotniky(chel.Id))
+ r.Add(new object[] {
+ chel.Id,
+ chel.FName +
+ (string.IsNullOrEmpty(chel.SName) ? "" : (" " + chel.SName[0] + ".")) +
+ (string.IsNullOrEmpty(chel.TName) ? "" : (" " + chel.TName[0] + ".")),
+ chel.Male ? "Муж" : "Жен",
+ chel.Birthday.ToString("yyyy.MM.dd"),
+ chel.Address,
+ chel.INN,
+ chel.SNILS,
+ chel.Pasport
+ });
+ }
+ if (chelGridView.Rows.Count > 0)
+ chelGridView.Rows[0].Selected = true;
+ }
+ catch (Exception e) { ShowError(e.Message); }
+ }
+ private Chel selectedChel()
+ {
+ try
+ {
+ if (chelGridView.SelectedRows.Count != 1) throw new Exception("Человек не выбран.");
+ var chel = FuncDB.GetChel((int)chelGridView.SelectedRows[0].Cells[0].Value);
+ return chel;
+ }
+ catch (Exception e) { ShowError(e.Message); return null; }
+ }
+ public Shtat formResult = null;
+ public ChelForm(bool select = false)
+ {
+ try
+ {
+ InitializeComponent();
+ Init(select);
+ resetChelTable();
+ }
+ catch { this.Close(); }
+ }
+ public void Init(bool s)
+ {
+ if (s) selectButton.Visible = true;
+ chelRodMI.Enabled = false;
+ }
+
+ private void addButton_Click(object sender, EventArgs e)
+ {
+ var res = new SupportForms.WorkChelForm();
+ res.ShowDialog();
+ if (!res.isCanceled)
+ resetChelTable();
+ }
+ private void changeButton_Click(object sender, EventArgs e)
+ {
+ var chel = selectedChel();
+ if (chel == null) { ShowError("Человек не выбран."); return; }
+ var res = new SupportForms.WorkChelForm(chel);
+ res.ShowDialog();
+ if (!res.isCanceled)
+ resetChelTable();
+ }
+ private void delButton_Click(object sender, EventArgs e)
+ {
+ var chel = selectedChel();
+ if (chel == null) { ShowError("Человек не выбран."); return; }
+ try
+ {
+ FuncDB.DelChel(chel);
+ resetChelTable();
+ }
+ catch (Exception ex) { ShowError(ex.Message); }
+ }
+ public void MI_Click(object sender, EventArgs e)
+ {
+ object form = null;
+ var idxMenu = -1;
+ try { idxMenu = menuStrip.Items.IndexOf((ToolStripMenuItem)sender); }
+ catch { };
+ switch (idxMenu)
+ {
+ case 0: form = new ShtatForm(); break;
+ case 1: form = new RabForm(); break;
+ case 2: form = new OtpForm(); break;
+ case 3: form = new ChelForm(); break;
+ }
+ if (form != null)
+ {
+ this.Hide();
+ ((Form)form).Closed += (s, args) => this.Close();
+ ((Form)form).Show();
+ return;
+ }
+ ShowError("Ошибка перехода на новую форму.");
+ }
+
+ private void checkBox_CheckedChanged(object sender, EventArgs e)
+ {
+ resetChelTable();
}
}
}
diff --git a/MainForms/ChelForm.resx b/MainForms/ChelForm.resx
index 19fb97c..9b0ed00 100644
--- a/MainForms/ChelForm.resx
+++ b/MainForms/ChelForm.resx
@@ -123,4 +123,7 @@
248, 17
+
+ 58
+
\ No newline at end of file
diff --git a/MainForms/ShtatForm.Designer.cs b/MainForms/ShtatForm.Designer.cs
index bddfe59..7158fda 100644
--- a/MainForms/ShtatForm.Designer.cs
+++ b/MainForms/ShtatForm.Designer.cs
@@ -133,11 +133,11 @@ namespace Diplom_O
this.freeShtatCheckBox.TabIndex = 6;
this.freeShtatCheckBox.Text = "Поrазать/скрыть занятые должности";
this.freeShtatCheckBox.UseVisualStyleBackColor = true;
- this.freeShtatCheckBox.CheckedChanged += new System.EventHandler(this.freeShtatCheckBox_CheckedChanged);
+ this.freeShtatCheckBox.CheckedChanged += new System.EventHandler(this.checkBox_CheckedChanged);
//
// addButton
//
- this.addButton.Location = new System.Drawing.Point(12, 27);
+ this.addButton.Location = new System.Drawing.Point(93, 27);
this.addButton.Name = "addButton";
this.addButton.Size = new System.Drawing.Size(75, 23);
this.addButton.TabIndex = 7;
@@ -147,7 +147,7 @@ namespace Diplom_O
//
// changeButton
//
- this.changeButton.Location = new System.Drawing.Point(93, 27);
+ this.changeButton.Location = new System.Drawing.Point(174, 27);
this.changeButton.Name = "changeButton";
this.changeButton.Size = new System.Drawing.Size(75, 23);
this.changeButton.TabIndex = 8;
@@ -157,7 +157,7 @@ namespace Diplom_O
//
// delButton
//
- this.delButton.Location = new System.Drawing.Point(174, 27);
+ this.delButton.Location = new System.Drawing.Point(255, 27);
this.delButton.Name = "delButton";
this.delButton.Size = new System.Drawing.Size(75, 23);
this.delButton.TabIndex = 9;
@@ -167,7 +167,7 @@ namespace Diplom_O
//
// selectButton
//
- this.selectButton.Location = new System.Drawing.Point(255, 27);
+ this.selectButton.Location = new System.Drawing.Point(12, 27);
this.selectButton.Name = "selectButton";
this.selectButton.Size = new System.Drawing.Size(75, 23);
this.selectButton.TabIndex = 13;
diff --git a/MainForms/ShtatForm.cs b/MainForms/ShtatForm.cs
index 8d38e79..3d54d3e 100644
--- a/MainForms/ShtatForm.cs
+++ b/MainForms/ShtatForm.cs
@@ -161,7 +161,7 @@ namespace Diplom_O
ShowError("Ошибка перехода на новую форму.");
}
- private void freeShtatCheckBox_CheckedChanged(object sender, EventArgs e)
+ private void checkBox_CheckedChanged(object sender, EventArgs e)
{
resetShatTable();
}
diff --git a/SupportForms/WorkChelForm.Designer.cs b/SupportForms/WorkChelForm.Designer.cs
new file mode 100644
index 0000000..0eb4b12
--- /dev/null
+++ b/SupportForms/WorkChelForm.Designer.cs
@@ -0,0 +1,160 @@
+
+namespace Diplom_O.SupportForms
+{
+ partial class WorkChelForm
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.doljBox = new System.Windows.Forms.TextBox();
+ this.kolvoBox = new System.Windows.Forms.TextBox();
+ this.statusStrip1 = new System.Windows.Forms.StatusStrip();
+ this.errorLabel = new System.Windows.Forms.ToolStripStatusLabel();
+ this.label1 = new System.Windows.Forms.Label();
+ this.label2 = new System.Windows.Forms.Label();
+ this.workButton = new System.Windows.Forms.Button();
+ this.canceledButton = new System.Windows.Forms.Button();
+ this.busySizeLabel = new System.Windows.Forms.ToolStripStatusLabel();
+ this.statusStrip1.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // doljBox
+ //
+ this.doljBox.Location = new System.Drawing.Point(87, 12);
+ this.doljBox.Name = "doljBox";
+ this.doljBox.Size = new System.Drawing.Size(162, 20);
+ this.doljBox.TabIndex = 0;
+ //
+ // kolvoBox
+ //
+ this.kolvoBox.Location = new System.Drawing.Point(87, 38);
+ this.kolvoBox.Name = "kolvoBox";
+ this.kolvoBox.Size = new System.Drawing.Size(162, 20);
+ this.kolvoBox.TabIndex = 1;
+ //
+ // statusStrip1
+ //
+ this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.errorLabel,
+ this.busySizeLabel});
+ this.statusStrip1.Location = new System.Drawing.Point(0, 90);
+ this.statusStrip1.Name = "statusStrip1";
+ this.statusStrip1.Size = new System.Drawing.Size(262, 22);
+ this.statusStrip1.TabIndex = 2;
+ this.statusStrip1.Text = "statusStrip1";
+ //
+ // errorLabel
+ //
+ this.errorLabel.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold);
+ this.errorLabel.ForeColor = System.Drawing.Color.Red;
+ this.errorLabel.Name = "errorLabel";
+ this.errorLabel.Size = new System.Drawing.Size(57, 17);
+ this.errorLabel.Text = "Ошибка.";
+ this.errorLabel.Visible = false;
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(16, 15);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(65, 13);
+ this.label1.TabIndex = 3;
+ this.label1.Text = "Должность";
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Location = new System.Drawing.Point(12, 41);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(69, 13);
+ this.label2.TabIndex = 4;
+ this.label2.Text = "Кол-во мест";
+ //
+ // workButton
+ //
+ this.workButton.Location = new System.Drawing.Point(175, 64);
+ this.workButton.Name = "workButton";
+ this.workButton.Size = new System.Drawing.Size(75, 23);
+ this.workButton.TabIndex = 5;
+ this.workButton.Text = "Добавить";
+ this.workButton.UseVisualStyleBackColor = true;
+ this.workButton.Click += new System.EventHandler(this.workButton_Click);
+ //
+ // canceledButton
+ //
+ this.canceledButton.Location = new System.Drawing.Point(94, 64);
+ this.canceledButton.Name = "canceledButton";
+ this.canceledButton.Size = new System.Drawing.Size(75, 23);
+ this.canceledButton.TabIndex = 6;
+ this.canceledButton.Text = "Отмена";
+ this.canceledButton.UseVisualStyleBackColor = true;
+ this.canceledButton.Click += new System.EventHandler(this.canceledButton_Click);
+ //
+ // busySizeLabel
+ //
+ this.busySizeLabel.Name = "busySizeLabel";
+ this.busySizeLabel.Size = new System.Drawing.Size(51, 17);
+ this.busySizeLabel.Text = "Занято: ";
+ this.busySizeLabel.Visible = false;
+ //
+ // WorkShtatForm
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(262, 112);
+ this.ControlBox = false;
+ this.Controls.Add(this.canceledButton);
+ this.Controls.Add(this.workButton);
+ this.Controls.Add(this.label2);
+ this.Controls.Add(this.label1);
+ this.Controls.Add(this.statusStrip1);
+ this.Controls.Add(this.kolvoBox);
+ this.Controls.Add(this.doljBox);
+ this.MaximizeBox = false;
+ this.MinimizeBox = false;
+ this.Name = "WorkShtatForm";
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
+ this.Text = "Штатное место";
+ this.statusStrip1.ResumeLayout(false);
+ this.statusStrip1.PerformLayout();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.TextBox doljBox;
+ private System.Windows.Forms.TextBox kolvoBox;
+ private System.Windows.Forms.StatusStrip statusStrip1;
+ private System.Windows.Forms.ToolStripStatusLabel errorLabel;
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.Button workButton;
+ private System.Windows.Forms.Button canceledButton;
+ private System.Windows.Forms.ToolStripStatusLabel busySizeLabel;
+ }
+}
\ No newline at end of file
diff --git a/SupportForms/WorkChelForm.cs b/SupportForms/WorkChelForm.cs
new file mode 100644
index 0000000..ec0bf6a
--- /dev/null
+++ b/SupportForms/WorkChelForm.cs
@@ -0,0 +1,81 @@
+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;
+using Diplom_O.DataBase;
+
+namespace Diplom_O.SupportForms
+{
+ public partial class WorkChelForm : Form
+ {
+ private Task errDrop;
+ private void ShowError(string msg = null)
+ {
+ errorLabel.Text = string.IsNullOrEmpty(msg) ? "Неизвестная ошибка." : msg;
+ errorLabel.Visible = true;
+ errDrop = new Task(() =>
+ {
+ var fd = errDrop.Id;
+ Task.Delay(5000).Wait();
+ if (errDrop.Id == fd)
+ if (InvokeRequired) Invoke((Action)(() => { errorLabel.Visible = false; }));
+ else errorLabel.Visible = false;
+ });
+ errDrop.Start();
+ }
+
+ public bool isCanceled = false;
+ private Chel chel = null;
+ public WorkChelForm(Chel chel = null)
+ {
+ InitializeComponent();
+ try
+ {
+ if (shtat != null)
+ {
+ this.shtat = shtat;
+ workButton.Text = "Изменить";
+ doljBox.Text = shtat.Doljnost;
+ kolvoBox.Text = shtat.Size.ToString();
+ busySizeLabel.Text = "Занято: " + FuncDB.BusySizeShtat(shtat.Id);
+ }
+ }
+ catch (Exception e)
+ {
+ ShowError(e.Message);
+ workButton.Enabled = false;
+ }
+ }
+
+ private void workButton_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ if (!int.TryParse(kolvoBox.Text, out int kolvo)) throw new Exception("Ошибка указания количества.");
+ if (shtat == null)
+ {
+ var s = new Shtat() { Doljnost = doljBox.Text, Size = kolvo };
+ FuncDB.AddShtat(s);
+ }
+ else
+ {
+ shtat.Doljnost = doljBox.Text;
+ shtat.Size = kolvo;
+ FuncDB.ChangeShtat(shtat);
+ }
+ this.Close();
+ }
+ catch (Exception ex) { ShowError(ex.Message); }
+ }
+ private void canceledButton_Click(object sender, EventArgs e)
+ {
+ isCanceled = true;
+ this.Close();
+ }
+ }
+}
diff --git a/SupportForms/WorkChelForm.resx b/SupportForms/WorkChelForm.resx
new file mode 100644
index 0000000..42dfef1
--- /dev/null
+++ b/SupportForms/WorkChelForm.resx
@@ -0,0 +1,126 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ 17, 17
+
+
+ True
+
+
\ No newline at end of file
diff --git a/bin/Debug/Diplom O.exe b/bin/Debug/Diplom O.exe
index e6ca455..b1520ef 100644
Binary files a/bin/Debug/Diplom O.exe and b/bin/Debug/Diplom O.exe differ
diff --git a/bin/Debug/Diplom O.pdb b/bin/Debug/Diplom O.pdb
index 3391649..8b2b261 100644
Binary files a/bin/Debug/Diplom O.pdb and b/bin/Debug/Diplom O.pdb differ
diff --git a/obj/Debug/Diplom O.csproj.AssemblyReference.cache b/obj/Debug/Diplom O.csproj.AssemblyReference.cache
index 53e498a..f5e894a 100644
Binary files a/obj/Debug/Diplom O.csproj.AssemblyReference.cache and b/obj/Debug/Diplom O.csproj.AssemblyReference.cache differ
diff --git a/obj/Debug/Diplom O.csproj.GenerateResource.cache b/obj/Debug/Diplom O.csproj.GenerateResource.cache
index c79d8ca..845a923 100644
Binary files a/obj/Debug/Diplom O.csproj.GenerateResource.cache and b/obj/Debug/Diplom O.csproj.GenerateResource.cache differ
diff --git a/obj/Debug/Diplom O.exe b/obj/Debug/Diplom O.exe
index e6ca455..b1520ef 100644
Binary files a/obj/Debug/Diplom O.exe and b/obj/Debug/Diplom O.exe differ
diff --git a/obj/Debug/Diplom O.pdb b/obj/Debug/Diplom O.pdb
index 3391649..8b2b261 100644
Binary files a/obj/Debug/Diplom O.pdb and b/obj/Debug/Diplom O.pdb differ