Compare commits

..

No commits in common. "lab3" and "main" have entirely different histories.
lab3 ... main

69 changed files with 0 additions and 4221 deletions

View File

@ -1,14 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="PDFsharp-MigraDoc-GDI" Version="6.1.1" />
</ItemGroup>
</Project>

View File

@ -1,14 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BarsukovComponents.Exceptions
{
public class CustomException: Exception
{
public CustomException() { }
public CustomException(string message) : base(message) { }
}
}

View File

@ -1,22 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BarsukovComponents.NotVisualComponents.Configs
{
public class ColumnInfo
{
public string PropertyName;
public string Header;
public int Width;
public ColumnInfo(string propertyName, string header, int width)
{
PropertyName = propertyName;
Header = header;
Width = width;
}
}
}

View File

@ -1,13 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BarsukovComponents.NotVisualComponents.Configs
{
public enum LengendAlign
{
top, bottom, left, right
}
}

View File

@ -1,20 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BarsukovComponents.NotVisualComponents.Configs
{
public class MergeCells
{
public string Header;
public int[] Indexes;
public MergeCells(string header, int[] indexes)
{
Header=header;
Indexes=indexes;
}
}
}

View File

@ -1,15 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BarsukovComponents.NotVisualComponents.Configs
{
public class TextPdfConf
{
public string Filename { get; set; } = string.Empty;
public string Title { get; set; } = string.Empty;
public List<string> Rows { get; set; } = new();
}
}

View File

@ -1,36 +0,0 @@
namespace BarsukovComponents.NotVisualComponents
{
partial class PdfDiagram
{
/// <summary>
/// Обязательная переменная конструктора.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Освободить все используемые ресурсы.
/// </summary>
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Код, автоматически созданный конструктором компонентов
/// <summary>
/// Требуемый метод для поддержки конструктора — не изменяйте
/// содержимое этого метода с помощью редактора кода.
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
}
#endregion
}
}

View File

@ -1,87 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BarsukovComponents.NotVisualComponents.Configs;
using PdfSharp.Charting;
using PdfSharp.Drawing;
using PdfSharp.Pdf;
namespace BarsukovComponents.NotVisualComponents
{
public partial class PdfDiagram : Component
{
public PdfDiagram()
{
InitializeComponent();
}
public PdfDiagram(IContainer container)
{
container.Add(this);
InitializeComponent();
}
public void CreateDiagram(string filename, string title, string diagramName, Dictionary<string, List<double>> data, LengendAlign legendAlign = LengendAlign.bottom)
{
if (string.IsNullOrEmpty(filename))
{
throw new ArgumentNullException("Enter filemale");
}
if (string.IsNullOrEmpty(title))
{
throw new ArgumentNullException("Enter title");
}
if (data.Count == 0)
{
throw new ArgumentNullException("Enter data");
}
Chart chart = new Chart(ChartType.Line);
chart.Legend.Docking = (DockingType)legendAlign;
chart.Legend.LineFormat.Visible = true;
foreach (var item in data)
{
Series series = chart.SeriesCollection.AddSeries();
series.Name = item.Key;
double[] values = new double[item.Value.Count];
for (int i = 0; i < item.Value.Count; i++)
{
values.SetValue(Convert.ToDouble(item.Value[i]), i);
}
series.Add(values);
}
chart.XAxis.MajorTickMark = TickMarkType.Outside;
chart.YAxis.MajorTickMark = TickMarkType.Cross;
chart.PlotArea.LineFormat.Color = XColors.Black;
chart.PlotArea.LineFormat.Visible = true;
chart.PlotArea.FillFormat.Color = XColors.White;
chart.Legend.LineFormat.Visible = true;
ChartFrame chartFrame = new ChartFrame();
chartFrame.Location = new XPoint(50, 70);
chartFrame.Size = new XSize(500, 400);
chartFrame.Add(chart);
PdfDocument document = new PdfDocument(filename);
PdfPage page = document.AddPage();
page.Size = PdfSharp.PageSize.A4;
XGraphics gfx = XGraphics.FromPdfPage(page);
gfx.DrawString(title, new XFont("Times new Roman", 20, XFontStyleEx.Bold), XBrushes.Black, new XRect(20, 20, page.Width, page.Height), XStringFormats.TopCenter);
gfx.DrawString(diagramName, new XFont("Times new Roman", 14), XBrushes.Black, new XRect(20, 40, page.Width, page.Height), XStringFormats.TopCenter);
chartFrame.DrawChart(gfx);
document.Close();
}
}
}

View File

@ -1,36 +0,0 @@
namespace BarsukovComponents.NotVisualComponents
{
partial class PdfHugeText
{
/// <summary>
/// Обязательная переменная конструктора.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Освободить все используемые ресурсы.
/// </summary>
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Код, автоматически созданный конструктором компонентов
/// <summary>
/// Требуемый метод для поддержки конструктора — не изменяйте
/// содержимое этого метода с помощью редактора кода.
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
}
#endregion
}
}

View File

@ -1,56 +0,0 @@
using BarsukovComponents.NotVisualComponents.Configs;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using MigraDoc;
using MigraDoc.DocumentObjectModel;
using PdfSharp.Pdf;
using MigraDoc.Rendering;
using BarsukovComponents.Exceptions;
namespace BarsukovComponents.NotVisualComponents
{
public partial class PdfHugeText : Component
{
public PdfHugeText()
{
InitializeComponent();
}
public PdfHugeText(IContainer container)
{
container.Add(this);
InitializeComponent();
}
public void CreatePdf(TextPdfConf conf)
{
if (string.IsNullOrEmpty(conf.Filename) || string.IsNullOrEmpty(conf.Title) || conf.Rows.Count == 0)
{
throw new CustomException("Путь до файла, заголовок или текст пусты");
}
Document document = new Document();
Section section = document.AddSection();
Paragraph paragraphTitle = section.AddParagraph();
paragraphTitle.AddText(conf.Title);
paragraphTitle.Format.Font.Bold = true;
paragraphTitle.Format.Font.Size = 20;
paragraphTitle.Format.SpaceAfter = "0.3cm";
Paragraph paragraph = section.AddParagraph();
paragraph.Format.Font.Size = 14;
foreach (var row in conf.Rows)
{
paragraph.AddText(row + '\n');
}
var renderer = new PdfDocumentRenderer(true);
renderer.Document = document;
renderer.RenderDocument();
renderer.PdfDocument.Save(conf.Filename);
}
}
}

View File

@ -1,36 +0,0 @@
namespace BarsukovComponents.NotVisualComponents
{
partial class PdfTable
{
/// <summary>
/// Обязательная переменная конструктора.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Освободить все используемые ресурсы.
/// </summary>
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Код, автоматически созданный конструктором компонентов
/// <summary>
/// Требуемый метод для поддержки конструктора — не изменяйте
/// содержимое этого метода с помощью редактора кода.
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
}
#endregion
}
}

View File

@ -1,150 +0,0 @@
using BarsukovComponents.NotVisualComponents.Configs;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using MigraDoc;
using MigraDoc.DocumentObjectModel;
using PdfSharp.Pdf;
using MigraDoc.Rendering;
using BarsukovComponents.Exceptions;
namespace BarsukovComponents.NotVisualComponents
{
public partial class PdfTable : Component
{
public PdfTable()
{
InitializeComponent();
}
public PdfTable(IContainer container)
{
container.Add(this);
InitializeComponent();
}
public void CreateTable<T>(string docPath, string title, List<MergeCells>? mergeCells, List<ColumnInfo> colInfo, List<T> data) where T : class, new()
{
if (string.IsNullOrEmpty(docPath))
{
throw new ArgumentNullException("Введите путь до файла!");
}
if (string.IsNullOrEmpty(title))
{
throw new ArgumentNullException("Введите заголовок");
}
if (colInfo == null)
{
throw new ArgumentNullException("Введите все заголовки");
}
if (data == null)
{
throw new ArgumentNullException("Нету информации для вывода");
}
Document _document = new Document();
var style = _document.Styles["Normal"];
style.Font.Name = "Times New Roman";
style.Font.Size = 14;
Section _section = _document.AddSection();
//Заголовок
var paragraph = _section.AddParagraph(title);
paragraph.Format.SpaceAfter = "0.3cm";
paragraph.Format.Font.Size = "16";
paragraph.Format.Font.Bold = true;
paragraph.Format.Alignment = ParagraphAlignment.Center;
//Создание таблицы
var table = _section.AddTable();
table.Borders.Visible = true;
//Создание колонок
for (int i = 0; i < colInfo.Count; i++)
{
table.AddColumn(colInfo[i].Width);
}
//Создание строк
if (mergeCells != null)
{
table.AddRow();
}
var row = table.AddRow();
for (int i = 0; i < colInfo.Count; i++)
{
row[i].AddParagraph(colInfo[i].Header);
}
List<int> MergeColls = new List<int>();
//Объединение ячеек в строке
if (mergeCells != null)
{
foreach (var cell in mergeCells)
{
MergeColls.AddRange(cell.Indexes[0..]);
table.Rows[0].Cells[cell.Indexes[0]].MergeRight = cell.Indexes[1..].Length;
table.Rows[0].Cells[cell.Indexes[0]].AddParagraph(cell.Header);
}
}
int cellsCount = table.Rows[1].Cells.Count;
//Объединение ячеек в столбце
if (MergeColls.Count != 0)
{
for (int i = 0; i < cellsCount; i++)
{
var cell = table.Rows[0].Cells[i];
if (!MergeColls.Contains(i))
{
cell.MergeDown = 1;
cell.AddParagraph(colInfo[i].Header);
}
}
}
//Вывод данных
int rowData = 2;
foreach (var item in data)
{
var properties = item.GetType().GetProperties();
//if (properties.Count() != cellsCount)
//{
// throw new Exception("Кол-во полей объекта не совпадает с кол-вом колонок");
//}
for (int i = 0; i < cellsCount; i++)
{
var property = properties.FirstOrDefault(p => p.Name == colInfo[i].PropertyName);
if (property != null)
{
var propValue = property.GetValue(item);
if (propValue == null)
{
throw new Exception("Пустое поле");
}
if (table.Rows.Count <= rowData)
{
table.AddRow();
}
table.Rows[rowData].Cells[i].AddParagraph(propValue.ToString());
}
}
rowData++;
}
var renderer = new PdfDocumentRenderer(true);
renderer.Document = _document;
renderer.RenderDocument();
renderer.PdfDocument.Save(docPath);
}
}
}

