Compare commits
No commits in common. "laboratory_3" and "main" have entirely different histories.
laboratory
...
main
@ -1,43 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.9.34728.123
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DesktopWithMyVisualComponents", "DesktopWithMyVisualComponents\DesktopWithMyVisualComponents.csproj", "{D784BAED-C48F-46F2-A6A0-BBD6CE599A59}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EnterpriseContracts", "EnterpriseContracts\EnterpriseContracts.csproj", "{B07E9BAB-F7E0-4191-A9A5-FECA4127F6FF}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EnterpriseDataBaseImplement", "EnterpriseDataBaseImplement\EnterpriseDataBaseImplement.csproj", "{D4FEF8DA-7060-4BF5-BB44-E5676DAE83E9}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EnterpriseBusinessLogic", "EnterpriseBusinessLogic\EnterpriseBusinessLogic.csproj", "{80D54561-34CE-4DE8-BF20-30A38B393D4B}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{D784BAED-C48F-46F2-A6A0-BBD6CE599A59}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D784BAED-C48F-46F2-A6A0-BBD6CE599A59}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D784BAED-C48F-46F2-A6A0-BBD6CE599A59}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D784BAED-C48F-46F2-A6A0-BBD6CE599A59}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{B07E9BAB-F7E0-4191-A9A5-FECA4127F6FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B07E9BAB-F7E0-4191-A9A5-FECA4127F6FF}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B07E9BAB-F7E0-4191-A9A5-FECA4127F6FF}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B07E9BAB-F7E0-4191-A9A5-FECA4127F6FF}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{D4FEF8DA-7060-4BF5-BB44-E5676DAE83E9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D4FEF8DA-7060-4BF5-BB44-E5676DAE83E9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D4FEF8DA-7060-4BF5-BB44-E5676DAE83E9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D4FEF8DA-7060-4BF5-BB44-E5676DAE83E9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{80D54561-34CE-4DE8-BF20-30A38B393D4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{80D54561-34CE-4DE8-BF20-30A38B393D4B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{80D54561-34CE-4DE8-BF20-30A38B393D4B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{80D54561-34CE-4DE8-BF20-30A38B393D4B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {26502496-F9AE-4E02-986A-76FD9595E9AE}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
@ -1,31 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net8.0-windows7.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BarsukovComponents" Version="1.0.0" />
|
||||
<PackageReference Include="BelianinComponents" Version="1.0.0" />
|
||||
<PackageReference Include="KryukovLib" Version="1.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.11">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Win32.SystemEvents" Version="8.0.0" />
|
||||
<PackageReference Include="MyCustomComponents" Version="1.0.0" />
|
||||
<PackageReference Include="System.Drawing.Common" Version="8.0.10" />
|
||||
<PackageReference Include="Unity" Version="5.11.10" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\EnterpriseBusinessLogic\EnterpriseBusinessLogic.csproj" />
|
||||
<ProjectReference Include="..\EnterpriseContracts\EnterpriseContracts.csproj" />
|
||||
<ProjectReference Include="..\EnterpriseDataBaseImplement\EnterpriseDataBaseImplement.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -1,188 +0,0 @@
|
||||
namespace DesktopWithMyVisualComponents
|
||||
{
|
||||
partial class FormEmployee
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
labelFIO = new Label();
|
||||
textBoxFIO = new TextBox();
|
||||
labelPhoneNumber = new Label();
|
||||
barsukovTextBoxPhoneNumber = new BarsukovComponents.VisualComponents.CustomTextBox();
|
||||
labelSkill = new Label();
|
||||
customSelectedCheckedListBoxProperty = new BelianinComponents.CustomSelectedCheckedListBoxProperty();
|
||||
buttonPhoto = new Button();
|
||||
buttonSave = new Button();
|
||||
buttonCancelAdd = new Button();
|
||||
pictureBoxPhoto = new PictureBox();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxPhoto).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// labelFIO
|
||||
//
|
||||
labelFIO.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
labelFIO.AutoSize = true;
|
||||
labelFIO.Location = new Point(30, 10);
|
||||
labelFIO.Name = "labelFIO";
|
||||
labelFIO.Size = new Size(45, 20);
|
||||
labelFIO.TabIndex = 0;
|
||||
labelFIO.Text = "ФИО:";
|
||||
//
|
||||
// textBoxFIO
|
||||
//
|
||||
textBoxFIO.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
textBoxFIO.Location = new Point(35, 34);
|
||||
textBoxFIO.Margin = new Padding(3, 4, 3, 4);
|
||||
textBoxFIO.Name = "textBoxFIO";
|
||||
textBoxFIO.Size = new Size(493, 27);
|
||||
textBoxFIO.TabIndex = 1;
|
||||
//
|
||||
// labelPhoneNumber
|
||||
//
|
||||
labelPhoneNumber.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
labelPhoneNumber.AutoSize = true;
|
||||
labelPhoneNumber.Location = new Point(242, 98);
|
||||
labelPhoneNumber.Name = "labelPhoneNumber";
|
||||
labelPhoneNumber.Size = new Size(130, 20);
|
||||
labelPhoneNumber.TabIndex = 2;
|
||||
labelPhoneNumber.Text = "Номер телефона:";
|
||||
//
|
||||
// barsukovTextBoxPhoneNumber
|
||||
//
|
||||
barsukovTextBoxPhoneNumber.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
barsukovTextBoxPhoneNumber.BorderStyle = BorderStyle.FixedSingle;
|
||||
barsukovTextBoxPhoneNumber.Location = new Point(242, 122);
|
||||
barsukovTextBoxPhoneNumber.Margin = new Padding(3, 4, 3, 4);
|
||||
barsukovTextBoxPhoneNumber.Name = "barsukovTextBoxPhoneNumber";
|
||||
barsukovTextBoxPhoneNumber.numberPattern = "";
|
||||
barsukovTextBoxPhoneNumber.Size = new Size(275, 81);
|
||||
barsukovTextBoxPhoneNumber.TabIndex = 3;
|
||||
barsukovTextBoxPhoneNumber.textBoxNumber = "";
|
||||
barsukovTextBoxPhoneNumber.Enter += barsukovTextBoxPhoneNumber_Enter;
|
||||
//
|
||||
// labelSkill
|
||||
//
|
||||
labelSkill.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
labelSkill.AutoSize = true;
|
||||
labelSkill.Location = new Point(35, 65);
|
||||
labelSkill.Name = "labelSkill";
|
||||
labelSkill.Size = new Size(57, 20);
|
||||
labelSkill.TabIndex = 4;
|
||||
labelSkill.Text = "Навык:";
|
||||
//
|
||||
// customSelectedCheckedListBoxProperty
|
||||
//
|
||||
customSelectedCheckedListBoxProperty.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
customSelectedCheckedListBoxProperty.Location = new Point(34, 84);
|
||||
customSelectedCheckedListBoxProperty.Margin = new Padding(3, 4, 3, 4);
|
||||
customSelectedCheckedListBoxProperty.Name = "customSelectedCheckedListBoxProperty";
|
||||
customSelectedCheckedListBoxProperty.SelectedElement = "";
|
||||
customSelectedCheckedListBoxProperty.Size = new Size(202, 207);
|
||||
customSelectedCheckedListBoxProperty.TabIndex = 5;
|
||||
//
|
||||
// buttonPhoto
|
||||
//
|
||||
buttonPhoto.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonPhoto.Location = new Point(35, 615);
|
||||
buttonPhoto.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonPhoto.Name = "buttonPhoto";
|
||||
buttonPhoto.Size = new Size(494, 48);
|
||||
buttonPhoto.TabIndex = 6;
|
||||
buttonPhoto.Text = "Загрузить фото";
|
||||
buttonPhoto.UseVisualStyleBackColor = true;
|
||||
buttonPhoto.Click += buttonPhoto_Click;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonSave.Location = new Point(309, 671);
|
||||
buttonSave.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(101, 41);
|
||||
buttonSave.TabIndex = 7;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += buttonSave_Click;
|
||||
//
|
||||
// buttonCancelAdd
|
||||
//
|
||||
buttonCancelAdd.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonCancelAdd.Location = new Point(427, 671);
|
||||
buttonCancelAdd.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonCancelAdd.Name = "buttonCancelAdd";
|
||||
buttonCancelAdd.Size = new Size(102, 41);
|
||||
buttonCancelAdd.TabIndex = 8;
|
||||
buttonCancelAdd.Text = "Отмена";
|
||||
buttonCancelAdd.UseVisualStyleBackColor = true;
|
||||
buttonCancelAdd.Click += buttonCancelAdd_Click;
|
||||
//
|
||||
// pictureBoxPhoto
|
||||
//
|
||||
pictureBoxPhoto.Location = new Point(35, 281);
|
||||
pictureBoxPhoto.Margin = new Padding(3, 4, 3, 4);
|
||||
pictureBoxPhoto.Name = "pictureBoxPhoto";
|
||||
pictureBoxPhoto.Size = new Size(493, 327);
|
||||
pictureBoxPhoto.TabIndex = 9;
|
||||
pictureBoxPhoto.TabStop = false;
|
||||
//
|
||||
// FormEmployee
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(559, 717);
|
||||
Controls.Add(pictureBoxPhoto);
|
||||
Controls.Add(buttonCancelAdd);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(buttonPhoto);
|
||||
Controls.Add(customSelectedCheckedListBoxProperty);
|
||||
Controls.Add(labelSkill);
|
||||
Controls.Add(barsukovTextBoxPhoneNumber);
|
||||
Controls.Add(labelPhoneNumber);
|
||||
Controls.Add(textBoxFIO);
|
||||
Controls.Add(labelFIO);
|
||||
Margin = new Padding(3, 4, 3, 4);
|
||||
Name = "FormEmployee";
|
||||
Text = "Сотрудник";
|
||||
Load += FormEmployee_Load;
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxPhoto).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label labelFIO;
|
||||
private TextBox textBoxFIO;
|
||||
private Label labelPhoneNumber;
|
||||
private BarsukovComponents.VisualComponents.CustomTextBox barsukovTextBoxPhoneNumber;
|
||||
private Label labelSkill;
|
||||
private BelianinComponents.CustomSelectedCheckedListBoxProperty customSelectedCheckedListBoxProperty;
|
||||
private Button buttonPhoto;
|
||||
private Button buttonSave;
|
||||
private Button buttonCancelAdd;
|
||||
private PictureBox pictureBoxPhoto;
|
||||
}
|
||||
}
|
@ -1,148 +0,0 @@
|
||||
using EnterpriseContracts.BindingModels;
|
||||
using EnterpriseContracts.BusinessLogicContracts;
|
||||
using EnterpriseContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace DesktopWithMyVisualComponents
|
||||
{
|
||||
public partial class FormEmployee : Form
|
||||
{
|
||||
public int Id { set { id = value; } }
|
||||
|
||||
private readonly IEmployeeLogic _logic;
|
||||
|
||||
private readonly ISkillLogic _logicS;
|
||||
|
||||
private string image = null;
|
||||
|
||||
private int? id;
|
||||
|
||||
public FormEmployee(IEmployeeLogic logic, ISkillLogic logicS)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logic = logic;
|
||||
_logicS = logicS;
|
||||
}
|
||||
|
||||
private void barsukovTextBoxPhoneNumber_Enter(object sender, EventArgs e)
|
||||
{
|
||||
ToolTip tt = new ToolTip();
|
||||
|
||||
// Формат записи телефона
|
||||
tt.Show("X-XXX-XX-XX", barsukovTextBoxPhoneNumber, 30, -20, 1000);
|
||||
}
|
||||
|
||||
private void FormEmployee_Load(object sender, EventArgs e)
|
||||
{
|
||||
barsukovTextBoxPhoneNumber.numberPattern = @"^\d{1}-\d{3}-\d{2}-\d{2}$";
|
||||
List<SkillViewModel> viewS = _logicS.Read(null);
|
||||
|
||||
if (viewS != null)
|
||||
{
|
||||
foreach (SkillViewModel skill in viewS)
|
||||
{
|
||||
customSelectedCheckedListBoxProperty.Items.Add(skill.Name);
|
||||
}
|
||||
}
|
||||
|
||||
if (id.HasValue)
|
||||
{
|
||||
try
|
||||
{
|
||||
EmployeeViewModel view = _logic.Read(new EmployeeBindingModel { Id = id.Value })?[0];
|
||||
|
||||
if (view != null)
|
||||
{
|
||||
textBoxFIO.Text = view.FIO;
|
||||
barsukovTextBoxPhoneNumber.textBoxNumber = view.PhoneNumber;
|
||||
customSelectedCheckedListBoxProperty.SelectedElement = view.Skill;
|
||||
|
||||
pictureBoxPhoto.Image = StringToImage(view.Photo);
|
||||
image = view.Photo;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Image StringToImage(string bytes)
|
||||
{
|
||||
byte[] arrayimg = Convert.FromBase64String(bytes);
|
||||
Image imageStr = Image.FromStream(new MemoryStream(arrayimg));
|
||||
|
||||
return imageStr;
|
||||
}
|
||||
|
||||
private string ImageToString(Image image)
|
||||
{
|
||||
using (var ms = new MemoryStream())
|
||||
{
|
||||
image.Save(ms, image.RawFormat);
|
||||
byte[] imageBytes = ms.ToArray();
|
||||
|
||||
// Convert byte[] to Base64 String
|
||||
string base64String = Convert.ToBase64String(imageBytes);
|
||||
return base64String;
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
List<SkillViewModel> viewS = _logicS.Read(null);
|
||||
|
||||
try
|
||||
{
|
||||
_logic.CreateOrUpdate(new EmployeeBindingModel
|
||||
{
|
||||
Id = id,
|
||||
FIO = textBoxFIO.Text,
|
||||
Photo = image,
|
||||
Skill = customSelectedCheckedListBoxProperty.SelectedElement,
|
||||
PhoneNumber = barsukovTextBoxPhoneNumber.textBoxNumber,
|
||||
});
|
||||
MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
DialogResult = DialogResult.OK;
|
||||
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonCancelAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void buttonPhoto_Click(object sender, EventArgs e)
|
||||
{
|
||||
var dialog = new OpenFileDialog();
|
||||
|
||||
dialog.Title = "Выберите изображение";
|
||||
dialog.Filter = "jpg files (*.jpg)|*.jpg";
|
||||
|
||||
if (dialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
var image_new = new Bitmap(dialog.FileName);
|
||||
pictureBoxPhoto.Image = image_new;
|
||||
image = ImageToString(image_new);
|
||||
}
|
||||
|
||||
dialog.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,120 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
@ -1,182 +0,0 @@
|
||||
namespace DesktopWithMyVisualComponents
|
||||
{
|
||||
partial class FormMain
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
components = new System.ComponentModel.Container();
|
||||
menuStrip = new MenuStrip();
|
||||
справочникиToolStripMenuItem = new ToolStripMenuItem();
|
||||
навыкиToolStripMenuItem = new ToolStripMenuItem();
|
||||
действияToolStripMenuItem = new ToolStripMenuItem();
|
||||
добавитьToolStripMenuItem = new ToolStripMenuItem();
|
||||
изменитьToolStripMenuItem = new ToolStripMenuItem();
|
||||
удалитьToolStripMenuItem = new ToolStripMenuItem();
|
||||
документыToolStripMenuItem = new ToolStripMenuItem();
|
||||
wordСФотоToolStripMenuItem = new ToolStripMenuItem();
|
||||
pdfТаблицаToolStripMenuItem = new ToolStripMenuItem();
|
||||
excelГистограммаToolStripMenuItem = new ToolStripMenuItem();
|
||||
wordWithImages = new BelianinComponents.WordWithImages(components);
|
||||
componentTableToPdf = new BarsukovComponents.NotVisualComponents.PdfTable(components);
|
||||
krykovItemTable = new KryukovLib.CustomDataGridView();
|
||||
excelGistogram = new KryukovLib.ExcelGistogram(components);
|
||||
menuStrip.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// menuStrip
|
||||
//
|
||||
menuStrip.ImageScalingSize = new Size(20, 20);
|
||||
menuStrip.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, действияToolStripMenuItem, документыToolStripMenuItem });
|
||||
menuStrip.Location = new Point(0, 0);
|
||||
menuStrip.Name = "menuStrip";
|
||||
menuStrip.Padding = new Padding(7, 3, 0, 3);
|
||||
menuStrip.Size = new Size(661, 30);
|
||||
menuStrip.TabIndex = 0;
|
||||
menuStrip.Text = "menuStrip";
|
||||
//
|
||||
// справочникиToolStripMenuItem
|
||||
//
|
||||
справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { навыкиToolStripMenuItem });
|
||||
справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
|
||||
справочникиToolStripMenuItem.Size = new Size(117, 24);
|
||||
справочникиToolStripMenuItem.Text = "Справочники";
|
||||
//
|
||||
// навыкиToolStripMenuItem
|
||||
//
|
||||
навыкиToolStripMenuItem.Name = "навыкиToolStripMenuItem";
|
||||
навыкиToolStripMenuItem.Size = new Size(146, 26);
|
||||
навыкиToolStripMenuItem.Text = "Навыки";
|
||||
навыкиToolStripMenuItem.Click += навыкиToolStripMenuItem_Click;
|
||||
//
|
||||
// действияToolStripMenuItem
|
||||
//
|
||||
действияToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { добавитьToolStripMenuItem, изменитьToolStripMenuItem, удалитьToolStripMenuItem });
|
||||
действияToolStripMenuItem.Name = "действияToolStripMenuItem";
|
||||
действияToolStripMenuItem.Size = new Size(88, 24);
|
||||
действияToolStripMenuItem.Text = "Действия";
|
||||
//
|
||||
// добавитьToolStripMenuItem
|
||||
//
|
||||
добавитьToolStripMenuItem.Name = "добавитьToolStripMenuItem";
|
||||
добавитьToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.A;
|
||||
добавитьToolStripMenuItem.Size = new Size(213, 26);
|
||||
добавитьToolStripMenuItem.Text = "Добавить";
|
||||
добавитьToolStripMenuItem.Click += добавитьToolStripMenuItem_Click;
|
||||
//
|
||||
// изменитьToolStripMenuItem
|
||||
//
|
||||
изменитьToolStripMenuItem.Name = "изменитьToolStripMenuItem";
|
||||
изменитьToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.U;
|
||||
изменитьToolStripMenuItem.Size = new Size(213, 26);
|
||||
изменитьToolStripMenuItem.Text = "Изменить";
|
||||
изменитьToolStripMenuItem.Click += изменитьToolStripMenuItem_Click;
|
||||
//
|
||||
// удалитьToolStripMenuItem
|
||||
//
|
||||
удалитьToolStripMenuItem.Name = "удалитьToolStripMenuItem";
|
||||
удалитьToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.D;
|
||||
удалитьToolStripMenuItem.Size = new Size(213, 26);
|
||||
удалитьToolStripMenuItem.Text = "Удалить";
|
||||
удалитьToolStripMenuItem.Click += удалитьToolStripMenuItem_Click;
|
||||
//
|
||||
// документыToolStripMenuItem
|
||||
//
|
||||
документыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { wordСФотоToolStripMenuItem, pdfТаблицаToolStripMenuItem, excelГистограммаToolStripMenuItem });
|
||||
документыToolStripMenuItem.Name = "документыToolStripMenuItem";
|
||||
документыToolStripMenuItem.Size = new Size(101, 24);
|
||||
документыToolStripMenuItem.Text = "Документы";
|
||||
//
|
||||
// wordСФотоToolStripMenuItem
|
||||
//
|
||||
wordСФотоToolStripMenuItem.Name = "wordСФотоToolStripMenuItem";
|
||||
wordСФотоToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.S;
|
||||
wordСФотоToolStripMenuItem.Size = new Size(271, 26);
|
||||
wordСФотоToolStripMenuItem.Text = "Word с фото";
|
||||
wordСФотоToolStripMenuItem.Click += wordСФотоToolStripMenuItem_Click;
|
||||
//
|
||||
// pdfТаблицаToolStripMenuItem
|
||||
//
|
||||
pdfТаблицаToolStripMenuItem.Name = "pdfТаблицаToolStripMenuItem";
|
||||
pdfТаблицаToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.T;
|
||||
pdfТаблицаToolStripMenuItem.Size = new Size(271, 26);
|
||||
pdfТаблицаToolStripMenuItem.Text = "Pdf таблица";
|
||||
pdfТаблицаToolStripMenuItem.Click += pdfТаблицаToolStripMenuItem_Click;
|
||||
//
|
||||
// excelГистограммаToolStripMenuItem
|
||||
//
|
||||
excelГистограммаToolStripMenuItem.Name = "excelГистограммаToolStripMenuItem";
|
||||
excelГистограммаToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.C;
|
||||
excelГистограммаToolStripMenuItem.Size = new Size(271, 26);
|
||||
excelГистограммаToolStripMenuItem.Text = "Excel гистограмма";
|
||||
excelГистограммаToolStripMenuItem.Click += excelГистограммаToolStripMenuItem_Click;
|
||||
//
|
||||
// krykovItemTable
|
||||
//
|
||||
krykovItemTable.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
krykovItemTable.Location = new Point(14, 36);
|
||||
krykovItemTable.Margin = new Padding(3, 5, 3, 5);
|
||||
krykovItemTable.Name = "krykovItemTable";
|
||||
krykovItemTable.Size = new Size(630, 477);
|
||||
krykovItemTable.TabIndex = 2;
|
||||
//
|
||||
// FormMain
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(661, 529);
|
||||
Controls.Add(krykovItemTable);
|
||||
Controls.Add(menuStrip);
|
||||
MainMenuStrip = menuStrip;
|
||||
Margin = new Padding(3, 4, 3, 4);
|
||||
Name = "FormMain";
|
||||
Text = "Главная";
|
||||
Load += FormMain_Load;
|
||||
menuStrip.ResumeLayout(false);
|
||||
menuStrip.PerformLayout();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private MenuStrip menuStrip;
|
||||
private ToolStripMenuItem справочникиToolStripMenuItem;
|
||||
private ToolStripMenuItem навыкиToolStripMenuItem;
|
||||
private ToolStripMenuItem действияToolStripMenuItem;
|
||||
private ToolStripMenuItem добавитьToolStripMenuItem;
|
||||
private ToolStripMenuItem изменитьToolStripMenuItem;
|
||||
private ToolStripMenuItem удалитьToolStripMenuItem;
|
||||
private ToolStripMenuItem документыToolStripMenuItem;
|
||||
private ToolStripMenuItem wordСФотоToolStripMenuItem;
|
||||
private ToolStripMenuItem pdfТаблицаToolStripMenuItem;
|
||||
private ToolStripMenuItem excelГистограммаToolStripMenuItem;
|
||||
private BelianinComponents.WordWithImages wordWithImages;
|
||||
private BarsukovComponents.NotVisualComponents.PdfTable componentTableToPdf;
|
||||
private KryukovLib.CustomDataGridView krykovItemTable;
|
||||
private KryukovLib.ExcelGistogram excelGistogram;
|
||||
}
|
||||
}
|
@ -1,248 +0,0 @@
|
||||
using BelianinComponents;
|
||||
using BelianinComponents.Models;
|
||||
using EnterpriseContracts.BindingModels;
|
||||
using EnterpriseContracts.BusinessLogicContracts;
|
||||
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 EnterpriseContracts.ViewModels;
|
||||
using EnterpriseDataBaseImplement.Models;
|
||||
using Unity;
|
||||
using BarsukovComponents.NotVisualComponents.Configs;
|
||||
|
||||
namespace DesktopWithMyVisualComponents
|
||||
{
|
||||
public partial class FormMain : Form
|
||||
{
|
||||
private readonly IEmployeeLogic _employeeLogic;
|
||||
|
||||
private readonly ISkillLogic _skillLogic;
|
||||
|
||||
// Конструктор
|
||||
public FormMain(IEmployeeLogic employeeLogic, ISkillLogic skillLogic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_employeeLogic = employeeLogic;
|
||||
|
||||
krykovItemTable.ConfigColumn(new()
|
||||
{
|
||||
ColumnsCount = 4,
|
||||
NameColumn = new string[] { "Id", "ФИО", "Навык", "Номер телефона" },
|
||||
Width = new int[] { 10, 150, 250, 200 },
|
||||
Visible = new bool[] { false, true, true, true },
|
||||
PropertiesObject = new string[] { "Id", "FIO", "Skill", "PhoneNumber" }
|
||||
});
|
||||
|
||||
_skillLogic = skillLogic;
|
||||
}
|
||||
|
||||
private void FormMain_Load(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
|
||||
private void LoadData()
|
||||
{
|
||||
try
|
||||
{
|
||||
krykovItemTable.ClearDataGrid();
|
||||
// Поиск записей в бд
|
||||
var list = _employeeLogic.Read(null);
|
||||
|
||||
if (list != null)
|
||||
{
|
||||
for (int j = 0; j < list.Count; j++)
|
||||
{
|
||||
krykovItemTable.AddItem(list[j], j);
|
||||
krykovItemTable.Update();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void добавитьToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var form = Program.Container.Resolve<FormEmployee>();
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
|
||||
private void изменитьToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var form = Program.Container.Resolve<FormEmployee>();
|
||||
|
||||
form.Id = Convert.ToInt32(krykovItemTable.GetSelectedObjectInRow<Employee>().Id);
|
||||
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
|
||||
private void удалитьToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (MessageBox.Show("Удалить запись", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
int id = Convert.ToInt32(krykovItemTable.GetSelectedObjectInRow<Employee>().Id);
|
||||
|
||||
try
|
||||
{
|
||||
_employeeLogic.Delete(new EmployeeBindingModel { Id = id });
|
||||
krykovItemTable.ClearDataGrid();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
|
||||
private void навыкиToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var form = Program.Container.Resolve<FormSkill>();
|
||||
|
||||
form.ShowDialog();
|
||||
}
|
||||
|
||||
private byte[] StringToImage(string bytes)
|
||||
{
|
||||
byte[] arrayimg = Convert.FromBase64String(bytes);
|
||||
|
||||
return arrayimg;
|
||||
}
|
||||
|
||||
private void wordСФотоToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
string fileName = "";
|
||||
|
||||
using (var dialog = new SaveFileDialog { Filter = "docx|*.docx" })
|
||||
{
|
||||
if (dialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
fileName = dialog.FileName.ToString();
|
||||
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
var list = _employeeLogic.Read(null);
|
||||
|
||||
var list_images = new List<byte[]>();
|
||||
|
||||
foreach (var item in list)
|
||||
{
|
||||
var img = StringToImage(item.Photo);
|
||||
list_images.Add(img);
|
||||
}
|
||||
|
||||
wordWithImages.CreateDoc(new WordWithImageConfig
|
||||
{
|
||||
FilePath = fileName,
|
||||
Header = "Фотографии:",
|
||||
Images = list_images
|
||||
});
|
||||
}
|
||||
|
||||
private void pdfТаблицаToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
string fileName = "";
|
||||
|
||||
using (var dialog = new
|
||||
SaveFileDialog
|
||||
{ Filter = "pdf|*.pdf" })
|
||||
{
|
||||
if (dialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
fileName = dialog.FileName.ToString();
|
||||
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
|
||||
// Вызов метода CreateTable
|
||||
componentTableToPdf.CreateDoc(new ComponentTableToPdfConfig<EmployeeViewModel>
|
||||
{
|
||||
// Путь к файлу
|
||||
FilePath = fileName,
|
||||
// Заголовок таблицы
|
||||
Header = "Таблица с сотрудниками",
|
||||
UseUnion = true,
|
||||
// Информация о колонках
|
||||
ColumnsRowsWidth = new List<(int, int)> { (20, 0), (20, 0), (20, 0), (20, 0) },
|
||||
// Объединённые ячейки
|
||||
ColumnUnion = new List<(int StartIndex, int Count)> { (2, 2) },
|
||||
|
||||
Headers = new List<(int ColumnIndex, int RowIndex, string Header, string PropertyName)>()
|
||||
{
|
||||
(0, 0, "Идент.", "Id"),
|
||||
(1, 0, "ФИО", "FIO"),
|
||||
(2, 0, "Работа", ""),
|
||||
(2, 1, "Номер телефона", "PhoneNumber"),
|
||||
(3, 1, "Навык", "Skill")
|
||||
},
|
||||
|
||||
// Данные для таблицы
|
||||
Data = _employeeLogic.Read(null)
|
||||
});
|
||||
}
|
||||
|
||||
private void excelГистограммаToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
string fileName = "";
|
||||
|
||||
using (var dialog = new SaveFileDialog { Filter = "xlsx|*.xlsx" })
|
||||
{
|
||||
if (dialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
fileName = dialog.FileName.ToString();
|
||||
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
|
||||
var list2D = new List<(string Date, double Value)>();
|
||||
|
||||
var emps = _employeeLogic.Read(null);
|
||||
var skills = _skillLogic.Read(null);
|
||||
|
||||
foreach (var skill in skills)
|
||||
{
|
||||
double count = 0;
|
||||
|
||||
foreach (var emp in emps)
|
||||
{
|
||||
if (skill.Name.Equals(emp.Skill))
|
||||
{
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
var elem = (skill.Name, count);
|
||||
list2D.Add(elem);
|
||||
}
|
||||
|
||||
excelGistogram.CreateDoc(new()
|
||||
{
|
||||
FilePath = fileName,
|
||||
Header = "Chart",
|
||||
ChartTitle = "BarChart",
|
||||
LegendLocation = KryukovLib.Models.Location.Top,
|
||||
Data = new Dictionary<string, List<(string Date, double Value)>>
|
||||
{
|
||||
{ "Series 1", list2D }
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -1,132 +0,0 @@
|
||||
<?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>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="wordWithImages.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>508, 17</value>
|
||||
</metadata>
|
||||
<metadata name="componentTableToPdf.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>145, 17</value>
|
||||
</metadata>
|
||||
<metadata name="excelGistogram.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>349, 17</value>
|
||||
</metadata>
|
||||
</root>
|
@ -1,66 +0,0 @@
|
||||
namespace DesktopWithMyVisualComponents
|
||||
{
|
||||
partial class FormSkill
|
||||
{
|
||||
/// <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.dataGridView = new System.Windows.Forms.DataGridView();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// dataGridView
|
||||
//
|
||||
this.dataGridView.AllowUserToAddRows = false;
|
||||
this.dataGridView.AllowUserToDeleteRows = false;
|
||||
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dataGridView.Location = new System.Drawing.Point(12, 12);
|
||||
this.dataGridView.Name = "dataGridView";
|
||||
this.dataGridView.RowTemplate.Height = 25;
|
||||
this.dataGridView.Size = new System.Drawing.Size(247, 150);
|
||||
this.dataGridView.TabIndex = 0;
|
||||
this.dataGridView.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView_CellEndEdit);
|
||||
this.dataGridView.KeyDown += new System.Windows.Forms.KeyEventHandler(this.dataGridView_KeyDown);
|
||||
//
|
||||
// FormSkill
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(271, 180);
|
||||
this.Controls.Add(this.dataGridView);
|
||||
this.Name = "FormSkill";
|
||||
this.Text = "Навыки";
|
||||
this.Load += new System.EventHandler(this.FormSkill_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DataGridView dataGridView;
|
||||
}
|
||||
}
|
@ -1,145 +0,0 @@
|
||||
using EnterpriseContracts.BindingModels;
|
||||
using EnterpriseContracts.BusinessLogicContracts;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace DesktopWithMyVisualComponents
|
||||
{
|
||||
public partial class FormSkill : Form
|
||||
{
|
||||
private readonly ISkillLogic _skillLogic;
|
||||
|
||||
BindingList<SkillBindingModel> list;
|
||||
|
||||
public FormSkill(ISkillLogic skillLogic)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
_skillLogic = skillLogic;
|
||||
dataGridView.AllowUserToDeleteRows = true;
|
||||
list = new BindingList<SkillBindingModel>();
|
||||
}
|
||||
|
||||
private void LoadData()
|
||||
{
|
||||
try
|
||||
{
|
||||
var list1 = _skillLogic.Read(null);
|
||||
list.Clear();
|
||||
|
||||
foreach (var item in list1)
|
||||
{
|
||||
list.Add(new SkillBindingModel
|
||||
{
|
||||
Id = item.Id,
|
||||
Name = item.Name,
|
||||
});
|
||||
}
|
||||
|
||||
if (list != null)
|
||||
{
|
||||
dataGridView.DataSource = list;
|
||||
dataGridView.Columns[0].Visible = false;
|
||||
dataGridView.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void FormSkill_Load(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
|
||||
private void dataGridView_CellEndEdit(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
var typeName = (string)dataGridView.CurrentRow.Cells[1].Value;
|
||||
|
||||
if (!string.IsNullOrEmpty(typeName))
|
||||
{
|
||||
if (dataGridView.CurrentRow.Cells[0].Value != null)
|
||||
{
|
||||
_skillLogic.CreateOrUpdate(new SkillBindingModel()
|
||||
{
|
||||
Id = Convert.ToInt32(dataGridView.CurrentRow.Cells[0].Value),
|
||||
Name = (string)dataGridView.CurrentRow.Cells[1].EditedFormattedValue
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
_skillLogic.CreateOrUpdate(new SkillBindingModel()
|
||||
{
|
||||
Name = (string)dataGridView.CurrentRow.Cells[1].EditedFormattedValue
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Введена пустая строка", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
LoadData();
|
||||
}
|
||||
|
||||
private void dataGridView_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.KeyData == Keys.Insert)
|
||||
{
|
||||
if (dataGridView.Rows.Count == 0)
|
||||
{
|
||||
list.Add(new SkillBindingModel());
|
||||
dataGridView.DataSource = new List<SkillBindingModel>(list);
|
||||
dataGridView.CurrentCell = dataGridView.Rows[0].Cells[1];
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (dataGridView.Rows[dataGridView.Rows.Count - 1].Cells[1].Value != null)
|
||||
{
|
||||
list.Add(new SkillBindingModel());
|
||||
dataGridView.DataSource = new List<SkillBindingModel>(list);
|
||||
dataGridView.CurrentCell = dataGridView.Rows[dataGridView.Rows.Count - 1].Cells[1];
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (e.KeyData == Keys.Delete)
|
||||
{
|
||||
if (dataGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
|
||||
try
|
||||
{
|
||||
if (!_skillLogic.Delete(new SkillBindingModel() { Id = id }))
|
||||
{
|
||||
throw new Exception("Ошибка при удалении");
|
||||
}
|
||||
|
||||
dataGridView.Rows.RemoveAt(dataGridView.SelectedRows[0].Index);
|
||||
|
||||
LoadData();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,120 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
@ -1,50 +0,0 @@
|
||||
using EnterpriseBusinessLogic.BusinessLogics;
|
||||
using EnterpriseContracts.BusinessLogicContracts;
|
||||
using EnterpriseContracts.StorageContracts;
|
||||
using EnterpriseDataBaseImplement.Implements;
|
||||
using Unity;
|
||||
using Unity.Lifetime;
|
||||
|
||||
namespace DesktopWithMyVisualComponents
|
||||
{
|
||||
internal static class Program
|
||||
{
|
||||
private static IUnityContainer container = null;
|
||||
|
||||
public static IUnityContainer Container
|
||||
{
|
||||
get
|
||||
{
|
||||
if (container == null)
|
||||
{
|
||||
container = BuildUnityContainer();
|
||||
}
|
||||
return container;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
Application.SetHighDpiMode(HighDpiMode.SystemAware);
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(Container.Resolve<FormMain>());
|
||||
}
|
||||
private static IUnityContainer BuildUnityContainer()
|
||||
{
|
||||
var currentContainer = new UnityContainer();
|
||||
|
||||
currentContainer.RegisterType<IEmployeeStorage, EmployeeStorage>(new HierarchicalLifetimeManager());
|
||||
currentContainer.RegisterType<ISkillStorage, SkillStorage>(new HierarchicalLifetimeManager());
|
||||
|
||||
currentContainer.RegisterType<IEmployeeLogic, EmployeeLogic>(new HierarchicalLifetimeManager());
|
||||
currentContainer.RegisterType<ISkillLogic, SkillLogic>(new HierarchicalLifetimeManager());
|
||||
|
||||
return currentContainer;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,83 +0,0 @@
|
||||
using EnterpriseContracts.BindingModels;
|
||||
using EnterpriseContracts.BusinessLogicContracts;
|
||||
using EnterpriseContracts.StorageContracts;
|
||||
using EnterpriseContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EnterpriseBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class EmployeeLogic : IEmployeeLogic
|
||||
{
|
||||
private readonly IEmployeeStorage _employeeStorage;
|
||||
|
||||
public EmployeeLogic(IEmployeeStorage employeeStorage)
|
||||
{
|
||||
_employeeStorage = employeeStorage;
|
||||
}
|
||||
|
||||
// Создание и обновление записи о работнике
|
||||
public void CreateOrUpdate(EmployeeBindingModel model)
|
||||
{
|
||||
var element = _employeeStorage.GetElement(new EmployeeBindingModel
|
||||
{
|
||||
FIO = model.FIO
|
||||
});
|
||||
|
||||
if (element != null && element.Id != model.Id)
|
||||
{
|
||||
throw new Exception("Сотрудник с таким именем уже существует");
|
||||
}
|
||||
|
||||
// Если уже создан, то обновляем, иначе создаём
|
||||
if (model.Id.HasValue)
|
||||
{
|
||||
_employeeStorage.Update(model);
|
||||
}
|
||||
else
|
||||
{
|
||||
_employeeStorage.Insert(model);
|
||||
}
|
||||
}
|
||||
|
||||
// Удаление записи о работнике
|
||||
public void Delete(EmployeeBindingModel model)
|
||||
{
|
||||
var element = _employeeStorage.GetElement(new EmployeeBindingModel
|
||||
{
|
||||
Id = model.Id
|
||||
});
|
||||
|
||||
if (element == null)
|
||||
{
|
||||
throw new Exception("Сотрудник не найден");
|
||||
}
|
||||
|
||||
_employeeStorage.Delete(model);
|
||||
}
|
||||
|
||||
// Чтение записей о работнике
|
||||
public List<EmployeeViewModel> Read(EmployeeBindingModel model)
|
||||
{
|
||||
// Если неконкретная запись, то выводим все
|
||||
if (model == null)
|
||||
{
|
||||
return _employeeStorage.GetFullList();
|
||||
}
|
||||
|
||||
// Если конкретная запись о навыке
|
||||
if (model.Id.HasValue)
|
||||
{
|
||||
return new List<EmployeeViewModel>
|
||||
{
|
||||
_employeeStorage.GetElement(model)
|
||||
};
|
||||
}
|
||||
|
||||
return _employeeStorage.GetFullList();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,89 +0,0 @@
|
||||
using EnterpriseContracts.BindingModels;
|
||||
using EnterpriseContracts.BusinessLogicContracts;
|
||||
using EnterpriseContracts.StorageContracts;
|
||||
using EnterpriseContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EnterpriseBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class SkillLogic : ISkillLogic
|
||||
{
|
||||
private readonly ISkillStorage _skillStorage;
|
||||
|
||||
public SkillLogic(ISkillStorage skillStorage)
|
||||
{
|
||||
_skillStorage = skillStorage;
|
||||
}
|
||||
|
||||
// Создание и обновление записи о навыке
|
||||
public void CreateOrUpdate(SkillBindingModel model)
|
||||
{
|
||||
var element = _skillStorage.GetElement(
|
||||
new SkillBindingModel
|
||||
{
|
||||
Name = model.Name
|
||||
});
|
||||
|
||||
if (element != null && element.Id != model.Id)
|
||||
{
|
||||
throw new Exception("Такой навык уже существует");
|
||||
}
|
||||
|
||||
// Если уже создан, то обновляем, иначе создаём
|
||||
if (model.Id.HasValue)
|
||||
{
|
||||
_skillStorage.Update(model);
|
||||
}
|
||||
else
|
||||
{
|
||||
_skillStorage.Insert(model);
|
||||
}
|
||||
}
|
||||
|
||||
// Удаление записи о навыке
|
||||
public bool Delete(SkillBindingModel model)
|
||||
{
|
||||
var element = _skillStorage.GetElement(new SkillBindingModel
|
||||
{
|
||||
Id = model.Id
|
||||
});
|
||||
|
||||
if (element == null)
|
||||
{
|
||||
throw new Exception("Навык не найден");
|
||||
}
|
||||
|
||||
if (_skillStorage.Delete(model) == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Чтение записей о навыках
|
||||
public List<SkillViewModel> Read(SkillBindingModel model)
|
||||
{
|
||||
// Если неконкретная запись, то выводим все
|
||||
if (model == null)
|
||||
{
|
||||
return _skillStorage.GetFullList();
|
||||
}
|
||||
|
||||
// Если конкретная запись о навыке
|
||||
if (model.Id.HasValue)
|
||||
{
|
||||
return new List<SkillViewModel>
|
||||
{
|
||||
_skillStorage.GetElement(model)
|
||||
};
|
||||
}
|
||||
|
||||
return _skillStorage.GetFilteredList(model);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\EnterpriseContracts\EnterpriseContracts.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -1,21 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EnterpriseContracts.BindingModels
|
||||
{
|
||||
public class EmployeeBindingModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
|
||||
public string Skill { get; set; }
|
||||
|
||||
public string Photo { get; set; }
|
||||
|
||||
public string FIO { get; set; }
|
||||
|
||||
public string PhoneNumber { get; set; }
|
||||
}
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EnterpriseContracts.BindingModels
|
||||
{
|
||||
public class SkillBindingModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
using EnterpriseContracts.BindingModels;
|
||||
using EnterpriseContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EnterpriseContracts.BusinessLogicContracts
|
||||
{
|
||||
public interface IEmployeeLogic
|
||||
{
|
||||
List<EmployeeViewModel> Read(EmployeeBindingModel model);
|
||||
|
||||
void CreateOrUpdate(EmployeeBindingModel model);
|
||||
|
||||
void Delete(EmployeeBindingModel model);
|
||||
}
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
using EnterpriseContracts.BindingModels;
|
||||
using EnterpriseContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EnterpriseContracts.BusinessLogicContracts
|
||||
{
|
||||
public interface ISkillLogic
|
||||
{
|
||||
List<SkillViewModel> Read(SkillBindingModel model);
|
||||
|
||||
void CreateOrUpdate(SkillBindingModel model);
|
||||
|
||||
bool Delete(SkillBindingModel model);
|
||||
}
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
@ -1,25 +0,0 @@
|
||||
using EnterpriseContracts.BindingModels;
|
||||
using EnterpriseContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EnterpriseContracts.StorageContracts
|
||||
{
|
||||
public interface IEmployeeStorage
|
||||
{
|
||||
List<EmployeeViewModel> GetFullList();
|
||||
|
||||
List<EmployeeViewModel> GetFilteredList(EmployeeBindingModel model);
|
||||
|
||||
EmployeeViewModel GetElement(EmployeeBindingModel model);
|
||||
|
||||
void Insert(EmployeeBindingModel model);
|
||||
|
||||
void Update(EmployeeBindingModel model);
|
||||
|
||||
void Delete(EmployeeBindingModel model);
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
using EnterpriseContracts.BindingModels;
|
||||
using EnterpriseContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EnterpriseContracts.StorageContracts
|
||||
{
|
||||
public interface ISkillStorage
|
||||
{
|
||||
List<SkillViewModel> GetFullList();
|
||||
|
||||
List<SkillViewModel> GetFilteredList(SkillBindingModel model);
|
||||
|
||||
SkillViewModel GetElement(SkillBindingModel model);
|
||||
|
||||
void Insert(SkillBindingModel model);
|
||||
|
||||
void Update(SkillBindingModel model);
|
||||
|
||||
bool Delete(SkillBindingModel model);
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EnterpriseContracts.ViewModels
|
||||
{
|
||||
public class EmployeeViewModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
|
||||
[DisplayName("Навык")]
|
||||
public string Skill { get; set; }
|
||||
|
||||
public string Photo { get; set; }
|
||||
|
||||
[DisplayName("ФИО")]
|
||||
public string FIO { get; set; }
|
||||
|
||||
[DisplayName("Номер телефона")]
|
||||
public string PhoneNumber { get; set; }
|
||||
}
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EnterpriseContracts.ViewModels
|
||||
{
|
||||
public class SkillViewModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
using EnterpriseDataBaseImplement.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EnterpriseDataBaseImplement
|
||||
{
|
||||
public class EnterpriseDataBase : DbContext
|
||||
{
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
if (optionsBuilder.IsConfigured == false)
|
||||
{
|
||||
optionsBuilder.UseSqlServer(@"Data Source=localhost\SQLEXPRESS;Initial Catalog=EnterpriseDataBase;Integrated Security=True;MultipleActiveResultSets=True; TrustServerCertificate=True");
|
||||
}
|
||||
|
||||
base.OnConfiguring(optionsBuilder);
|
||||
}
|
||||
|
||||
public virtual DbSet<Employee> Employees { set; get; }
|
||||
|
||||
public virtual DbSet<Skill> Skills { set; get; }
|
||||
}
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.11" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Analyzers" Version="7.0.11" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.11">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.11" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.11">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\EnterpriseContracts\EnterpriseContracts.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -1,135 +0,0 @@
|
||||
using EnterpriseContracts.BindingModels;
|
||||
using EnterpriseContracts.StorageContracts;
|
||||
using EnterpriseContracts.ViewModels;
|
||||
using EnterpriseDataBaseImplement.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EnterpriseDataBaseImplement.Implements
|
||||
{
|
||||
public class EmployeeStorage : IEmployeeStorage
|
||||
{
|
||||
// Создание работника
|
||||
private static Employee CreateModel(EmployeeBindingModel model, Employee employee)
|
||||
{
|
||||
employee.FIO = model.FIO;
|
||||
employee.Skill = model.Skill;
|
||||
employee.PhoneNumber = model.PhoneNumber;
|
||||
employee.Photo = model.Photo;
|
||||
|
||||
return employee;
|
||||
}
|
||||
|
||||
private EmployeeViewModel CreateModel(Employee employee)
|
||||
{
|
||||
return new EmployeeViewModel
|
||||
{
|
||||
Id = employee.Id,
|
||||
FIO = employee.FIO,
|
||||
Photo = employee.Photo,
|
||||
PhoneNumber = employee.PhoneNumber,
|
||||
Skill = employee.Skill
|
||||
};
|
||||
}
|
||||
|
||||
// Добавление работника
|
||||
public void Insert(EmployeeBindingModel model)
|
||||
{
|
||||
var context = new EnterpriseDataBase();
|
||||
var transaction = context.Database.BeginTransaction();
|
||||
|
||||
try
|
||||
{
|
||||
context.Employees.Add(CreateModel(model, new Employee()));
|
||||
context.SaveChanges();
|
||||
transaction.Commit();
|
||||
}
|
||||
catch
|
||||
{
|
||||
transaction.Rollback();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
// Обновление данных о работнике
|
||||
public void Update(EmployeeBindingModel model)
|
||||
{
|
||||
var context = new EnterpriseDataBase();
|
||||
var transaction = context.Database.BeginTransaction();
|
||||
|
||||
try
|
||||
{
|
||||
var employee = context.Employees.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
|
||||
if (employee == null)
|
||||
{
|
||||
throw new Exception("Сотрудник не найден");
|
||||
}
|
||||
|
||||
CreateModel(model, employee);
|
||||
context.SaveChanges();
|
||||
transaction.Commit();
|
||||
}
|
||||
catch
|
||||
{
|
||||
transaction.Rollback();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void Delete(EmployeeBindingModel model)
|
||||
{
|
||||
var context = new EnterpriseDataBase();
|
||||
var employee = context.Employees.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
|
||||
if (employee != null)
|
||||
{
|
||||
context.Employees.Remove(employee);
|
||||
context.SaveChanges();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("Сотрудник не найден");
|
||||
}
|
||||
}
|
||||
|
||||
// Получение записи о работнике
|
||||
public EmployeeViewModel GetElement(EmployeeBindingModel model)
|
||||
{
|
||||
// Если пусто
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
using var context = new EnterpriseDataBase();
|
||||
|
||||
var employee = context.Employees.ToList()
|
||||
.FirstOrDefault(rec => rec.FIO == model.FIO || rec.Id == model.Id);
|
||||
|
||||
return employee != null ? CreateModel(employee) : null;
|
||||
}
|
||||
|
||||
// Получение отфильтрованного списка
|
||||
public List<EmployeeViewModel> GetFilteredList(EmployeeBindingModel model)
|
||||
{
|
||||
var context = new EnterpriseDataBase();
|
||||
|
||||
return context.Employees
|
||||
.Where(employee => employee.FIO.Contains(model.FIO) && employee.Skill.Contains(model.Skill))
|
||||
.ToList().Select(CreateModel).ToList();
|
||||
}
|
||||
|
||||
// Получение всех записей
|
||||
public List<EmployeeViewModel> GetFullList()
|
||||
{
|
||||
using (var context = new EnterpriseDataBase())
|
||||
{
|
||||
return context.Employees.ToList().Select(CreateModel).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,133 +0,0 @@
|
||||
using EnterpriseContracts.BindingModels;
|
||||
using EnterpriseContracts.StorageContracts;
|
||||
using EnterpriseContracts.ViewModels;
|
||||
using EnterpriseDataBaseImplement.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EnterpriseDataBaseImplement.Implements
|
||||
{
|
||||
public class SkillStorage : ISkillStorage
|
||||
{
|
||||
// Создание навыка
|
||||
private static Skill CreateModel(SkillBindingModel model, Skill skill)
|
||||
{
|
||||
skill.Name = model.Name;
|
||||
return skill;
|
||||
}
|
||||
|
||||
private static SkillViewModel CreateModel(Skill skill)
|
||||
{
|
||||
return new SkillViewModel
|
||||
{
|
||||
Id = skill.Id,
|
||||
Name = skill.Name
|
||||
};
|
||||
}
|
||||
|
||||
// Добавление навыка
|
||||
public void Insert(SkillBindingModel model)
|
||||
{
|
||||
var context = new EnterpriseDataBase();
|
||||
var transaction = context.Database.BeginTransaction();
|
||||
|
||||
try
|
||||
{
|
||||
context.Skills.Add(CreateModel(model, new Skill()));
|
||||
context.SaveChanges();
|
||||
transaction.Commit();
|
||||
}
|
||||
catch
|
||||
{
|
||||
transaction.Rollback();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
// Обновление навыка
|
||||
public void Update(SkillBindingModel model)
|
||||
{
|
||||
var context = new EnterpriseDataBase();
|
||||
var transaction = context.Database.BeginTransaction();
|
||||
|
||||
try
|
||||
{
|
||||
var skill = context.Skills.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
|
||||
// Навык не найден -> исключение
|
||||
if (skill == null)
|
||||
{
|
||||
throw new Exception("Навык не найден :(");
|
||||
}
|
||||
|
||||
CreateModel(model, skill);
|
||||
context.SaveChanges();
|
||||
transaction.Commit();
|
||||
}
|
||||
catch
|
||||
{
|
||||
transaction.Rollback();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
// Удаление навыка
|
||||
public bool Delete(SkillBindingModel model)
|
||||
{
|
||||
var context = new EnterpriseDataBase();
|
||||
var skill = context.Skills.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
|
||||
if (skill != null)
|
||||
{
|
||||
context.Skills.Remove(skill);
|
||||
context.SaveChanges();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("Навык не найден");
|
||||
}
|
||||
}
|
||||
|
||||
// Получение записи о навыке
|
||||
public SkillViewModel GetElement(SkillBindingModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
using var context = new EnterpriseDataBase();
|
||||
|
||||
var skill = context.Skills.ToList().FirstOrDefault(rec => rec.Id == model.Id || rec.Name == model.Name);
|
||||
|
||||
return skill != null ? CreateModel(skill) : null;
|
||||
}
|
||||
|
||||
// Получение фильтрованного списка
|
||||
public List<SkillViewModel> GetFilteredList(SkillBindingModel model)
|
||||
{
|
||||
// Если пусто
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
using var context = new EnterpriseDataBase();
|
||||
|
||||
return context.Skills.Where(rec => rec.Name.Contains(model.Name))
|
||||
.Select(CreateModel).ToList();
|
||||
}
|
||||
|
||||
// Получение всего списка навыков
|
||||
public List<SkillViewModel> GetFullList()
|
||||
{
|
||||
using var context = new EnterpriseDataBase();
|
||||
|
||||
return context.Skills.Select(CreateModel).ToList();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,75 +0,0 @@
|
||||
// <auto-generated />
|
||||
using EnterpriseDataBaseImplement;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace EnterpriseDataBaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(EnterpriseDataBase))]
|
||||
[Migration("20241022142146_Initial")]
|
||||
partial class Initial
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.11")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("EnterpriseDataBaseImplement.Models.Employee", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("FIO")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("PhoneNumber")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Photo")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Skill")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Employees");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("EnterpriseDataBaseImplement.Models.Skill", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Skills");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -1,53 +0,0 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace EnterpriseDataBaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Initial : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Employees",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
Skill = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Photo = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
FIO = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
PhoneNumber = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Employees", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Skills",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Skills", x => x.Id);
|
||||
});
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "Employees");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Skills");
|
||||
}
|
||||
}
|
||||
}
|
@ -1,72 +0,0 @@
|
||||
// <auto-generated />
|
||||
using EnterpriseDataBaseImplement;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace EnterpriseDataBaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(EnterpriseDataBase))]
|
||||
partial class EnterpriseDataBaseModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.11")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("EnterpriseDataBaseImplement.Models.Employee", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("FIO")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("PhoneNumber")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Photo")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Skill")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Employees");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("EnterpriseDataBaseImplement.Models.Skill", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Skills");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EnterpriseDataBaseImplement.Models
|
||||
{
|
||||
public class Employee
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
public string Skill { get; set; }
|
||||
|
||||
[Required]
|
||||
public string Photo { get; set; }
|
||||
|
||||
[Required]
|
||||
public string FIO { get; set; }
|
||||
|
||||
[Required]
|
||||
public string PhoneNumber { get; set; }
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EnterpriseDataBaseImplement.Models
|
||||
{
|
||||
public class Skill
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user