Last fixes

This commit is contained in:
2024-09-20 06:53:52 +03:00
parent 09f10a924c
commit d07c586ade
139 changed files with 12409 additions and 1234 deletions

View File

@@ -31,17 +31,15 @@ namespace Diplom_O
{
this.menuStrip = new System.Windows.Forms.MenuStrip();
this.shtatMI = new System.Windows.Forms.ToolStripMenuItem();
this.rabitnikiMI = new System.Windows.Forms.ToolStripMenuItem();
this.otpBolMI = new System.Windows.Forms.ToolStripMenuItem();
this.chelRodMI = new System.Windows.Forms.ToolStripMenuItem();
this.rabitnikiMI = new System.Windows.Forms.ToolStripMenuItem();
this.stajMI = new System.Windows.Forms.ToolStripMenuItem();
this.learnMI = new System.Windows.Forms.ToolStripMenuItem();
this.otpBolMI = new System.Windows.Forms.ToolStripMenuItem();
this.детиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.настройкиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.errorLabel = new System.Windows.Forms.ToolStripStatusLabel();
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.rodGridView = new System.Windows.Forms.DataGridView();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.chelRodLabel = new System.Windows.Forms.LinkLabel();
this.delRodButton = new System.Windows.Forms.Button();
this.addRodButton = new System.Windows.Forms.Button();
this.chelGridView = new System.Windows.Forms.DataGridView();
this.delButton = new System.Windows.Forms.Button();
this.changeButton = new System.Windows.Forms.Button();
@@ -50,10 +48,9 @@ namespace Diplom_O
this.dropFindButton = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.findBox = new System.Windows.Forms.TextBox();
this.selectButton = new System.Windows.Forms.Button();
this.menuStrip.SuspendLayout();
this.statusStrip1.SuspendLayout();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.rodGridView)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.chelGridView)).BeginInit();
this.SuspendLayout();
//
@@ -61,26 +58,49 @@ namespace Diplom_O
//
this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.shtatMI,
this.chelRodMI,
this.rabitnikiMI,
this.stajMI,
this.learnMI,
this.otpBolMI,
this.chelRodMI});
this.детиToolStripMenuItem,
this.настройкиToolStripMenuItem});
this.menuStrip.Location = new System.Drawing.Point(0, 0);
this.menuStrip.Name = "menuStrip";
this.menuStrip.Size = new System.Drawing.Size(1186, 24);
this.menuStrip.Size = new System.Drawing.Size(1328, 24);
this.menuStrip.TabIndex = 1;
this.menuStrip.Text = "menuStrip1";
this.menuStrip.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.upperMenuClicked);
//
// shtatMI
//
this.shtatMI.Name = "shtatMI";
this.shtatMI.Size = new System.Drawing.Size(46, 20);
this.shtatMI.Text = "Штат";
this.shtatMI.Size = new System.Drawing.Size(139, 20);
this.shtatMI.Text = "Актуальные вакансии";
//
// chelRodMI
//
this.chelRodMI.Name = "chelRodMI";
this.chelRodMI.Size = new System.Drawing.Size(50, 20);
this.chelRodMI.Text = "Люди";
//
// rabitnikiMI
//
this.rabitnikiMI.Name = "rabitnikiMI";
this.rabitnikiMI.Size = new System.Drawing.Size(78, 20);
this.rabitnikiMI.Text = "Работники";
this.rabitnikiMI.Size = new System.Drawing.Size(85, 20);
this.rabitnikiMI.Text = "Сотрудники";
//
// stajMI
//
this.stajMI.Name = "stajMI";
this.stajMI.Size = new System.Drawing.Size(47, 20);
this.stajMI.Text = "Стаж";
//
// learnMI
//
this.learnMI.Name = "learnMI";
this.learnMI.Size = new System.Drawing.Size(92, 20);
this.learnMI.Text = "Образование";
//
// otpBolMI
//
@@ -88,11 +108,17 @@ namespace Diplom_O
this.otpBolMI.Size = new System.Drawing.Size(100, 20);
this.otpBolMI.Text = "Отпуск/Больн.";
//
// chelRodMI
// детиToolStripMenuItem
//
this.chelRodMI.Name = "chelRodMI";
this.chelRodMI.Size = new System.Drawing.Size(95, 20);
this.chelRodMI.Text = "Люди/Родств.";
this.детиToolStripMenuItem.Name = етиToolStripMenuItem";
this.детиToolStripMenuItem.Size = new System.Drawing.Size(45, 20);
this.детиToolStripMenuItem.Text = "Дети";
//
// настройкиToolStripMenuItem
//
this.настройкиToolStripMenuItem.Name = астройкиToolStripMenuItem";
this.настройкиToolStripMenuItem.Size = new System.Drawing.Size(79, 20);
this.настройкиToolStripMenuItem.Text = "Настройки";
//
// errorLabel
//
@@ -107,85 +133,12 @@ namespace Diplom_O
//
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.errorLabel});
this.statusStrip1.Location = new System.Drawing.Point(0, 386);
this.statusStrip1.Location = new System.Drawing.Point(0, 772);
this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Size = new System.Drawing.Size(1186, 22);
this.statusStrip1.Size = new System.Drawing.Size(1328, 22);
this.statusStrip1.TabIndex = 16;
this.statusStrip1.Text = "statusStrip1";
//
// groupBox1
//
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox1.Controls.Add(this.rodGridView);
this.groupBox1.Controls.Add(this.comboBox1);
this.groupBox1.Controls.Add(this.chelRodLabel);
this.groupBox1.Controls.Add(this.delRodButton);
this.groupBox1.Controls.Add(this.addRodButton);
this.groupBox1.Location = new System.Drawing.Point(844, 27);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(330, 356);
this.groupBox1.TabIndex = 26;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Родственники";
//
// 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, 265);
this.rodGridView.TabIndex = 12;
//
// 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 = 7;
//
// chelRodLabel
//
this.chelRodLabel.AutoSize = true;
this.chelRodLabel.Location = new System.Drawing.Point(6, 24);
this.chelRodLabel.Name = "chelRodLabel";
this.chelRodLabel.Size = new System.Drawing.Size(81, 13);
this.chelRodLabel.TabIndex = 6;
this.chelRodLabel.TabStop = true;
this.chelRodLabel.Text = "Фамилия И.О.";
this.chelRodLabel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.chelRodLabel_Clicked);
//
// delRodButton
//
this.delRodButton.Location = new System.Drawing.Point(87, 56);
this.delRodButton.Name = "delRodButton";
this.delRodButton.Size = new System.Drawing.Size(75, 23);
this.delRodButton.TabIndex = 10;
this.delRodButton.Text = "Удалить";
this.delRodButton.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 = 8;
this.addRodButton.Text = "Добавить";
this.addRodButton.UseVisualStyleBackColor = true;
//
// chelGridView
//
this.chelGridView.AllowUserToAddRows = false;
@@ -200,12 +153,13 @@ namespace Diplom_O
this.chelGridView.ReadOnly = true;
this.chelGridView.RowHeadersVisible = false;
this.chelGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.chelGridView.Size = new System.Drawing.Size(826, 298);
this.chelGridView.Size = new System.Drawing.Size(1304, 684);
this.chelGridView.TabIndex = 11;
//
// delButton
//
this.delButton.Location = new System.Drawing.Point(174, 27);
this.delButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.delButton.Location = new System.Drawing.Point(1241, 27);
this.delButton.Name = "delButton";
this.delButton.Size = new System.Drawing.Size(75, 23);
this.delButton.TabIndex = 2;
@@ -215,7 +169,8 @@ namespace Diplom_O
//
// changeButton
//
this.changeButton.Location = new System.Drawing.Point(93, 27);
this.changeButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.changeButton.Location = new System.Drawing.Point(1160, 27);
this.changeButton.Name = "changeButton";
this.changeButton.Size = new System.Drawing.Size(75, 23);
this.changeButton.TabIndex = 1;
@@ -225,7 +180,8 @@ namespace Diplom_O
//
// addButton
//
this.addButton.Location = new System.Drawing.Point(12, 27);
this.addButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.addButton.Location = new System.Drawing.Point(1079, 27);
this.addButton.Name = "addButton";
this.addButton.Size = new System.Drawing.Size(75, 23);
this.addButton.TabIndex = 0;
@@ -238,18 +194,18 @@ namespace Diplom_O
this.showWorkerCheckBox.AutoSize = true;
this.showWorkerCheckBox.Checked = true;
this.showWorkerCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
this.showWorkerCheckBox.Location = new System.Drawing.Point(255, 31);
this.showWorkerCheckBox.Location = new System.Drawing.Point(15, 31);
this.showWorkerCheckBox.Name = "showWorkerCheckBox";
this.showWorkerCheckBox.Size = new System.Drawing.Size(204, 17);
this.showWorkerCheckBox.Size = new System.Drawing.Size(165, 17);
this.showWorkerCheckBox.TabIndex = 3;
this.showWorkerCheckBox.Text = "Поrазать/скрыть трудоустроенных";
this.showWorkerCheckBox.Text = "Показать трудоустроенных";
this.showWorkerCheckBox.UseVisualStyleBackColor = true;
this.showWorkerCheckBox.CheckedChanged += new System.EventHandler(this.checkBox_CheckedChanged);
this.showWorkerCheckBox.CheckedChanged += new System.EventHandler(this.showWorker_CheckedChanged);
//
// dropFindButton
//
this.dropFindButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.dropFindButton.Location = new System.Drawing.Point(763, 360);
this.dropFindButton.Location = new System.Drawing.Point(1241, 746);
this.dropFindButton.Name = "dropFindButton";
this.dropFindButton.Size = new System.Drawing.Size(75, 23);
this.dropFindButton.TabIndex = 5;
@@ -261,7 +217,7 @@ namespace Diplom_O
//
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, 365);
this.label1.Location = new System.Drawing.Point(12, 751);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(39, 13);
this.label1.TabIndex = 28;
@@ -271,17 +227,29 @@ namespace Diplom_O
//
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, 362);
this.findBox.Location = new System.Drawing.Point(57, 748);
this.findBox.Name = "findBox";
this.findBox.Size = new System.Drawing.Size(700, 20);
this.findBox.Size = new System.Drawing.Size(1178, 20);
this.findBox.TabIndex = 4;
this.findBox.TextChanged += new System.EventHandler(this.findBox_TextChanged);
//
// selectButton
//
this.selectButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.selectButton.Location = new System.Drawing.Point(998, 27);
this.selectButton.Name = "selectButton";
this.selectButton.Size = new System.Drawing.Size(75, 23);
this.selectButton.TabIndex = 29;
this.selectButton.Text = "Выбрать";
this.selectButton.UseVisualStyleBackColor = true;
this.selectButton.Click += new System.EventHandler(this.selectButton_Click);
//
// ChelForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1186, 408);
this.ClientSize = new System.Drawing.Size(1328, 794);
this.Controls.Add(this.selectButton);
this.Controls.Add(this.chelGridView);
this.Controls.Add(this.delButton);
this.Controls.Add(this.changeButton);
@@ -290,18 +258,15 @@ namespace Diplom_O
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 = "Люди / Родственники";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Люди";
this.menuStrip.ResumeLayout(false);
this.menuStrip.PerformLayout();
this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout();
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.rodGridView)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.chelGridView)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@@ -317,12 +282,6 @@ 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.GroupBox groupBox1;
private System.Windows.Forms.DataGridView rodGridView;
private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.LinkLabel chelRodLabel;
private System.Windows.Forms.Button delRodButton;
private System.Windows.Forms.Button addRodButton;
private System.Windows.Forms.DataGridView chelGridView;
private System.Windows.Forms.Button delButton;
private System.Windows.Forms.Button changeButton;
@@ -331,5 +290,10 @@ namespace Diplom_O
private System.Windows.Forms.Button dropFindButton;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox findBox;
}
private System.Windows.Forms.ToolStripMenuItem детиToolStripMenuItem;
private System.Windows.Forms.Button selectButton;
private System.Windows.Forms.ToolStripMenuItem stajMI;
private System.Windows.Forms.ToolStripMenuItem learnMI;
private System.Windows.Forms.ToolStripMenuItem настройкиToolStripMenuItem;
}
}

View File

@@ -13,113 +13,86 @@ namespace Diplom_O
{
public partial class ChelForm : 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();
}
private Task filterDrop;
private readonly ColumnConf[] tableColumns = {
new ColumnConf(name: "№"),
new ColumnConf("Фамилия", 140),
new ColumnConf("Имя", 140),
new ColumnConf("Отчество", 140),
new ColumnConf(name: "Пол"),
new ColumnConf(name: "Дата рождения", size: 80),
new ColumnConf(name: "Адрес", size: 140, warp: true),
new ColumnConf(name: "Телефон", size: 100),
new ColumnConf(name: "ИНН", size: 100),
new ColumnConf(name: "СНИЛС", size: 100),
new ColumnConf(name: "Паспорт", size: 140, warp: true),
new ColumnConf(name: "Пенсионер", size: 100)
};
private void findBox_TextChanged(object sender, EventArgs e)
{
filterDrop = new Task(() =>
{
var fd = filterDrop.Id;
Task.Delay(1000).Wait();
if (filterDrop.Id == fd)
if (InvokeRequired) Invoke((Action)(() => { resetChelTable(); }));
else resetChelTable();
});
filterDrop.Start();
this.FindOnChanged(resetChelTable);
}
private void dropFindButton_Click(object sender, EventArgs e)
{
findBox.Text = "";
filterDrop = new Task(() => { return; });
this.FindOnChanged(null);
resetChelTable();
}
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 = 80;
c[4].Width = 140;
c[5].Width = 90;
c[6].Width = 100;
c[7].Width = 140;
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.HaveChelRabotnik(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;
var tmp = FuncDB.ChelListTableMain(findBox.Text, showWorkerCheckBox.Checked);
var res = new List<string[]>();
this.ResetTable(
chelGridView,
tableColumns,
tmp
);
}
catch (Exception e) { ShowError(e.Message); }
catch (Exception e) { this.ShowError(errorLabel, 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;
if (chelGridView.SelectedRows.Count != 1)
throw new Exception("Человек не выбран.");
if (int.TryParse((string)chelGridView.SelectedRows[0].Cells[0].Value, out int value))
return FuncDB.ChelGetById(value);
else
throw new Exception("Ошибка в таблице.");
}
catch (Exception e)
{
this.ShowError(errorLabel, e.Message);
return null;
}
catch (Exception e) { ShowError(e.Message); return null; }
}
public ChelForm()
public bool isCanceled = true;
public Chel formResult = null;
public ChelForm(bool select = false)
{
try
{
InitializeComponent();
chelRodMI.Enabled = false;
selectButton.Visible = select;
menuStrip.Enabled = !select;
this.correctUpperMenu(menuStrip, 1);
resetChelTable();
addButton.Enabled =
changeButton.Enabled =
delButton.Enabled = false;
var user = this.GetUser();
if (user == null)
return;
delButton.Enabled = FuncDB.AccessGetByUserIdFormIdAccessId(user.Id, 1, 1) != null;
changeButton.Enabled = FuncDB.AccessGetByUserIdFormIdAccessId(user.Id, 1, 2) != null;
addButton.Enabled = FuncDB.AccessGetByUserIdFormIdAccessId(user.Id, 1, 3) != null;
}
catch { this.Close(); }
}
private void addButton_Click(object sender, EventArgs e)
{
var res = new SupportForms.WorkChelForm();
@@ -130,7 +103,8 @@ namespace Diplom_O
private void changeButton_Click(object sender, EventArgs e)
{
var chel = selectedChel();
if (chel == null) { ShowError("Человек не выбран."); return; }
if (chel == null)
return;
var res = new SupportForms.WorkChelForm(chel);
res.ShowDialog();
if (!res.isCanceled)
@@ -139,49 +113,35 @@ namespace Diplom_O
private void delButton_Click(object sender, EventArgs e)
{
var chel = selectedChel();
if (chel == null) { ShowError("Человек не выбран."); return; }
if (FuncDB.HaveChelToChel(chel.Id)) { ShowError("Человек есть в таблице родственников."); return; }
if (chel == null)
return;
try
{
FuncDB.DelChel(chel);
FuncDB.ChelDelete(chel);
resetChelTable();
}
catch (Exception ex) { ShowError(ex.Message); }
catch (Exception ex)
{
this.ShowError(errorLabel, ex.Message);
}
}
public void MI_Click(object sender, EventArgs e)
private void selectButton_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("Ошибка перехода на новую форму.");
formResult = selectedChel();
isCanceled = false;
this.Close();
}
private void checkBox_CheckedChanged(object sender, EventArgs e)
private void showWorker_CheckedChanged(object sender, EventArgs e)
{
resetChelTable();
}
private void upperMenuClicked(object sender, ToolStripItemClickedEventArgs e)
{
this.upperMenuClicked((MenuStrip)sender);
if (this.GetNextForm() != -1)
Close();
}
private Chel chelRod = null;
private void chelRodLabel_Clicked(object sender, LinkLabelLinkClickedEventArgs e)
{
var chelForm = new SupportForms.SelectChelForm();
chelForm.ShowDialog();
if(chelForm.isCanceled)
}
}
}

393
MainForms/ChildForm.Designer.cs generated Normal file
View File

@@ -0,0 +1,393 @@

