Compare commits
5 Commits
383f82d65e
...
1719292030
Author | SHA1 | Date | |
---|---|---|---|
1719292030 | |||
f0ab159b0a | |||
7b6abd796f | |||
80cd4e3eb9 | |||
48e9f2ec28 |
@ -17,6 +17,6 @@ namespace Contracts.BindingModels
|
||||
|
||||
public string OrganisationType { get; set; } = string.Empty;
|
||||
|
||||
public DateTime? DateLastDelivery { get; set; }
|
||||
public string? DateLastDelivery { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ namespace Contracts.SearchModels
|
||||
{
|
||||
public class ProviderSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public string? Name { get; set; }
|
||||
|
||||
public string? OrganisationType { get; set; }
|
||||
|
@ -22,7 +22,7 @@ namespace Contracts.ViewModels
|
||||
public string OrganisationType { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Дата последней доставки")]
|
||||
public DateTime? DateLastDelivery { get; set; }
|
||||
public string? DateLastDelivery { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,76 @@
|
||||
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 OrganisationTypeStorage : IOrganisationTypeStorage
|
||||
{
|
||||
public List<OrganisationTypeViewModel> GetFullList()
|
||||
{
|
||||
using var context = new Database();
|
||||
return context.OrganisationTypes.Select(x => x.GetViewModel).ToList();
|
||||
}
|
||||
|
||||
public List<OrganisationTypeViewModel> GetFilteredList(OrganisationTypeSearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.Name))
|
||||
{
|
||||
return new();
|
||||
}
|
||||
using var context = new Database();
|
||||
return context.OrganisationTypes.Where(x => x.Name == model.Name).Select(x=> x.GetViewModel).ToList();
|
||||
}
|
||||
|
||||
public OrganisationTypeViewModel? GetElement(OrganisationTypeSearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.Name))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new Database();
|
||||
return context.OrganisationTypes.FirstOrDefault(x => x.Name == model.Name)?.GetViewModel;
|
||||
}
|
||||
|
||||
|
||||
public OrganisationTypeViewModel? Insert(OrganisationTypeBindingModel model)
|
||||
{
|
||||
var newType = OrganisationType.Create(model);
|
||||
if(newType == null) return null;
|
||||
using var context = new Database();
|
||||
context.OrganisationTypes.Add(newType);
|
||||
context.SaveChanges();
|
||||
return newType.GetViewModel;
|
||||
}
|
||||
|
||||
public OrganisationTypeViewModel? Update(OrganisationTypeBindingModel model)
|
||||
{
|
||||
using var context = new Database();
|
||||
var type = context.OrganisationTypes.FirstOrDefault(x => x.Id == model.Id);
|
||||
if(type == null) return null;
|
||||
type.Update(model);
|
||||
context.SaveChanges();
|
||||
return type.GetViewModel;
|
||||
}
|
||||
|
||||
public OrganisationTypeViewModel? Delete(OrganisationTypeBindingModel model)
|
||||
{
|
||||
using var context = new Database();
|
||||
var element = context.OrganisationTypes.FirstOrDefault(x => x.Name == model.Name);
|
||||
if(element != null)
|
||||
{
|
||||
context.OrganisationTypes.Remove(element);
|
||||
context.SaveChanges();
|
||||
return element.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -31,12 +31,12 @@ namespace DatabaseImplement.Implements
|
||||
|
||||
public ProviderViewModel? GetElement(ProviderSearchModel model)
|
||||
{
|
||||
if(string.IsNullOrEmpty(model.Name))
|
||||
if(!model.Id.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new Database();
|
||||
return context.Providers.FirstOrDefault(x => x.Name == model.Name)?.GetViewModel;
|
||||
return context.Providers.FirstOrDefault(x => x.Id == model.Id)?.GetViewModel;
|
||||
}
|
||||
|
||||
public ProviderViewModel? Insert(ProviderBindingModel model)
|
||||
|
74
ComponentProgramming/DatabaseImplement/Migrations/20241022152445_InitMigration.Designer.cs
generated
Normal file
74
ComponentProgramming/DatabaseImplement/Migrations/20241022152445_InitMigration.Designer.cs
generated
Normal file
@ -0,0 +1,74 @@
|
||||
// <auto-generated />
|
||||
using DatabaseImplement;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace DatabaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(Database))]
|
||||
[Migration("20241022152445_InitMigration")]
|
||||
partial class InitMigration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.10")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("DatabaseImplement.Models.OrganisationType", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("OrganisationTypes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DatabaseImplement.Models.Provider", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("DateLastDelivery")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("FurnitureType")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("OrganisationType")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Providers");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace DatabaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class InitMigration : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "OrganisationTypes",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_OrganisationTypes", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Providers",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
FurnitureType = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
OrganisationType = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
DateLastDelivery = table.Column<string>(type: "nvarchar(max)", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Providers", x => x.Id);
|
||||
});
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "OrganisationTypes");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Providers");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
// <auto-generated />
|
||||
using DatabaseImplement;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#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", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("DatabaseImplement.Models.OrganisationType", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("OrganisationTypes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DatabaseImplement.Models.Provider", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("DateLastDelivery")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("FurnitureType")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("OrganisationType")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Providers");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -23,7 +23,7 @@ namespace DatabaseImplement.Models
|
||||
[Required]
|
||||
public string OrganisationType { get; private set; } = string.Empty;
|
||||
|
||||
public DateTime? DateLastDelivery { get; private set; }
|
||||
public string? DateLastDelivery { get; private set; }
|
||||
|
||||
public static Provider? Create(ProviderBindingModel model)
|
||||
{
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net8.0-windows</TargetFramework>
|
||||
<TargetFramework>net8.0-windows7.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
@ -11,11 +11,16 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ComponentsLibraryNet60" Version="1.0.0" />
|
||||
<PackageReference Include="ControlsLibraryNet60" 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>
|
||||
<PackageReference Include="PDFsharp-MigraDoc-GDI" Version="6.1.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ComponentProgramming\ComponentProgramming.csproj" />
|
||||
<ProjectReference Include="..\DatabaseImplement\DatabaseImplement.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
54
ComponentProgramming/Forms/MainForm.Designer.cs
generated
54
ComponentProgramming/Forms/MainForm.Designer.cs
generated
@ -28,18 +28,68 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
components = new System.ComponentModel.Container();
|
||||
controlDataTreeTable = new ControlsLibraryNet60.Data.ControlDataTreeTable();
|
||||
contextMenuStrip1 = new ContextMenuStrip(components);
|
||||
organisationTypesToolStripMenuItem = new ToolStripMenuItem();
|
||||
addProviderToolStripMenuItem = new ToolStripMenuItem();
|
||||
editProviderToolStripMenuItem = new ToolStripMenuItem();
|
||||
contextMenuStrip1.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// controlDataTreeTable
|
||||
//
|
||||
controlDataTreeTable.ContextMenuStrip = contextMenuStrip1;
|
||||
controlDataTreeTable.Location = new Point(13, 12);
|
||||
controlDataTreeTable.Margin = new Padding(4, 3, 4, 3);
|
||||
controlDataTreeTable.Name = "controlDataTreeTable";
|
||||
controlDataTreeTable.Size = new Size(337, 382);
|
||||
controlDataTreeTable.TabIndex = 1;
|
||||
//
|
||||
// contextMenuStrip1
|
||||
//
|
||||
contextMenuStrip1.Items.AddRange(new ToolStripItem[] { organisationTypesToolStripMenuItem, addProviderToolStripMenuItem, editProviderToolStripMenuItem });
|
||||
contextMenuStrip1.Name = "contextMenuStrip1";
|
||||
contextMenuStrip1.Size = new Size(181, 92);
|
||||
//
|
||||
// organisationTypesToolStripMenuItem
|
||||
//
|
||||
organisationTypesToolStripMenuItem.Name = "organisationTypesToolStripMenuItem";
|
||||
organisationTypesToolStripMenuItem.Size = new Size(180, 22);
|
||||
organisationTypesToolStripMenuItem.Text = "Organisation types";
|
||||
organisationTypesToolStripMenuItem.Click += organisationTypesToolStripMenuItem_Click;
|
||||
//
|
||||
// addProviderToolStripMenuItem
|
||||
//
|
||||
addProviderToolStripMenuItem.Name = "addProviderToolStripMenuItem";
|
||||
addProviderToolStripMenuItem.Size = new Size(180, 22);
|
||||
addProviderToolStripMenuItem.Text = "Add provider";
|
||||
addProviderToolStripMenuItem.Click += addProviderToolStripMenuItem_Click;
|
||||
//
|
||||
// editProviderToolStripMenuItem
|
||||
//
|
||||
editProviderToolStripMenuItem.Name = "editProviderToolStripMenuItem";
|
||||
editProviderToolStripMenuItem.Size = new Size(180, 22);
|
||||
editProviderToolStripMenuItem.Text = "Edit provider";
|
||||
editProviderToolStripMenuItem.Click += editProviderToolStripMenuItem_Click;
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(800, 450);
|
||||
ClientSize = new Size(358, 403);
|
||||
Controls.Add(controlDataTreeTable);
|
||||
Name = "MainForm";
|
||||
Text = "Основная форма";
|
||||
Text = "Main Form";
|
||||
contextMenuStrip1.ResumeLayout(false);
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
private ControlsLibraryNet60.Data.ControlDataTreeTable controlDataTreeTable;
|
||||
private ContextMenuStrip contextMenuStrip1;
|
||||
private ToolStripMenuItem organisationTypesToolStripMenuItem;
|
||||
private ToolStripMenuItem addProviderToolStripMenuItem;
|
||||
private ToolStripMenuItem editProviderToolStripMenuItem;
|
||||
}
|
||||
}
|
@ -7,14 +7,73 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using ComponentsLibraryNet60;
|
||||
using Contracts.BusinessLogicsContracts;
|
||||
using Contracts.ViewModels;
|
||||
using ControlsLibraryNet60.Data;
|
||||
using ControlsLibraryNet60.Models;
|
||||
|
||||
namespace Forms
|
||||
{
|
||||
public partial class MainForm : Form
|
||||
{
|
||||
public MainForm()
|
||||
|
||||
private readonly IProviderLogic _logic;
|
||||
|
||||
public MainForm(IProviderLogic logic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logic = logic;
|
||||
LoadData();
|
||||
}
|
||||
|
||||
private void LoadData()
|
||||
{
|
||||
var list = _logic.ReadList(null);
|
||||
if (list != null)
|
||||
{
|
||||
DataTreeNodeConfig treeConfig = new();
|
||||
treeConfig.NodeNames = new();
|
||||
treeConfig.NodeNames.Enqueue("OrganisationType");
|
||||
treeConfig.NodeNames.Enqueue("DateLastDelivery");
|
||||
treeConfig.NodeNames.Enqueue("Id");
|
||||
treeConfig.NodeNames.Enqueue("Name");
|
||||
|
||||
controlDataTreeTable.LoadConfig(treeConfig);
|
||||
controlDataTreeTable.AddTable(list);
|
||||
}
|
||||
}
|
||||
private void organisationTypesToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(OrganisationTypeForm));
|
||||
if (service is OrganisationTypeForm form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void addProviderToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(ProviderForm));
|
||||
if (service is ProviderForm form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
LoadData();
|
||||
}
|
||||
|
||||
private void editProviderToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(ProviderForm));
|
||||
if(service is ProviderForm form)
|
||||
{
|
||||
int id = Convert.ToInt32(controlDataTreeTable.GetSelectedObject<ProviderViewModel>()?.Id);
|
||||
form.Id = id;
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -117,4 +117,7 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>132, 17</value>
|
||||
</metadata>
|
||||
</root>
|
74
ComponentProgramming/Forms/OrganisationTypeForm.Designer.cs
generated
Normal file
74
ComponentProgramming/Forms/OrganisationTypeForm.Designer.cs
generated
Normal file
@ -0,0 +1,74 @@
|
||||
namespace Forms
|
||||
{
|
||||
partial class OrganisationTypeForm
|
||||
{
|
||||
/// <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();
|
||||
Type = new DataGridViewTextBoxColumn();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// dataGridView
|
||||
//
|
||||
dataGridView.AllowUserToAddRows = false;
|
||||
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dataGridView.BackgroundColor = Color.White;
|
||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView.Columns.AddRange(new DataGridViewColumn[] { Type });
|
||||
dataGridView.GridColor = Color.Gray;
|
||||
dataGridView.Location = new Point(12, 12);
|
||||
dataGridView.Name = "dataGridView";
|
||||
dataGridView.RowHeadersVisible = false;
|
||||
dataGridView.Size = new Size(181, 286);
|
||||
dataGridView.TabIndex = 0;
|
||||
dataGridView.CellValueChanged += dataGridView_CellValueChanged;
|
||||
dataGridView.KeyDown += dataGridView_KeyDown;
|
||||
//
|
||||
// Type
|
||||
//
|
||||
Type.HeaderText = "Тип организации";
|
||||
Type.Name = "Type";
|
||||
//
|
||||
// OrganisationTypeForm
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(205, 308);
|
||||
Controls.Add(dataGridView);
|
||||
Name = "OrganisationTypeForm";
|
||||
Text = "Справочник";
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DataGridView dataGridView;
|
||||
private DataGridViewTextBoxColumn Type;
|
||||
}
|
||||
}
|
93
ComponentProgramming/Forms/OrganisationTypeForm.cs
Normal file
93
ComponentProgramming/Forms/OrganisationTypeForm.cs
Normal file
@ -0,0 +1,93 @@
|
||||
using Contracts.BindingModels;
|
||||
using Contracts.BusinessLogicsContracts;
|
||||
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 Forms
|
||||
{
|
||||
public partial class OrganisationTypeForm : Form
|
||||
{
|
||||
|
||||
private readonly IOrganisationTypeLogic _logic;
|
||||
|
||||
public OrganisationTypeForm(IOrganisationTypeLogic 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 OrganisationTypeBindingModel
|
||||
{
|
||||
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;
|
||||
}
|
||||
_logic.Create(new OrganisationTypeBindingModel
|
||||
{
|
||||
Name = name,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
123
ComponentProgramming/Forms/OrganisationTypeForm.resx
Normal file
123
ComponentProgramming/Forms/OrganisationTypeForm.resx
Normal file
@ -0,0 +1,123 @@
|
||||
<?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="Type.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
</root>
|
43
ComponentProgramming/Forms/Program.cs
Normal file
43
ComponentProgramming/Forms/Program.cs
Normal file
@ -0,0 +1,43 @@
|
||||
using BusinessLogics.BusinessLogics;
|
||||
using Contracts.BusinessLogicsContracts;
|
||||
using Contracts.StorageContracts;
|
||||
using DatabaseImplement.Implements;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
|
||||
namespace Forms
|
||||
{
|
||||
internal static class Program
|
||||
{
|
||||
private static ServiceProvider? _serviceProvider;
|
||||
public static ServiceProvider? ServiceProvider => _serviceProvider;
|
||||
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[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<MainForm>());
|
||||
}
|
||||
|
||||
|
||||
private static void ConfigureServices(ServiceCollection services)
|
||||
{
|
||||
services.AddTransient<IOrganisationTypeStorage, OrganisationTypeStorage>();
|
||||
services.AddTransient<IOrganisationTypeLogic, OrganisationTypeLogic>();
|
||||
services.AddTransient<IProviderLogic, ProviderLogic>();
|
||||
services.AddTransient<IProviderStorage, ProviderStorage>();
|
||||
services.AddTransient<MainForm>();
|
||||
services.AddTransient<OrganisationTypeForm>();
|
||||
services.AddTransient<ProviderForm>();
|
||||
}
|
||||
}
|
||||
}
|
170
ComponentProgramming/Forms/ProviderForm.Designer.cs
generated
Normal file
170
ComponentProgramming/Forms/ProviderForm.Designer.cs
generated
Normal file
@ -0,0 +1,170 @@
|
||||
namespace Forms
|
||||
{
|
||||
partial class ProviderForm
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
controlInputNullableDate = new ControlsLibraryNet60.Input.ControlInputNullableDate();
|
||||
controlSelectedComboBoxList = new ControlsLibraryNet60.Selected.ControlSelectedComboBoxList();
|
||||
textBoxName = new TextBox();
|
||||
label1 = new Label();
|
||||
textBoxFurnitureType = new TextBox();
|
||||
label2 = new Label();
|
||||
label3 = new Label();
|
||||
label4 = new Label();
|
||||
buttonAdd = new Button();
|
||||
buttonCancel = new Button();
|
||||
SuspendLayout();
|
||||
//
|
||||
// controlInputNullableDate
|
||||
//
|
||||
controlInputNullableDate.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
controlInputNullableDate.Location = new Point(12, 164);
|
||||
controlInputNullableDate.Margin = new Padding(4, 3, 4, 3);
|
||||
controlInputNullableDate.Name = "controlInputNullableDate";
|
||||
controlInputNullableDate.Size = new Size(254, 23);
|
||||
controlInputNullableDate.TabIndex = 0;
|
||||
controlInputNullableDate.Value = null;
|
||||
//
|
||||
// controlSelectedComboBoxList
|
||||
//
|
||||
controlSelectedComboBoxList.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
controlSelectedComboBoxList.Location = new Point(12, 119);
|
||||
controlSelectedComboBoxList.Margin = new Padding(5, 3, 5, 3);
|
||||
controlSelectedComboBoxList.Name = "controlSelectedComboBoxList";
|
||||
controlSelectedComboBoxList.SelectedElement = "";
|
||||
controlSelectedComboBoxList.Size = new Size(254, 24);
|
||||
controlSelectedComboBoxList.TabIndex = 1;
|
||||
//
|
||||
// textBoxName
|
||||
//
|
||||
textBoxName.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
textBoxName.Location = new Point(12, 27);
|
||||
textBoxName.Name = "textBoxName";
|
||||
textBoxName.Size = new Size(254, 23);
|
||||
textBoxName.TabIndex = 2;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new Point(12, 9);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(42, 15);
|
||||
label1.TabIndex = 3;
|
||||
label1.Text = "Name:";
|
||||
//
|
||||
// textBoxFurnitureType
|
||||
//
|
||||
textBoxFurnitureType.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
textBoxFurnitureType.Location = new Point(12, 73);
|
||||
textBoxFurnitureType.Name = "textBoxFurnitureType";
|
||||
textBoxFurnitureType.Size = new Size(254, 23);
|
||||
textBoxFurnitureType.TabIndex = 4;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
label2.AutoSize = true;
|
||||
label2.Location = new Point(12, 55);
|
||||
label2.Name = "label2";
|
||||
label2.Size = new Size(84, 15);
|
||||
label2.TabIndex = 5;
|
||||
label2.Text = "Furniture type:";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
label3.AutoSize = true;
|
||||
label3.Location = new Point(12, 101);
|
||||
label3.Name = "label3";
|
||||
label3.Size = new Size(104, 15);
|
||||
label3.TabIndex = 6;
|
||||
label3.Text = "Organisation type:";
|
||||
//
|
||||
// label4
|
||||
//
|
||||
label4.AutoSize = true;
|
||||
label4.Location = new Point(12, 146);
|
||||
label4.Name = "label4";
|
||||
label4.Size = new Size(75, 15);
|
||||
label4.TabIndex = 7;
|
||||
label4.Text = "Last delivery:";
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left;
|
||||
buttonAdd.Location = new Point(12, 193);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(94, 36);
|
||||
buttonAdd.TabIndex = 8;
|
||||
buttonAdd.Text = "Add";
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += buttonAdd_Click;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left;
|
||||
buttonCancel.Location = new Point(173, 193);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(94, 36);
|
||||
buttonCancel.TabIndex = 9;
|
||||
buttonCancel.Text = "Cancel";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// ProviderForm
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(279, 241);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonAdd);
|
||||
Controls.Add(label4);
|
||||
Controls.Add(label3);
|
||||
Controls.Add(label2);
|
||||
Controls.Add(textBoxFurnitureType);
|
||||
Controls.Add(label1);
|
||||
Controls.Add(textBoxName);
|
||||
Controls.Add(controlSelectedComboBoxList);
|
||||
Controls.Add(controlInputNullableDate);
|
||||
Name = "ProviderForm";
|
||||
Text = "Create Provider";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private ControlsLibraryNet60.Input.ControlInputNullableDate controlInputNullableDate;
|
||||
private ControlsLibraryNet60.Selected.ControlSelectedComboBoxList controlSelectedComboBoxList;
|
||||
private TextBox textBoxName;
|
||||
private Label label1;
|
||||
private TextBox textBoxFurnitureType;
|
||||
private Label label2;
|
||||
private Label label3;
|
||||
private Label label4;
|
||||
private Button buttonAdd;
|
||||
private Button buttonCancel;
|
||||
}
|
||||
}
|
97
ComponentProgramming/Forms/ProviderForm.cs
Normal file
97
ComponentProgramming/Forms/ProviderForm.cs
Normal file
@ -0,0 +1,97 @@
|
||||
using Contracts.BindingModels;
|
||||
using Contracts.BusinessLogicsContracts;
|
||||
using Contracts.SearchModels;
|
||||
using DocumentFormat.OpenXml.Spreadsheet;
|
||||
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 Forms
|
||||
{
|
||||
public partial class ProviderForm : Form
|
||||
{
|
||||
private int? _id;
|
||||
public int Id { set { _id = value; } }
|
||||
private readonly IProviderLogic _pLogic;
|
||||
private readonly IOrganisationTypeLogic _oLogic;
|
||||
//private bool isEdited;
|
||||
|
||||
public ProviderForm(IProviderLogic plogic, IOrganisationTypeLogic ologic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_pLogic = plogic;
|
||||
_oLogic = ologic;
|
||||
//isEdited = false;
|
||||
LoadData();
|
||||
}
|
||||
|
||||
private void LoadData()
|
||||
{
|
||||
var list = _oLogic.ReadList(null);
|
||||
if (list != null)
|
||||
{
|
||||
List<string> strList = new List<string>();
|
||||
foreach (var item in list)
|
||||
{
|
||||
strList.Add(item.Name);
|
||||
}
|
||||
controlSelectedComboBoxList.AddList(strList);
|
||||
}
|
||||
if (_id.HasValue)
|
||||
{
|
||||
var view = _pLogic.ReadElement(new ProviderSearchModel
|
||||
{
|
||||
Id = _id.Value,
|
||||
});
|
||||
controlSelectedComboBoxList.SelectedElement = view!.OrganisationType;
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
if(string.IsNullOrEmpty(textBoxName.Text))
|
||||
{
|
||||
MessageBox.Show("Заполните поле Название", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(textBoxFurnitureType.Text))
|
||||
{
|
||||
MessageBox.Show("Заполните Перечень мебели ", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
if(string.IsNullOrEmpty(controlSelectedComboBoxList.SelectedElement))
|
||||
{
|
||||
MessageBox.Show("Выберите Тип организации", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
var s = controlInputNullableDate.Value.ToString();
|
||||
try
|
||||
{
|
||||
var OperationResult = _pLogic.Create(new ProviderBindingModel
|
||||
{
|
||||
Name = textBoxName.Text,
|
||||
FurnitureType = textBoxFurnitureType.Text,
|
||||
DateLastDelivery = controlInputNullableDate.Value.ToString() == "" ? "No date" : controlInputNullableDate.Value.ToString(),
|
||||
OrganisationType = controlSelectedComboBoxList.SelectedElement
|
||||
});
|
||||
if (!OperationResult)
|
||||
{
|
||||
throw new Exception("Ошибка при создании поставщика.");
|
||||
}
|
||||
MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
120
ComponentProgramming/Forms/ProviderForm.resx
Normal file
120
ComponentProgramming/Forms/ProviderForm.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?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>
|
@ -15,6 +15,6 @@ namespace Models.Models
|
||||
|
||||
string OrganisationType { get; }
|
||||
|
||||
DateTime? DateLastDelivery { get; }
|
||||
string? DateLastDelivery { get; }
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user