View File

@ -1,70 +0,0 @@
namespace BarsukovComponents.VisualComponents
{
partial class CustomComboBox
{
/// <summary>
/// Обязательная переменная конструктора.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Освободить все используемые ресурсы.
/// </summary>
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Код, автоматически созданный конструктором компонентов
/// <summary>
/// Требуемый метод для поддержки конструктора — не изменяйте
/// содержимое этого метода с помощью редактора кода.
/// </summary>
private void InitializeComponent()
{
comboBox = new ComboBox();
textBox1 = new TextBox();
SuspendLayout();
//
// comboBox
//
comboBox.FormattingEnabled = true;
comboBox.Location = new Point(10, 36);
comboBox.Name = "comboBox";
comboBox.Size = new Size(230, 28);
comboBox.TabIndex = 0;
comboBox.SelectedIndexChanged += CustomComboBox_SelectedValueChanged;
//
// textBox1
//
textBox1.Location = new Point(10, 3);
textBox1.Name = "textBox1";
textBox1.Size = new Size(230, 27);
textBox1.TabIndex = 1;
textBox1.Text = "Выпадающий список";
//
// CustomComboBox
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
BorderStyle = BorderStyle.FixedSingle;
Controls.Add(textBox1);
Controls.Add(comboBox);
Name = "CustomComboBox";
Size = new Size(248, 73);
ResumeLayout(false);
PerformLayout();
}
#endregion
private ComboBox comboBox;
private TextBox textBox1;
}
}

View File

@ -1,60 +0,0 @@
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 BarsukovComponents.VisualComponents
{
public partial class CustomComboBox : UserControl
{
public CustomComboBox()
{
InitializeComponent();
}
public void ClearComboBox()
{
comboBox.Items.Clear();
comboBox.SelectedItem = null;
comboBox.Text = string.Empty;
}
public string SelectedItem
{
get
{
return comboBox.SelectedItem?.ToString() ?? string.Empty; }
set
{
comboBox.SelectedItem = value;
}
}
public ComboBox.ObjectCollection ComboBoxItems
{
get { return comboBox.Items; }
}
private EventHandler _onValueChangedEvent;
public event EventHandler ValueChangedEvent
{
add
{
_onValueChangedEvent += value;
}
remove
{
_onValueChangedEvent -= value;
}
}
private void CustomComboBox_SelectedValueChanged(object sender, EventArgs e)
{
_onValueChangedEvent?.Invoke(sender, e);
}
}
}

View File

@ -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>

View File

@ -1,57 +0,0 @@
namespace BarsukovComponents.VisualComponents
{
partial class CustomListBox
{
/// <summary>
/// Обязательная переменная конструктора.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Освободить все используемые ресурсы.
/// </summary>
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Код, автоматически созданный конструктором компонентов
/// <summary>
/// Требуемый метод для поддержки конструктора — не изменяйте
/// содержимое этого метода с помощью редактора кода.
/// </summary>
private void InitializeComponent()
{
listBox = new ListBox();
SuspendLayout();
//
// listBox
//
listBox.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
listBox.FormattingEnabled = true;
listBox.Location = new Point(9, 5);
listBox.Name = "listBox";
listBox.Size = new Size(814, 384);
listBox.TabIndex = 0;
//
// CustomListBox
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
Controls.Add(listBox);
Name = "CustomListBox";
Size = new Size(828, 410);
ResumeLayout(false);
}
#endregion
private ListBox listBox;
}
}

View File

@ -1,147 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace BarsukovComponents.VisualComponents
{
public partial class CustomListBox : UserControl
{
public CustomListBox()
{
InitializeComponent();
}
private string template;
private string start;
private string end;
public void setTemplate(string _template, string _start, string _end)
{
if (string.IsNullOrEmpty(_template) || string.IsNullOrEmpty(_start) || string.IsNullOrEmpty(_end))
{
throw new ArgumentNullException("Wrong template");
}
template = _template;
start = _start;
end = _end;
}
public int SelectedRow
{
get
{
return listBox.SelectedIndex;
}
set
{
if (value < 0) return;
listBox.SelectedIndex = value;
}
}
public T GetObjectFromStr<T>() where T : class, new()
{
if (listBox.SelectedIndex < 0)
{
return null;
}
string row = listBox.SelectedItem.ToString();
T curObject = new T();
StringBuilder sb = new StringBuilder(row);
//MessageBox.Show(sb.ToString());
string[] words = template.Split(new[] { char.Parse(start), char.Parse(end) });
// Дорогой дневник, мне не подобрать слов чтобы описать всю {Mood}, что я испытал сегодня; {Date}
// Дорогой дневник, мне не подобрать слов чтобы описать всю радость, что я испытал сегодня; 01.01.01
StringBuilder myrow = new StringBuilder(row);
List<string> flexPartsTemplate = new();
foreach (string word in words)
{
if (row.Contains(word) && !string.IsNullOrEmpty(word))
{
myrow.Replace(word, end);
}
else
{
flexPartsTemplate.Add(word);
}
}
string[] flexParts = myrow.ToString().Split(end);
int i = 1;
StringBuilder result = new StringBuilder(template);
foreach (string word in flexPartsTemplate)
{
if (!string.IsNullOrEmpty(word))
{
result.Replace(word, flexParts[i]);
i++;
}
}
sb = result;
foreach (var property in typeof(T).GetProperties())
{
if (!property.CanWrite)
{
continue;
}
//MessageBox.Show(property.Name);
int startBorder = sb.ToString().IndexOf(start);
if (startBorder == -1)
{
break;
}
int endBorder = sb.ToString().IndexOf(end, startBorder + 1);
if (endBorder == -1)
{
break;
}
string propertyValue = sb.ToString(startBorder + 1, endBorder - startBorder - 1);
sb.Remove(0, endBorder + 1);
property.SetValue(curObject, Convert.ChangeType(propertyValue, property.PropertyType));
}
return curObject;
}
public void FillProperty<T>(T dataObject, int rowIndex, string propertyName)
{
while (listBox.Items.Count <= rowIndex)
{
listBox.Items.Add(template);
}
string row = listBox.Items[rowIndex].ToString();
PropertyInfo propertyInfo = dataObject.GetType().GetProperty(propertyName);
if (propertyInfo != null)
{
var propertyValue = propertyInfo.GetValue(dataObject);
row = row.Replace($"{start}{propertyName}{end}", propertyValue.ToString());
listBox.Items[rowIndex] = row;
}
}
public int CountRows()
{
return listBox.Items.Count;
}
}
}

View File

@ -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>

View File

@ -1,70 +0,0 @@
namespace BarsukovComponents.VisualComponents
{
partial class CustomTextBox
{
/// <summary>
/// Обязательная переменная конструктора.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Освободить все используемые ресурсы.
/// </summary>
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Код, автоматически созданный конструктором компонентов
/// <summary>
/// Требуемый метод для поддержки конструктора — не изменяйте
/// содержимое этого метода с помощью редактора кода.
/// </summary>
private void InitializeComponent()
{
textBox = new TextBox();
textBox1 = new TextBox();
SuspendLayout();
//
// textBox
//
textBox.Location = new Point(3, 40);
textBox.Name = "textBox";
textBox.Size = new Size(249, 27);
textBox.TabIndex = 0;
textBox.Click += showToolTip;
textBox.Leave += CustomTextBox_TextChanged;
//
// textBox1
//
textBox1.Location = new Point(3, 7);
textBox1.Name = "textBox1";
textBox1.Size = new Size(249, 27);
textBox1.TabIndex = 2;
textBox1.Text = "Поле для ввода номера телефона";
//
// CustomTextBox
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
BorderStyle = BorderStyle.FixedSingle;
Controls.Add(textBox1);
Controls.Add(textBox);
Name = "CustomTextBox";
Size = new Size(259, 68);
ResumeLayout(false);
PerformLayout();
}
#endregion
private TextBox textBox;
private TextBox textBox1;
}
}

View File