namespace Diplom_O
{
partial class ChildForm
{
/// <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.menuStrip = new System.Windows.Forms.MenuStrip();
this.shtatMI = new System.Windows.Forms.ToolStripMenuItem();
this.rabitnikiMI = new System.Windows.Forms.ToolStripMenuItem();
this.stajMI = new System.Windows.Forms.ToolStripMenuItem();
this.learnMI = new System.Windows.Forms.ToolStripMenuItem();
this.otpBolMI = new System.Windows.Forms.ToolStripMenuItem();
this.chelRodMI = new System.Windows.Forms.ToolStripMenuItem();
this.детиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.errorLabel = new System.Windows.Forms.ToolStripStatusLabel();
this.childGridView = new System.Windows.Forms.DataGridView();
this.addButton = new System.Windows.Forms.Button();
this.dropFindButton = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.findBox = new System.Windows.Forms.TextBox();
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.changeButton = new System.Windows.Forms.Button();
this.delButton = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.lableChildCountFemale = new System.Windows.Forms.Label();
this.lableChildCountMale = new System.Windows.Forms.Label();
this.lableChildCount = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.dateTimePicker1 = new System.Windows.Forms.DateTimePicker();
this.label5 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.настройкиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.childGridView)).BeginInit();
this.statusStrip1.SuspendLayout();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// menuStrip
//
this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.shtatMI,
this.rabitnikiMI,
this.stajMI,
this.learnMI,
this.otpBolMI,
this.chelRodMI,
this.детиToolStripMenuItem,
this.настройкиToolStripMenuItem});
this.menuStrip.Location = new System.Drawing.Point(0, 0);
this.menuStrip.Name = "menuStrip";
this.menuStrip.Size = new System.Drawing.Size(1059, 24);
this.menuStrip.TabIndex = 30;
this.menuStrip.Text = "menuStrip1";
this.menuStrip.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.upperMenuClicked);
//
// shtatMI
//
this.shtatMI.Name = "shtatMI";
this.shtatMI.Size = new System.Drawing.Size(139, 20);
this.shtatMI.Text = "Актуальные вакансии";
//
// rabitnikiMI
//
this.rabitnikiMI.Name = "rabitnikiMI";
this.rabitnikiMI.Size = new System.Drawing.Size(85, 20);
this.rabitnikiMI.Text = "Сотрудники";
//
// stajMI
//
this.stajMI.Name = "stajMI";
this.stajMI.Size = new System.Drawing.Size(47, 20);
this.stajMI.Text = "Стаж";
//
// learnMI
//
this.learnMI.Name = "learnMI";
this.learnMI.Size = new System.Drawing.Size(92, 20);
this.learnMI.Text = "Образование";
//
// otpBolMI
//
this.otpBolMI.Name = "otpBolMI";
this.otpBolMI.Size = new System.Drawing.Size(100, 20);
this.otpBolMI.Text = "Отпуск/Больн.";
//
// chelRodMI
//
this.chelRodMI.Name = "chelRodMI";
this.chelRodMI.Size = new System.Drawing.Size(50, 20);
this.chelRodMI.Text = "Люди";
//
// детиToolStripMenuItem
//
this.детиToolStripMenuItem.Name = етиToolStripMenuItem";
this.детиToolStripMenuItem.Size = new System.Drawing.Size(45, 20);
this.детиToolStripMenuItem.Text = "Дети";
//
// 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(137, 17);
this.errorLabel.Text = "Отображение ошибки";
this.errorLabel.Visible = false;
//
// childGridView
//
this.childGridView.AllowUserToAddRows = false;
this.childGridView.AllowUserToDeleteRows = false;
this.childGridView.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.childGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.childGridView.Location = new System.Drawing.Point(12, 56);
this.childGridView.MultiSelect = false;
this.childGridView.Name = "childGridView";
this.childGridView.ReadOnly = true;
this.childGridView.RowHeadersVisible = false;
this.childGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.childGridView.Size = new System.Drawing.Size(688, 376);
this.childGridView.TabIndex = 36;
//
// addButton
//
this.addButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.addButton.Location = new System.Drawing.Point(463, 27);
this.addButton.Name = "addButton";
this.addButton.Size = new System.Drawing.Size(75, 23);
this.addButton.TabIndex = 29;
this.addButton.Text = "Добавить";
this.addButton.UseVisualStyleBackColor = true;
this.addButton.Click += new System.EventHandler(this.addButton_Click);
//
// dropFindButton
//
this.dropFindButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.dropFindButton.Location = new System.Drawing.Point(625, 438);
this.dropFindButton.Name = "dropFindButton";
this.dropFindButton.Size = new System.Drawing.Size(75, 23);
this.dropFindButton.TabIndex = 35;
this.dropFindButton.Text = "Сбросить";
this.dropFindButton.UseVisualStyleBackColor = true;
this.dropFindButton.Click += new System.EventHandler(this.dropFindButton_Click);
//
// 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, 443);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(39, 13);
this.label1.TabIndex = 38;
this.label1.Text = "Поиск";
//
// findBox
//
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, 440);
this.findBox.Name = "findBox";
this.findBox.Size = new System.Drawing.Size(562, 20);
this.findBox.TabIndex = 34;
this.findBox.TextChanged += new System.EventHandler(this.findBox_TextChanged);
//
// statusStrip1
//
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.errorLabel});
this.statusStrip1.Location = new System.Drawing.Point(0, 464);
this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Size = new System.Drawing.Size(1059, 22);
this.statusStrip1.TabIndex = 37;
this.statusStrip1.Text = "statusStrip1";
//
// changeButton
//
this.changeButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.changeButton.Location = new System.Drawing.Point(544, 27);
this.changeButton.Name = "changeButton";
this.changeButton.Size = new System.Drawing.Size(75, 23);
this.changeButton.TabIndex = 39;
this.changeButton.Text = "Изменить";
this.changeButton.UseVisualStyleBackColor = true;
this.changeButton.Click += new System.EventHandler(this.changeButton_Click);
//
// delButton
//
this.delButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.delButton.Location = new System.Drawing.Point(625, 27);
this.delButton.Name = "delButton";
this.delButton.Size = new System.Drawing.Size(75, 23);
this.delButton.TabIndex = 40;
this.delButton.Text = "Удалить";
this.delButton.UseVisualStyleBackColor = true;
this.delButton.Click += new System.EventHandler(this.delButton_Click);
//
// groupBox1
//
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox1.Controls.Add(this.lableChildCountFemale);
this.groupBox1.Controls.Add(this.lableChildCountMale);
this.groupBox1.Controls.Add(this.lableChildCount);
this.groupBox1.Controls.Add(this.button1);
this.groupBox1.Controls.Add(this.dateTimePicker1);
this.groupBox1.Controls.Add(this.label5);
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Location = new System.Drawing.Point(706, 27);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(341, 433);
this.groupBox1.TabIndex = 41;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Расчет";
//
// lableChildCountFemale
//
this.lableChildCountFemale.AutoSize = true;
this.lableChildCountFemale.Location = new System.Drawing.Point(122, 100);
this.lableChildCountFemale.Name = "lableChildCountFemale";
this.lableChildCountFemale.Size = new System.Drawing.Size(13, 13);
this.lableChildCountFemale.TabIndex = 20;
this.lableChildCountFemale.Text = "0";
//
// lableChildCountMale
//
this.lableChildCountMale.AutoSize = true;
this.lableChildCountMale.Location = new System.Drawing.Point(122, 74);
this.lableChildCountMale.Name = "lableChildCountMale";
this.lableChildCountMale.Size = new System.Drawing.Size(13, 13);
this.lableChildCountMale.TabIndex = 19;
this.lableChildCountMale.Text = "0";
//
// lableChildCount
//
this.lableChildCount.AutoSize = true;
this.lableChildCount.Location = new System.Drawing.Point(122, 48);
this.lableChildCount.Name = "lableChildCount";
this.lableChildCount.Size = new System.Drawing.Size(13, 13);
this.lableChildCount.TabIndex = 18;
this.lableChildCount.Text = "0";
//
// button1
//
this.button1.Location = new System.Drawing.Point(270, 17);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(65, 23);
this.button1.TabIndex = 17;
this.button1.Text = "Расчет";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// dateTimePicker1
//
this.dateTimePicker1.Location = new System.Drawing.Point(125, 19);
this.dateTimePicker1.Name = "dateTimePicker1";
this.dateTimePicker1.Size = new System.Drawing.Size(139, 20);
this.dateTimePicker1.TabIndex = 16;
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(65, 100);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(54, 13);
this.label5.TabIndex = 15;
this.label5.Text = "Девочек:";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(53, 74);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(66, 13);
this.label4.TabIndex = 14;
this.label4.Text = "Мальчиков:";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(6, 48);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(113, 13);
this.label3.TabIndex = 13;
this.label3.Text = "Общее кол-во детей:";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(34, 22);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(85, 13);
this.label2.TabIndex = 12;
this.label2.Text = "Расчет на дату:";
//
// настройкиToolStripMenuItem
//
this.настройкиToolStripMenuItem.Name = астройкиToolStripMenuItem";
this.настройкиToolStripMenuItem.Size = new System.Drawing.Size(79, 20);
this.настройкиToolStripMenuItem.Text = "Настройки";
//
// ChildForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1059, 486);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.delButton);
this.Controls.Add(this.changeButton);
this.Controls.Add(this.menuStrip);
this.Controls.Add(this.childGridView);
this.Controls.Add(this.addButton);
this.Controls.Add(this.dropFindButton);
this.Controls.Add(this.label1);
this.Controls.Add(this.findBox);
this.Controls.Add(this.statusStrip1);
this.Name = "ChildForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Дети";
this.menuStrip.ResumeLayout(false);
this.menuStrip.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.childGridView)).EndInit();
this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout();
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.MenuStrip menuStrip;
private System.Windows.Forms.ToolStripMenuItem shtatMI;
private System.Windows.Forms.ToolStripMenuItem rabitnikiMI;
private System.Windows.Forms.ToolStripMenuItem otpBolMI;
private System.Windows.Forms.ToolStripMenuItem chelRodMI;
private System.Windows.Forms.ToolStripMenuItem детиToolStripMenuItem;
private System.Windows.Forms.ToolStripStatusLabel errorLabel;
private System.Windows.Forms.DataGridView childGridView;
private System.Windows.Forms.Button addButton;
private System.Windows.Forms.Button dropFindButton;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox findBox;
private System.Windows.Forms.StatusStrip statusStrip1;
private System.Windows.Forms.Button changeButton;
private System.Windows.Forms.Button delButton;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.DateTimePicker dateTimePicker1;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label lableChildCountFemale;
private System.Windows.Forms.Label lableChildCountMale;
private System.Windows.Forms.Label lableChildCount;
private System.Windows.Forms.ToolStripMenuItem stajMI;
private System.Windows.Forms.ToolStripMenuItem learnMI;
private System.Windows.Forms.ToolStripMenuItem настройкиToolStripMenuItem;
}
}

162
MainForms/ChildForm.cs Normal file
View File

@@ -0,0 +1,162 @@
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
{
public partial class ChildForm : Form
{
private readonly ColumnConf[] tableMainColumns = {
new ColumnConf(name: "№"),
new ColumnConf(name: "Фамилия И.О.", size: 140),
new ColumnConf(name: "Пол", size: 80),
new ColumnConf(name: "Дата рождения", size: 80),
new ColumnConf(name: "Род 1", size: 140),
new ColumnConf(name: "Род 2", size: 140)
};
private void resetChildTable()
{
try
{
var res = FuncDB.ChildTableMain(findBox.Text);
this.ResetTable(
childGridView,
tableMainColumns,
res
);
}
catch (Exception e)
{
this.ShowError(errorLabel, e.Message);
}
}
private Child selectedChildTable()
{
try
{
if (childGridView.SelectedRows.Count != 1)
throw new Exception("Ребонок не выбран.");
if (int.TryParse((string)childGridView.SelectedRows[0].Cells[0].Value, out int value))
return FuncDB.ChildGetById(value);
else
throw new Exception("Ошибка в таблице.");
}
catch (Exception e)
{
this.ShowError(errorLabel, e.Message);
return null;
}
}
private void resetChildCount()
{
try
{
lableChildCount.Text = FuncDB.ChildCount(dateTimePicker1.Value).ToString();
lableChildCountMale.Text = FuncDB.ChildCount(dateTimePicker1.Value, true).ToString();
lableChildCountFemale.Text = FuncDB.ChildCount(dateTimePicker1.Value, false).ToString();
}
catch (Exception e)
{
this.ShowError(errorLabel, e.Message);
}
}
public ChildForm()
{
InitializeComponent();
this.correctUpperMenu(menuStrip, 6);
resetChildTable();
dateTimePicker1.Value = DateTime.Now;
resetChildCount();
addButton.Enabled =
changeButton.Enabled =
delButton.Enabled = false;
var user = this.GetUser();
if (user == null)
return;
delButton.Enabled = FuncDB.AccessGetByUserIdFormIdAccessId(user.Id, 6, 1) != null;
changeButton.Enabled = FuncDB.AccessGetByUserIdFormIdAccessId(user.Id, 6, 2) != null;
addButton.Enabled = FuncDB.AccessGetByUserIdFormIdAccessId(user.Id, 6, 3) != null;
}
private void addButton_Click(object sender, EventArgs e)
{
try
{
var form = new SupportForms.ChildForm();
form.ShowDialog();
if (!form.isCanceled)
resetChildTable();
resetChildCount();
}
catch (Exception ex)
{
this.ShowError(errorLabel, ex.Message);
}
}
private void changeButton_Click(object sender, EventArgs e)
{
try
{
var form = new SupportForms.ChildForm(selectedChildTable());
form.ShowDialog();
if (!form.isCanceled)
resetChildTable();
resetChildCount();
}
catch (Exception ex)
{
this.ShowError(errorLabel, ex.Message);
}
}
private void delButton_Click(object sender, EventArgs e)
{
try
{
var res = selectedChildTable();
FuncDB.ChildDelete(res);
resetChildTable();
resetChildCount();
}
catch (Exception ex)
{
this.ShowError(errorLabel, ex.Message);
}
}
private void upperMenuClicked(object sender, ToolStripItemClickedEventArgs e)
{
this.upperMenuClicked((MenuStrip)sender);
if (this.GetNextForm() != -1)
Close();
}
private void button1_Click(object sender, EventArgs e)
{
resetChildCount();
}
private void findBox_TextChanged(object sender, EventArgs e)
{
this.FindOnChanged(resetChildTable);
}
private void dropFindButton_Click(object sender, EventArgs e)
{
findBox.Text = "";
this.FindOnChanged(null);
resetChildTable();
}
}
}

126
MainForms/ChildForm.resx Normal file
View File

@@ -0,0 +1,126 @@
<?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>
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>364, 17</value>
</metadata>
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>472, 17</value>
</metadata>
</root>

210
MainForms/ChildrenForm.Designer.cs generated Normal file
View File

@@ -0,0 +1,210 @@

namespace Diplom_O
{
partial class ChildrenForm
{
/// <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.menuStrip = new System.Windows.Forms.MenuStrip();
this.shtatMI = new System.Windows.Forms.ToolStripMenuItem();
this.rabitnikiMI = new System.Windows.Forms.ToolStripMenuItem();
this.otpBolMI = new System.Windows.Forms.ToolStripMenuItem();
this.chelRodMI = new System.Windows.Forms.ToolStripMenuItem();
this.детиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.errorLabel = new System.Windows.Forms.ToolStripStatusLabel();
this.workerGridView = new System.Windows.Forms.DataGridView();
this.addWorkerButton = new System.Windows.Forms.Button();
this.dropFindButton = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.findBox = new System.Windows.Forms.TextBox();
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.menuStrip.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.workerGridView)).BeginInit();
this.statusStrip1.SuspendLayout();
this.SuspendLayout();
//
// menuStrip
//
this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.shtatMI,
this.rabitnikiMI,
this.otpBolMI,
this.chelRodMI,
this.детиToolStripMenuItem});
this.menuStrip.Location = new System.Drawing.Point(0, 0);
this.menuStrip.Name = "menuStrip";
this.menuStrip.Size = new System.Drawing.Size(983, 24);
this.menuStrip.TabIndex = 30;
this.menuStrip.Text = "menuStrip1";
this.menuStrip.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.upperMenuClicked);
//
// shtatMI
//
this.shtatMI.Name = "shtatMI";
this.shtatMI.Size = new System.Drawing.Size(139, 20);
this.shtatMI.Text = "Актуальные вакансии";
//
// rabitnikiMI
//
this.rabitnikiMI.Name = "rabitnikiMI";
this.rabitnikiMI.Size = new System.Drawing.Size(78, 20);
this.rabitnikiMI.Text = "Сотрудник";
//
// otpBolMI
//
this.otpBolMI.Name = "otpBolMI";
this.otpBolMI.Size = new System.Drawing.Size(100, 20);
this.otpBolMI.Text = "Отпуск/Больн.";
//
// chelRodMI
//
this.chelRodMI.Name = "chelRodMI";
this.chelRodMI.Size = new System.Drawing.Size(50, 20);
this.chelRodMI.Text = "Люди";
//
// детиToolStripMenuItem
//
this.детиToolStripMenuItem.Name = етиToolStripMenuItem";
this.детиToolStripMenuItem.Size = new System.Drawing.Size(45, 20);
this.детиToolStripMenuItem.Text = "Дети";
//
// 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(137, 17);
this.errorLabel.Text = "Отображение ошибки";
this.errorLabel.Visible = false;
//
// workerGridView
//
this.workerGridView.AllowUserToAddRows = false;
this.workerGridView.AllowUserToDeleteRows = false;
this.workerGridView.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.workerGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.workerGridView.Location = new System.Drawing.Point(12, 56);
this.workerGridView.MultiSelect = false;
this.workerGridView.Name = "workerGridView";
this.workerGridView.ReadOnly = true;
this.workerGridView.RowHeadersVisible = false;
this.workerGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.workerGridView.Size = new System.Drawing.Size(459, 694);
this.workerGridView.TabIndex = 36;
this.workerGridView.SelectionChanged += new System.EventHandler(this.workerGridView_SelectionChanged);
//
// addWorkerButton
//
this.addWorkerButton.Location = new System.Drawing.Point(396, 27);
this.addWorkerButton.Name = "addWorkerButton";
this.addWorkerButton.Size = new System.Drawing.Size(75, 23);
this.addWorkerButton.TabIndex = 29;
this.addWorkerButton.Text = "Добавить";
this.addWorkerButton.UseVisualStyleBackColor = true;
this.addWorkerButton.Click += new System.EventHandler(this.addWorkerButton_Click);
//
// dropFindButton
//
this.dropFindButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.dropFindButton.Location = new System.Drawing.Point(396, 756);
this.dropFindButton.Name = "dropFindButton";
this.dropFindButton.Size = new System.Drawing.Size(75, 23);
this.dropFindButton.TabIndex = 35;
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, 761);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(39, 13);
this.label1.TabIndex = 38;
this.label1.Text = "Поиск";
//
// findBox
//
this.findBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.findBox.Location = new System.Drawing.Point(57, 758);
this.findBox.Name = "findBox";
this.findBox.Size = new System.Drawing.Size(333, 20);
this.findBox.TabIndex = 34;
//
// statusStrip1
//
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.errorLabel});
this.statusStrip1.Location = new System.Drawing.Point(0, 782);
this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Size = new System.Drawing.Size(983, 22);
this.statusStrip1.TabIndex = 37;
this.statusStrip1.Text = "statusStrip1";
//
// ChildrenForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(983, 804);
this.Controls.Add(this.menuStrip);
this.Controls.Add(this.workerGridView);
this.Controls.Add(this.addWorkerButton);
this.Controls.Add(this.dropFindButton);
this.Controls.Add(this.label1);
this.Controls.Add(this.findBox);
this.Controls.Add(this.statusStrip1);
this.Name = "ChildrenForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "ChildrenForm";
this.menuStrip.ResumeLayout(false);
this.menuStrip.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.workerGridView)).EndInit();
this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.MenuStrip menuStrip;
private System.Windows.Forms.ToolStripMenuItem shtatMI;
private System.Windows.Forms.ToolStripMenuItem rabitnikiMI;
private System.Windows.Forms.ToolStripMenuItem otpBolMI;
private System.Windows.Forms.ToolStripMenuItem chelRodMI;
private System.Windows.Forms.ToolStripMenuItem детиToolStripMenuItem;
private System.Windows.Forms.ToolStripStatusLabel errorLabel;
private System.Windows.Forms.DataGridView workerGridView;
private System.Windows.Forms.Button addWorkerButton;
private System.Windows.Forms.Button dropFindButton;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox findBox;
private System.Windows.Forms.StatusStrip statusStrip1;
}
}

237
MainForms/ChildrenForm.cs Normal file
View File

