Work with Chel
This commit is contained in:
160
SupportForms/WorkChelForm.Designer.cs
generated
Normal file
160
SupportForms/WorkChelForm.Designer.cs
generated
Normal file
@@ -0,0 +1,160 @@
|
||||
|
||||
namespace Diplom_O.SupportForms
|
||||
{
|
||||
partial class WorkChelForm
|
||||
{
|
||||
/// <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.doljBox = new System.Windows.Forms.TextBox();
|
||||
this.kolvoBox = new System.Windows.Forms.TextBox();
|
||||
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
|
||||
this.errorLabel = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.workButton = new System.Windows.Forms.Button();
|
||||
this.canceledButton = new System.Windows.Forms.Button();
|
||||
this.busySizeLabel = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.statusStrip1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// doljBox
|
||||
//
|
||||
this.doljBox.Location = new System.Drawing.Point(87, 12);
|
||||
this.doljBox.Name = "doljBox";
|
||||
this.doljBox.Size = new System.Drawing.Size(162, 20);
|
||||
this.doljBox.TabIndex = 0;
|
||||
//
|
||||
// kolvoBox
|
||||
//
|
||||
this.kolvoBox.Location = new System.Drawing.Point(87, 38);
|
||||
this.kolvoBox.Name = "kolvoBox";
|
||||
this.kolvoBox.Size = new System.Drawing.Size(162, 20);
|
||||
this.kolvoBox.TabIndex = 1;
|
||||
//
|
||||
// statusStrip1
|
||||
//
|
||||
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.errorLabel,
|
||||
this.busySizeLabel});
|
||||
this.statusStrip1.Location = new System.Drawing.Point(0, 90);
|
||||
this.statusStrip1.Name = "statusStrip1";
|
||||
this.statusStrip1.Size = new System.Drawing.Size(262, 22);
|
||||
this.statusStrip1.TabIndex = 2;
|
||||
this.statusStrip1.Text = "statusStrip1";
|
||||
//
|
||||
// errorLabel
|
||||
//
|
||||
this.errorLabel.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold);
|
||||
this.errorLabel.ForeColor = System.Drawing.Color.Red;
|
||||
this.errorLabel.Name = "errorLabel";
|
||||
this.errorLabel.Size = new System.Drawing.Size(57, 17);
|
||||
this.errorLabel.Text = "Ошибка.";
|
||||
this.errorLabel.Visible = false;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(16, 15);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(65, 13);
|
||||
this.label1.TabIndex = 3;
|
||||
this.label1.Text = "Должность";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(12, 41);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(69, 13);
|
||||
this.label2.TabIndex = 4;
|
||||
this.label2.Text = "Кол-во мест";
|
||||
//
|
||||
// workButton
|
||||
//
|
||||
this.workButton.Location = new System.Drawing.Point(175, 64);
|
||||
this.workButton.Name = "workButton";
|
||||
this.workButton.Size = new System.Drawing.Size(75, 23);
|
||||
this.workButton.TabIndex = 5;
|
||||
this.workButton.Text = "Добавить";
|
||||
this.workButton.UseVisualStyleBackColor = true;
|
||||
this.workButton.Click += new System.EventHandler(this.workButton_Click);
|
||||
//
|
||||
// canceledButton
|
||||
//
|
||||
this.canceledButton.Location = new System.Drawing.Point(94, 64);
|
||||
this.canceledButton.Name = "canceledButton";
|
||||
this.canceledButton.Size = new System.Drawing.Size(75, 23);
|
||||
this.canceledButton.TabIndex = 6;
|
||||
this.canceledButton.Text = "Отмена";
|
||||
this.canceledButton.UseVisualStyleBackColor = true;
|
||||
this.canceledButton.Click += new System.EventHandler(this.canceledButton_Click);
|
||||
//
|
||||
// busySizeLabel
|
||||
//
|
||||
this.busySizeLabel.Name = "busySizeLabel";
|
||||
this.busySizeLabel.Size = new System.Drawing.Size(51, 17);
|
||||
this.busySizeLabel.Text = "Занято: ";
|
||||
this.busySizeLabel.Visible = false;
|
||||
//
|
||||
// WorkShtatForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(262, 112);
|
||||
this.ControlBox = false;
|
||||
this.Controls.Add(this.canceledButton);
|
||||
this.Controls.Add(this.workButton);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.statusStrip1);
|
||||
this.Controls.Add(this.kolvoBox);
|
||||
this.Controls.Add(this.doljBox);
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "WorkShtatForm";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "Штатное место";
|
||||
this.statusStrip1.ResumeLayout(false);
|
||||
this.statusStrip1.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TextBox doljBox;
|
||||
private System.Windows.Forms.TextBox kolvoBox;
|
||||
private System.Windows.Forms.StatusStrip statusStrip1;
|
||||
private System.Windows.Forms.ToolStripStatusLabel errorLabel;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Button workButton;
|
||||
private System.Windows.Forms.Button canceledButton;
|
||||
private System.Windows.Forms.ToolStripStatusLabel busySizeLabel;
|
||||
}
|
||||
}
|
81
SupportForms/WorkChelForm.cs
Normal file
81
SupportForms/WorkChelForm.cs
Normal file
@@ -0,0 +1,81 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Diplom_O.DataBase;
|
||||
|
||||
namespace Diplom_O.SupportForms
|
||||
{
|
||||
public partial class WorkChelForm : Form
|
||||
{
|
||||
private Task errDrop;
|
||||
private void ShowError(string msg = null)
|
||||
{
|
||||
errorLabel.Text = string.IsNullOrEmpty(msg) ? "Неизвестная ошибка." : msg;
|
||||
errorLabel.Visible = true;
|
||||
errDrop = new Task(() =>
|
||||
{
|
||||
var fd = errDrop.Id;
|
||||
Task.Delay(5000).Wait();
|
||||
if (errDrop.Id == fd)
|
||||
if (InvokeRequired) Invoke((Action)(() => { errorLabel.Visible = false; }));
|
||||
else errorLabel.Visible = false;
|
||||
});
|
||||
errDrop.Start();
|
||||
}
|
||||
|
||||
public bool isCanceled = false;
|
||||
private Chel chel = null;
|
||||
public WorkChelForm(Chel chel = null)
|
||||
{
|
||||
InitializeComponent();
|
||||
try
|
||||
{
|
||||
if (shtat != null)
|
||||
{
|
||||
this.shtat = shtat;
|
||||
workButton.Text = "Изменить";
|
||||
doljBox.Text = shtat.Doljnost;
|
||||
kolvoBox.Text = shtat.Size.ToString();
|
||||
busySizeLabel.Text = "Занято: " + FuncDB.BusySizeShtat(shtat.Id);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
ShowError(e.Message);
|
||||
workButton.Enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void workButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!int.TryParse(kolvoBox.Text, out int kolvo)) throw new Exception("Ошибка указания количества.");
|
||||
if (shtat == null)
|
||||
{
|
||||
var s = new Shtat() { Doljnost = doljBox.Text, Size = kolvo };
|
||||
FuncDB.AddShtat(s);
|
||||
}
|
||||
else
|
||||
{
|
||||
shtat.Doljnost = doljBox.Text;
|
||||
shtat.Size = kolvo;
|
||||
FuncDB.ChangeShtat(shtat);
|
||||
}
|
||||
this.Close();
|
||||
}
|
||||
catch (Exception ex) { ShowError(ex.Message); }
|
||||
}
|
||||
private void canceledButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
isCanceled = true;
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
126
SupportForms/WorkChelForm.resx
Normal file
126
SupportForms/WorkChelForm.resx
Normal 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>
|
Reference in New Issue
Block a user