@ -1,95 +0,0 @@
using BarsukovComponents.Exceptions;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace BarsukovComponents.VisualComponents
{
public partial class CustomTextBox : UserControl
{
public CustomTextBox()
{
InitializeComponent();
}
private string _numberPattern;
public string numberPattern
{
get
{
return _numberPattern;
}
set
{
_numberPattern = value;
}
}
public string textBoxNumber
{
get
{
if (_numberPattern == null)
{
throw new CustomException("there is no pattern");
}
Regex regex = new(_numberPattern);
if (regex.IsMatch(textBox.Text))
{
return textBox.Text;
}
else
{
throw new CustomException("there is wrong pattern");
}
}
set
{
if (string.IsNullOrEmpty(_numberPattern))
{
return;
}
Regex regex = new(_numberPattern);
if (regex.IsMatch(value))
{
textBox.Text = value;
}
else
{
textBox.Text = string.Empty;
}
}
}
private void showToolTip(object sender, EventArgs e)
{
ToolTip tt = new ToolTip();
tt.Show("+X XXX XXX XX XX" , textBox);
}
private EventHandler _onValueChangedEvent;
public event EventHandler ValueChangedEvent
{
add
{
_onValueChangedEvent += value;
}
remove
{
_onValueChangedEvent -= value;
}
}
private void CustomTextBox_TextChanged(object sender, EventArgs e)
{
_onValueChangedEvent?.Invoke(sender, e);
}
}
}

View File

@ -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>

View File

@ -1,10 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
</Project>

View File

@ -1,14 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Contracts\Contracts.csproj" />
</ItemGroup>
</Project>

View File

@ -1,91 +0,0 @@
using Contracts.BindingModels;
using Contracts.BusinessLogicContracts;
using Contracts.SearchModels;
using Contracts.StorageContracts;
using Contracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BusinessLogic
{
public class JobTypeLogic: IJobTypeLogic
{
private readonly IJobTypeStorage _jobTypeStorage;
public JobTypeLogic(IJobTypeStorage jobTypeStorage)
{
_jobTypeStorage = jobTypeStorage;
}
public List<JobTypeViewModel>? ReadList(JobTypeSearchModel? model)
{
var list = model == null ? _jobTypeStorage.GetFullList() : _jobTypeStorage.GetFilteredList(model);
if (list == null)
{
return null;
}
return list;
}
public JobTypeViewModel? ReadElement(JobTypeSearchModel? model)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
var element = _jobTypeStorage.GetElement(model);
if (element == null)
{
return null;
}
return element;
}
public bool Create(JobTypeBindingModel model)
{
CheckModel(model);
if (_jobTypeStorage.Insert(model) == null)
{
return false;
}
return true;
}
public bool Update(JobTypeBindingModel model)
{
CheckModel(model);
if (_jobTypeStorage.Update(model) == null)
{
return false;
}
return true;
}
public bool Delete(JobTypeBindingModel model)
{
CheckModel(model);
if (_jobTypeStorage.Delete(model) == null)
{
return false;
}
return true;
}
private void CheckModel(JobTypeBindingModel model, bool withParams = true)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
if (!withParams)
{
return;
}
if (string.IsNullOrEmpty(model.Name))
{
throw new ArgumentException("Введите название должности");
}
}
}
}

View File

@ -1,98 +0,0 @@
using Contracts.BusinessLogicContracts;
using Contracts.StorageContracts;
using Contracts.SearchModels;
using Contracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Contracts.BindingModels;
namespace BusinessLogic
{
public class WorkerLogic : IWorkerLogic
{
private readonly IWorkerStorage _workerStorage;
public WorkerLogic(IWorkerStorage workerStorage)
{
_workerStorage = workerStorage;
}
public List<WorkerViewModel>? ReadList(WorkerSearchModel? model)
{
var list = model == null ? _workerStorage.GetFullList() : _workerStorage.GetFilteredList(model);
if (list == null)
{
return null;
}
return list;
}
public WorkerViewModel? ReadElement(WorkerSearchModel? model)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
var element = _workerStorage.GetElement(model);
if (element == null)
{
return null;
}
return element;
}
public bool Create(WorkerBindingModel model)
{
CheckModel(model);
if (_workerStorage.Insert(model) == null)
{
return false;
}
return true;
}
public bool Update(WorkerBindingModel model)
{
CheckModel(model);
if (_workerStorage.Update(model) == null)
{
return false;
}
return true;
}
public bool Delete(WorkerBindingModel model)
{
CheckModel(model, false);
if (_workerStorage.Delete(model) == null)
{
return false;
}
return true;
}
private void CheckModel(WorkerBindingModel model, bool withParams = true)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
if (!withParams)
{
return;
}
if (string.IsNullOrEmpty(model.Name))
{
throw new ArgumentException("Введите ФИО");
}
if (string.IsNullOrEmpty(model.Autobiography))
{
throw new ArgumentException("Введите автобиографию");
}
if (string.IsNullOrEmpty(model.JobType))
{
throw new ArgumentException("Выберите должность");
}
}
}
}

View File

@ -1,15 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Models;
namespace Contracts.BindingModels
{
public class JobTypeBindingModel: IJobTypeModel
{
public int Id { get; set; }
public string Name { get; set; }
}
}

View File

@ -1,18 +0,0 @@
using Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Contracts.BindingModels
{
public class WorkerBindingModel: IWorkerModel
{
public int Id { get; set; }
public string Name { get; set; } = string.Empty;
public string Autobiography { get; set; } = string.Empty;
public string? DateAdvance { get; set; }
public string JobType { get; set; } = string.Empty;
}
}

View File

@ -1,20 +0,0 @@
using Contracts.BindingModels;
using Contracts.SearchModels;
using Contracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Contracts.BusinessLogicContracts
{
public interface IJobTypeLogic
{
List<JobTypeViewModel>? ReadList(JobTypeSearchModel? model);
JobTypeViewModel? ReadElement (JobTypeSearchModel? model);
bool Create(JobTypeBindingModel model);
bool Update(JobTypeBindingModel model);
bool Delete(JobTypeBindingModel model);
}
}

View File

@ -1,20 +0,0 @@
using Contracts.BindingModels;
using Contracts.SearchModels;
using Contracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Contracts.BusinessLogicContracts
{
public interface IWorkerLogic
{
List<WorkerViewModel>? ReadList(WorkerSearchModel? model);
WorkerViewModel? ReadElement(WorkerSearchModel? model);
bool Create(WorkerBindingModel model);
bool Update(WorkerBindingModel model);
bool Delete(WorkerBindingModel model);
}
}

View File

@ -1,14 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Models\Models.csproj" />
</ItemGroup>
</Project>

View File

@ -1,13 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Contracts.SearchModels
{
public class JobTypeSearchModel
{
public string? Name { get; set; }
}
}

View File

@ -1,17 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Contracts.SearchModels
{
public class WorkerSearchModel
{
public int? Id { get; set; }
public string? Name { get; set; }
public string? Autobiography { get; set; }
public string? DateAdvance { get; set; }
public string? JobType { get; set; }
}
}

View File

@ -1,21 +0,0 @@
using Contracts.BindingModels;
using Contracts.SearchModels;
using Contracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Contracts.StorageContracts
{
public interface IJobTypeStorage
{
List<JobTypeViewModel> GetFullList();
List<JobTypeViewModel> GetFilteredList(JobTypeSearchModel model);
JobTypeViewModel? GetElement(JobTypeSearchModel model);
JobTypeViewModel? Insert(JobTypeBindingModel model);
JobTypeViewModel? Update(JobTypeBindingModel model);
JobTypeViewModel? Delete(JobTypeBindingModel model);
}
}

View File

@ -1,22 +0,0 @@
using Contracts.BindingModels;
using Contracts.SearchModels;
using Contracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Contracts.StorageContracts
{
public interface IWorkerStorage
{
List<WorkerViewModel> GetFullList();
List<WorkerViewModel> GetFilteredList(WorkerSearchModel model);
WorkerViewModel? GetElement(WorkerSearchModel model);
WorkerViewModel? Insert(WorkerBindingModel model);
WorkerViewModel? Update(WorkerBindingModel model);
WorkerViewModel? Delete(WorkerBindingModel model);
}
}

View File

@ -1,17 +0,0 @@
using Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Contracts.ViewModels
{
public class JobTypeViewModel: IJobTypeModel
{
public int Id { get; set; }
[DisplayName("Должность")]
public string Name { get; set; } = string.Empty;
}
}

View File

@ -1,23 +0,0 @@
using Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Contracts.ViewModels
{
public class WorkerViewModel: IWorkerModel
{
public int Id { get; set; }
[DisplayName("ФИО")]
public string Name { get; set; } = string.Empty;
[DisplayName("Автобиография")]
public string Autobiography { get; set; } = string.Empty;
[DisplayName("Должность")]
public string JobType { get; set; } = string.Empty;
[DisplayName("Дата повышения квалификации")]
public string? DateAdvance { get; set; } = string.Empty;
}
}

View File