@@ -0,0 +1,237 @@
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
{
public partial class ChildrenForm : Form
{
private readonly ColumnConf[] tableMainColumns = {
new ColumnConf(name: "№"),
new ColumnConf(name: "Таб. №", size: 80),
new ColumnConf(name: "Фамилия И.О.", size: 140),
new ColumnConf(name: "Должность", size: 140)
};
private readonly ColumnConf[] tableHistoryColumns =
{
new ColumnConf(name: "№"),
new ColumnConf(name: "Таб. №", size: 80),
new ColumnConf(name: "Должность", size: 140),
new ColumnConf(name: "Дата начала", size: 80),
new ColumnConf(name: "Дата конца", size: 80)
};
private readonly ColumnConf[] tableStajColumns =
{
new ColumnConf(name: "№"),
new ColumnConf(name: "Тип стажа", size: 120),
};
private void resetRabotnikTable()
{
try
{
var res = FuncDB.RabotnikTableMain(findBox.Text);
this.ResetTable(
workerGridView,
tableMainColumns,
res
);
}
catch (Exception e)
{
this.ShowError(errorLabel, e.Message);
}
}
private Rabotnik selectedRabotnikTable()
{
try
{
if (workerGridView.SelectedRows.Count != 1)
throw new Exception("Человек не выбран.");
if (int.TryParse((string)workerGridView.SelectedRows[0].Cells[0].Value, out int value))
return FuncDB.RabotnikGetById(value);
else
throw new Exception("Ошибка в таблице.");
}
catch (Exception e)
{
this.ShowError(errorLabel, e.Message);
return null;
}
}
private void workerGridView_SelectionChanged(object sender, EventArgs e)
{
resetHistoryWorkTable();
}
private void resetHistoryWorkTable()
{
try
{
var rabotnik = selectedRabotnikTable();
var res = (rabotnik == null) ? Array.Empty<string[]>() : FuncDB.RabotnikByChelIdTable(rabotnik.ChelId);
this.ResetTable(
historyWorkGridView,
tableHistoryColumns,
res
);
}
catch (Exception e)
{
this.ShowError(errorLabel, e.Message);
}
}
private Rabotnik selectedHistoryWorkTable()
{
try
{
if (historyWorkGridView.SelectedRows.Count != 1)
throw new Exception("Человек не выбран.");
if (int.TryParse((string)historyWorkGridView.SelectedRows[0].Cells[0].Value, out int value))
return FuncDB.RabotnikGetById(value);
else
throw new Exception("Ошибка в таблице.");
}
catch (Exception e)
{
this.ShowError(errorLabel, e.Message);
return null;
}
}
private void historyWorkGridView_SelectionChanged(object sender, EventArgs e)
{
resetRabotnikStajTable();
}
private void resetRabotnikStajTable()
{
try
{
var rabotnik = selectedHistoryWorkTable();
var res = (rabotnik == null) ? Array.Empty<string[]>() :
FuncDB.RabotnikTypeStajListString(rabotnik.Id);
this.ResetTable(
stajGridView,
tableStajColumns,
res
);
}
catch (Exception e)
{
this.ShowError(errorLabel, e.Message);
}
}
private RabotnikTypeStaj selectedRabotnikStajTable()
{
try
{
if (stajGridView.SelectedRows.Count != 1)
throw new Exception("Стаж сотрудника не выбран.");
if (int.TryParse((string)stajGridView.SelectedRows[0].Cells[0].Value, out int value))
return FuncDB.RabotnikTypeStajGetById(value);
else
throw new Exception("Ошибка в таблице.");
}
catch (Exception e)
{
this.ShowError(errorLabel, e.Message);
return null;
}
}
private void resetTypeStajComboBox()
{
try
{
var list = FuncDB.TypeStajListString();
comboBox1.Items.Clear();
comboBox1.Items.AddRange(list);
comboBox1.SelectedIndex = -1;
}
catch (Exception e)
{
this.ShowError(errorLabel, e.Message);
}
}
public RabForm()
{
InitializeComponent();
this.correctUpperMenu(menuStrip, 1);
resetRabotnikTable();
resetTypeStajComboBox();
}
private void addWorkerButton_Click(object sender, EventArgs e)
{
var form = new SupportForms.WorkerForm();
form.ShowDialog();
if (!form.isCanceled)
resetRabotnikTable();
}
private void addWorkPlaceButton_Click(object sender, EventArgs e)
{
var form = new SupportForms.WorkerForm(selectedHistoryWorkTable(), true);
form.ShowDialog();
if (!form.isCanceled)
resetRabotnikTable();
}
private void addTypeStajButton_Click(object sender, EventArgs e)
{
try
{
var typestaj = FuncDB.TypeStajGetByName(comboBox1.Text);
if (typestaj == null)
{
FuncDB.TypeStajAdd(new TypeStaj() { Name = comboBox1.Text });
typestaj = FuncDB.TypeStajGetByName(comboBox1.Text);
}
var rabotnik = selectedHistoryWorkTable();
if (rabotnik == null)
throw new Exception("Не выбран сотрудник");
FuncDB.RabotnikTypeStajAdd(new RabotnikTypeStaj() { RabitnikId = rabotnik.Id, TypeStajId = typestaj.Id });
resetTypeStajComboBox();
resetRabotnikStajTable();
}
catch (Exception ex)
{
this.ShowError(errorLabel, ex.Message);
}
}
private void changeWorkPlaceButton_Click(object sender, EventArgs e)
{
var form = new SupportForms.WorkerForm(selectedHistoryWorkTable());
form.ShowDialog();
if (!form.isCanceled)
resetRabotnikTable();
}
private void delWorkPlaceButton_Click(object sender, EventArgs e)
{
var res = selectedHistoryWorkTable();
FuncDB.RabotnikDelete(res);
resetHistoryWorkTable();
}
private void delTypeStajButton_Click(object sender, EventArgs e)
{
var res = selectedRabotnikStajTable();
FuncDB.RabotnikTypeStajDelete(res);
resetRabotnikStajTable();
}
private void upperMenuClicked(object sender, ToolStripItemClickedEventArgs e)
{
this.upperMenuClicked((MenuStrip)sender);
if (this.GetNextForm() != -1)
Close();
}
}
}

126
MainForms/ChildrenForm.resx Normal file
View File

@@ -0,0 +1,126 @@
<?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>
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>364, 17</value>
</metadata>
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>472, 17</value>
</metadata>
</root>

269
MainForms/LearnForm.Designer.cs generated Normal file
View File

@@ -0,0 +1,269 @@

namespace Diplom_O
{
partial class LearnForm
{
/// <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.menuStrip = new System.Windows.Forms.MenuStrip();
this.shtatMI = new System.Windows.Forms.ToolStripMenuItem();
this.chelRodMI = new System.Windows.Forms.ToolStripMenuItem();
this.rabitnikiMI = new System.Windows.Forms.ToolStripMenuItem();
this.stajMI = new System.Windows.Forms.ToolStripMenuItem();
this.learnMI = new System.Windows.Forms.ToolStripMenuItem();
this.otpBolMI = new System.Windows.Forms.ToolStripMenuItem();
this.детиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.errorLabel = new System.Windows.Forms.ToolStripStatusLabel();
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.group = new System.Windows.Forms.GroupBox();
this.learnGridView = new System.Windows.Forms.DataGridView();
this.linkRabLabel = new System.Windows.Forms.LinkLabel();
this.label2 = new System.Windows.Forms.Label();
this.addButton = new System.Windows.Forms.Button();
this.changeButton = new System.Windows.Forms.Button();
this.delButton = new System.Windows.Forms.Button();
this.настройкиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip.SuspendLayout();
this.statusStrip1.SuspendLayout();
this.group.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.learnGridView)).BeginInit();
this.SuspendLayout();
//
// menuStrip
//
this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.shtatMI,
this.chelRodMI,
this.rabitnikiMI,
this.stajMI,
this.learnMI,
this.otpBolMI,
this.детиToolStripMenuItem,
this.настройкиToolStripMenuItem});
this.menuStrip.Location = new System.Drawing.Point(0, 0);
this.menuStrip.Name = "menuStrip";
this.menuStrip.Size = new System.Drawing.Size(918, 24);
this.menuStrip.TabIndex = 30;
this.menuStrip.Text = "menuStrip1";
this.menuStrip.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.upperMenuClicked);
//
// shtatMI
//
this.shtatMI.Name = "shtatMI";
this.shtatMI.Size = new System.Drawing.Size(139, 20);
this.shtatMI.Text = "Актуальные вакансии";
//
// chelRodMI
//
this.chelRodMI.Name = "chelRodMI";
this.chelRodMI.Size = new System.Drawing.Size(50, 20);
this.chelRodMI.Text = "Люди";
//
// rabitnikiMI
//
this.rabitnikiMI.Name = "rabitnikiMI";
this.rabitnikiMI.Size = new System.Drawing.Size(78, 20);
this.rabitnikiMI.Text = "Сотрудник";
//
// stajMI
//
this.stajMI.Name = "stajMI";
this.stajMI.Size = new System.Drawing.Size(47, 20);
this.stajMI.Text = "Стаж";
//
// learnMI
//
this.learnMI.Name = "learnMI";
this.learnMI.Size = new System.Drawing.Size(92, 20);
this.learnMI.Text = "Образование";
//
// otpBolMI
//
this.otpBolMI.Name = "otpBolMI";
this.otpBolMI.Size = new System.Drawing.Size(100, 20);
this.otpBolMI.Text = "Отпуск/Больн.";
//
// детиToolStripMenuItem
//
this.детиToolStripMenuItem.Name = етиToolStripMenuItem";
this.детиToolStripMenuItem.Size = new System.Drawing.Size(45, 20);
this.детиToolStripMenuItem.Text = "Дети";
//
// 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(137, 17);
this.errorLabel.Text = "Отображение ошибки";
this.errorLabel.Visible = false;
//
// statusStrip1
//
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.errorLabel});
this.statusStrip1.Location = new System.Drawing.Point(0, 423);
this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Size = new System.Drawing.Size(918, 22);
this.statusStrip1.TabIndex = 37;
this.statusStrip1.Text = "statusStrip1";
//
// group
//
this.group.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.group.Controls.Add(this.learnGridView);
this.group.Location = new System.Drawing.Point(15, 56);
this.group.Name = "group";
this.group.Size = new System.Drawing.Size(891, 364);
this.group.TabIndex = 39;
this.group.TabStop = false;
this.group.Text = "Образование";
//
// learnGridView
//
this.learnGridView.AllowUserToAddRows = false;
this.learnGridView.AllowUserToDeleteRows = false;
this.learnGridView.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.learnGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.learnGridView.Location = new System.Drawing.Point(6, 19);
this.learnGridView.MultiSelect = false;
this.learnGridView.Name = "learnGridView";
this.learnGridView.ReadOnly = true;
this.learnGridView.RowHeadersVisible = false;
this.learnGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.learnGridView.Size = new System.Drawing.Size(879, 339);
this.learnGridView.TabIndex = 37;
//
// linkRabLabel
//
this.linkRabLabel.AutoSize = true;
this.linkRabLabel.Location = new System.Drawing.Point(76, 32);
this.linkRabLabel.Name = "linkRabLabel";
this.linkRabLabel.Size = new System.Drawing.Size(121, 13);
this.linkRabLabel.TabIndex = 41;
this.linkRabLabel.TabStop = true;
this.linkRabLabel.Text = "Выбрать сотрудника...";
this.linkRabLabel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkRabLabel_LinkClicked);
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(12, 32);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(63, 13);
this.label2.TabIndex = 42;
this.label2.Text = "Сотрудник:";
//
// addButton
//
this.addButton.Location = new System.Drawing.Point(669, 27);
this.addButton.Name = "addButton";
this.addButton.Size = new System.Drawing.Size(75, 23);
this.addButton.TabIndex = 43;
this.addButton.Text = "Добавить";
this.addButton.UseVisualStyleBackColor = true;
this.addButton.Click += new System.EventHandler(this.addButton_Click);
//
// changeButton
//
this.changeButton.Location = new System.Drawing.Point(750, 27);
this.changeButton.Name = "changeButton";
this.changeButton.Size = new System.Drawing.Size(75, 23);
this.changeButton.TabIndex = 44;
this.changeButton.Text = "Изменить";
this.changeButton.UseVisualStyleBackColor = true;
this.changeButton.Click += new System.EventHandler(this.changeButton_Click);
//
// delButton
//
this.delButton.Location = new System.Drawing.Point(831, 27);
this.delButton.Name = "delButton";
this.delButton.Size = new System.Drawing.Size(75, 23);
this.delButton.TabIndex = 45;
this.delButton.Text = "Удалить";
this.delButton.UseVisualStyleBackColor = true;
this.delButton.Click += new System.EventHandler(this.delButton_Click);
//
// настройкиToolStripMenuItem
//
this.настройкиToolStripMenuItem.Name = астройкиToolStripMenuItem";
this.настройкиToolStripMenuItem.Size = new System.Drawing.Size(79, 20);
this.настройкиToolStripMenuItem.Text = "Настройки";
//
// LearnForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(918, 445);
this.Controls.Add(this.delButton);
this.Controls.Add(this.changeButton);
this.Controls.Add(this.addButton);
this.Controls.Add(this.label2);
this.Controls.Add(this.linkRabLabel);
this.Controls.Add(this.group);
this.Controls.Add(this.menuStrip);
this.Controls.Add(this.statusStrip1);
this.Name = "LearnForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Образование";
this.menuStrip.ResumeLayout(false);
this.menuStrip.PerformLayout();
this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout();
this.group.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.learnGridView)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.MenuStrip menuStrip;
private System.Windows.Forms.ToolStripMenuItem shtatMI;
private System.Windows.Forms.ToolStripMenuItem rabitnikiMI;
private System.Windows.Forms.ToolStripMenuItem otpBolMI;
private System.Windows.Forms.ToolStripMenuItem chelRodMI;
private System.Windows.Forms.ToolStripMenuItem детиToolStripMenuItem;
private System.Windows.Forms.ToolStripStatusLabel errorLabel;
private System.Windows.Forms.StatusStrip statusStrip1;
private System.Windows.Forms.ToolStripMenuItem stajMI;
private System.Windows.Forms.GroupBox group;
private System.Windows.Forms.DataGridView learnGridView;
private System.Windows.Forms.LinkLabel linkRabLabel;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button addButton;
private System.Windows.Forms.Button changeButton;
private System.Windows.Forms.Button delButton;
private System.Windows.Forms.ToolStripMenuItem learnMI;
private System.Windows.Forms.ToolStripMenuItem настройкиToolStripMenuItem;
}
}

165
MainForms/LearnForm.cs Normal file
View File

@@ -0,0 +1,165 @@
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
{
public partial class LearnForm : Form
{
private readonly ColumnConf[] tableMainColumns = {
new ColumnConf(name: "№"),
new ColumnConf(name: "Название обр. учр.", size: 140, warp: true),
new ColumnConf(name: "Уровень", size: 140),
new ColumnConf(name: "Специальность", size: 140),
new ColumnConf(name: "Дата окончания", size: 80),
new ColumnConf(name: "Курсы", size: 140, warp: true),
new ColumnConf(name: "Проф. переподготовка", size: 140, warp: true)
};
private Rabotnik rabotnik = null;
private void linkRabLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
var form = new RabForm(true);
form.ShowDialog();
if (form.isCanceled)
rabotnik = null;
else
rabotnik = form.formResult;
ResetLinkRabotnik();
resetLearnTable();
}
private void ResetLinkRabotnik()
{
if (rabotnik == null)
{
linkRabLabel.Text = "Выбрать сотрудника...";
return;
}
var chel = FuncDB.ChelGetById(rabotnik.ChelId);
if (chel == null)
{
linkRabLabel.Text = "Выбрать сотрудника...";
return;
}
var res = chel.FName.ToString() + " " +
chel.SName[0].ToString() + "." +
((!string.IsNullOrEmpty(chel.TName)) ?
chel.TName[0].ToString() + "." : "");
linkRabLabel.Text = res;
}
private void resetLearnTable()
{
try
{
var res = rabotnik == null ? Array.Empty<string[]>() : FuncDB.LearnListTableMain(rabotnik.ChelId);
this.ResetTable(
learnGridView,
tableMainColumns,
res
);
}
catch (Exception e)
{
this.ShowError(errorLabel, e.Message);
}
}
private Learn selectedLearnTable()
{
try
{
if (learnGridView.SelectedRows.Count != 1)
throw new Exception("Образование не выбрано.");
if (int.TryParse((string)learnGridView.SelectedRows[0].Cells[0].Value, out int value))
return FuncDB.LearnGetById(value);
else
throw new Exception("Ошибка в таблице.");
}
catch (Exception e)
{
this.ShowError(errorLabel, e.Message);
return null;
}
}
public LearnForm()
{
InitializeComponent();
this.correctUpperMenu(menuStrip, 4);
ResetLinkRabotnik();
resetLearnTable();
linkRabLabel.Enabled =
addButton.Enabled =
changeButton.Enabled =
delButton.Enabled = false;
var user = this.GetUser();
if (user == null)
return;
linkRabLabel.Enabled = FuncDB.AccessGetByUserIdFormIdAccessId(user.Id, 4, 0) != null;
delButton.Enabled = FuncDB.AccessGetByUserIdFormIdAccessId(user.Id, 4, 1) != null;
changeButton.Enabled = FuncDB.AccessGetByUserIdFormIdAccessId(user.Id, 4, 2) != null;
addButton.Enabled = FuncDB.AccessGetByUserIdFormIdAccessId(user.Id, 4, 3) != null;
}
private void addButton_Click(object sender, EventArgs e)
{
try
{
if (rabotnik == null)
throw new Exception("Не выбран сотрудник.");
var form = new SupportForms.LearnForm(chelId: rabotnik.ChelId);
form.ShowDialog();
if (!form.isCanceled)
{
resetLearnTable();
}
}
catch (Exception ex)
{
this.ShowError(errorLabel, ex.Message);
}
}
private void changeButton_Click(object sender, EventArgs e)
{
try
{
var form = new SupportForms.LearnForm(selectedLearnTable());
form.ShowDialog();
if (!form.isCanceled)
resetLearnTable();
}
catch (Exception ex)
{
this.ShowError(errorLabel, ex.Message);
}
}
private void delButton_Click(object sender, EventArgs e)
{
try
{
FuncDB.LearnDelete(selectedLearnTable());
resetLearnTable();
}
catch (Exception ex)
{
this.ShowError(errorLabel, ex.Message);
}
}
private void upperMenuClicked(object sender, ToolStripItemClickedEventArgs e)
{
this.upperMenuClicked((MenuStrip)sender);
if (this.GetNextForm() != -1)
Close();
}
}
}

126
MainForms/LearnForm.resx Normal file
View File

@@ -0,0 +1,126 @@
<?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>
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>364, 17</value>
</metadata>
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>472, 17</value>
</metadata>
</root>

151
MainForms/LoginForm.Designer.cs generated Normal file
View File

@@ -0,0 +1,151 @@

namespace Diplom_O
{
partial class LoginForm
{
/// <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.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.errorLabel = new System.Windows.Forms.ToolStripStatusLabel();
this.workButton = new System.Windows.Forms.Button();
this.canceledButton = new System.Windows.Forms.Button();
this.loginBox = new System.Windows.Forms.ComboBox();
this.textBox1 = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.statusStrip1.SuspendLayout();
this.SuspendLayout();
//
// statusStrip1
//
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.errorLabel});
this.statusStrip1.Location = new System.Drawing.Point(0, 98);
this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Size = new System.Drawing.Size(332, 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;
//
// workButton
//
this.workButton.Location = new System.Drawing.Point(245, 65);
this.workButton.Name = "workButton";
this.workButton.Size = new System.Drawing.Size(75, 23);
this.workButton.TabIndex = 9;
this.workButton.Text = "Войти";
this.workButton.UseVisualStyleBackColor = true;
this.workButton.Click += new System.EventHandler(this.workButton_Click);
//
// canceledButton
//
this.canceledButton.Location = new System.Drawing.Point(164, 65);
this.canceledButton.Name = "canceledButton";
this.canceledButton.Size = new System.Drawing.Size(75, 23);
this.canceledButton.TabIndex = 10;
this.canceledButton.Text = "Отмена";
this.canceledButton.UseVisualStyleBackColor = true;
this.canceledButton.Click += new System.EventHandler(this.canceledButton_Click);
//
// loginBox
//
this.loginBox.FormattingEnabled = true;
this.loginBox.Location = new System.Drawing.Point(66, 12);
this.loginBox.Name = "loginBox";
this.loginBox.Size = new System.Drawing.Size(254, 21);
this.loginBox.TabIndex = 11;
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(66, 39);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(254, 20);
this.textBox1.TabIndex = 12;
this.textBox1.UseSystemPasswordChar = true;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(19, 15);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(41, 13);
this.label1.TabIndex = 13;
this.label1.Text = "Логин:";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(12, 42);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(48, 13);
this.label2.TabIndex = 14;
this.label2.Text = "Пароль:";
//
// LoginForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(332, 120);
this.ControlBox = false;
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.loginBox);
this.Controls.Add(this.canceledButton);
this.Controls.Add(this.workButton);
this.Controls.Add(this.statusStrip1);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "LoginForm";
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.StatusStrip statusStrip1;
private System.Windows.Forms.ToolStripStatusLabel errorLabel;
private System.Windows.Forms.Button workButton;
private System.Windows.Forms.Button canceledButton;
private System.Windows.Forms.ComboBox loginBox;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
}
}

64
MainForms/LoginForm.cs Normal file
View File

@@ -0,0 +1,64 @@
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;
using System.Security.Cryptography;
namespace Diplom_O
{
public partial class LoginForm : Form
{
public bool isCanceled = false;
public LoginForm()
{
InitializeComponent();
try
{
loginBox.Items.Clear();
var userList = FuncDB.UserList();
foreach (var usr in userList)
loginBox.Items.Add(usr.Login);
if (loginBox.Items.Count > 0)
loginBox.SelectedIndex = 0;
}
catch (Exception e)
{
this.ShowError(errorLabel, e.Message);
workButton.Enabled = false;
}
}
private void workButton_Click(object sender, EventArgs e)
{
try
{
var _user = FuncDB.UserGetByLogin((string)loginBox.Text);
if (_user == null)
throw new Exception("Пользователя не существует.");
if (_user.Pass != textBox1.Text)
throw new Exception("Не верный пароль.");
byte[] pass_bytes = Encoding.ASCII.GetBytes(textBox1.Text);
var pass_hash_bytes = new MD5CryptoServiceProvider().ComputeHash(pass_bytes);
_user.Pass = Encoding.ASCII.GetString(pass_hash_bytes);
this.SetUser(_user);
this.SetNextForm(_user.Default);
this.Close();
}
catch (Exception ex)
{
this.ShowError(errorLabel, ex.Message);
}
}
private void canceledButton_Click(object sender, EventArgs e)
{
isCanceled = true;
this.Close();
}
}
}

126
MainForms/LoginForm.resx Normal file
View File

@@ -0,0 +1,126 @@
<?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>
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

View File

@@ -1,40 +1,442 @@

namespace Diplom_O
{
partial class OtpForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
partial class OtpForm
{
/// <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);
}
/// <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
#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.components = new System.ComponentModel.Container();
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Text = "OtpForm";
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.menuStrip = new System.Windows.Forms.MenuStrip();
this.shtatMI = new System.Windows.Forms.ToolStripMenuItem();
this.chelRodMI = new System.Windows.Forms.ToolStripMenuItem();
this.rabitnikiMI = new System.Windows.Forms.ToolStripMenuItem();
this.stajMI = new System.Windows.Forms.ToolStripMenuItem();
this.learnMI = new System.Windows.Forms.ToolStripMenuItem();
this.otpBolMI = new System.Windows.Forms.ToolStripMenuItem();
this.детиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.errorLabel = new System.Windows.Forms.ToolStripStatusLabel();
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.group = new System.Windows.Forms.GroupBox();
this.freeGridView = new System.Windows.Forms.DataGridView();
this.linkRabLabel = new System.Windows.Forms.LinkLabel();
this.label2 = new System.Windows.Forms.Label();
this.addButton = new System.Windows.Forms.Button();
this.changeButton = new System.Windows.Forms.Button();
this.delButton = new System.Windows.Forms.Button();
this.groupBox = new System.Windows.Forms.GroupBox();
this.otherDaysLabel = new System.Windows.Forms.Label();
this.bolDaysLabel = new System.Windows.Forms.Label();
this.otpDaysLabel = new System.Windows.Forms.Label();
this.totalDaysLabel = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.dateTimePicker1 = new System.Windows.Forms.DateTimePicker();
this.dateTimePicker2 = new System.Windows.Forms.DateTimePicker();
this.updateButton = new System.Windows.Forms.Button();
this.настройкиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip.SuspendLayout();
this.statusStrip1.SuspendLayout();
this.group.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.freeGridView)).BeginInit();
this.groupBox.SuspendLayout();
this.SuspendLayout();
//
// menuStrip
//
this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.shtatMI,
this.chelRodMI,
this.rabitnikiMI,
this.stajMI,
this.learnMI,
this.otpBolMI,
this.детиToolStripMenuItem,
this.настройкиToolStripMenuItem});
this.menuStrip.Location = new System.Drawing.Point(0, 0);
this.menuStrip.Name = "menuStrip";
this.menuStrip.Size = new System.Drawing.Size(918, 24);
this.menuStrip.TabIndex = 30;
this.menuStrip.Text = "menuStrip1";
this.menuStrip.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.upperMenuClicked);
//
// shtatMI
//
this.shtatMI.Name = "shtatMI";
this.shtatMI.Size = new System.Drawing.Size(139, 20);
this.shtatMI.Text = "Актуальные вакансии";
//
// chelRodMI
//
this.chelRodMI.Name = "chelRodMI";
this.chelRodMI.Size = new System.Drawing.Size(50, 20);
this.chelRodMI.Text = "Люди";
//
// rabitnikiMI
//
this.rabitnikiMI.Name = "rabitnikiMI";
this.rabitnikiMI.Size = new System.Drawing.Size(85, 20);
this.rabitnikiMI.Text = "Сотрудники";
//
// stajMI
//
this.stajMI.Name = "stajMI";
this.stajMI.Size = new System.Drawing.Size(47, 20);
this.stajMI.Text = "Стаж";
//
// learnMI
//
this.learnMI.Name = "learnMI";
this.learnMI.Size = new System.Drawing.Size(92, 20);
this.learnMI.Text = "Образование";
//
// otpBolMI
//
this.otpBolMI.Name = "otpBolMI";
this.otpBolMI.Size = new System.Drawing.Size(100, 20);
this.otpBolMI.Text = "Отпуск/Больн.";
//
// детиToolStripMenuItem
//
this.детиToolStripMenuItem.Name = етиToolStripMenuItem";
this.детиToolStripMenuItem.Size = new System.Drawing.Size(45, 20);
this.детиToolStripMenuItem.Text = "Дети";
//
// 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(137, 17);
this.errorLabel.Text = "Отображение ошибки";
this.errorLabel.Visible = false;
//
// statusStrip1
//
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.errorLabel});
this.statusStrip1.Location = new System.Drawing.Point(0, 462);
this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Size = new System.Drawing.Size(918, 22);
this.statusStrip1.TabIndex = 37;
this.statusStrip1.Text = "statusStrip1";
//
// group
//
this.group.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.group.Controls.Add(this.freeGridView);
this.group.Location = new System.Drawing.Point(15, 82);
this.group.Name = "group";
this.group.Size = new System.Drawing.Size(478, 377);
this.group.TabIndex = 39;
this.group.TabStop = false;
this.group.Text = "Образование";
//
// freeGridView
//
this.freeGridView.AllowUserToAddRows = false;
this.freeGridView.AllowUserToDeleteRows = false;
this.freeGridView.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.freeGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.freeGridView.Location = new System.Drawing.Point(6, 19);
this.freeGridView.MultiSelect = false;
this.freeGridView.Name = "freeGridView";
this.freeGridView.ReadOnly = true;
this.freeGridView.RowHeadersVisible = false;
this.freeGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.freeGridView.Size = new System.Drawing.Size(466, 352);
this.freeGridView.TabIndex = 37;
//
// linkRabLabel
//
this.linkRabLabel.AutoSize = true;
this.linkRabLabel.Location = new System.Drawing.Point(76, 32);
this.linkRabLabel.Name = "linkRabLabel";
this.linkRabLabel.Size = new System.Drawing.Size(121, 13);
this.linkRabLabel.TabIndex = 41;
this.linkRabLabel.TabStop = true;
this.linkRabLabel.Text = "Выбрать сотрудника...";
this.linkRabLabel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkRabLabel_LinkClicked);
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(12, 32);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(63, 13);
this.label2.TabIndex = 42;
this.label2.Text = "Сотрудник:";
//
// addButton
//
this.addButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.addButton.Location = new System.Drawing.Point(669, 27);
this.addButton.Name = "addButton";
this.addButton.Size = new System.Drawing.Size(75, 23);
this.addButton.TabIndex = 43;
this.addButton.Text = "Добавить";
this.addButton.UseVisualStyleBackColor = true;
this.addButton.Click += new System.EventHandler(this.addButton_Click);
//
// changeButton
//
this.changeButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.changeButton.Location = new System.Drawing.Point(750, 27);
this.changeButton.Name = "changeButton";
this.changeButton.Size = new System.Drawing.Size(75, 23);
this.changeButton.TabIndex = 44;
this.changeButton.Text = "Изменить";
this.changeButton.UseVisualStyleBackColor = true;
this.changeButton.Click += new System.EventHandler(this.changeButton_Click);
//
// delButton
//
this.delButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.delButton.Location = new System.Drawing.Point(831, 27);
this.delButton.Name = "delButton";
this.delButton.Size = new System.Drawing.Size(75, 23);
this.delButton.TabIndex = 45;
this.delButton.Text = "Удалить";
this.delButton.UseVisualStyleBackColor = true;
this.delButton.Click += new System.EventHandler(this.delButton_Click);
//
// groupBox
//
this.groupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox.Controls.Add(this.otherDaysLabel);
this.groupBox.Controls.Add(this.bolDaysLabel);
this.groupBox.Controls.Add(this.otpDaysLabel);
this.groupBox.Controls.Add(this.totalDaysLabel);
this.groupBox.Controls.Add(this.label7);
this.groupBox.Controls.Add(this.label6);
this.groupBox.Controls.Add(this.label5);
this.groupBox.Controls.Add(this.label4);
this.groupBox.Location = new System.Drawing.Point(499, 82);
this.groupBox.Name = "groupBox";
this.groupBox.Size = new System.Drawing.Size(407, 371);
this.groupBox.TabIndex = 46;
this.groupBox.TabStop = false;
this.groupBox.Text = "Расчет";
//
// otherDaysLabel
//
this.otherDaysLabel.AutoSize = true;
this.otherDaysLabel.Location = new System.Drawing.Point(120, 100);
this.otherDaysLabel.Name = "otherDaysLabel";
this.otherDaysLabel.Size = new System.Drawing.Size(81, 13);
this.otherDaysLabel.TabIndex = 23;
this.otherDaysLabel.Text = "otherDaysLabel";
//
// bolDaysLabel
//
this.bolDaysLabel.AutoSize = true;
this.bolDaysLabel.Location = new System.Drawing.Point(120, 74);
this.bolDaysLabel.Name = "bolDaysLabel";
this.bolDaysLabel.Size = new System.Drawing.Size(71, 13);
this.bolDaysLabel.TabIndex = 22;
this.bolDaysLabel.Text = "bolDaysLabel";
//
// otpDaysLabel
//
this.otpDaysLabel.AutoSize = true;
this.otpDaysLabel.Location = new System.Drawing.Point(120, 48);
this.otpDaysLabel.Name = "otpDaysLabel";
this.otpDaysLabel.Size = new System.Drawing.Size(72, 13);
this.otpDaysLabel.TabIndex = 21;
this.otpDaysLabel.Text = "otpDaysLabel";
//
// totalDaysLabel
//
this.totalDaysLabel.AutoSize = true;
this.totalDaysLabel.Location = new System.Drawing.Point(120, 22);
this.totalDaysLabel.Name = "totalDaysLabel";
this.totalDaysLabel.Size = new System.Drawing.Size(77, 13);
this.totalDaysLabel.TabIndex = 20;
this.totalDaysLabel.Text = "totalDaysLabel";
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(78, 100);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(36, 13);
this.label7.TabIndex = 17;
this.label7.Text = "Иное:";
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(42, 74);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(72, 13);
this.label6.TabIndex = 16;
this.label6.Text = "Больничный:";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(68, 48);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(46, 13);
this.label5.TabIndex = 15;
this.label5.Text = "Отпуск:";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(6, 22);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(108, 13);
this.label4.TabIndex = 14;
this.label4.Text = "Общее кол-во дней:";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 59);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(74, 13);
this.label1.TabIndex = 12;
this.label1.Text = "Дата начала:";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(245, 59);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(69, 13);
this.label3.TabIndex = 13;
this.label3.Text = "Дата конца:";
//
// dateTimePicker1
//
this.dateTimePicker1.Location = new System.Drawing.Point(92, 56);
this.dateTimePicker1.Name = "dateTimePicker1";
this.dateTimePicker1.Size = new System.Drawing.Size(147, 20);
this.dateTimePicker1.TabIndex = 18;
//
// dateTimePicker2
//
this.dateTimePicker2.Location = new System.Drawing.Point(320, 56);
this.dateTimePicker2.Name = "dateTimePicker2";
this.dateTimePicker2.Size = new System.Drawing.Size(147, 20);
this.dateTimePicker2.TabIndex = 19;
//
// updateButton
//
this.updateButton.Location = new System.Drawing.Point(473, 54);
this.updateButton.Name = "updateButton";
this.updateButton.Size = new System.Drawing.Size(75, 23);
this.updateButton.TabIndex = 47;
this.updateButton.Text = "Обновить";
this.updateButton.UseVisualStyleBackColor = true;
this.updateButton.Click += new System.EventHandler(this.updateButton_Click);
//
// настройкиToolStripMenuItem
//
this.настройкиToolStripMenuItem.Name = астройкиToolStripMenuItem";
this.настройкиToolStripMenuItem.Size = new System.Drawing.Size(79, 20);
this.настройкиToolStripMenuItem.Text = "Настройки";
//
// OtpForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(918, 484);
this.Controls.Add(this.updateButton);
this.Controls.Add(this.groupBox);
this.Controls.Add(this.delButton);
this.Controls.Add(this.changeButton);
this.Controls.Add(this.dateTimePicker2);
this.Controls.Add(this.addButton);
this.Controls.Add(this.dateTimePicker1);
this.Controls.Add(this.label2);
this.Controls.Add(this.linkRabLabel);
this.Controls.Add(this.group);
this.Controls.Add(this.label3);
this.Controls.Add(this.menuStrip);
this.Controls.Add(this.statusStrip1);
this.Controls.Add(this.label1);
this.Name = "OtpForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Отпуск/Больничный";
this.menuStrip.ResumeLayout(false);
this.menuStrip.PerformLayout();
this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout();
this.group.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.freeGridView)).EndInit();
this.groupBox.ResumeLayout(false);
this.groupBox.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
#endregion
}
}
#endregion
private System.Windows.Forms.MenuStrip menuStrip;
private System.Windows.Forms.ToolStripMenuItem shtatMI;
private System.Windows.Forms.ToolStripMenuItem rabitnikiMI;
private System.Windows.Forms.ToolStripMenuItem otpBolMI;
private System.Windows.Forms.ToolStripMenuItem chelRodMI;
private System.Windows.Forms.ToolStripMenuItem детиToolStripMenuItem;
private System.Windows.Forms.ToolStripStatusLabel errorLabel;
private System.Windows.Forms.StatusStrip statusStrip1;
private System.Windows.Forms.ToolStripMenuItem stajMI;
private System.Windows.Forms.GroupBox group;
private System.Windows.Forms.DataGridView freeGridView;
private System.Windows.Forms.LinkLabel linkRabLabel;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button addButton;
private System.Windows.Forms.Button changeButton;
private System.Windows.Forms.Button delButton;
private System.Windows.Forms.ToolStripMenuItem learnMI;
private System.Windows.Forms.GroupBox groupBox;
private System.Windows.Forms.Label otherDaysLabel;
private System.Windows.Forms.Label bolDaysLabel;
private System.Windows.Forms.Label otpDaysLabel;
private System.Windows.Forms.Label totalDaysLabel;
private System.Windows.Forms.DateTimePicker dateTimePicker2;
private System.Windows.Forms.DateTimePicker dateTimePicker1;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button updateButton;
private System.Windows.Forms.ToolStripMenuItem настройкиToolStripMenuItem;
}
}

View File

@@ -7,14 +7,201 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Diplom_O.DataBase;
namespace Diplom_O
{
public partial class OtpForm : Form
{
private readonly ColumnConf[] tableMainColumns = {
new ColumnConf(name: "№"),
new ColumnConf(name: "Тип", size: 140, warp: true),
new ColumnConf(name: "Дата начала", size: 80),
new ColumnConf(name: "Дата конца", size: 80),
new ColumnConf(name: "Общее кол-во дней", size: 100)
};
private Rabotnik rabotnik = null;
private void linkRabLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
var form = new RabForm(true);
form.ShowDialog();
if (form.isCanceled)
rabotnik = null;
else
rabotnik = form.formResult;
ResetLinkRabotnik();
resetFreeTable();
resetFreeDays();
}
private void ResetLinkRabotnik()
{
if (rabotnik == null)
{
linkRabLabel.Text = "Выбрать сотрудника...";
return;
}
var chel = FuncDB.ChelGetById(rabotnik.ChelId);
if (chel == null)
{
linkRabLabel.Text = "Выбрать сотрудника...";
return;
}
var res = chel.FName.ToString() + " " +
chel.SName[0].ToString() + "." +
((!string.IsNullOrEmpty(chel.TName)) ?
chel.TName[0].ToString() + "." : "");
linkRabLabel.Text = res;
}
private void resetFreeTable()
{
try
{
var res = rabotnik == null ? Array.Empty<string[]>() : FuncDB.FreeListTable(rabotnik.ChelId, dateTimePicker1.Value, dateTimePicker2.Value);
this.ResetTable(
freeGridView,
tableMainColumns,
res
);
}
catch (Exception e)
{
this.ShowError(errorLabel, e.Message);
}
}
private void resetFreeDays()
{
try
{
var res = rabotnik == null ? new Dictionary<string, int>() : FuncDB.FreeListDays(rabotnik.ChelId, dateTimePicker1.Value, dateTimePicker2.Value);
if (res.ContainsKey("Общее"))
totalDaysLabel.Text = res["Общее"].ToString();
else
totalDaysLabel.Text = "0";
if (res.ContainsKey("Отпуск"))
otpDaysLabel.Text = res["Отпуск"].ToString();
else
otpDaysLabel.Text = "0";
if (res.ContainsKey("Больничный"))
bolDaysLabel.Text = res["Больничный"].ToString();
else
bolDaysLabel.Text = "0";
if (res.ContainsKey("Иное"))
otherDaysLabel.Text = res["Иное"].ToString();
else
otherDaysLabel.Text = "0";
}
catch (Exception e)
{
this.ShowError(errorLabel, e.Message);
}
}
private Free selectedFreeTable()
{
try
{
if (freeGridView.SelectedRows.Count != 1)
throw new Exception("Отстранение не выбрано.");
if (int.TryParse((string)freeGridView.SelectedRows[0].Cells[0].Value, out int value))
return FuncDB.FreeGetById(value);
else
throw new Exception("Ошибка в таблице.");
}
catch (Exception e)
{
this.ShowError(errorLabel, e.Message);
return null;
}
}
public OtpForm()
{
InitializeComponent();
this.correctUpperMenu(menuStrip, 5);
DateTime d = DateTime.Now;
dateTimePicker1.Value = new DateTime(d.Year, 1, 1, 0, 0, 0);
dateTimePicker2.Value = new DateTime(d.Year + 1, 1, 1, 0, 0, 0);
ResetLinkRabotnik();
resetFreeTable();
resetFreeDays();
linkRabLabel.Enabled =
addButton.Enabled =
changeButton.Enabled =
delButton.Enabled = false;
var user = this.GetUser();
if (user == null)
return;
linkRabLabel.Enabled = FuncDB.AccessGetByUserIdFormIdAccessId(user.Id, 5, 0) != null;
delButton.Enabled = FuncDB.AccessGetByUserIdFormIdAccessId(user.Id, 5, 1) != null;
changeButton.Enabled = FuncDB.AccessGetByUserIdFormIdAccessId(user.Id, 5, 2) != null;
addButton.Enabled = FuncDB.AccessGetByUserIdFormIdAccessId(user.Id, 5, 3) != null;
}
}
private void addButton_Click(object sender, EventArgs e)
{
try
{
if (rabotnik == null)
throw new Exception("Не выбран сотрудник.");
var form = new SupportForms.OptForm(chelId: rabotnik.ChelId);
form.ShowDialog();
if (!form.isCanceled)
{
resetFreeTable();
resetFreeDays();
}
}
catch (Exception ex)
{
this.ShowError(errorLabel, ex.Message);
}
}
private void changeButton_Click(object sender, EventArgs e)
{
try
{
var form = new SupportForms.OptForm(selectedFreeTable());
form.ShowDialog();
if (!form.isCanceled)
{
resetFreeTable();
resetFreeDays();
}
}
catch (Exception ex)
{
this.ShowError(errorLabel, ex.Message);
}
}
private void delButton_Click(object sender, EventArgs e)
{
try
{
FuncDB.FreeDelete(selectedFreeTable());
resetFreeTable();
resetFreeDays();
}
catch (Exception ex)
{
this.ShowError(errorLabel, ex.Message);
}
}
private void upperMenuClicked(object sender, ToolStripItemClickedEventArgs e)
{
this.upperMenuClicked((MenuStrip)sender);
if (this.GetNextForm() != -1)
Close();
}
private void updateButton_Click(object sender, EventArgs e)
{
resetFreeTable();
resetFreeDays();
}
}
}

126
MainForms/OtpForm.resx Normal file
View File

@@ -0,0 +1,126 @@
<?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>
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>364, 17</value>
</metadata>
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>472, 17</value>
</metadata>
</root>

View File