@ -1,58 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.11.35222.181
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BarsukovComponents", "..\Components\BarsukovComponents.csproj", "{52A015B2-0077-47D3-9BC8-F378C3BCF965}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestApp", "TestApp\TestApp.csproj", "{BF4A0F84-CD73-443C-A480-B54A9A0B7867}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Models", "Models\Models.csproj", "{8334B55D-6509-476C-B43E-5753D21A3A7A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Contracts", "Contracts\Contracts.csproj", "{ACCDF1FF-335F-4ABC-9771-4CAA4EA42D00}"
ProjectSection(ProjectDependencies) = postProject
{8334B55D-6509-476C-B43E-5753D21A3A7A} = {8334B55D-6509-476C-B43E-5753D21A3A7A}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BusinessLogic", "BusinessLogic\BusinessLogic.csproj", "{3D6084D7-4D23-4202-9B05-AE0EB73D01A8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DatabaseImplement", "DatabaseImplement\DatabaseImplement.csproj", "{D78462A7-BA09-4E15-856A-B1D688B138CC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{52A015B2-0077-47D3-9BC8-F378C3BCF965}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{52A015B2-0077-47D3-9BC8-F378C3BCF965}.Debug|Any CPU.Build.0 = Debug|Any CPU
{52A015B2-0077-47D3-9BC8-F378C3BCF965}.Release|Any CPU.ActiveCfg = Release|Any CPU
{52A015B2-0077-47D3-9BC8-F378C3BCF965}.Release|Any CPU.Build.0 = Release|Any CPU
{BF4A0F84-CD73-443C-A480-B54A9A0B7867}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BF4A0F84-CD73-443C-A480-B54A9A0B7867}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BF4A0F84-CD73-443C-A480-B54A9A0B7867}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BF4A0F84-CD73-443C-A480-B54A9A0B7867}.Release|Any CPU.Build.0 = Release|Any CPU
{8334B55D-6509-476C-B43E-5753D21A3A7A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8334B55D-6509-476C-B43E-5753D21A3A7A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8334B55D-6509-476C-B43E-5753D21A3A7A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8334B55D-6509-476C-B43E-5753D21A3A7A}.Release|Any CPU.Build.0 = Release|Any CPU
{ACCDF1FF-335F-4ABC-9771-4CAA4EA42D00}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{ACCDF1FF-335F-4ABC-9771-4CAA4EA42D00}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ACCDF1FF-335F-4ABC-9771-4CAA4EA42D00}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ACCDF1FF-335F-4ABC-9771-4CAA4EA42D00}.Release|Any CPU.Build.0 = Release|Any CPU
{3D6084D7-4D23-4202-9B05-AE0EB73D01A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3D6084D7-4D23-4202-9B05-AE0EB73D01A8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3D6084D7-4D23-4202-9B05-AE0EB73D01A8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3D6084D7-4D23-4202-9B05-AE0EB73D01A8}.Release|Any CPU.Build.0 = Release|Any CPU
{D78462A7-BA09-4E15-856A-B1D688B138CC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D78462A7-BA09-4E15-856A-B1D688B138CC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D78462A7-BA09-4E15-856A-B1D688B138CC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D78462A7-BA09-4E15-856A-B1D688B138CC}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F37036A6-D640-4CD0-8488-B7A0518B4EB8}
EndGlobalSection
EndGlobal

View File

@ -1,6 +0,0 @@
namespace CustomComboBox
{
public class Class1
{
}
}

View File

@ -1,10 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
</Project>

View File

@ -1,26 +0,0 @@
using DatabaseImplement.Models;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DatabaseImplement
{
public class Database: DbContext
{
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (optionsBuilder.IsConfigured == false)
{
optionsBuilder.UseNpgsql(@"Host=localhost;Database=WorkersDatabase;Username=postgres;Password=postgres");
}
base.OnConfiguring(optionsBuilder);
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
AppContext.SetSwitch("Npgsql.DisableDateTimeInfinityConversions", true);
}
public virtual DbSet<Worker> Workers { get; set; }
public virtual DbSet<JobType> JobTypes { get; set; }
}
}

View File

@ -1,25 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.10">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.10" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\BusinessLogic\BusinessLogic.csproj" />
<ProjectReference Include="..\Contracts\Contracts.csproj" />
<ProjectReference Include="..\Models\Models.csproj" />
</ItemGroup>
</Project>

View File

@ -1,81 +0,0 @@
using Contracts.BindingModels;
using Contracts.SearchModels;
using Contracts.StorageContracts;
using Contracts.ViewModels;
using DatabaseImplement.Models;
using Microsoft.EntityFrameworkCore.Storage;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DatabaseImplement.Implements
{
public class JobTypeStorage: IJobTypeStorage
{
public List<JobTypeViewModel> GetFullList()
{
using var context = new Database();
return context.JobTypes
.Select(x => x.GetViewModel).ToList();
}
public List<JobTypeViewModel> GetFilteredList(JobTypeSearchModel model)
{
if (string.IsNullOrEmpty(model.Name))
{
return new();
}
using var context = new Database();
return context.JobTypes
.Where(x => x.Name == model.Name)
.Select(x => x.GetViewModel).ToList();
}
public JobTypeViewModel? GetElement(JobTypeSearchModel model)
{
if (string.IsNullOrEmpty(model.Name))
{
return null;
}
using var context = new Database();
return context.JobTypes
.FirstOrDefault(x => x.Name == model.Name)?.GetViewModel;
}
public JobTypeViewModel? Insert(JobTypeBindingModel model)
{
var newType = JobType.Create(model);
if (newType == null)
{
return null;
}
using var context = new Database();
context.JobTypes.Add(newType);
context.SaveChanges();
return newType.GetViewModel;
}
public JobTypeViewModel? Update(JobTypeBindingModel model)
{
using var context = new Database();
var type = context.JobTypes.FirstOrDefault(x => x.Id == model.Id);
if (type == null)
{
return null;
}
type.Update(model);
context.SaveChanges();
return type.GetViewModel;
}
public JobTypeViewModel? Delete(JobTypeBindingModel model)
{
using var context = new Database();
var element = context.JobTypes.FirstOrDefault(x => x.Name == model.Name);
if (element == null)
{
return null;
}
context.JobTypes.Remove(element);
context.SaveChanges();
return element.GetViewModel;
}
}
}

View File

@ -1,78 +0,0 @@
using Contracts.BindingModels;
using Contracts.SearchModels;
using Contracts.StorageContracts;
using Contracts.ViewModels;
using DatabaseImplement.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DatabaseImplement.Implements
{
public class WorkerStorage: IWorkerStorage
{
public List<WorkerViewModel> GetFullList()
{
using var context = new Database();
return context.Workers.Select(x => x.GetViewModel).ToList();
}
public List<WorkerViewModel> GetFilteredList(WorkerSearchModel model)
{
if (string.IsNullOrEmpty(model.Name))
{
return new();
}
using var context = new Database();
return context.Workers
.Where(x => x.JobType == model.JobType)
.Select(x => x.GetViewModel).ToList();
}
public WorkerViewModel GetElement(WorkerSearchModel model)
{
if (!model.Id.HasValue)
{
return null;
}
using var context = new Database();
return context.Workers.FirstOrDefault(x => x.Id == model.Id)?.GetViewModel;
}
public WorkerViewModel? Insert(WorkerBindingModel model)
{
var newType = Worker.Create(model);
if (newType == null)
{
return null;
}
using var context = new Database();
context.Workers.Add(newType);
context.SaveChanges();
return newType.GetViewModel;
}
public WorkerViewModel? Update(WorkerBindingModel model)
{
using var context = new Database();
var type = context.Workers.FirstOrDefault(x => x.Id == model.Id);
if (type == null)
{
return null;
}
type.Update(model);
context.SaveChanges();
return type.GetViewModel;
}
public WorkerViewModel? Delete(WorkerBindingModel model)
{
using var context = new Database();
var element = context.Workers.FirstOrDefault(x => x.Id == model.Id);
if (element == null)
{
return null;
}
context.Workers.Remove(element);
context.SaveChanges();
return element.GetViewModel;
}
}
}

View File

@ -1,75 +0,0 @@
// <auto-generated />
using DatabaseImplement;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace DatabaseImplement.Migrations
{
[DbContext(typeof(Database))]
[Migration("20241111171158_try2")]
partial class try2
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.10")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("DatabaseImplement.Models.JobType", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("JobTypes");
});
modelBuilder.Entity("DatabaseImplement.Models.Worker", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Autobiography")
.IsRequired()
.HasColumnType("text");
b.Property<string>("DateAdvance")
.IsRequired()
.HasColumnType("text");
b.Property<string>("JobType")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Workers");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -1,54 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace DatabaseImplement.Migrations
{
/// <inheritdoc />
public partial class try2 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "JobTypes",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Name = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_JobTypes", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Workers",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Name = table.Column<string>(type: "text", nullable: false),
Autobiography = table.Column<string>(type: "text", nullable: false),
DateAdvance = table.Column<string>(type: "text", nullable: false),
JobType = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Workers", x => x.Id);
});
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "JobTypes");
migrationBuilder.DropTable(
name: "Workers");
}
}
}

View File