@@ -29,12 +29,398 @@ namespace Diplom_O
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Text = "RabForm";
this.menuStrip = new System.Windows.Forms.MenuStrip();
this.shtatMI = new System.Windows.Forms.ToolStripMenuItem();
this.chelRodMI = new System.Windows.Forms.ToolStripMenuItem();
this.rabitnikiMI = new System.Windows.Forms.ToolStripMenuItem();
this.stajMI = new System.Windows.Forms.ToolStripMenuItem();
this.learnMI = new System.Windows.Forms.ToolStripMenuItem();
this.otpBolMI = new System.Windows.Forms.ToolStripMenuItem();
this.детиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.errorLabel = new System.Windows.Forms.ToolStripStatusLabel();
this.workerGridView = new System.Windows.Forms.DataGridView();
this.addWorkerButton = new System.Windows.Forms.Button();
this.dropFindButton = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.findBox = new System.Windows.Forms.TextBox();
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.addWorkPlaceButton = new System.Windows.Forms.Button();
this.historyWorkGridView = new System.Windows.Forms.DataGridView();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.stajGridView = new System.Windows.Forms.DataGridView();
this.addTypeStajButton = new System.Windows.Forms.Button();
this.delTypeStajButton = new System.Windows.Forms.Button();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.changeWorkPlaceButton = new System.Windows.Forms.Button();
this.delWorkPlaceButton = new System.Windows.Forms.Button();
this.fioLabel = new System.Windows.Forms.Label();
this.selectButton = new System.Windows.Forms.Button();
this.настройкиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.workerGridView)).BeginInit();
this.statusStrip1.SuspendLayout();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.historyWorkGridView)).BeginInit();
this.groupBox2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.stajGridView)).BeginInit();
this.SuspendLayout();
//
// menuStrip
//
this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.shtatMI,
this.chelRodMI,
this.rabitnikiMI,
this.stajMI,
this.learnMI,
this.otpBolMI,
this.детиToolStripMenuItem,
this.настройкиToolStripMenuItem});
this.menuStrip.Location = new System.Drawing.Point(0, 0);
this.menuStrip.Name = "menuStrip";
this.menuStrip.Size = new System.Drawing.Size(983, 24);
this.menuStrip.TabIndex = 30;
this.menuStrip.Text = "menuStrip1";
this.menuStrip.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.upperMenuClicked);
//
// shtatMI
//
this.shtatMI.Name = "shtatMI";
this.shtatMI.Size = new System.Drawing.Size(139, 20);
this.shtatMI.Text = "Актуальные вакансии";
//
// chelRodMI
//
this.chelRodMI.Name = "chelRodMI";
this.chelRodMI.Size = new System.Drawing.Size(50, 20);
this.chelRodMI.Text = "Люди";
//
// rabitnikiMI
//
this.rabitnikiMI.Name = "rabitnikiMI";
this.rabitnikiMI.Size = new System.Drawing.Size(85, 20);
this.rabitnikiMI.Text = "Сотрудники";
//
// stajMI
//
this.stajMI.Name = "stajMI";
this.stajMI.Size = new System.Drawing.Size(47, 20);
this.stajMI.Text = "Стаж";
//
// learnMI
//
this.learnMI.Name = "learnMI";
this.learnMI.Size = new System.Drawing.Size(92, 20);
this.learnMI.Text = "Образование";
//
// otpBolMI
//
this.otpBolMI.Name = "otpBolMI";
this.otpBolMI.Size = new System.Drawing.Size(100, 20);
this.otpBolMI.Text = "Отпуск/Больн.";
//
// детиToolStripMenuItem
//
this.детиToolStripMenuItem.Name = етиToolStripMenuItem";
this.детиToolStripMenuItem.Size = new System.Drawing.Size(45, 20);
this.детиToolStripMenuItem.Text = "Дети";
//
// 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(137, 17);
this.errorLabel.Text = "Отображение ошибки";
this.errorLabel.Visible = false;
//
// workerGridView
//
this.workerGridView.AllowUserToAddRows = false;
this.workerGridView.AllowUserToDeleteRows = false;
this.workerGridView.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.workerGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.workerGridView.Location = new System.Drawing.Point(12, 56);
this.workerGridView.MultiSelect = false;
this.workerGridView.Name = "workerGridView";
this.workerGridView.ReadOnly = true;
this.workerGridView.RowHeadersVisible = false;
this.workerGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.workerGridView.Size = new System.Drawing.Size(459, 694);
this.workerGridView.TabIndex = 36;
this.workerGridView.SelectionChanged += new System.EventHandler(this.workerGridView_SelectionChanged);
//
// addWorkerButton
//
this.addWorkerButton.Location = new System.Drawing.Point(396, 27);
this.addWorkerButton.Name = "addWorkerButton";
this.addWorkerButton.Size = new System.Drawing.Size(75, 23);
this.addWorkerButton.TabIndex = 29;
this.addWorkerButton.Text = "Добавить";
this.addWorkerButton.UseVisualStyleBackColor = true;
this.addWorkerButton.Click += new System.EventHandler(this.addWorkerButton_Click);
//
// dropFindButton
//
this.dropFindButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.dropFindButton.Location = new System.Drawing.Point(396, 756);
this.dropFindButton.Name = "dropFindButton";
this.dropFindButton.Size = new System.Drawing.Size(75, 23);
this.dropFindButton.TabIndex = 35;
this.dropFindButton.Text = "Сбросить";
this.dropFindButton.UseVisualStyleBackColor = true;
this.dropFindButton.TextChanged += new System.EventHandler(this.dropFindButton_Click);
//
// 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, 761);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(39, 13);
this.label1.TabIndex = 38;
this.label1.Text = "Поиск";
//
// findBox
//
this.findBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.findBox.Location = new System.Drawing.Point(57, 758);
this.findBox.Name = "findBox";
this.findBox.Size = new System.Drawing.Size(333, 20);
this.findBox.TabIndex = 34;
this.findBox.TextChanged += new System.EventHandler(this.findBox_TextChanged);
//
// statusStrip1
//
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.errorLabel});
this.statusStrip1.Location = new System.Drawing.Point(0, 782);
this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Size = new System.Drawing.Size(983, 22);
this.statusStrip1.TabIndex = 37;
this.statusStrip1.Text = "statusStrip1";
//
// groupBox1
//
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.groupBox1.Controls.Add(this.addWorkPlaceButton);
this.groupBox1.Controls.Add(this.historyWorkGridView);
this.groupBox1.Controls.Add(this.groupBox2);
this.groupBox1.Controls.Add(this.changeWorkPlaceButton);
this.groupBox1.Controls.Add(this.delWorkPlaceButton);
this.groupBox1.Controls.Add(this.fioLabel);
this.groupBox1.Location = new System.Drawing.Point(477, 31);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(494, 747);
this.groupBox1.TabIndex = 39;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "История";
//
// addWorkPlaceButton
//
this.addWorkPlaceButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.addWorkPlaceButton.Location = new System.Drawing.Point(251, 19);
this.addWorkPlaceButton.Name = "addWorkPlaceButton";
this.addWorkPlaceButton.Size = new System.Drawing.Size(75, 23);
this.addWorkPlaceButton.TabIndex = 43;
this.addWorkPlaceButton.Text = "Добавить";
this.addWorkPlaceButton.UseVisualStyleBackColor = true;
this.addWorkPlaceButton.Click += new System.EventHandler(this.addWorkPlaceButton_Click);
//
// historyWorkGridView
//
this.historyWorkGridView.AllowUserToAddRows = false;
this.historyWorkGridView.AllowUserToDeleteRows = false;
this.historyWorkGridView.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.historyWorkGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.historyWorkGridView.Location = new System.Drawing.Point(9, 48);
this.historyWorkGridView.MultiSelect = false;
this.historyWorkGridView.Name = "historyWorkGridView";
this.historyWorkGridView.ReadOnly = true;
this.historyWorkGridView.RowHeadersVisible = false;
this.historyWorkGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.historyWorkGridView.Size = new System.Drawing.Size(479, 332);
this.historyWorkGridView.TabIndex = 42;
this.historyWorkGridView.SelectionChanged += new System.EventHandler(this.historyWorkGridView_SelectionChanged);
//
// groupBox2
//
this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox2.Controls.Add(this.stajGridView);
this.groupBox2.Controls.Add(this.addTypeStajButton);
this.groupBox2.Controls.Add(this.delTypeStajButton);
this.groupBox2.Controls.Add(this.comboBox1);
this.groupBox2.Location = new System.Drawing.Point(9, 386);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(479, 355);
this.groupBox2.TabIndex = 41;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Типы стажа";
//
// stajGridView
//
this.stajGridView.AllowUserToAddRows = false;
this.stajGridView.AllowUserToDeleteRows = false;
this.stajGridView.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.stajGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.stajGridView.Location = new System.Drawing.Point(6, 48);
this.stajGridView.MultiSelect = false;
this.stajGridView.Name = "stajGridView";
this.stajGridView.ReadOnly = true;
this.stajGridView.RowHeadersVisible = false;
this.stajGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.stajGridView.Size = new System.Drawing.Size(467, 301);
this.stajGridView.TabIndex = 37;
//
// addTypeStajButton
//
this.addTypeStajButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.addTypeStajButton.Location = new System.Drawing.Point(317, 19);
this.addTypeStajButton.Name = "addTypeStajButton";
this.addTypeStajButton.Size = new System.Drawing.Size(75, 23);
this.addTypeStajButton.TabIndex = 2;
this.addTypeStajButton.Text = "Добавить";
this.addTypeStajButton.UseVisualStyleBackColor = true;
this.addTypeStajButton.Click += new System.EventHandler(this.addTypeStajButton_Click);
//
// delTypeStajButton
//
this.delTypeStajButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.delTypeStajButton.Location = new System.Drawing.Point(398, 19);
this.delTypeStajButton.Name = "delTypeStajButton";
this.delTypeStajButton.Size = new System.Drawing.Size(75, 23);
this.delTypeStajButton.TabIndex = 1;
this.delTypeStajButton.Text = "Удалить";
this.delTypeStajButton.UseVisualStyleBackColor = true;
this.delTypeStajButton.Click += new System.EventHandler(this.delTypeStajButton_Click);
//
// comboBox1
//
this.comboBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.comboBox1.FormattingEnabled = true;
this.comboBox1.Location = new System.Drawing.Point(6, 21);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(305, 21);
this.comboBox1.TabIndex = 0;
//
// changeWorkPlaceButton
//
this.changeWorkPlaceButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.changeWorkPlaceButton.Location = new System.Drawing.Point(332, 19);
this.changeWorkPlaceButton.Name = "changeWorkPlaceButton";
this.changeWorkPlaceButton.Size = new System.Drawing.Size(75, 23);
this.changeWorkPlaceButton.TabIndex = 3;
this.changeWorkPlaceButton.Text = "Изменить";
this.changeWorkPlaceButton.UseVisualStyleBackColor = true;
this.changeWorkPlaceButton.Click += new System.EventHandler(this.changeWorkPlaceButton_Click);
//
// delWorkPlaceButton
//
this.delWorkPlaceButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.delWorkPlaceButton.Location = new System.Drawing.Point(413, 19);
this.delWorkPlaceButton.Name = "delWorkPlaceButton";
this.delWorkPlaceButton.Size = new System.Drawing.Size(75, 23);
this.delWorkPlaceButton.TabIndex = 1;
this.delWorkPlaceButton.Text = "Удалить";
this.delWorkPlaceButton.UseVisualStyleBackColor = true;
this.delWorkPlaceButton.Click += new System.EventHandler(this.delWorkPlaceButton_Click);
//
// fioLabel
//
this.fioLabel.AutoSize = true;
this.fioLabel.Location = new System.Drawing.Point(6, 24);
this.fioLabel.Name = "fioLabel";
this.fioLabel.Size = new System.Drawing.Size(114, 13);
this.fioLabel.TabIndex = 0;
this.fioLabel.Text = "Таб№ Фамилия И.О.";
//
// selectButton
//
this.selectButton.Location = new System.Drawing.Point(315, 27);
this.selectButton.Name = "selectButton";
this.selectButton.Size = new System.Drawing.Size(75, 23);
this.selectButton.TabIndex = 40;
this.selectButton.Text = "Выбрать";
this.selectButton.UseVisualStyleBackColor = true;
this.selectButton.Click += new System.EventHandler(this.selectButton_Click);
//
// настройкиToolStripMenuItem
//
this.настройкиToolStripMenuItem.Name = астройкиToolStripMenuItem";
this.настройкиToolStripMenuItem.Size = new System.Drawing.Size(79, 20);
this.настройкиToolStripMenuItem.Text = "Настройки";
//
// RabForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(983, 804);
this.Controls.Add(this.selectButton);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.menuStrip);
this.Controls.Add(this.workerGridView);
this.Controls.Add(this.addWorkerButton);
this.Controls.Add(this.dropFindButton);
this.Controls.Add(this.label1);
this.Controls.Add(this.findBox);
this.Controls.Add(this.statusStrip1);
this.Name = "RabForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Сотрудники";
this.menuStrip.ResumeLayout(false);
this.menuStrip.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.workerGridView)).EndInit();
this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout();
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.historyWorkGridView)).EndInit();
this.groupBox2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.stajGridView)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
}
#endregion
private System.Windows.Forms.MenuStrip menuStrip;
private System.Windows.Forms.ToolStripMenuItem shtatMI;
private System.Windows.Forms.ToolStripMenuItem rabitnikiMI;
private System.Windows.Forms.ToolStripMenuItem otpBolMI;
private System.Windows.Forms.ToolStripMenuItem chelRodMI;
private System.Windows.Forms.ToolStripMenuItem детиToolStripMenuItem;
private System.Windows.Forms.ToolStripStatusLabel errorLabel;
private System.Windows.Forms.DataGridView workerGridView;
private System.Windows.Forms.Button addWorkerButton;
private System.Windows.Forms.Button dropFindButton;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox findBox;
private System.Windows.Forms.StatusStrip statusStrip1;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Button changeWorkPlaceButton;
private System.Windows.Forms.Button delWorkPlaceButton;
private System.Windows.Forms.Label fioLabel;
private System.Windows.Forms.DataGridView historyWorkGridView;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.DataGridView stajGridView;
private System.Windows.Forms.Button addTypeStajButton;
private System.Windows.Forms.Button delTypeStajButton;
private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.Button addWorkPlaceButton;
private System.Windows.Forms.ToolStripMenuItem stajMI;
private System.Windows.Forms.Button selectButton;
private System.Windows.Forms.ToolStripMenuItem learnMI;
private System.Windows.Forms.ToolStripMenuItem настройкиToolStripMenuItem;
}
}

View File

@@ -7,14 +7,286 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Diplom_O.DataBase;
namespace Diplom_O
{
public partial class RabForm : Form
{
public RabForm()
private readonly ColumnConf[] tableMainColumns = {
new ColumnConf(name: "№"),
new ColumnConf(name: "Таб. №", size: 80),
new ColumnConf(name: "Фамилия И.О.", size: 140),
new ColumnConf(name: "Должность", size: 140)
};
private readonly ColumnConf[] tableHistoryColumns =
{
new ColumnConf(name: "№"),
new ColumnConf(name: "Таб. №", size: 80),
new ColumnConf(name: "Должность", size: 140),
new ColumnConf(name: "Дата начала", size: 80),
new ColumnConf(name: "Дата конца", size: 80)
};
private readonly ColumnConf[] tableStajColumns =
{
new ColumnConf(name: "№"),
new ColumnConf(name: "Тип стажа", size: 120),
};
private void resetRabotnikTable()
{
try
{
var rab = FuncDB.RabotnikTableMain(findBox.Text);
var res = new List<string[]>();
foreach (var r in rab)
{
bool flag_add = false;
foreach (var a in r)
if (a.Contains(findBox.Text) && !flag_add)
{
res.Add(r);
flag_add = true;
}
}
this.ResetTable(
workerGridView,
tableMainColumns,
res.ToArray()
);
}
catch (Exception e)
{
this.ShowError(errorLabel, e.Message);
}
}
private Rabotnik selectedRabotnikTable()
{
try
{
if (workerGridView.RowCount == 0)
return null;
if (workerGridView.SelectedRows.Count != 1)
throw new Exception("Человек не выбран.");
if (int.TryParse((string)workerGridView.SelectedRows[0].Cells[0].Value, out int value))
return FuncDB.RabotnikGetById(value);
else
throw new Exception("Ошибка в таблице.");
}
catch (Exception e)
{
//this.ShowError(errorLabel, e.Message);
return null;
}
}
private void workerGridView_SelectionChanged(object sender, EventArgs e)
{
resetHistoryWorkTable();
}
private void resetHistoryWorkTable()
{
try
{
var rabotnik = selectedRabotnikTable();
var res = (rabotnik == null) ? Array.Empty<string[]>() : FuncDB.RabotnikByChelIdTable(rabotnik.ChelId);
this.ResetTable(
historyWorkGridView,
tableHistoryColumns,
res
);
}
catch (Exception e)
{
this.ShowError(errorLabel, e.Message);
}
}
private Rabotnik selectedHistoryWorkTable()
{
try
{
if (historyWorkGridView.RowCount == 0)
return null;
if (historyWorkGridView.SelectedRows.Count != 1)
throw new Exception("Человек не выбран.");
if (int.TryParse((string)historyWorkGridView.SelectedRows[0].Cells[0].Value, out int value))
return FuncDB.RabotnikGetById(value);
else
throw new Exception("Ошибка в таблице.");
}
catch (Exception e)
{
//this.ShowError(errorLabel, e.Message);
return null;
}
}
private void historyWorkGridView_SelectionChanged(object sender, EventArgs e)
{
resetRabotnikStajTable();
}
private void resetRabotnikStajTable()
{
try
{
var rabotnik = selectedHistoryWorkTable();
var res = (rabotnik == null) ? Array.Empty<string[]>() :
FuncDB.RabotnikTypeStajListString(rabotnik.Id);
this.ResetTable(
stajGridView,
tableStajColumns,
res
);
}
catch (Exception e)
{
this.ShowError(errorLabel, e.Message);
}
}
private RabotnikTypeStaj selectedRabotnikStajTable()
{
try
{
if (stajGridView.SelectedRows.Count != 1)
throw new Exception("Стаж сотрудника не выбран.");
if (int.TryParse((string)stajGridView.SelectedRows[0].Cells[0].Value, out int value))
return FuncDB.RabotnikTypeStajGetById(value);
else
throw new Exception("Ошибка в таблице.");
}
catch (Exception e)
{
//this.ShowError(errorLabel, e.Message);
return null;
}
}
private void resetTypeStajComboBox()
{
try
{
var list = FuncDB.TypeStajListString();
comboBox1.Items.Clear();
comboBox1.Items.AddRange(list);
comboBox1.SelectedIndex = -1;
}
catch (Exception e)
{
this.ShowError(errorLabel, e.Message);
}
}
public bool isCanceled = true;
public Rabotnik formResult = null;
public RabForm(bool select = false)
{
InitializeComponent();
selectButton.Visible = select;
menuStrip.Enabled = !select;
this.correctUpperMenu(menuStrip, 2);
resetRabotnikTable();
resetTypeStajComboBox();
addTypeStajButton.Enabled =
delTypeStajButton.Enabled =
delWorkPlaceButton.Enabled =
changeWorkPlaceButton.Enabled =
addWorkPlaceButton.Enabled =
addWorkerButton.Enabled = false;
var user = this.GetUser();
if (user == null)
return;
delWorkPlaceButton.Enabled = FuncDB.AccessGetByUserIdFormIdAccessId(user.Id, 2, 1) != null;
changeWorkPlaceButton.Enabled =
delTypeStajButton.Enabled =
addTypeStajButton.Enabled = FuncDB.AccessGetByUserIdFormIdAccessId(user.Id, 2, 2) != null;
addWorkerButton.Enabled =
addWorkPlaceButton.Enabled = FuncDB.AccessGetByUserIdFormIdAccessId(user.Id, 2, 3) != null;
}
private void addWorkerButton_Click(object sender, EventArgs e)
{
var form = new SupportForms.WorkerForm();
form.ShowDialog();
if (!form.isCanceled)
resetRabotnikTable();
}
private void addWorkPlaceButton_Click(object sender, EventArgs e)
{
var form = new SupportForms.WorkerForm(selectedHistoryWorkTable(), true);
form.ShowDialog();
if (!form.isCanceled)
resetRabotnikTable();
}
private void addTypeStajButton_Click(object sender, EventArgs e)
{
try
{
var typestaj = FuncDB.TypeStajGetByName(comboBox1.Text);
if (typestaj == null)
{
FuncDB.TypeStajAdd(new TypeStaj() { Name = comboBox1.Text });
typestaj = FuncDB.TypeStajGetByName(comboBox1.Text);
}
var rabotnik = selectedHistoryWorkTable();
if (rabotnik == null)
throw new Exception("Не выбран сотрудник");
FuncDB.RabotnikTypeStajAdd(new RabotnikTypeStaj() { RabitnikId = rabotnik.Id, TypeStajId = typestaj.Id });
resetTypeStajComboBox();
resetRabotnikStajTable();
}
catch (Exception ex)
{
this.ShowError(errorLabel, ex.Message);
}
}
private void changeWorkPlaceButton_Click(object sender, EventArgs e)
{
var form = new SupportForms.WorkerForm(selectedHistoryWorkTable());
form.ShowDialog();
if (!form.isCanceled)
resetRabotnikTable();
}
private void delWorkPlaceButton_Click(object sender, EventArgs e)
{
var res = selectedHistoryWorkTable();
FuncDB.RabotnikDelete(res);
resetHistoryWorkTable();
}
private void delTypeStajButton_Click(object sender, EventArgs e)
{
var res = selectedRabotnikStajTable();
FuncDB.RabotnikTypeStajDelete(res);
resetRabotnikStajTable();
}
private void upperMenuClicked(object sender, ToolStripItemClickedEventArgs e)
{
this.upperMenuClicked((MenuStrip)sender);
if (this.GetNextForm() != -1)
Close();
}
private void selectButton_Click(object sender, EventArgs e)
{
formResult = selectedRabotnikTable();
isCanceled = false;
this.Close();
}
private void findBox_TextChanged(object sender, EventArgs e)
{
this.FindOnChanged(resetRabotnikTable);
}
private void dropFindButton_Click(object sender, EventArgs e)
{
findBox.Text = "";
this.FindOnChanged(null);
resetRabotnikTable();
}
}
}

126
MainForms/RabForm.resx Normal file
View File

@@ -0,0 +1,126 @@
<?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>
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>364, 17</value>
</metadata>
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>472, 17</value>
</metadata>
</root>

378
MainForms/SettingsForm.Designer.cs generated Normal file
View File

@@ -0,0 +1,378 @@

namespace Diplom_O
{
partial class SettingsForm
{
/// <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.menuStrip = new System.Windows.Forms.MenuStrip();
this.shtatMI = new System.Windows.Forms.ToolStripMenuItem();
this.chelRodMI = new System.Windows.Forms.ToolStripMenuItem();
this.rabitnikiMI = new System.Windows.Forms.ToolStripMenuItem();
this.stajMI = new System.Windows.Forms.ToolStripMenuItem();
this.learnMI = new System.Windows.Forms.ToolStripMenuItem();
this.otpBolMI = new System.Windows.Forms.ToolStripMenuItem();
this.детиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.настройкиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.errorLabel = new System.Windows.Forms.ToolStripStatusLabel();
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.group = new System.Windows.Forms.GroupBox();
this.userGridView = new System.Windows.Forms.DataGridView();
this.delUserButton = new System.Windows.Forms.Button();
this.addUserButton = new System.Windows.Forms.Button();
this.changeUserButton = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.accessGridView = new System.Windows.Forms.DataGridView();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.textBox1 = new System.Windows.Forms.TextBox();
this.typeStajGridView = new System.Windows.Forms.DataGridView();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.menuStrip.SuspendLayout();
this.statusStrip1.SuspendLayout();
this.group.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.userGridView)).BeginInit();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.accessGridView)).BeginInit();
this.groupBox2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.typeStajGridView)).BeginInit();
this.SuspendLayout();
//
// menuStrip
//
this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.shtatMI,
this.chelRodMI,
this.rabitnikiMI,
this.stajMI,
this.learnMI,
this.otpBolMI,
this.детиToolStripMenuItem,
this.настройкиToolStripMenuItem});
this.menuStrip.Location = new System.Drawing.Point(0, 0);
this.menuStrip.Name = "menuStrip";
this.menuStrip.Size = new System.Drawing.Size(1079, 24);
this.menuStrip.TabIndex = 30;
this.menuStrip.Text = "menuStrip1";
this.menuStrip.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.upperMenuClicked);
//
// shtatMI
//
this.shtatMI.Name = "shtatMI";
this.shtatMI.Size = new System.Drawing.Size(139, 20);
this.shtatMI.Text = "Актуальные вакансии";
//
// chelRodMI
//
this.chelRodMI.Name = "chelRodMI";
this.chelRodMI.Size = new System.Drawing.Size(50, 20);
this.chelRodMI.Text = "Люди";
//
// rabitnikiMI
//
this.rabitnikiMI.Name = "rabitnikiMI";
this.rabitnikiMI.Size = new System.Drawing.Size(85, 20);
this.rabitnikiMI.Text = "Сотрудники";
//
// stajMI
//
this.stajMI.Name = "stajMI";
this.stajMI.Size = new System.Drawing.Size(47, 20);
this.stajMI.Text = "Стаж";
//
// learnMI
//
this.learnMI.Name = "learnMI";
this.learnMI.Size = new System.Drawing.Size(92, 20);
this.learnMI.Text = "Образование";
//
// otpBolMI
//
this.otpBolMI.Name = "otpBolMI";
this.otpBolMI.Size = new System.Drawing.Size(100, 20);
this.otpBolMI.Text = "Отпуск/Больн.";
//
// детиToolStripMenuItem
//
this.детиToolStripMenuItem.Name = етиToolStripMenuItem";
this.детиToolStripMenuItem.Size = new System.Drawing.Size(45, 20);
this.детиToolStripMenuItem.Text = "Дети";
//
// настройкиToolStripMenuItem
//
this.настройкиToolStripMenuItem.Name = астройкиToolStripMenuItem";
this.настройкиToolStripMenuItem.Size = new System.Drawing.Size(79, 20);
this.настройкиToolStripMenuItem.Text = "Настройки";
//
// 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(137, 17);
this.errorLabel.Text = "Отображение ошибки";
this.errorLabel.Visible = false;
//
// statusStrip1
//
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.errorLabel});
this.statusStrip1.Location = new System.Drawing.Point(0, 421);
this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Size = new System.Drawing.Size(1079, 22);
this.statusStrip1.TabIndex = 37;
this.statusStrip1.Text = "statusStrip1";
//
// group
//
this.group.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.group.Controls.Add(this.userGridView);
this.group.Controls.Add(this.delUserButton);
this.group.Controls.Add(this.addUserButton);
this.group.Controls.Add(this.changeUserButton);
this.group.Location = new System.Drawing.Point(267, 27);
this.group.Name = "group";
this.group.Size = new System.Drawing.Size(249, 391);
this.group.TabIndex = 39;
this.group.TabStop = false;
this.group.Text = "Пользователи";
//
// userGridView
//
this.userGridView.AllowUserToAddRows = false;
this.userGridView.AllowUserToDeleteRows = false;
this.userGridView.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.userGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.userGridView.Location = new System.Drawing.Point(6, 50);
this.userGridView.MultiSelect = false;
this.userGridView.Name = "userGridView";
this.userGridView.ReadOnly = true;
this.userGridView.RowHeadersVisible = false;
this.userGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.userGridView.Size = new System.Drawing.Size(237, 335);
this.userGridView.TabIndex = 37;
this.userGridView.SelectionChanged += new System.EventHandler(this.userGridView_SelectionChanged);
//
// delUserButton
//
this.delUserButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.delUserButton.Location = new System.Drawing.Point(168, 21);
this.delUserButton.Name = "delUserButton";
this.delUserButton.Size = new System.Drawing.Size(75, 23);
this.delUserButton.TabIndex = 45;
this.delUserButton.Text = "Удалить";
this.delUserButton.UseVisualStyleBackColor = true;
this.delUserButton.Click += new System.EventHandler(this.delUserButton_Click);
//
// addUserButton
//
this.addUserButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.addUserButton.Location = new System.Drawing.Point(6, 21);
this.addUserButton.Name = "addUserButton";
this.addUserButton.Size = new System.Drawing.Size(75, 23);
this.addUserButton.TabIndex = 43;
this.addUserButton.Text = "Добавить";
this.addUserButton.UseVisualStyleBackColor = true;
this.addUserButton.Click += new System.EventHandler(this.addUserButton_Click);
//
// changeUserButton
//
this.changeUserButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.changeUserButton.Location = new System.Drawing.Point(87, 21);
this.changeUserButton.Name = "changeUserButton";
this.changeUserButton.Size = new System.Drawing.Size(75, 23);
this.changeUserButton.TabIndex = 44;
this.changeUserButton.Text = "Изменить";
this.changeUserButton.UseVisualStyleBackColor = true;
this.changeUserButton.Click += new System.EventHandler(this.changeUserButton_Click);
//
// groupBox1
//
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.groupBox1.Controls.Add(this.accessGridView);
this.groupBox1.Location = new System.Drawing.Point(522, 26);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(545, 391);
this.groupBox1.TabIndex = 40;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Доступ";
//
// accessGridView
//
this.accessGridView.AllowUserToAddRows = false;
this.accessGridView.AllowUserToDeleteRows = false;
this.accessGridView.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.accessGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.accessGridView.Location = new System.Drawing.Point(6, 22);
this.accessGridView.MultiSelect = false;
this.accessGridView.Name = "accessGridView";
this.accessGridView.ReadOnly = true;
this.accessGridView.RowHeadersVisible = false;
this.accessGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect;
this.accessGridView.Size = new System.Drawing.Size(533, 363);
this.accessGridView.TabIndex = 37;
this.accessGridView.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.accessGridView_CellClick);
//
// groupBox2
//
this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.groupBox2.Controls.Add(this.textBox1);
this.groupBox2.Controls.Add(this.typeStajGridView);
this.groupBox2.Controls.Add(this.button1);
this.groupBox2.Controls.Add(this.button2);
this.groupBox2.Controls.Add(this.button3);
this.groupBox2.Location = new System.Drawing.Point(12, 27);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(249, 391);
this.groupBox2.TabIndex = 41;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Типы стажа";
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(6, 48);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(237, 20);
this.textBox1.TabIndex = 46;
//
// typeStajGridView
//
this.typeStajGridView.AllowUserToAddRows = false;
this.typeStajGridView.AllowUserToDeleteRows = false;
this.typeStajGridView.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.typeStajGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.typeStajGridView.Location = new System.Drawing.Point(6, 74);
this.typeStajGridView.MultiSelect = false;
this.typeStajGridView.Name = "typeStajGridView";
this.typeStajGridView.ReadOnly = true;
this.typeStajGridView.RowHeadersVisible = false;
this.typeStajGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.typeStajGridView.Size = new System.Drawing.Size(237, 311);
this.typeStajGridView.TabIndex = 37;
this.typeStajGridView.SelectionChanged += new System.EventHandler(this.typeStajGridView_SelectionChanged);
//
// button1
//
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.button1.Location = new System.Drawing.Point(168, 19);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 45;
this.button1.Text = "Удалить";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.delTypeButton_Click);
//
// button2
//
this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.button2.Location = new System.Drawing.Point(6, 19);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23);
this.button2.TabIndex = 43;
this.button2.Text = "Добавить";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.addTypeStajButton_Click);
//
// button3
//
this.button3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.button3.Location = new System.Drawing.Point(87, 19);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(75, 23);
this.button3.TabIndex = 44;
this.button3.Text = "Изменить";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.changeTypeStajButton_Click);
//
// SettingsForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1079, 443);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.group);
this.Controls.Add(this.menuStrip);
this.Controls.Add(this.statusStrip1);
this.Name = "SettingsForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Отпуск/Больничный";
this.menuStrip.ResumeLayout(false);
this.menuStrip.PerformLayout();
this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout();
this.group.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.userGridView)).EndInit();
this.groupBox1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.accessGridView)).EndInit();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.typeStajGridView)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.MenuStrip menuStrip;
private System.Windows.Forms.ToolStripMenuItem shtatMI;
private System.Windows.Forms.ToolStripMenuItem rabitnikiMI;
private System.Windows.Forms.ToolStripMenuItem otpBolMI;
private System.Windows.Forms.ToolStripMenuItem chelRodMI;
private System.Windows.Forms.ToolStripMenuItem детиToolStripMenuItem;
private System.Windows.Forms.ToolStripStatusLabel errorLabel;
private System.Windows.Forms.StatusStrip statusStrip1;
private System.Windows.Forms.ToolStripMenuItem stajMI;
private System.Windows.Forms.GroupBox group;
private System.Windows.Forms.DataGridView userGridView;
private System.Windows.Forms.Button addUserButton;
private System.Windows.Forms.Button changeUserButton;
private System.Windows.Forms.Button delUserButton;
private System.Windows.Forms.ToolStripMenuItem learnMI;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.DataGridView accessGridView;
private System.Windows.Forms.ToolStripMenuItem настройкиToolStripMenuItem;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.DataGridView typeStajGridView;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.TextBox textBox1;
}
}

364
MainForms/SettingsForm.cs Normal file
View File

@@ -0,0 +1,364 @@
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
{
public partial class SettingsForm : Form
{
private readonly ColumnConf[] tableUserColumns = {
new ColumnConf(name: "Логин", size: 140)
};
private readonly ColumnConf[] tableAccessColumns = {
new ColumnConf(name: "Форма", size: 140),
new ColumnConf(name: "Просм.", size: 80),
new ColumnConf(name: "Удал.", size: 80),
new ColumnConf(name: "Изм.", size: 80),
new ColumnConf(name: "Доб.", size: 80)
};
private readonly ColumnConf[] tableTypeStajColumns = {
new ColumnConf(name: "Название", size: 140)
};
private void resetTypeStajTable()
{
try
{
var res = new List<string[]>();
var subres = FuncDB.TypeStajListString();
foreach (var a in subres)
res.Add(new string[] { a });
this.ResetTable(
typeStajGridView,
tableTypeStajColumns,
res.ToArray()
);
}
catch (Exception e)
{
this.ShowError(errorLabel, e.Message);
}
}
private TypeStaj selectedTypeStajTable()
{
try
{
if (typeStajGridView.SelectedRows.Count != 1)
return null;
return FuncDB.TypeStajGetByName((string)typeStajGridView.SelectedRows[0].Cells[0].Value);
}
catch (Exception e)
{
this.ShowError(errorLabel, e.Message);
return null;
}
}
private void typeStajGridView_SelectionChanged(object sender, EventArgs e)
{
var type_staj = selectedTypeStajTable();
textBox1.Text = type_staj == null ? "" : type_staj.Name;
}
private void resetUserTable()
{
try
{
this.ResetTable(
userGridView,
tableUserColumns,
FuncDB.UserListTable(true)
);
}
catch (Exception e)
{
this.ShowError(errorLabel, e.Message);
}
}
private User selectedUserTable()
{
try
{
if (userGridView.SelectedRows.Count != 1)
return null;
return FuncDB.UserGetByLogin((string)userGridView.SelectedRows[0].Cells[0].Value);
}
catch (Exception e)
{
this.ShowError(errorLabel, e.Message);
return null;
}
}
private void userGridView_SelectionChanged(object sender, EventArgs e)
{
resetAccessTable();
}
private void initAccessTable()
{
try
{
accessGridView.Rows.Clear();
accessGridView.Columns.Clear();
var c = accessGridView.Columns;
for (var i = 0; i < tableAccessColumns.Length; i++)
{
if (i != 0)
c.Add(new DataGridViewCheckBoxColumn()
{
FalseValue = false,
TrueValue = true,
HeaderText = tableAccessColumns[i].name
});
else
c.Add(tableAccessColumns[i].name, tableAccessColumns[i].name);
c[i].Width = tableAccessColumns[i].size;
if (tableAccessColumns[i].warp)
c[i].DefaultCellStyle.WrapMode = DataGridViewTriState.True;
}
foreach (var formName in FormArray.formName)
{
accessGridView.Rows.Add();
var row = accessGridView.Rows[accessGridView.Rows.Count - 1];
row.Cells[0].Value = formName;
for (var i = 0; i < FormArray.formAccess.Length; i++)
((DataGridViewCheckBoxCell)row.Cells[i + 1]).Value = false;
}
}
catch (Exception ex)
{
this.ShowError(errorLabel, ex.Message);
}
}
private void accessGridView_CellClick(object sender, DataGridViewCellEventArgs e)
{
try
{
if (accessGridView.SelectedCells.Count != 1)
return;
var cell = accessGridView.SelectedCells[0];
var accessId = cell.ColumnIndex;
if (accessId == 0)
return;
else
accessId--;
var formId = cell.RowIndex;
((DataGridViewCheckBoxCell)accessGridView.SelectedCells[0]).Value =
!(bool)((DataGridViewCheckBoxCell)accessGridView.SelectedCells[0]).Value;
var user = selectedUserTable();
if (user == null)
throw new Exception("Пользователь не выбран.");
var access = FuncDB.AccessGetByUserIdFormIdAccessId(user.Id, formId, accessId);
if (
(access == null && !(bool)cell.Value) ||
(access != null && (bool)cell.Value)
)
return;
if ((bool)cell.Value)
{
if (FuncDB.AccessGetByUserIdFormIdAccessId(user.Id, formId, 0) == null)
FuncDB.AccessAdd(new Access()
{
UserId = user.Id,
FormId = formId,
FormatAccess = 0
});
FuncDB.AccessAdd(new Access()
{
UserId = user.Id,
FormId = formId,
FormatAccess = accessId
});
}
else
{
if (formId == 7 && FuncDB.AccessToSettingsFullCountWithoutUserId(user) == 0)
throw new Exception("Должен хотя бы 1 польз. иметь полн. дост. к настр.");
if (formId == user.Default && accessId == 0)
throw new Exception("Нельзя снять разрешение для окна по умолчанию.");
if (accessId == 0)
{
var list = FuncDB.AccessGetByUserIdFormId(user.Id, formId);
foreach (var l in list)
FuncDB.AccessDelete(l);
}
else
{
FuncDB.AccessDelete(access);
}
}
resetAccessTable();
}
catch (Exception ex)
{
this.ShowError(errorLabel, ex.Message);
resetAccessTable();
}
}
private void resetAccessTable()
{
try
{
var user = selectedUserTable();
var res = new bool[FormArray.formName.Length, FormArray.formAccess.Length];
if (user != null)
res = FuncDB.AccessListTable(user.Id);
for (var i = 0; i < FormArray.formName.Length; i++)
for (var j = 0; j < FormArray.formAccess.Length; j++)
((DataGridViewCheckBoxCell)accessGridView.Rows[i].Cells[j + 1]).Value = res[i, j];
}
catch (Exception e)
{
this.ShowError(errorLabel, e.Message);
}
}
public SettingsForm()
{
InitializeComponent();
this.correctUpperMenu(menuStrip, 7);
initAccessTable();
resetTypeStajTable();
resetUserTable();
addUserButton.Enabled =
changeUserButton.Enabled =
delUserButton.Enabled =
accessGridView.Enabled =
button2.Enabled =
button1.Enabled =
button3.Enabled =
false;
var user = this.GetUser();
if (user == null)
return;
accessGridView.Enabled =
FuncDB.AccessGetByUserIdFormIdAccessId(user.Id, 7, 2) != null ||
FuncDB.AccessGetByUserIdFormIdAccessId(user.Id, 7, 3) != null;
delUserButton.Enabled =
button1.Enabled =
FuncDB.AccessGetByUserIdFormIdAccessId(user.Id, 7, 1) != null;
changeUserButton.Enabled =
button3.Enabled =
FuncDB.AccessGetByUserIdFormIdAccessId(user.Id, 7, 2) != null;
addUserButton.Enabled =
button2.Enabled =
FuncDB.AccessGetByUserIdFormIdAccessId(user.Id, 7, 3) != null;
}
private void addTypeStajButton_Click(object sender, EventArgs e)
{
try
{
var type = new TypeStaj()
{
Name = textBox1.Text
};
FuncDB.TypeStajAdd(type);
resetTypeStajTable();
}
catch (Exception ex)
{
this.ShowError(errorLabel, ex.Message);
}
}
private void changeTypeStajButton_Click(object sender, EventArgs e)
{
try
{
var type = selectedTypeStajTable();
if (type == null)
throw new Exception("Не вбран тип стажа.");
type.Name = textBox1.Text;
FuncDB.TypeStajChange(type);
resetTypeStajTable();
}
catch (Exception ex)
{
this.ShowError(errorLabel, ex.Message);
}
}
private void delTypeButton_Click(object sender, EventArgs e)
{
try
{
var type = selectedTypeStajTable();
if (type == null)
throw new Exception("Не вбран тип стажа.");
FuncDB.TypeStajDelete(type);
resetTypeStajTable();
}
catch (Exception ex)
{
this.ShowError(errorLabel, ex.Message);
}
}
private void addUserButton_Click(object sender, EventArgs e)
{
try
{
var form = new SupportForms.LoginForm();
form.ShowDialog();
if (!form.isCanceled)
resetUserTable();
}
catch (Exception ex)
{
this.ShowError(errorLabel, ex.Message);
}
}
private void changeUserButton_Click(object sender, EventArgs e)
{
try
{
if (selectedUserTable() == null)
throw new Exception("Не выбран пользователь.");
var form = new SupportForms.LoginForm(selectedUserTable());
form.ShowDialog();
if (!form.isCanceled)
resetUserTable();
}
catch (Exception ex)
{
this.ShowError(errorLabel, ex.Message);
}
}
private void delUserButton_Click(object sender, EventArgs e)
{
try
{
var user = selectedUserTable();
if (user == null)
throw new Exception("Не выбран пользователь.");
if (FuncDB.AccessToSettingsFullCountWithoutUserId(user) == 0)
throw new Exception("Должен хотя бы 1 польз. иметь полн. дост. к настр.");
FuncDB.UserDelete(selectedUserTable());
resetUserTable();
}
catch (Exception ex)
{
this.ShowError(errorLabel, ex.Message);
}
}
private void upperMenuClicked(object sender, ToolStripItemClickedEventArgs e)
{
this.upperMenuClicked((MenuStrip)sender);
if (this.GetNextForm() != -1)
Close();
}
}
}