@ -1,72 +0,0 @@
// <auto-generated />
using DatabaseImplement;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace DatabaseImplement.Migrations
{
[DbContext(typeof(Database))]
partial class DatabaseModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.10")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("DatabaseImplement.Models.JobType", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("JobTypes");
});
modelBuilder.Entity("DatabaseImplement.Models.Worker", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Autobiography")
.IsRequired()
.HasColumnType("text");
b.Property<string>("DateAdvance")
.IsRequired()
.HasColumnType("text");
b.Property<string>("JobType")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Workers");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -1,44 +0,0 @@
using Contracts.BindingModels;
using Contracts.ViewModels;
using Models;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DatabaseImplement.Models
{
public class JobType: IJobTypeModel
{
public int Id { get; set; }
[Required]
public string Name { get; private set; } = string.Empty;
public static JobType? Create(JobTypeBindingModel model)
{
if (model == null)
{
return null;
}
return new JobType
{
Id = model.Id,
Name = model.Name,
};
}
public void Update(JobTypeBindingModel model)
{
if (model == null)
{
return;
}
Name = model.Name;
}
public JobTypeViewModel GetViewModel => new()
{
Id = Id,
Name = Name,
};
}
}

View File

@ -1,59 +0,0 @@
using Contracts.BindingModels;
using Contracts.ViewModels;
using Models;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DatabaseImplement.Models
{
public class Worker: IWorkerModel
{
public int Id { get; private set; }
[Required]
public string Name { get; private set; } = string.Empty;
[Required]
public string Autobiography { get; private set; } = string.Empty;
public string DateAdvance { get; private set; } = string.Empty;
[Required]
public string JobType { get; private set; } = string.Empty;
public static Worker? Create(WorkerBindingModel model)
{
if (model == null)
{
return null;
}
return new Worker
{
Id = model.Id,
Name = model.Name,
Autobiography = model.Autobiography,
DateAdvance = model.DateAdvance,
JobType = model.JobType,
};
}
public void Update(WorkerBindingModel model)
{
if (model == null)
{
return;
}
Name = model.Name;
Autobiography = model.Autobiography;
DateAdvance = model.DateAdvance;
JobType = model.JobType;
}
public WorkerViewModel GetViewModel => new()
{
Id = Id,
Name = Name,
Autobiography = Autobiography,
DateAdvance = DateAdvance,
JobType = JobType,
};
}
}

View File

@ -1,13 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Models
{
public interface IId
{
int Id { get; }
}
}

View File

@ -1,13 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Models
{
public interface IJobTypeModel: IId
{
string Name { get; }
}
}

View File

@ -1,16 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Models
{
public interface IWorkerModel: IId
{
string Name { get; }
string Autobiography { get; }
string? DateAdvance { get; }
string JobType { get; }
}
}

View File

@ -1,10 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
</Project>

View File

@ -1,20 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TestApp
{
public class Day
{
public string Mood { get; set; }
public DateTime Date { get; set; }
public Day() { }
public Day(string mood, DateTime date)
{
Mood = mood;
Date = date;
}
}
}

View File

@ -1,26 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TestApp
{
public class Example
{
public string First { get; set; } = string.Empty;
public string Second { get; set; } = string.Empty;
public string Third { get; set; } = string.Empty;
public string Fourth { get; set; } = string.Empty;
public string Fifth { get; set; } = string.Empty;
public Example() { }
public Example(string first, string second, string third, string fourth, string fifth)
{
First=first;
Second=second;
Third=third;
Fourth=fourth;
Fifth=fifth;
}
}
}

View File

@ -1,175 +0,0 @@
using BarsukovComponents.NotVisualComponents.Configs;
namespace TestApp
{
partial class Form1
{
/// <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()
{
customComboBox = new BarsukovComponents.VisualComponents.CustomComboBox();
buttonAdd = new Button();
buttonClear = new Button();
buttonGet = new Button();
customTextBox = new BarsukovComponents.VisualComponents.CustomTextBox();
customListBox = new BarsukovComponents.VisualComponents.CustomListBox();
buttonDay = new Button();
buttonAddDay = new Button();
textBoxMood = new TextBox();
label1 = new Label();
SuspendLayout();
//
// customComboBox
//
customComboBox.BorderStyle = BorderStyle.FixedSingle;
customComboBox.Location = new Point(12, 0);
customComboBox.Name = "customComboBox";
customComboBox.SelectedItem = "";
customComboBox.Size = new Size(252, 91);
customComboBox.TabIndex = 0;
customComboBox.ValueChangedEvent += customComboBox_ValueChanged;
//
// buttonAdd
//
buttonAdd.Location = new Point(5, 97);
buttonAdd.Name = "buttonAdd";
buttonAdd.Size = new Size(94, 29);
buttonAdd.TabIndex = 1;
buttonAdd.Text = "Add";
buttonAdd.UseVisualStyleBackColor = true;
buttonAdd.Click += buttonAdd_Click;
//
// buttonClear
//
buttonClear.Location = new Point(105, 97);
buttonClear.Name = "buttonClear";
buttonClear.Size = new Size(94, 29);
buttonClear.TabIndex = 2;
buttonClear.Text = "Clear";
buttonClear.UseVisualStyleBackColor = true;
buttonClear.Click += buttonClear_Click;
//
// buttonGet
//
buttonGet.Location = new Point(205, 97);
buttonGet.Name = "buttonGet";
buttonGet.Size = new Size(94, 29);
buttonGet.TabIndex = 3;
buttonGet.Text = "Get";
buttonGet.UseVisualStyleBackColor = true;
buttonGet.Click += buttonGet_Click;
//
// customTextBox
//
customTextBox.BorderStyle = BorderStyle.FixedSingle;
customTextBox.Location = new Point(12, 144);
customTextBox.Name = "customTextBox";
customTextBox.numberPattern = null;
customTextBox.Size = new Size(258, 88);
customTextBox.TabIndex = 4;
customTextBox.ValueChangedEvent += customTextBox_ValueChanged;
//
// customListBox
//
customListBox.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
customListBox.Location = new Point(296, 0);
customListBox.Name = "customListBox";
customListBox.SelectedRow = -1;
customListBox.Size = new Size(848, 400);
customListBox.TabIndex = 5;
//
// buttonDay
//
buttonDay.Location = new Point(205, 342);
buttonDay.Name = "buttonDay";
buttonDay.Size = new Size(94, 29);
buttonDay.TabIndex = 6;
buttonDay.Text = "Get day";
buttonDay.UseVisualStyleBackColor = true;
buttonDay.Click += buttonDay_Click;
//
// buttonAddDay
//
buttonAddDay.Location = new Point(205, 371);
buttonAddDay.Name = "buttonAddDay";
buttonAddDay.Size = new Size(94, 29);
buttonAddDay.TabIndex = 7;
buttonAddDay.Text = "Write";
buttonAddDay.UseVisualStyleBackColor = true;
buttonAddDay.Click += buttonAddDay_Click;
//
// textBoxMood
//
textBoxMood.Location = new Point(74, 371);
textBoxMood.Name = "textBoxMood";
textBoxMood.Size = new Size(125, 27);
textBoxMood.TabIndex = 8;
//
// label1
//
label1.AutoSize = true;
label1.Location = new Point(12, 378);
label1.Name = "label1";
label1.Size = new Size(52, 20);
label1.TabIndex = 9;
label1.Text = "Mood:";
//
// Form1
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(1156, 416);
Controls.Add(label1);
Controls.Add(textBoxMood);
Controls.Add(buttonAddDay);
Controls.Add(buttonDay);
Controls.Add(customListBox);
Controls.Add(customTextBox);
Controls.Add(buttonGet);
Controls.Add(buttonClear);
Controls.Add(buttonAdd);
Controls.Add(customComboBox);
Name = "Form1";
Text = "Form1";
Load += MyForm_Load;
ResumeLayout(false);
PerformLayout();
}
#endregion
private BarsukovComponents.VisualComponents.CustomComboBox customComboBox;
private Button buttonAdd;
private Button buttonClear;
private Button buttonGet;
private BarsukovComponents.VisualComponents.CustomTextBox customTextBox;
private BarsukovComponents.VisualComponents.CustomListBox customListBox;
private Button buttonDay;
private Button buttonAddDay;
private TextBox textBoxMood;
private Label label1;
}
}

View File

@ -1,144 +0,0 @@
using BarsukovComponents;
using BarsukovComponents.NotVisualComponents;
using BarsukovComponents.NotVisualComponents.Configs;
using MigraDoc.DocumentObjectModel;
namespace TestApp
{
public partial class Form1 : Form
{
private int counter = 4;
public Form1()
{
InitializeComponent();
FillCustomComboBox();
FillCustomTextBox();
FillCustomListBox();
}
private void FillCustomComboBox()
{
customComboBox.ComboBoxItems.Add("some text 1");
customComboBox.ComboBoxItems.Add("some text 2");
customComboBox.ComboBoxItems.Add("some text 3");
}
private void buttonAdd_Click(object sender, EventArgs e)
{
customComboBox.ComboBoxItems.Add($"some text {counter}");
counter++;
}
private void buttonClear_Click(object sender, EventArgs e)
{
customComboBox.ClearComboBox();
counter = 1;
}
private void customComboBox_ValueChanged(object sender, EventArgs e)
{
MessageBox.Show(customComboBox.SelectedItem.ToString());
}
private void buttonGet_Click(object sender, EventArgs e)
{
MessageBox.Show("Âûáðàííûé ýëåìåíò :" + customComboBox.SelectedItem.ToString());
}
private void FillCustomTextBox()
{
customTextBox.numberPattern = @"\+\d\s\d{3}\s\d{3}\s\d{2}\s\d{2}$";
customTextBox.textBoxNumber = "+7 953 982 67 85";
}
private void customTextBox_ValueChanged(object sender, EventArgs e)
{
try
{
customTextBox.textBoxNumber = customTextBox.textBoxNumber;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
customTextBox.textBoxNumber = string.Empty;
}
}
private void FillCustomListBox()
{
Day day1 = new Day() { Mood = "áîëü", Date = DateTime.Now };
Day day2 = new Day() { Mood = "ðàäîñòü", Date = DateTime.Now.AddDays(1.0) };
customListBox.setTemplate("Äîðîãîé äíåâíèê, ìíå íå ïîäîáðàòü ñëîâ ÷òîáû îïèñàòü âñþ {Mood}, ÷òî ÿ èñïûòàë ñåãîäíÿ; {Date}", "{", "}");
customListBox.FillProperty(day1, 0, "Mood");
customListBox.FillProperty(day1, 0, "Date");
customListBox.FillProperty(day2, 1, "Mood");
customListBox.FillProperty(day2, 1, "Date");
}
private void buttonDay_Click(object sender, EventArgs e)
{
Day selectedDay = customListBox.GetObjectFromStr<Day>();
MessageBox.Show($"there was a lot {selectedDay.Mood} in {selectedDay.Date}");
}
private void buttonAddDay_Click(object sender, EventArgs e)
{
Day day = new();
day.Date = DateTime.Now;
if (string.IsNullOrEmpty(textBoxMood.Text))
{
MessageBox.Show("Write something!!!", "Error");
return;
}
day.Mood = textBoxMood.Text;
int index = customListBox.CountRows();
customListBox.FillProperty(day, index, "Mood");
customListBox.FillProperty(day, index, "Date");
}
private void MyForm_Load(object sender, EventArgs e)
{
TextPdfConf conf = new TextPdfConf();
conf.Filename = "C:/Users/pasha/Desktop/MyDocument.pdf";
conf.Title = "My Document";
conf.Rows = new List<string> { "This is the first row. it's gonna be very long row that should actually take two rows or even more", "This is the second row.", "This is the third row." };
PdfHugeText pdfHugeText = new PdfHugeText();
pdfHugeText.CreatePdf(conf);
// -------------------
List<ColumnInfo> colInfos = new List<ColumnInfo>()
{
new ColumnInfo("First","First Prop",50),
new ColumnInfo("Second","Second Prop",100),
//new ColumnInfo("Third","Third Prop",100),
new ColumnInfo("Fourth","Fourth Prop",200),
new ColumnInfo("Fifth","Fifth Prop",50),
};
List<MergeCells> mergeCells = new List<MergeCells>()
{
new MergeCells("Merged columns", new int[] {2,3})
};
List<Example> workers = new List<Example>()
{
new Example("1 ïåðâûé", "1 ýòî âòîðîé)))", "1 òðåòèé", "1 ÷åòûðêà", "1 ïÿòêà"),
new Example("2 ïåðâàê", "2 ýòî âòîðîé âòîðîé)))", "2 òðåòüÿê", "2 õîðîøî", "5 ïÿòêà"),
};
PdfTable pdfTable = new PdfTable();
pdfTable.CreateTable("C:/Users/pasha/Desktop/MyTable.pdf", "TITLE", mergeCells, colInfos, workers);
// -------------------
Dictionary<string, List<double>> data = new();
data.Add("first", new List<double> {0.5, 3, 5, 9 });
data.Add("second", new List<double> {1, 2, 3, 7 });
PdfDiagram pdfDiagram = new PdfDiagram();
pdfDiagram.CreateDiagram("C:/Users/pasha/Desktop/MyDiagram.pdf", "title", "öèôåðêè öèôåðêè", data, LengendAlign.right);
}
}
}

View File

@ -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>

View File

@ -1,79 +0,0 @@
namespace TestApp
{
partial class FormJobType
{
/// <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()
{
dataGridView = new DataGridView();
Title = new DataGridViewTextBoxColumn();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
SuspendLayout();
//
// dataGridView
//
dataGridView.AllowUserToAddRows = false;
dataGridView.AllowUserToDeleteRows = false;
dataGridView.AllowUserToResizeColumns = false;
dataGridView.AllowUserToResizeRows = false;
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView.Columns.AddRange(new DataGridViewColumn[] { Title });
dataGridView.Location = new Point(12, 12);
dataGridView.MultiSelect = false;
dataGridView.Name = "dataGridView";
dataGridView.RowHeadersVisible = false;
dataGridView.RowHeadersWidth = 51;
dataGridView.Size = new Size(257, 426);
dataGridView.TabIndex = 0;
dataGridView.CellBeginEdit += dataGridView_CellBeginEdit;
dataGridView.CellValueChanged += dataGridView_CellValueChanged;
dataGridView.KeyDown += dataGridView_KeyDown;
//
// Title
//
Title.HeaderText = "Название";
Title.MinimumWidth = 6;
Title.Name = "Title";
Title.Width = 125;
//
// FormJobType
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(275, 450);
Controls.Add(dataGridView);
Name = "FormJobType";
Text = "FormJobType";
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
ResumeLayout(false);
}
#endregion
private DataGridView dataGridView;
private DataGridViewTextBoxColumn Title;
}
}

View File

@ -1,120 +0,0 @@
using Contracts.BindingModels;
using Contracts.SearchModels;
using Contracts.BusinessLogicContracts;
using Contracts.StorageContracts;
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 Microsoft.IdentityModel.Tokens;
namespace TestApp
{
public partial class FormJobType : Form
{
private readonly IJobTypeLogic _logic;
private string OldName = string.Empty;
public FormJobType(IJobTypeLogic logic)
{
InitializeComponent();
_logic = logic;
LoadData();
}
private void LoadData()
{
try
{
var list = _logic.ReadList(null);
if (list != null)
{
foreach (var item in list)
{
dataGridView.Rows.Add(item.Name);
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void dataGridView_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Insert)
{
for (int i = 0; i<dataGridView.Rows.Count; i++)
{
if (dataGridView.Rows[i].Cells[0].Value == null)
{
return;
}
}
dataGridView.Rows.Add();
}
else if (e.KeyCode == Keys.Delete)
{
if (MessageBox.Show("Удалить строку?", "Удаление", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
var name = dataGridView.SelectedCells[0].Value.ToString();
if (name != null)
{
_logic.Delete(new JobTypeBindingModel
{
Name = name,
});
dataGridView.Rows.RemoveAt(dataGridView.SelectedCells[0].RowIndex);
}
}
}
}
private void dataGridView_CellValueChanged(object sender, DataGridViewCellEventArgs e)
{
if (dataGridView.Rows.Count > 0)
{
var name = dataGridView.Rows[e.RowIndex].Cells[0].Value.ToString();
if (string.IsNullOrEmpty(name))
{
MessageBox.Show("Введите название!");
return;
}
if (e.RowIndex >= dataGridView.Rows.Count || string.IsNullOrEmpty(OldName))
{
_logic.Create(new JobTypeBindingModel
{
Name = name,
});
}
else
{
var element = _logic.ReadElement(new JobTypeSearchModel { Name = OldName });
_logic.Update(new JobTypeBindingModel
{
Id = element.Id,
Name = name,
});
}
//_logic.Create(new JobTypeBindingModel
//{
// Name = name,
//});
//var elem = _logic.ReadElement(new JobTypeSearchModel { Name = name });
//MessageBox.Show(elem.Name + " " + elem.Id);
}
}
private void dataGridView_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
{
if (dataGridView.Rows[e.RowIndex].Cells[0].Value != null)
{
OldName = dataGridView.Rows[e.RowIndex].Cells[0].Value.ToString();
}
}
}
}

View File

@ -1,123 +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="Title.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

View File

@ -1,160 +0,0 @@
namespace TestApp
{
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();
menuStrip1 = new MenuStrip();
menuToolStripMenuItem = new ToolStripMenuItem();
jobTypesToolStripMenuItem = new ToolStripMenuItem();
addWorkerToolStripMenuItem = new ToolStripMenuItem();
editWorkerToolStripMenuItem = new ToolStripMenuItem();
deleteWorkerToolStripMenuItem = new ToolStripMenuItem();
pdfToolStripMenuItem = new ToolStripMenuItem();
excelToolStripMenuItem = new ToolStripMenuItem();
wordToolStripMenuItem = new ToolStripMenuItem();
customTreeView = new BelianinComponents.CustomTreeView();
pdfHugeText = new BarsukovComponents.NotVisualComponents.PdfHugeText(components);
excelWithCustomTable = new KryukovLib.ExcelWithCustomTable(components);
wordWithDiagram = new BelianinComponents.WordWithDiagram(components);
menuStrip1.SuspendLayout();
SuspendLayout();
//
// menuStrip1
//
menuStrip1.ImageScalingSize = new Size(20, 20);
menuStrip1.Items.AddRange(new ToolStripItem[] { menuToolStripMenuItem });
menuStrip1.Location = new Point(0, 0);
menuStrip1.Name = "menuStrip1";
menuStrip1.Size = new Size(550, 28);
menuStrip1.TabIndex = 1;
menuStrip1.Text = "menuStrip1";
//
// menuToolStripMenuItem
//
menuToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { jobTypesToolStripMenuItem, addWorkerToolStripMenuItem, editWorkerToolStripMenuItem, deleteWorkerToolStripMenuItem, pdfToolStripMenuItem, excelToolStripMenuItem, wordToolStripMenuItem });
menuToolStripMenuItem.Name = "menuToolStripMenuItem";
menuToolStripMenuItem.Size = new Size(60, 24);
menuToolStripMenuItem.Text = "menu";
//
// jobTypesToolStripMenuItem
//
jobTypesToolStripMenuItem.Name = "jobTypesToolStripMenuItem";
jobTypesToolStripMenuItem.Size = new Size(329, 26);
jobTypesToolStripMenuItem.Text = "Работа с должностями";
jobTypesToolStripMenuItem.Click += jobTypesToolStripMenuItem_Click;
//
// addWorkerToolStripMenuItem
//
addWorkerToolStripMenuItem.Name = "addWorkerToolStripMenuItem";
addWorkerToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.A;
addWorkerToolStripMenuItem.Size = new Size(329, 26);
addWorkerToolStripMenuItem.Text = "Добавить сотрудника";
addWorkerToolStripMenuItem.Click += addWorkerToolStripMenuItem_Click;
//
// editWorkerToolStripMenuItem
//
editWorkerToolStripMenuItem.Name = "editWorkerToolStripMenuItem";
editWorkerToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.U;
editWorkerToolStripMenuItem.Size = new Size(329, 26);
editWorkerToolStripMenuItem.Text = "Редактировать сотрудника";
editWorkerToolStripMenuItem.Click += editWorkerToolStripMenuItem_Click;
//
// deleteWorkerToolStripMenuItem
//
deleteWorkerToolStripMenuItem.Name = "deleteWorkerToolStripMenuItem";
deleteWorkerToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.D;
deleteWorkerToolStripMenuItem.Size = new Size(329, 26);
deleteWorkerToolStripMenuItem.Text = "Удалить сотрудника";
deleteWorkerToolStripMenuItem.Click += deleteWorkerToolStripMenuItem_Click;
//
// pdfToolStripMenuItem
//
pdfToolStripMenuItem.Name = "pdfToolStripMenuItem";
pdfToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.S;
pdfToolStripMenuItem.Size = new Size(329, 26);
pdfToolStripMenuItem.Text = "PDF отчет";
pdfToolStripMenuItem.Click += pdfToolStripMenuItem_Click;
//
// excelToolStripMenuItem
//
excelToolStripMenuItem.Name = "excelToolStripMenuItem";
excelToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.T;
excelToolStripMenuItem.Size = new Size(329, 26);
excelToolStripMenuItem.Text = "Excel отчет";
excelToolStripMenuItem.Click += excelToolStripMenuItem_Click;
//
// wordToolStripMenuItem
//
wordToolStripMenuItem.Name = "wordToolStripMenuItem";
wordToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.C;
wordToolStripMenuItem.Size = new Size(329, 26);
wordToolStripMenuItem.Text = "Word отчет";
wordToolStripMenuItem.Click += wordToolStripMenuItem_Click;
//
// customTreeView
//
customTreeView.hierarchy = null;
customTreeView.Location = new Point(12, 31);
customTreeView.Name = "customTreeView";
customTreeView.Size = new Size(529, 271);
customTreeView.TabIndex = 2;
//
// FormMain
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(550, 312);
Controls.Add(customTreeView);
Controls.Add(menuStrip1);
KeyPreview = true;
MainMenuStrip = menuStrip1;
Name = "FormMain";
Text = "FormMain";
menuStrip1.ResumeLayout(false);
menuStrip1.PerformLayout();
ResumeLayout(false);
PerformLayout();
}
#endregion
private MenuStrip menuStrip1;
private ToolStripMenuItem menuToolStripMenuItem;
private ToolStripMenuItem jobTypesToolStripMenuItem;
private ToolStripMenuItem addWorkerToolStripMenuItem;
private ToolStripMenuItem editWorkerToolStripMenuItem;
private ToolStripMenuItem deleteWorkerToolStripMenuItem;
private ToolStripMenuItem pdfToolStripMenuItem;
private ToolStripMenuItem excelToolStripMenuItem;
private ToolStripMenuItem wordToolStripMenuItem;
private BelianinComponents.CustomTreeView customTreeView;
private BarsukovComponents.NotVisualComponents.PdfHugeText pdfHugeText;
private KryukovLib.ExcelWithCustomTable excelWithCustomTable;
private BelianinComponents.WordWithDiagram wordWithDiagram;
}
}

View File

@ -1,187 +0,0 @@
using Contracts.BusinessLogicContracts;
using Contracts.BindingModels;
using Contracts.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;
using BarsukovComponents.NotVisualComponents.Configs;
using KryukovLib;
using BelianinComponents.Models;
namespace TestApp
{
public partial class FormMain : Form
{
private readonly IWorkerLogic _workerLogic;
private readonly IJobTypeLogic _jobTypeLogic;
public FormMain(IWorkerLogic workerLogic, IJobTypeLogic jobTypeLogic)
{
InitializeComponent();
_workerLogic = workerLogic;
_jobTypeLogic = jobTypeLogic;
KeyBind();
LoadData();
}
private void KeyBind()
{
}
private void LoadData()
{
var list = _workerLogic.ReadList(null);
if (list != null)
{
customTreeView.Clear();
customTreeView.hierarchy = new List<string> { "JobType", "DateAdvance", "Id", "Name" };
foreach (var item in list)
{
customTreeView.AddNode(item, "Name");
}
}
}
private void jobTypesToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormJobType));
if (service is FormJobType form)
{
form.ShowDialog();
}
}
private void addWorkerToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormWorker));
if (service is FormWorker form)
{
form.ShowDialog();
}
LoadData();
}
private void editWorkerToolStripMenuItem_Click(object sender, EventArgs e)
{
Transmit item = customTreeView.GetSelectedNode<Transmit>();
int id = Convert.ToInt32(item.Id);
FormWorker form = new FormWorker(_jobTypeLogic, _workerLogic, id);
form.ShowDialog();
LoadData();
}
private void deleteWorkerToolStripMenuItem_Click(object sender, EventArgs e)
{
var confirmResult = MessageBox.Show("Вы действительно хотите удалить запись?", "Подтвердите действие",
MessageBoxButtons.YesNo,
MessageBoxIcon.Question
);
Transmit item = customTreeView.GetSelectedNode<Transmit>();
if (confirmResult == DialogResult.Yes)
{
_workerLogic.Delete(new WorkerBindingModel
{
Id = Convert.ToInt32(item.Id)
});
LoadData();
}
}
private void pdfToolStripMenuItem_Click(object sender, EventArgs e)
{
SaveFileDialog saveFileDialog = new SaveFileDialog();
if (saveFileDialog.ShowDialog() != DialogResult.OK)
{
return;
};
string path = saveFileDialog.FileName + ".pdf";
var list = _workerLogic.ReadList(null);
TextPdfConf conf = new();
conf.Filename = path;
conf.Title = "Учет сотрудников предприятия, прошедших квалификацию";
List<string> rows = new List<string>();
foreach (var el in list)
{
rows.Add($"{el.Name}: {el.Autobiography}");
rows.Add("");
}
conf.Rows = rows;
pdfHugeText.CreatePdf(conf);
MessageBox.Show("Отчет создан", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void excelToolStripMenuItem_Click(object sender, EventArgs e)
{
SaveFileDialog saveFileDialog = new SaveFileDialog();
if (saveFileDialog.ShowDialog() != DialogResult.OK)
{
return;
};
string path = saveFileDialog.FileName + ".xlsx";
var list = _workerLogic.ReadList(null);
excelWithCustomTable.CreateDoc(new KryukovLib.Models.TableWithHeaderConfig<WorkerViewModel>
{
FilePath = path,
Header = "Учет сотрудников предприятия",
ColumnsRowsWidth = new List<(int Column, int Row)> { (5, 5), (15, 5), (10, 0), (30, 0), },
Headers = new List<(int ColumnIndex, string Header, string PropertyName)>
{
(0, "Индификатор", "Id"),
(1, "ФИО", "Name"),
(2, "Должность", "JobType"),
(3, "Дата повышения квалификации", "DateAdvance"),
},
Data = list,
});
MessageBox.Show("Отчет создан", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void wordToolStripMenuItem_Click(object sender, EventArgs e)
{
SaveFileDialog saveFileDialog = new SaveFileDialog();
if (saveFileDialog.ShowDialog() != DialogResult.OK)
{
return;
};
string path = saveFileDialog.FileName + ".docx";
var list = _workerLogic.ReadList(null);
List<(int Date, double Value)> data = new List<(int Date, double Value)>();
var grouped = list
.GroupBy(x => x.JobType)
.Select(x => new
{
index = x.Key,
Count = (double)x.Count(c => c.DateAdvance == "Повышения квалификации не было")
})
.ToList();
var result = grouped
.Select((x, index) => (Date: index + 1, Value: x.Count))
.ToList();
wordWithDiagram.CreateDoc(new WordWithDiagramConfig
{
FilePath = path,
Header = "Сотрудники, не прошедшие повышение квалификации в разрезе должностей",
ChartTitle = "Круговая диаграмма",
LegendLocation = BelianinComponents.Models.Location.Left,
Data = new Dictionary<string, List<(int Date, double Value)>>
{
{"Серия 1", result}
}
});
MessageBox.Show("Отчет создан", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}

View File

@ -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="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="pdfHugeText.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>153, 17</value>
</metadata>
<metadata name="excelWithCustomTable.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>297, 31</value>
</metadata>
<metadata name="wordWithDiagram.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>503, 31</value>
</metadata>
</root>

View File

@ -1,174 +0,0 @@
namespace TestApp
{
partial class FormWorker
{
/// <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()
{
label1 = new Label();
label2 = new Label();
label3 = new Label();
label4 = new Label();
textBoxName = new TextBox();
textBoxAutobiography = new TextBox();
customComboBox = new BarsukovComponents.VisualComponents.CustomComboBox();
dateBoxWithNull = new KryukovLib.DateBoxWithNull();
buttonCancel = new Button();
buttonOK = new Button();
SuspendLayout();
//
// label1
//
label1.AutoSize = true;
label1.Font = new Font("Times New Roman", 12F);
label1.Location = new Point(101, 10);
label1.Name = "label1";
label1.Size = new Size(60, 22);
label1.TabIndex = 0;
label1.Text = "ФИО:";
//
// label2
//
label2.AutoSize = true;
label2.Font = new Font("Times New Roman", 12F);
label2.Location = new Point(12, 45);
label2.Name = "label2";
label2.Size = new Size(149, 22);
label2.TabIndex = 1;
label2.Text = "Автобиография:";
//
// label3
//
label3.AutoSize = true;
label3.Font = new Font("Times New Roman", 12F);
label3.Location = new Point(49, 80);
label3.Name = "label3";
label3.Size = new Size(112, 22);
label3.TabIndex = 2;
label3.Text = "Должность:";
//
// label4
//
label4.Font = new Font("Times New Roman", 12F);
label4.Location = new Point(3, 185);
label4.Name = "label4";
label4.Size = new Size(158, 54);
label4.TabIndex = 3;
label4.Text = "Дата повышения: квалификации";
//
// textBoxName
//
textBoxName.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
textBoxName.Location = new Point(167, 5);
textBoxName.Name = "textBoxName";
textBoxName.Size = new Size(250, 27);
textBoxName.TabIndex = 4;
textBoxName.TextChanged += OnInputChange;
//
// textBoxAutobiography
//
textBoxAutobiography.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
textBoxAutobiography.Location = new Point(167, 43);
textBoxAutobiography.Name = "textBoxAutobiography";
textBoxAutobiography.Size = new Size(250, 27);
textBoxAutobiography.TabIndex = 5;
textBoxAutobiography.TextChanged += OnInputChange;
//
// customComboBox
//
customComboBox.BorderStyle = BorderStyle.FixedSingle;
customComboBox.Location = new Point(167, 80);
customComboBox.Name = "customComboBox";
customComboBox.SelectedItem = "";
customComboBox.Size = new Size(250, 91);
customComboBox.TabIndex = 6;
customComboBox.Enter += OnInputChange;
//
// dateBoxWithNull
//
dateBoxWithNull.Location = new Point(167, 185);
dateBoxWithNull.Name = "dateBoxWithNull";
dateBoxWithNull.Size = new Size(278, 45);
dateBoxWithNull.TabIndex = 7;
//
// buttonCancel
//
buttonCancel.Font = new Font("Times New Roman", 12F, FontStyle.Regular, GraphicsUnit.Point, 204);
buttonCancel.Location = new Point(339, 249);
buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(94, 29);
buttonCancel.TabIndex = 8;
buttonCancel.Text = "Отмена";
buttonCancel.UseVisualStyleBackColor = true;
buttonCancel.Click += buttonCancel_Click;
//
// buttonOK
//
buttonOK.Font = new Font("Times New Roman", 12F, FontStyle.Regular, GraphicsUnit.Point, 204);
buttonOK.Location = new Point(239, 249);
buttonOK.Name = "buttonOK";
buttonOK.Size = new Size(94, 29);
buttonOK.TabIndex = 9;
buttonOK.Text = "OK";
buttonOK.UseVisualStyleBackColor = true;
buttonOK.Click += buttonOK_Click;
//
// FormWorker
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(445, 290);
Controls.Add(buttonOK);
Controls.Add(buttonCancel);
Controls.Add(dateBoxWithNull);
Controls.Add(customComboBox);
Controls.Add(textBoxAutobiography);
Controls.Add(textBoxName);
Controls.Add(label4);
Controls.Add(label3);
Controls.Add(label2);
Controls.Add(label1);
Name = "FormWorker";
Text = "FormWorker";
FormClosing += FormWorker_FormClosing;
ResumeLayout(false);
PerformLayout();
}
#endregion
private Label label1;
private Label label2;
private Label label3;
private Label label4;
private TextBox textBoxName;
private TextBox textBoxAutobiography;
private BarsukovComponents.VisualComponents.CustomComboBox customComboBox;
private KryukovLib.DateBoxWithNull dateBoxWithNull;
private Button buttonCancel;
private Button buttonOK;
}
}

View File

@ -1,146 +0,0 @@
using BusinessLogic;
using Contracts.BindingModels;
using Contracts.SearchModels;
using Contracts.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 TestApp
{
public partial class FormWorker : Form
{
private int? _id;
private IJobTypeLogic _jobTypeLogic;
private IWorkerLogic _workerLogic;
private bool _isEdited;
public FormWorker(IJobTypeLogic jobTypeLogic, IWorkerLogic workerLogic, int? id = null)
{
InitializeComponent();
_jobTypeLogic = jobTypeLogic;
_workerLogic = workerLogic;
_id = id;
LoadData();
}
private void LoadData()
{
var list = _jobTypeLogic.ReadList(null);
if (list != null)
{
foreach (var item in list)
{
customComboBox.ComboBoxItems.Add(item.Name);
}
}
if (_id.HasValue)
{
var item = _workerLogic.ReadElement(new WorkerSearchModel
{
Id = _id.Value,
});
textBoxName.Text = item.Name;
textBoxAutobiography.Text = item.Autobiography;
if (item.DateAdvance == "Повышения квалификации не было")
{
dateBoxWithNull.Value = null;
}
else
{
dateBoxWithNull.Value = DateTime.Parse(item.DateAdvance);
}
customComboBox.SelectedItem = item.JobType;
_isEdited = false;
}
}
private void OnInputChange(object sender, EventArgs e)
{
_isEdited = true;
}
private void buttonOK_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(textBoxName.Text))
{
MessageBox.Show("Заполните поле ФИО", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
if (string.IsNullOrEmpty(textBoxAutobiography.Text))
{
MessageBox.Show("Заполните поле Автобиография", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
if (string.IsNullOrEmpty(customComboBox.SelectedItem))
{
MessageBox.Show("Выберите должность", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
try
{
string? date = dateBoxWithNull.Value.ToString();
}
catch (Exception ex)
{
MessageBox.Show("Впишите дату в формате DD.MM.YYYY, либо поставте галочку (в случае, если повышения квалификации не было)", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
_isEdited = false;
try
{
var model = new WorkerBindingModel
{
Id = _id ?? 0,
Name = textBoxName.Text,
Autobiography = textBoxAutobiography.Text,
JobType = customComboBox.SelectedItem,
DateAdvance = dateBoxWithNull.Value.ToString() == ""
? "Повышения квалификации не было"
: dateBoxWithNull.Value.ToString(),
};
bool result = _id.HasValue ? _workerLogic.Update(model) : _workerLogic.Create(model);
if (!result)
{
throw new Exception("Error while creating or updating worker");
}
MessageBox.Show("Сохранено", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
DialogResult = DialogResult.OK;
Close();
}
catch(Exception ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void FormWorker_FormClosing(object sender, FormClosingEventArgs e)
{
if (!_isEdited)
{
return;
}
var confirmResult = MessageBox.Show(
"Вы не сохранили изменения.\nВы действительно хотите выйти?", "Подтвердите действие",
MessageBoxButtons.YesNo,
MessageBoxIcon.Question
);
if (confirmResult == DialogResult.No)
{
e.Cancel = true;
}
}
private void buttonCancel_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
Close();
}
}
}

View File

@ -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>

View File

@ -1,36 +0,0 @@
using BusinessLogic;
using Contracts.BusinessLogicContracts;
using Contracts.StorageContracts;
using DatabaseImplement.Implements;
using Microsoft.Extensions.DependencyInjection;
using System.Drawing.Printing;
namespace TestApp
{
internal static class Program
{
private static ServiceProvider? _serviceProvider;
public static ServiceProvider? ServiceProvider => _serviceProvider;
[STAThread]
static void Main()
{
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
var services = new ServiceCollection();
ConfigureServices(services);
_serviceProvider = services.BuildServiceProvider();
Application.Run(_serviceProvider.GetRequiredService<FormMain>());
}
private static void ConfigureServices(ServiceCollection services)
{
services.AddTransient<IJobTypeStorage, JobTypeStorage>();
services.AddTransient<IJobTypeLogic, JobTypeLogic>();
services.AddTransient<IWorkerLogic, WorkerLogic>();
services.AddTransient<IWorkerStorage, WorkerStorage>();
services.AddTransient<FormMain>();
services.AddTransient<FormJobType>();
services.AddTransient<FormWorker>();
}
}
}

View File

@ -1,26 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="BelianinComponents" Version="1.0.0" />
<PackageReference Include="KryukovLib" Version="1.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.10">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Components\BarsukovComponents.csproj" />
<ProjectReference Include="..\Contracts\Contracts.csproj" />
<ProjectReference Include="..\DatabaseImplement\DatabaseImplement.csproj" />
</ItemGroup>
</Project>

View File

@ -1,22 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TestApp
{
public class Transmit
{
public string Id { get; set; }
[DisplayName("ФИО")]
public string Name { get; set; } = string.Empty;
[DisplayName("Автобиография")]
public string Autobiography { get; set; } = string.Empty;
[DisplayName("Должность")]
public string JobType { get; set; } = string.Empty;
[DisplayName("Дата повышения квалификации")]
public string? DateAdvance { get; set; } = string.Empty;
}
}