126
MainForms/SettingsForm.resx Normal file
View File

@@ -0,0 +1,126 @@
<?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>
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>364, 17</value>
</metadata>
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>472, 17</value>
</metadata>
</root>

View File

@@ -29,75 +29,38 @@ namespace Diplom_O
/// </summary>
private void InitializeComponent()
{
this.menuStrip = new System.Windows.Forms.MenuStrip();
this.shtatMI = new System.Windows.Forms.ToolStripMenuItem();
this.rabitnikiMI = new System.Windows.Forms.ToolStripMenuItem();
this.otpBolMI = new System.Windows.Forms.ToolStripMenuItem();
this.chelRodMI = new System.Windows.Forms.ToolStripMenuItem();
this.findBox = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.dropFindButton = new System.Windows.Forms.Button();
this.freeShtatCheckBox = new System.Windows.Forms.CheckBox();
this.addButton = new System.Windows.Forms.Button();
this.changeButton = new System.Windows.Forms.Button();
this.delButton = new System.Windows.Forms.Button();
this.selectButton = new System.Windows.Forms.Button();
this.shtatGridView = new System.Windows.Forms.DataGridView();
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.errorLabel = new System.Windows.Forms.ToolStripStatusLabel();
this.menuStrip.SuspendLayout();
this.menuStrip = new System.Windows.Forms.MenuStrip();
this.shtatMI = new System.Windows.Forms.ToolStripMenuItem();
this.chelRodMI = new System.Windows.Forms.ToolStripMenuItem();
this.rabitnikiMI = new System.Windows.Forms.ToolStripMenuItem();
this.stajMI = new System.Windows.Forms.ToolStripMenuItem();
this.learnMI = new System.Windows.Forms.ToolStripMenuItem();
this.otpBolMI = new System.Windows.Forms.ToolStripMenuItem();
this.детиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.delButton = new System.Windows.Forms.Button();
this.changeButton = new System.Windows.Forms.Button();
this.addButton = new System.Windows.Forms.Button();
this.настройкиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
((System.ComponentModel.ISupportInitialize)(this.shtatGridView)).BeginInit();
this.statusStrip1.SuspendLayout();
this.menuStrip.SuspendLayout();
this.SuspendLayout();
//
// menuStrip
//
this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.shtatMI,
this.rabitnikiMI,
this.otpBolMI,
this.chelRodMI});
this.menuStrip.Location = new System.Drawing.Point(0, 0);
this.menuStrip.Name = "menuStrip";
this.menuStrip.Size = new System.Drawing.Size(342, 24);
this.menuStrip.TabIndex = 8;
this.menuStrip.Text = "menuStrip1";
//
// shtatMI
//
this.shtatMI.Name = "shtatMI";
this.shtatMI.Size = new System.Drawing.Size(46, 20);
this.shtatMI.Text = "Штат";
this.shtatMI.Click += new System.EventHandler(this.MI_Click);
//
// rabitnikiMI
//
this.rabitnikiMI.Name = "rabitnikiMI";
this.rabitnikiMI.Size = new System.Drawing.Size(78, 20);
this.rabitnikiMI.Text = "Работники";
this.rabitnikiMI.Click += new System.EventHandler(this.MI_Click);
//
// otpBolMI
//
this.otpBolMI.Name = "otpBolMI";
this.otpBolMI.Size = new System.Drawing.Size(100, 20);
this.otpBolMI.Text = "Отпуск/Больн.";
this.otpBolMI.Click += new System.EventHandler(this.MI_Click);
//
// chelRodMI
//
this.chelRodMI.Name = "chelRodMI";
this.chelRodMI.Size = new System.Drawing.Size(95, 20);
this.chelRodMI.Text = "Люди/Родств.";
this.chelRodMI.Click += new System.EventHandler(this.MI_Click);
//
// findBox
//
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, 490);
this.findBox.Location = new System.Drawing.Point(57, 613);
this.findBox.Name = "findBox";
this.findBox.Size = new System.Drawing.Size(192, 20);
this.findBox.Size = new System.Drawing.Size(505, 20);
this.findBox.TabIndex = 5;
this.findBox.TextChanged += new System.EventHandler(this.findBox_TextChanged);
//
@@ -105,7 +68,7 @@ namespace Diplom_O
//
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, 493);
this.label1.Location = new System.Drawing.Point(12, 616);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(39, 13);
this.label1.TabIndex = 3;
@@ -114,66 +77,39 @@ namespace Diplom_O
// dropFindButton
//
this.dropFindButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.dropFindButton.Location = new System.Drawing.Point(255, 488);
this.dropFindButton.Location = new System.Drawing.Point(568, 611);
this.dropFindButton.Name = "dropFindButton";
this.dropFindButton.Size = new System.Drawing.Size(75, 23);
this.dropFindButton.TabIndex = 6;
this.dropFindButton.Text = "Сбросить";
this.dropFindButton.UseVisualStyleBackColor = true;
this.dropFindButton.TextChanged += new System.EventHandler(this.dropFindButton_Click);
this.dropFindButton.Click += new System.EventHandler(this.dropFindButton_Click);
//
// freeShtatCheckBox
//
this.freeShtatCheckBox.AutoSize = true;
this.freeShtatCheckBox.Checked = true;
this.freeShtatCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
this.freeShtatCheckBox.Location = new System.Drawing.Point(12, 56);
this.freeShtatCheckBox.Location = new System.Drawing.Point(12, 31);
this.freeShtatCheckBox.Name = "freeShtatCheckBox";
this.freeShtatCheckBox.Size = new System.Drawing.Size(218, 17);
this.freeShtatCheckBox.Size = new System.Drawing.Size(177, 17);
this.freeShtatCheckBox.TabIndex = 4;
this.freeShtatCheckBox.Text = "Поrазать/скрыть занятые должности";
this.freeShtatCheckBox.Text = "Только актуальные вакансии";
this.freeShtatCheckBox.UseVisualStyleBackColor = true;
this.freeShtatCheckBox.CheckedChanged += new System.EventHandler(this.checkBox_CheckedChanged);
//
// addButton
//
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 = 1;
this.addButton.Text = "Добавить";
this.addButton.UseVisualStyleBackColor = true;
this.addButton.Click += new System.EventHandler(this.addButton_Click);
//
// changeButton
//
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 = 2;
this.changeButton.Text = "Изменить";
this.changeButton.UseVisualStyleBackColor = true;
this.changeButton.Click += new System.EventHandler(this.changeButton_Click);
//
// delButton
//
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 = 3;
this.delButton.Text = "Удалить";
this.delButton.UseVisualStyleBackColor = true;
this.delButton.Click += new System.EventHandler(this.delButton_Click);
//
// selectButton
//
this.selectButton.Location = new System.Drawing.Point(12, 27);
this.selectButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.selectButton.Location = new System.Drawing.Point(325, 27);
this.selectButton.Name = "selectButton";
this.selectButton.Size = new System.Drawing.Size(75, 23);
this.selectButton.TabIndex = 0;
this.selectButton.Text = "Выбрать";
this.selectButton.UseVisualStyleBackColor = true;
this.selectButton.Visible = false;
this.selectButton.Click += new System.EventHandler(this.selectButton_Click);
//
// shtatGridView
//
@@ -183,22 +119,22 @@ namespace Diplom_O
| 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, 79);
this.shtatGridView.Location = new System.Drawing.Point(12, 56);
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, 403);
this.shtatGridView.Size = new System.Drawing.Size(631, 549);
this.shtatGridView.TabIndex = 7;
//
// statusStrip1
//
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.errorLabel});
this.statusStrip1.Location = new System.Drawing.Point(0, 514);
this.statusStrip1.Location = new System.Drawing.Point(0, 637);
this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Size = new System.Drawing.Size(342, 22);
this.statusStrip1.Size = new System.Drawing.Size(655, 22);
this.statusStrip1.TabIndex = 15;
this.statusStrip1.Text = "statusStrip1";
//
@@ -211,54 +147,155 @@ namespace Diplom_O
this.errorLabel.Text = "Отображение ошибки";
this.errorLabel.Visible = false;
//
// menuStrip
//
this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.shtatMI,
this.chelRodMI,
this.rabitnikiMI,
this.stajMI,
this.learnMI,
this.otpBolMI,
this.детиToolStripMenuItem,
this.настройкиToolStripMenuItem});
this.menuStrip.Location = new System.Drawing.Point(0, 0);
this.menuStrip.Name = "menuStrip";
this.menuStrip.Size = new System.Drawing.Size(655, 24);
this.menuStrip.TabIndex = 16;
this.menuStrip.Text = "menuStrip1";
this.menuStrip.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.upperMenuClicked);
//
// shtatMI
//
this.shtatMI.Name = "shtatMI";
this.shtatMI.Size = new System.Drawing.Size(139, 20);
this.shtatMI.Text = "Актуальные вакансии";
//
// chelRodMI
//
this.chelRodMI.Name = "chelRodMI";
this.chelRodMI.Size = new System.Drawing.Size(50, 20);
this.chelRodMI.Text = "Люди";
//
// rabitnikiMI
//
this.rabitnikiMI.Name = "rabitnikiMI";
this.rabitnikiMI.Size = new System.Drawing.Size(85, 20);
this.rabitnikiMI.Text = "Сотрудники";
//
// stajMI
//
this.stajMI.Name = "stajMI";
this.stajMI.Size = new System.Drawing.Size(47, 20);
this.stajMI.Text = "Стаж";
//
// learnMI
//
this.learnMI.Name = "learnMI";
this.learnMI.Size = new System.Drawing.Size(92, 20);
this.learnMI.Text = "Образование";
//
// otpBolMI
//
this.otpBolMI.Name = "otpBolMI";
this.otpBolMI.Size = new System.Drawing.Size(100, 20);
this.otpBolMI.Text = "Отпуск/Больн.";
//
// детиToolStripMenuItem
//
this.детиToolStripMenuItem.Name = етиToolStripMenuItem";
this.детиToolStripMenuItem.Size = new System.Drawing.Size(45, 20);
this.детиToolStripMenuItem.Text = "Дети";
//
// delButton
//
this.delButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.delButton.Location = new System.Drawing.Point(568, 27);
this.delButton.Name = "delButton";
this.delButton.Size = new System.Drawing.Size(75, 23);
this.delButton.TabIndex = 17;
this.delButton.Text = "Удалить";
this.delButton.UseVisualStyleBackColor = true;
this.delButton.Click += new System.EventHandler(this.delButton_Click);
//
// changeButton
//
this.changeButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.changeButton.Location = new System.Drawing.Point(487, 27);
this.changeButton.Name = "changeButton";
this.changeButton.Size = new System.Drawing.Size(75, 23);
this.changeButton.TabIndex = 18;
this.changeButton.Text = "Изменить";
this.changeButton.UseVisualStyleBackColor = true;
this.changeButton.Click += new System.EventHandler(this.changeButton_Click);
//
// addButton
//
this.addButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.addButton.Location = new System.Drawing.Point(406, 27);
this.addButton.Name = "addButton";
this.addButton.Size = new System.Drawing.Size(75, 23);
this.addButton.TabIndex = 19;
this.addButton.Text = "Добавить";
this.addButton.UseVisualStyleBackColor = true;
this.addButton.Click += new System.EventHandler(this.addButton_Click);
//
// настройкиToolStripMenuItem
//
this.настройкиToolStripMenuItem.Name = астройкиToolStripMenuItem";
this.настройкиToolStripMenuItem.Size = new System.Drawing.Size(79, 20);
this.настройкиToolStripMenuItem.Text = "Настройки";
//
// ShtatForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(342, 536);
this.ClientSize = new System.Drawing.Size(655, 659);
this.Controls.Add(this.addButton);
this.Controls.Add(this.changeButton);
this.Controls.Add(this.delButton);
this.Controls.Add(this.menuStrip);
this.Controls.Add(this.statusStrip1);
this.Controls.Add(this.shtatGridView);
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.dropFindButton);
this.Controls.Add(this.label1);
this.Controls.Add(this.findBox);
this.Controls.Add(this.menuStrip);
this.MainMenuStrip = this.menuStrip;
this.Name = "ShtatForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Штат";
this.menuStrip.ResumeLayout(false);
this.menuStrip.PerformLayout();
this.Text = "Вакансии";
((System.ComponentModel.ISupportInitialize)(this.shtatGridView)).EndInit();
this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout();
this.menuStrip.ResumeLayout(false);
this.menuStrip.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.MenuStrip menuStrip;
private System.Windows.Forms.ToolStripMenuItem rabitnikiMI;
private System.Windows.Forms.TextBox findBox;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button dropFindButton;
private System.Windows.Forms.CheckBox freeShtatCheckBox;
private System.Windows.Forms.Button addButton;
private System.Windows.Forms.Button changeButton;
private System.Windows.Forms.Button delButton;
private System.Windows.Forms.Button selectButton;
private System.Windows.Forms.DataGridView shtatGridView;
private System.Windows.Forms.StatusStrip statusStrip1;
private System.Windows.Forms.ToolStripStatusLabel errorLabel;
private System.Windows.Forms.ToolStripMenuItem shtatMI;
private System.Windows.Forms.ToolStripMenuItem otpBolMI;
private System.Windows.Forms.ToolStripMenuItem chelRodMI;
}
private System.Windows.Forms.MenuStrip menuStrip;
private System.Windows.Forms.ToolStripMenuItem shtatMI;
private System.Windows.Forms.ToolStripMenuItem rabitnikiMI;
private System.Windows.Forms.ToolStripMenuItem otpBolMI;
private System.Windows.Forms.ToolStripMenuItem chelRodMI;
private System.Windows.Forms.ToolStripMenuItem детиToolStripMenuItem;
private System.Windows.Forms.Button delButton;
private System.Windows.Forms.Button changeButton;
private System.Windows.Forms.Button addButton;
private System.Windows.Forms.ToolStripMenuItem stajMI;
private System.Windows.Forms.ToolStripMenuItem learnMI;
private System.Windows.Forms.ToolStripMenuItem настройкиToolStripMenuItem;
}
}

View File

@@ -13,39 +13,22 @@ namespace Diplom_O
{
public partial class ShtatForm : Form
{
private Task errDrop;
private void ShowError(string msg = null)
private readonly ColumnConf[] tableColumns =
{
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();
}
new ColumnConf("№"),
new ColumnConf("Должность", 140),
new ColumnConf(name: "Кол-во"),
new ColumnConf(name: "Своб.")
};
private Task filterDrop;
private void findBox_TextChanged(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();
this.FindOnChanged(resetShatTable);
}
private void dropFindButton_Click(object sender, EventArgs e)
{
findBox.Text = "";
filterDrop = new Task(() => { return; });
this.FindOnChanged(null);
resetShatTable();
}
@@ -53,64 +36,68 @@ namespace Diplom_O
{
try
{
{
shtatGridView.Rows.Clear();
shtatGridView.Columns.Clear();
var c = shtatGridView.Columns;
c.Add("Id", "№");
c.Add("Dolj", "Должность");
c.Add("Kolvo", "Кол-во");
c.Add("Free", "Своб.");
c[0].Width = 40;
c[1].Width = 120;
c[2].Width = 40;
c[3].Width = 40;
}
{
var arr = FuncDB.ListShtat(findBox.Text);
var r = shtatGridView.Rows;
foreach (var shtat in arr)
if (shtat.ost != 0)
r.Add(new object[] {
shtat.shtat.Id,
shtat.shtat.Doljnost,
shtat.shtat.Size,
shtat.ost
});
}
if (shtatGridView.Rows.Count > 0)
shtatGridView.Rows[0].Selected = true;
var tmp = FuncDB.ShtatListTableMain(findBox.Text, freeShtatCheckBox.Checked);
var res = new List<string[]>();
foreach (var i in tmp)
if (int.TryParse(i[0], out int t) && t != 0)
res.Add(i);
this.ResetTable(
shtatGridView,
tableColumns,
freeShtatCheckBox.Checked ?
tmp :
res.ToArray()
);
}
catch ( Exception e )
{
this.ShowError( errorLabel, e.Message );
}
catch (Exception e) { ShowError(e.Message); }
}
private Shtat selectedShtat()
{
try
{
if (shtatGridView.SelectedRows.Count != 1) throw new Exception("Должность не выбрана.");
var shtat = FuncDB.GetShtat((int)shtatGridView.SelectedRows[0].Cells[0].Value);
return shtat;
if ( shtatGridView.SelectedRows.Count != 1 )
throw new Exception("Должность не выбрана.");
if (int.TryParse((string)shtatGridView.SelectedRows[0].Cells[0].Value, out int value))
return FuncDB.ShtatGetById(value);
else
throw new Exception("Ошибка в таблице.");
}
catch (Exception e)
{
this.ShowError(errorLabel, e.Message);
return null;
}
catch (Exception e) { ShowError(e.Message); return null; }
}
public bool isCanceled = true;
public Shtat formResult = null;
public ShtatForm(bool select = false)
{
try
{
InitializeComponent();
Init(select);
selectButton.Visible = select;
shtatMI.Enabled = !select;
this.correctUpperMenu(menuStrip, 0);
resetShatTable();
addButton.Enabled =
changeButton.Enabled =
delButton.Enabled = false;
var user = this.GetUser();
if (user == null)
return;
delButton.Enabled = FuncDB.AccessGetByUserIdFormIdAccessId(user.Id, 0, 1) != null;
changeButton.Enabled = FuncDB.AccessGetByUserIdFormIdAccessId(user.Id, 0, 2) != null;
addButton.Enabled = FuncDB.AccessGetByUserIdFormIdAccessId(user.Id, 0, 3) != null;
}
catch { this.Close(); }
}
public void Init(bool s)
{
if (s) selectButton.Visible = true;
shtatMI.Enabled = false;
}
private void addButton_Click(object sender, EventArgs e)
{
var res = new SupportForms.WorkShtatForm();
@@ -121,7 +108,8 @@ namespace Diplom_O
private void changeButton_Click(object sender, EventArgs e)
{
var shtat = selectedShtat();
if (shtat == null) { ShowError("Должность не выбрана."); return; }
if (shtat == null)
return;
var res = new SupportForms.WorkShtatForm(shtat);
res.ShowDialog();
if (!res.isCanceled)
@@ -130,40 +118,37 @@ namespace Diplom_O
private void delButton_Click(object sender, EventArgs e)
{
var shtat = selectedShtat();
if (shtat == null) { ShowError("Должность не выбрана."); return; }
if (shtat == null)
return;
try
{
FuncDB.DelShtat(shtat);
FuncDB.ShtatDelete(shtat);
resetShatTable();
}
catch (Exception ex) { ShowError(ex.Message); }
catch (Exception ex)
{
this.ShowError(errorLabel, ex.Message);
}
}
public void MI_Click(object sender, EventArgs e)
private void selectButton_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("Ошибка перехода на новую форму.");
formResult = selectedShtat();
isCanceled = false;
this.Close();
}
private void checkBox_CheckedChanged(object sender, EventArgs e)
{
resetShatTable();
}
}
private void upperMenuClicked(object sender, ToolStripItemClickedEventArgs e)
{
this.upperMenuClicked((MenuStrip)sender);
if (this.GetNextForm() != -1)
Close();
}
}
}

View File

@@ -117,10 +117,10 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>132, 17</value>
</metadata>
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>24, 19</value>
</metadata>
</root>

397
MainForms/StajForm.Designer.cs generated Normal file
View File

@@ -0,0 +1,397 @@

namespace Diplom_O
{
partial class StajForm
{
/// <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.menuStrip = new System.Windows.Forms.MenuStrip();
this.shtatMI = new System.Windows.Forms.ToolStripMenuItem();
this.chelRodMI = new System.Windows.Forms.ToolStripMenuItem();
this.rabitnikiMI = new System.Windows.Forms.ToolStripMenuItem();
this.stajMI = new System.Windows.Forms.ToolStripMenuItem();
this.learnMI = new System.Windows.Forms.ToolStripMenuItem();
this.otpBolMI = new System.Windows.Forms.ToolStripMenuItem();
this.детиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.errorLabel = new System.Windows.Forms.ToolStripStatusLabel();
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.stajGridView = new System.Windows.Forms.DataGridView();
this.linkRabLabel = new System.Windows.Forms.LinkLabel();
this.label2 = new System.Windows.Forms.Label();
this.addStajButton = new System.Windows.Forms.Button();
this.label3 = new System.Windows.Forms.Label();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.dayTB = new System.Windows.Forms.TextBox();
this.monthTB = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.yearTB = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label();
this.addRadioButton = new System.Windows.Forms.RadioButton();
this.delRadioButton = new System.Windows.Forms.RadioButton();
this.dateTimePicker1 = new System.Windows.Forms.DateTimePicker();
this.button1 = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.настройкиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip.SuspendLayout();
this.statusStrip1.SuspendLayout();
this.groupBox2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.stajGridView)).BeginInit();
this.SuspendLayout();
//
// menuStrip
//
this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.shtatMI,
this.chelRodMI,
this.rabitnikiMI,
this.stajMI,
this.learnMI,
this.otpBolMI,
this.детиToolStripMenuItem,
this.настройкиToolStripMenuItem});
this.menuStrip.Location = new System.Drawing.Point(0, 0);
this.menuStrip.Name = "menuStrip";
this.menuStrip.Size = new System.Drawing.Size(705, 24);
this.menuStrip.TabIndex = 30;
this.menuStrip.Text = "menuStrip1";
this.menuStrip.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.upperMenuClicked);
//
// shtatMI
//
this.shtatMI.Name = "shtatMI";
this.shtatMI.Size = new System.Drawing.Size(139, 20);
this.shtatMI.Text = "Актуальные вакансии";
//
// chelRodMI
//
this.chelRodMI.Name = "chelRodMI";
this.chelRodMI.Size = new System.Drawing.Size(50, 20);
this.chelRodMI.Text = "Люди";
//
// rabitnikiMI
//
this.rabitnikiMI.Name = "rabitnikiMI";
this.rabitnikiMI.Size = new System.Drawing.Size(85, 20);
this.rabitnikiMI.Text = "Сотрудники";
//
// stajMI
//
this.stajMI.Name = "stajMI";
this.stajMI.Size = new System.Drawing.Size(47, 20);
this.stajMI.Text = "Стаж";
//
// learnMI
//
this.learnMI.Name = "learnMI";
this.learnMI.Size = new System.Drawing.Size(92, 20);
this.learnMI.Text = "Образование";
//
// otpBolMI
//
this.otpBolMI.Name = "otpBolMI";
this.otpBolMI.Size = new System.Drawing.Size(100, 20);
this.otpBolMI.Text = "Отпуск/Больн.";
//
// детиToolStripMenuItem
//
this.детиToolStripMenuItem.Name = етиToolStripMenuItem";
this.детиToolStripMenuItem.Size = new System.Drawing.Size(45, 20);
this.детиToolStripMenuItem.Text = "Дети";
//
// 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(137, 17);
this.errorLabel.Text = "Отображение ошибки";
this.errorLabel.Visible = false;
//
// statusStrip1
//
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.errorLabel});
this.statusStrip1.Location = new System.Drawing.Point(0, 432);
this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Size = new System.Drawing.Size(705, 22);
this.statusStrip1.TabIndex = 37;
this.statusStrip1.Text = "statusStrip1";
//
// groupBox2
//
this.groupBox2.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.groupBox2.Controls.Add(this.stajGridView);
this.groupBox2.Location = new System.Drawing.Point(13, 113);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(678, 316);
this.groupBox2.TabIndex = 40;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Стаж";
//
// stajGridView
//
this.stajGridView.AllowUserToAddRows = false;
this.stajGridView.AllowUserToDeleteRows = false;
this.stajGridView.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.stajGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.stajGridView.Location = new System.Drawing.Point(6, 19);
this.stajGridView.MultiSelect = false;
this.stajGridView.Name = "stajGridView";
this.stajGridView.ReadOnly = true;
this.stajGridView.RowHeadersVisible = false;
this.stajGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.stajGridView.Size = new System.Drawing.Size(666, 291);
this.stajGridView.TabIndex = 37;
//
// linkRabLabel
//
this.linkRabLabel.AutoSize = true;
this.linkRabLabel.Location = new System.Drawing.Point(76, 32);
this.linkRabLabel.Name = "linkRabLabel";
this.linkRabLabel.Size = new System.Drawing.Size(121, 13);
this.linkRabLabel.TabIndex = 41;
this.linkRabLabel.TabStop = true;
this.linkRabLabel.Text = "Выбрать сотрудника...";
this.linkRabLabel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkRabLabel_LinkClicked);
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(12, 32);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(69, 13);
this.label2.TabIndex = 42;
this.label2.Text = "Сотрудники:";
//
// addStajButton
//
this.addStajButton.Location = new System.Drawing.Point(616, 53);
this.addStajButton.Name = "addStajButton";
this.addStajButton.Size = new System.Drawing.Size(75, 51);
this.addStajButton.TabIndex = 47;
this.addStajButton.Text = "Установить";
this.addStajButton.UseVisualStyleBackColor = true;
this.addStajButton.Click += new System.EventHandler(this.addStajButton_Click);
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(10, 60);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(63, 13);
this.label3.TabIndex = 48;
this.label3.Text = "Тип стажа:";
//
// comboBox1
//
this.comboBox1.FormattingEnabled = true;
this.comboBox1.Location = new System.Drawing.Point(79, 57);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(530, 21);
this.comboBox1.TabIndex = 49;
this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.typeStajChanged);
this.comboBox1.SelectedValueChanged += new System.EventHandler(this.typeStajChanged);
//
// dayTB
//
this.dayTB.Location = new System.Drawing.Point(308, 86);
this.dayTB.Name = "dayTB";
this.dayTB.Size = new System.Drawing.Size(75, 20);
this.dayTB.TabIndex = 50;
//
// monthTB
//
this.monthTB.Location = new System.Drawing.Point(187, 86);
this.monthTB.Name = "monthTB";
this.monthTB.Size = new System.Drawing.Size(75, 20);
this.monthTB.TabIndex = 51;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(268, 89);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(37, 13);
this.label4.TabIndex = 52;
this.label4.Text = "Дней:";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(126, 89);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(55, 13);
this.label5.TabIndex = 53;
this.label5.Text = "Месяцев:";
//
// yearTB
//
this.yearTB.Location = new System.Drawing.Point(45, 86);
this.yearTB.Name = "yearTB";
this.yearTB.Size = new System.Drawing.Size(75, 20);
this.yearTB.TabIndex = 54;
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(10, 89);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(29, 13);
this.label6.TabIndex = 55;
this.label6.Text = "Лет:";
//
// addRadioButton
//
this.addRadioButton.AutoSize = true;
this.addRadioButton.Location = new System.Drawing.Point(389, 87);
this.addRadioButton.Name = "addRadioButton";
this.addRadioButton.Size = new System.Drawing.Size(80, 17);
this.addRadioButton.TabIndex = 56;
this.addRadioButton.TabStop = true;
this.addRadioButton.Text = "Прибавить";
this.addRadioButton.UseVisualStyleBackColor = true;
//
// delRadioButton
//
this.delRadioButton.AutoSize = true;
this.delRadioButton.Location = new System.Drawing.Point(475, 87);
this.delRadioButton.Name = "delRadioButton";
this.delRadioButton.Size = new System.Drawing.Size(68, 17);
this.delRadioButton.TabIndex = 57;
this.delRadioButton.TabStop = true;
this.delRadioButton.Text = "Вычесть";
this.delRadioButton.UseVisualStyleBackColor = true;
//
// dateTimePicker1
//
this.dateTimePicker1.Location = new System.Drawing.Point(458, 29);
this.dateTimePicker1.Name = "dateTimePicker1";
this.dateTimePicker1.Size = new System.Drawing.Size(151, 20);
this.dateTimePicker1.TabIndex = 58;
//
// button1
//
this.button1.Location = new System.Drawing.Point(616, 28);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 59;
this.button1.Text = "Расчитать";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(367, 33);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(85, 13);
this.label1.TabIndex = 60;
this.label1.Text = "Расчет на дату:";
//
// настройкиToolStripMenuItem
//
this.настройкиToolStripMenuItem.Name = астройкиToolStripMenuItem";
this.настройкиToolStripMenuItem.Size = new System.Drawing.Size(79, 20);
this.настройкиToolStripMenuItem.Text = "Настройки";
//
// StajForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(705, 454);
this.Controls.Add(this.label1);
this.Controls.Add(this.button1);
this.Controls.Add(this.dateTimePicker1);
this.Controls.Add(this.delRadioButton);
this.Controls.Add(this.addRadioButton);
this.Controls.Add(this.label6);
this.Controls.Add(this.yearTB);
this.Controls.Add(this.label5);
this.Controls.Add(this.label4);
this.Controls.Add(this.monthTB);
this.Controls.Add(this.dayTB);
this.Controls.Add(this.comboBox1);
this.Controls.Add(this.label3);
this.Controls.Add(this.addStajButton);
this.Controls.Add(this.label2);
this.Controls.Add(this.linkRabLabel);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.menuStrip);
this.Controls.Add(this.statusStrip1);
this.Name = "StajForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Стаж";
this.menuStrip.ResumeLayout(false);
this.menuStrip.PerformLayout();
this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout();
this.groupBox2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.stajGridView)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.MenuStrip menuStrip;
private System.Windows.Forms.ToolStripMenuItem shtatMI;
private System.Windows.Forms.ToolStripMenuItem rabitnikiMI;
private System.Windows.Forms.ToolStripMenuItem otpBolMI;
private System.Windows.Forms.ToolStripMenuItem chelRodMI;
private System.Windows.Forms.ToolStripMenuItem детиToolStripMenuItem;
private System.Windows.Forms.ToolStripStatusLabel errorLabel;
private System.Windows.Forms.StatusStrip statusStrip1;
private System.Windows.Forms.ToolStripMenuItem stajMI;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.DataGridView stajGridView;
private System.Windows.Forms.LinkLabel linkRabLabel;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button addStajButton;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.TextBox dayTB;
private System.Windows.Forms.TextBox monthTB;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.TextBox yearTB;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.RadioButton addRadioButton;
private System.Windows.Forms.RadioButton delRadioButton;
private System.Windows.Forms.ToolStripMenuItem learnMI;
private System.Windows.Forms.DateTimePicker dateTimePicker1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.ToolStripMenuItem настройкиToolStripMenuItem;
}
}

298
MainForms/StajForm.cs Normal file
View File

@@ -0,0 +1,298 @@
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
{
public partial class StajForm : Form
{
private readonly ColumnConf[] tableStajColumns = {
new ColumnConf(name: "№"),
new ColumnConf(name: "Названиe", size: 140, warp: true),
new ColumnConf(name: "Лет", size: 60),
new ColumnConf(name: "Месяцев", size: 60),
new ColumnConf(name: "Дней", size: 60)
};
private Rabotnik rabotnik = null;
private void linkRabLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
var form = new RabForm(true);
form.ShowDialog();
if (form.isCanceled)
rabotnik = null;
else
rabotnik = form.formResult;
ResetLinkRabotnik();
resetStajTable();
}
private void ResetLinkRabotnik()
{
if (rabotnik == null)
{
linkRabLabel.Text = "Выбрать сотрудника...";
return;
}
var chel = FuncDB.ChelGetById(rabotnik.ChelId);
if (chel == null)
{
linkRabLabel.Text = "Выбрать сотрудника...";
return;
}
var res = chel.FName.ToString() + " " +
chel.SName[0].ToString() + "." +
((!string.IsNullOrEmpty(chel.TName)) ?
chel.TName[0].ToString() + "." : "");
linkRabLabel.Text = res;
}
private void resetStajTable()
{
(int year, int month, int day) Sum(
(int year, int month, int day) t1,
(int year, int month, int day) t2
)
{
var year = t1.year + t2.year;
var month = t1.month + t2.month;
var day = t1.day + t2.day;
month += day / 30;
day %= 30;
year += month / 12;
month %= 12;
return (year, month, day);
}
(int year, int month, int day) Sub(
(int year, int month, int day) t1,
(int year, int month, int day) t2
)
{
var year = t1.year - t2.year;
var month = t1.month - t2.month;
var day = t1.day - t2.day;
while (day < 0)
{
day += 30;
month--;
}
while (month < 0)
{
month += 12;
year--;
}
month += day / 30;
day %= 30;
year += month / 12;
month %= 12;
return (year, month, day);
}
try
{
var res = new List<string[]>();
if (rabotnik == null)
{
this.ResetTable(
stajGridView,
tableStajColumns,
res.ToArray()
);
return;
}
var count = new Dictionary<int, (int year, int month, int day)>();
var listRab = FuncDB.RabotnikHistoryByChelId(rabotnik.ChelId);
foreach (var rab in listRab)
{
var size = FuncDB.RabotnikGetTotalTime(rab, dateTimePicker1.Value);
var staj = FuncDB.RabotnikTypeStajList(rab.Id);
if (count.ContainsKey(-1))
count[-1] = Sum(count[-1], size);
else
count[-1] = size;
foreach(var st in staj)
if (count.ContainsKey(st.TypeStajId))
count[st.TypeStajId] = Sum(count[st.TypeStajId], size);
else
count[st.TypeStajId] = size;
}
var listCorrStaj = FuncDB.CorrStajList(rabotnik.ChelId);
foreach (var corr in listCorrStaj)
{
var ts = FuncDB.TypeStajGetById(corr.TypeStajId);
if (ts != null && ts.Name.CompareTo("Общий") == 0)
corr.TypeStajId = -1;
var size = (corr.Year, corr.Month, corr.Day);
if (!count.ContainsKey(corr.TypeStajId))
count[corr.TypeStajId] = (0, 0, 0);
if (corr.AddFlag)
count[corr.TypeStajId] = Sum(count[corr.TypeStajId], size);
else
count[corr.TypeStajId] = Sub(count[corr.TypeStajId], size);
}
foreach (var r in count)
{
if (r.Value.year < 0 || r.Value.year + r.Value.month + r.Value.day == 0)
continue;
var sr = new List<string>();
sr.Add(r.Key.ToString());
if (r.Key == -1)
sr.Add("Общий");
else
sr.Add(FuncDB.TypeStajGetById(r.Key).Name);
sr.Add(r.Value.year.ToString());
sr.Add(r.Value.month.ToString());
sr.Add(r.Value.day.ToString());
res.Add(sr.ToArray());
}
this.ResetTable(
stajGridView,
tableStajColumns,
res.ToArray()
);
}
catch (Exception e)
{
this.ShowError(errorLabel, e.Message);
}
}
public StajForm()
{
InitializeComponent();
this.correctUpperMenu(menuStrip, 3);
dateTimePicker1.Value = DateTime.Now;
ResetLinkRabotnik();
resetTypeStajComboBox();
linkRabLabel.Enabled = false;
addStajButton.Enabled = false;
var user = this.GetUser();
if (user == null)
return;
linkRabLabel.Enabled =
FuncDB.AccessGetByUserIdFormIdAccessId(user.Id, 3, 0) != null;
addStajButton.Enabled =
FuncDB.AccessGetByUserIdFormIdAccessId(user.Id, 3, 2) != null ||
FuncDB.AccessGetByUserIdFormIdAccessId(user.Id, 3, 3) != null;
}
private void resetTypeStajComboBox()
{
try
{
var list = new List<string>();
list.Add("Общий");
list.AddRange(FuncDB.TypeStajListString());
comboBox1.Items.Clear();
comboBox1.Items.AddRange(list.ToArray());
comboBox1.SelectedIndex = -1;
}
catch (Exception e)
{
this.ShowError(errorLabel, e.Message);
}
}
private void upperMenuClicked(object sender, ToolStripItemClickedEventArgs e)
{
this.upperMenuClicked((MenuStrip)sender);
if (this.GetNextForm() != -1)
Close();
}
private void typeStajChanged(object sender, EventArgs e)
{
try
{
addRadioButton.Checked = ! (delRadioButton.Checked = false);
yearTB.Text = monthTB.Text = dayTB.Text = "";
if (rabotnik == null)
return;
var staj = FuncDB.TypeStajGetByName(comboBox1.Text);
if (staj == null)
return;
var corrStaj = FuncDB.CorrStaj(rabotnik.ChelId, staj.Name);
if (corrStaj == null)
return;
yearTB.Text = corrStaj.Year.ToString();
monthTB.Text = corrStaj.Month.ToString();
dayTB.Text = corrStaj.Day.ToString();
delRadioButton.Checked = !(addRadioButton.Checked = corrStaj.AddFlag);
}
catch (Exception ex)
{
this.ShowError(errorLabel, ex.Message);
}
}
private void addStajButton_Click(object sender, EventArgs e)
{
try
{
if (rabotnik == null)
throw new Exception("Не выбран сотрудник.");
if (!int.TryParse(yearTB.Text, out int year) || year < 0)
throw new Exception("Не верно указан год.");
if (!int.TryParse(monthTB.Text, out int month) || month < 0)
throw new Exception("Не верно указан месяц.");
if (!int.TryParse(dayTB.Text, out int day) || day < 0)
throw new Exception("Не верно указан день.");
var typeStaj = FuncDB.TypeStajGetByName(comboBox1.Text);
if(typeStaj == null)
{
FuncDB.TypeStajAdd(new TypeStaj() { Name = comboBox1.Text });
typeStaj = FuncDB.TypeStajGetByName(comboBox1.Text);
}
var corrStaj = FuncDB.CorrStaj(rabotnik.ChelId, typeStaj.Name);
if (corrStaj == null)
{
FuncDB.CorrStajAdd(new CorrStaj()
{
Year = year,
Month = month,
Day = day,
ChelId = rabotnik.ChelId,
TypeStajId = typeStaj.Id,
AddFlag = addRadioButton.Checked
});
}
else
{
corrStaj.ChelId = rabotnik.ChelId;
corrStaj.TypeStajId = typeStaj.Id;
corrStaj.AddFlag = addRadioButton.Checked;
corrStaj.Year = year;
corrStaj.Month = month;
corrStaj.Day = day;
FuncDB.CorrStajChange(corrStaj);
}
resetStajTable();
resetTypeStajComboBox();
}
catch (Exception ex)
{
this.ShowError(errorLabel, ex.Message);
}
}
private void button1_Click(object sender, EventArgs e)
{
resetStajTable();
}
}
}

126
MainForms/StajForm.resx Normal file
View File

@@ -0,0 +1,126 @@
<?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>
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>364, 17</value>
</metadata>
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>472, 17</value>
</metadata>
</root>