Набедакурил всякого
This commit is contained in:
parent
0d4201259e
commit
20dbdc8aa2
git/JurasicZoo
JurasicZoo
ClientCreateRoute.csClientRoutes.Designer.csClientRoutes.csFormClientMain.Designer.csFormClientMain.csFormClientMain.resxFormPreserve.Designer.csFormPreserve.csFormPreserve.resxFormPreserves.Designer.csFormPreserves.csFormPreserves.resxFormRoute.Designer.csFormRoute.csFormRoute.resxFormRoutePreserves.Designer.csFormRoutePreserves.csFormRoutePreserves.resxFormRoutes.Designer.csFormRoutes.csFormRoutes.resxProgram.csZooView.csproj
ZooBusinessLogic/BusinessLogic
ZooClientApp/Controllers
ZooContracts
ZooDataBaseImplement
ZooDataModels/Models
@ -1,20 +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 ZooView
|
||||
{
|
||||
public partial class ClientCreateRoute : Form
|
||||
{
|
||||
public ClientCreateRoute()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
154
git/JurasicZoo/JurasicZoo/ClientRoutes.Designer.cs
generated
154
git/JurasicZoo/JurasicZoo/ClientRoutes.Designer.cs
generated
@ -1,154 +0,0 @@
|
||||
namespace ZooView
|
||||
{
|
||||
partial class ClientRoutes
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
dataGridView1 = new DataGridView();
|
||||
RouteId = new DataGridViewTextBoxColumn();
|
||||
RouteName = new DataGridViewTextBoxColumn();
|
||||
RouteCost = new DataGridViewTextBoxColumn();
|
||||
DateStart = new DataGridViewTextBoxColumn();
|
||||
DateFinish = new DataGridViewTextBoxColumn();
|
||||
buttonAddRoute = new Button();
|
||||
buttonUpdateRoute = new Button();
|
||||
buttonRouteDelete = new Button();
|
||||
buttonRoutePay = new Button();
|
||||
RouteStatus = new DataGridViewTextBoxColumn();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView1).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// dataGridView1
|
||||
//
|
||||
dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView1.Columns.AddRange(new DataGridViewColumn[] { RouteId, RouteName, RouteCost, DateStart, DateFinish, RouteStatus });
|
||||
dataGridView1.Location = new Point(12, 3);
|
||||
dataGridView1.Name = "dataGridView1";
|
||||
dataGridView1.RowTemplate.Height = 25;
|
||||
dataGridView1.Size = new Size(484, 435);
|
||||
dataGridView1.TabIndex = 1;
|
||||
//
|
||||
// RouteId
|
||||
//
|
||||
RouteId.HeaderText = "id";
|
||||
RouteId.Name = "RouteId";
|
||||
RouteId.Visible = false;
|
||||
//
|
||||
// RouteName
|
||||
//
|
||||
RouteName.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
RouteName.HeaderText = "Название";
|
||||
RouteName.Name = "RouteName";
|
||||
//
|
||||
// RouteCost
|
||||
//
|
||||
RouteCost.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
RouteCost.HeaderText = "Стоимость";
|
||||
RouteCost.Name = "RouteCost";
|
||||
//
|
||||
// DateStart
|
||||
//
|
||||
DateStart.HeaderText = "Дата начала";
|
||||
DateStart.Name = "DateStart";
|
||||
//
|
||||
// DateFinish
|
||||
//
|
||||
DateFinish.HeaderText = "Дата окончания";
|
||||
DateFinish.Name = "DateFinish";
|
||||
//
|
||||
// buttonAddRoute
|
||||
//
|
||||
buttonAddRoute.Location = new Point(507, 27);
|
||||
buttonAddRoute.Name = "buttonAddRoute";
|
||||
buttonAddRoute.Size = new Size(129, 37);
|
||||
buttonAddRoute.TabIndex = 2;
|
||||
buttonAddRoute.Text = "Добавить";
|
||||
buttonAddRoute.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// buttonUpdateRoute
|
||||
//
|
||||
buttonUpdateRoute.Location = new Point(508, 97);
|
||||
buttonUpdateRoute.Name = "buttonUpdateRoute";
|
||||
buttonUpdateRoute.Size = new Size(129, 37);
|
||||
buttonUpdateRoute.TabIndex = 3;
|
||||
buttonUpdateRoute.Text = "Изменить";
|
||||
buttonUpdateRoute.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// buttonRouteDelete
|
||||
//
|
||||
buttonRouteDelete.Location = new Point(507, 161);
|
||||
buttonRouteDelete.Name = "buttonRouteDelete";
|
||||
buttonRouteDelete.Size = new Size(129, 37);
|
||||
buttonRouteDelete.TabIndex = 4;
|
||||
buttonRouteDelete.Text = "Удалить";
|
||||
buttonRouteDelete.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// buttonRoutePay
|
||||
//
|
||||
buttonRoutePay.Location = new Point(508, 220);
|
||||
buttonRoutePay.Name = "buttonRoutePay";
|
||||
buttonRoutePay.Size = new Size(129, 37);
|
||||
buttonRoutePay.TabIndex = 5;
|
||||
buttonRoutePay.Text = "Оплатить";
|
||||
buttonRoutePay.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// RouteStatus
|
||||
//
|
||||
RouteStatus.HeaderText = "Статус оплаты";
|
||||
RouteStatus.Name = "RouteStatus";
|
||||
//
|
||||
// Routes
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(649, 450);
|
||||
Controls.Add(buttonRoutePay);
|
||||
Controls.Add(buttonRouteDelete);
|
||||
Controls.Add(buttonUpdateRoute);
|
||||
Controls.Add(buttonAddRoute);
|
||||
Controls.Add(dataGridView1);
|
||||
Name = "Routes";
|
||||
Text = "Routes";
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DataGridView dataGridView1;
|
||||
private DataGridViewTextBoxColumn RouteId;
|
||||
private DataGridViewTextBoxColumn RouteName;
|
||||
private DataGridViewTextBoxColumn RouteCost;
|
||||
private DataGridViewTextBoxColumn DateStart;
|
||||
private DataGridViewTextBoxColumn DateFinish;
|
||||
private Button buttonAddRoute;
|
||||
private Button buttonUpdateRoute;
|
||||
private Button buttonRouteDelete;
|
||||
private Button buttonRoutePay;
|
||||
private DataGridViewTextBoxColumn RouteStatus;
|
||||
}
|
||||
}
|
@ -1,20 +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 ZooView
|
||||
{
|
||||
public partial class ClientRoutes : Form
|
||||
{
|
||||
public ClientRoutes()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
129
git/JurasicZoo/JurasicZoo/FormClientMain.Designer.cs
generated
Normal file
129
git/JurasicZoo/JurasicZoo/FormClientMain.Designer.cs
generated
Normal file
@ -0,0 +1,129 @@
|
||||
namespace ZooView
|
||||
{
|
||||
partial class FormClientMain
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
menuStrip1 = new MenuStrip();
|
||||
создатьМаршрутToolStripMenuItem = new ToolStripMenuItem();
|
||||
оплатитьМаршрутToolStripMenuItem = new ToolStripMenuItem();
|
||||
получитьОтчетToolStripMenuItem = new ToolStripMenuItem();
|
||||
вДокументToolStripMenuItem = new ToolStripMenuItem();
|
||||
наПочтуToolStripMenuItem = new ToolStripMenuItem();
|
||||
button1 = new Button();
|
||||
button2 = new Button();
|
||||
menuStrip1.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// menuStrip1
|
||||
//
|
||||
menuStrip1.Items.AddRange(new ToolStripItem[] { создатьМаршрутToolStripMenuItem, оплатитьМаршрутToolStripMenuItem, получитьОтчетToolStripMenuItem });
|
||||
menuStrip1.Location = new Point(0, 0);
|
||||
menuStrip1.Name = "menuStrip1";
|
||||
menuStrip1.Size = new Size(800, 24);
|
||||
menuStrip1.TabIndex = 0;
|
||||
menuStrip1.Text = "menuStrip1";
|
||||
//
|
||||
// создатьМаршрутToolStripMenuItem
|
||||
//
|
||||
создатьМаршрутToolStripMenuItem.Name = "создатьМаршрутToolStripMenuItem";
|
||||
создатьМаршрутToolStripMenuItem.Size = new Size(116, 20);
|
||||
создатьМаршрутToolStripMenuItem.Text = "Создать маршрут";
|
||||
создатьМаршрутToolStripMenuItem.Click += создатьМаршрутToolStripMenuItem_Click;
|
||||
//
|
||||
// оплатитьМаршрутToolStripMenuItem
|
||||
//
|
||||
оплатитьМаршрутToolStripMenuItem.Name = "оплатитьМаршрутToolStripMenuItem";
|
||||
оплатитьМаршрутToolStripMenuItem.Size = new Size(125, 20);
|
||||
оплатитьМаршрутToolStripMenuItem.Text = "Оплатить маршрут";
|
||||
//
|
||||
// получитьОтчетToolStripMenuItem
|
||||
//
|
||||
получитьОтчетToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { вДокументToolStripMenuItem, наПочтуToolStripMenuItem });
|
||||
получитьОтчетToolStripMenuItem.Name = "получитьОтчетToolStripMenuItem";
|
||||
получитьОтчетToolStripMenuItem.Size = new Size(106, 20);
|
||||
получитьОтчетToolStripMenuItem.Text = "Получить отчет";
|
||||
//
|
||||
// вДокументToolStripMenuItem
|
||||
//
|
||||
вДокументToolStripMenuItem.Name = "вДокументToolStripMenuItem";
|
||||
вДокументToolStripMenuItem.Size = new Size(136, 22);
|
||||
вДокументToolStripMenuItem.Text = "В документ";
|
||||
//
|
||||
// наПочтуToolStripMenuItem
|
||||
//
|
||||
наПочтуToolStripMenuItem.Name = "наПочтуToolStripMenuItem";
|
||||
наПочтуToolStripMenuItem.Size = new Size(136, 22);
|
||||
наПочтуToolStripMenuItem.Text = "На почту";
|
||||
//
|
||||
// button1
|
||||
//
|
||||
button1.Location = new Point(156, 186);
|
||||
button1.Name = "button1";
|
||||
button1.Size = new Size(75, 23);
|
||||
button1.TabIndex = 1;
|
||||
button1.Text = "button1";
|
||||
button1.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// button2
|
||||
//
|
||||
button2.Location = new Point(510, 192);
|
||||
button2.Name = "button2";
|
||||
button2.Size = new Size(75, 23);
|
||||
button2.TabIndex = 2;
|
||||
button2.Text = "button2";
|
||||
button2.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// FormClientMain
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(800, 450);
|
||||
Controls.Add(button2);
|
||||
Controls.Add(button1);
|
||||
Controls.Add(menuStrip1);
|
||||
MainMenuStrip = menuStrip1;
|
||||
Name = "FormClientMain";
|
||||
Text = "FormClientMain";
|
||||
menuStrip1.ResumeLayout(false);
|
||||
menuStrip1.PerformLayout();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private MenuStrip menuStrip1;
|
||||
private ToolStripMenuItem создатьМаршрутToolStripMenuItem;
|
||||
private ToolStripMenuItem оплатитьМаршрутToolStripMenuItem;
|
||||
private ToolStripMenuItem получитьОтчетToolStripMenuItem;
|
||||
private ToolStripMenuItem вДокументToolStripMenuItem;
|
||||
private ToolStripMenuItem наПочтуToolStripMenuItem;
|
||||
private Button button1;
|
||||
private Button button2;
|
||||
}
|
||||
}
|
30
git/JurasicZoo/JurasicZoo/FormClientMain.cs
Normal file
30
git/JurasicZoo/JurasicZoo/FormClientMain.cs
Normal file
@ -0,0 +1,30 @@
|
||||
using ZooView;
|
||||
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 ZooView
|
||||
{
|
||||
public partial class FormClientMain : Form
|
||||
{
|
||||
public FormClientMain()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void создатьМаршрутToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormRoutes));
|
||||
if (service is FormRoutes form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -117,42 +117,6 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="RouteId.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="RouteName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="RouteCost.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="DateStart.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="DateFinish.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="RouteStatus.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="RouteId.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="RouteName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="RouteCost.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="DateStart.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="DateFinish.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="RouteStatus.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
124
git/JurasicZoo/JurasicZoo/FormPreserve.Designer.cs
generated
Normal file
124
git/JurasicZoo/JurasicZoo/FormPreserve.Designer.cs
generated
Normal file
@ -0,0 +1,124 @@
|
||||
namespace ZooView
|
||||
{
|
||||
partial class FormPreserve
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.labelName = new System.Windows.Forms.Label();
|
||||
this.textBoxName = new System.Windows.Forms.TextBox();
|
||||
this.textBoxCost = new System.Windows.Forms.TextBox();
|
||||
this.labelCost = new System.Windows.Forms.Label();
|
||||
this.buttonSave = new System.Windows.Forms.Button();
|
||||
this.buttonCancel = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// labelName
|
||||
//
|
||||
this.labelName.AutoSize = true;
|
||||
this.labelName.Location = new System.Drawing.Point(10, 7);
|
||||
this.labelName.Name = "labelName";
|
||||
this.labelName.Size = new System.Drawing.Size(62, 15);
|
||||
this.labelName.TabIndex = 0;
|
||||
this.labelName.Text = "Название:";
|
||||
//
|
||||
// textBoxName
|
||||
//
|
||||
this.textBoxName.Location = new System.Drawing.Point(86, 7);
|
||||
this.textBoxName.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.textBoxName.Name = "textBoxName";
|
||||
this.textBoxName.Size = new System.Drawing.Size(275, 23);
|
||||
this.textBoxName.TabIndex = 1;
|
||||
//
|
||||
// textBoxCost
|
||||
//
|
||||
this.textBoxCost.Location = new System.Drawing.Point(86, 32);
|
||||
this.textBoxCost.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.textBoxCost.Name = "textBoxCost";
|
||||
this.textBoxCost.Size = new System.Drawing.Size(122, 23);
|
||||
this.textBoxCost.TabIndex = 3;
|
||||
//
|
||||
// labelCost
|
||||
//
|
||||
this.labelCost.AutoSize = true;
|
||||
this.labelCost.Location = new System.Drawing.Point(10, 32);
|
||||
this.labelCost.Name = "labelCost";
|
||||
this.labelCost.Size = new System.Drawing.Size(38, 15);
|
||||
this.labelCost.TabIndex = 2;
|
||||
this.labelCost.Text = "Цена:";
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
this.buttonSave.Location = new System.Drawing.Point(143, 72);
|
||||
this.buttonSave.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.buttonSave.Name = "buttonSave";
|
||||
this.buttonSave.Size = new System.Drawing.Size(96, 26);
|
||||
this.buttonSave.TabIndex = 4;
|
||||
this.buttonSave.Text = "Сохранить";
|
||||
this.buttonSave.UseVisualStyleBackColor = true;
|
||||
this.buttonSave.Click += new System.EventHandler(this.ButtonSave_Click);
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
this.buttonCancel.Location = new System.Drawing.Point(245, 72);
|
||||
this.buttonCancel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.buttonCancel.Name = "buttonCancel";
|
||||
this.buttonCancel.Size = new System.Drawing.Size(97, 26);
|
||||
this.buttonCancel.TabIndex = 5;
|
||||
this.buttonCancel.Text = "Отмена";
|
||||
this.buttonCancel.UseVisualStyleBackColor = true;
|
||||
this.buttonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
|
||||
//
|
||||
// FormComponent
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(373, 106);
|
||||
this.Controls.Add(this.buttonCancel);
|
||||
this.Controls.Add(this.buttonSave);
|
||||
this.Controls.Add(this.textBoxCost);
|
||||
this.Controls.Add(this.labelCost);
|
||||
this.Controls.Add(this.textBoxName);
|
||||
this.Controls.Add(this.labelName);
|
||||
this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.Name = "FormComponent";
|
||||
this.Text = "Компонент";
|
||||
this.Load += new System.EventHandler(this.FormComponent_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label labelName;
|
||||
private TextBox textBoxName;
|
||||
private TextBox textBoxCost;
|
||||
private Label labelCost;
|
||||
private Button buttonSave;
|
||||
private Button buttonCancel;
|
||||
}
|
||||
}
|
92
git/JurasicZoo/JurasicZoo/FormPreserve.cs
Normal file
92
git/JurasicZoo/JurasicZoo/FormPreserve.cs
Normal file
@ -0,0 +1,92 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using ZooContracts.BindingModels;
|
||||
using ZooContracts.BusinessLogicsContracts;
|
||||
using ZooContracts.SearchModels;
|
||||
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 ZooContracts.BuisnessLogicsContracts;
|
||||
|
||||
|
||||
namespace ZooView
|
||||
{
|
||||
public partial class FormPreserve : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IPreserveLogic _logic;
|
||||
private int? _id;
|
||||
public int Id { set { _id = value; } }
|
||||
public FormPreserve(ILogger<FormPreserve> logger, IPreserveLogic logic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_logic = logic;
|
||||
}
|
||||
private void FormComponent_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (_id.HasValue)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger.LogInformation("Получение компонента");
|
||||
var view = _logic.ReadElement(new PreserveSearchModel
|
||||
{
|
||||
Id = _id.Value
|
||||
});
|
||||
if (view != null)
|
||||
{
|
||||
textBoxName.Text = view.PreserveName;
|
||||
textBoxCost.Text = view.PreservePrice.ToString();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка получения компонента");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
private void ButtonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(textBoxName.Text))
|
||||
{
|
||||
MessageBox.Show("Заполните название", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
_logger.LogInformation("Сохранение компонента");
|
||||
try
|
||||
{
|
||||
var model = new PreserveBindingModel
|
||||
{
|
||||
Id = _id ?? 0,
|
||||
PreserveName = textBoxName.Text,
|
||||
PreservePrice = Convert.ToDouble(textBoxCost.Text)
|
||||
};
|
||||
var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model);
|
||||
if (!operationResult)
|
||||
{
|
||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");//При обновлении, может быть, тоже ошибка появиться..
|
||||
}
|
||||
MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка сохранения компонента");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void ButtonCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
60
git/JurasicZoo/JurasicZoo/FormPreserve.resx
Normal file
60
git/JurasicZoo/JurasicZoo/FormPreserve.resx
Normal file
@ -0,0 +1,60 @@
|
||||
<root>
|
||||
<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>
|
138
git/JurasicZoo/JurasicZoo/FormPreserves.Designer.cs
generated
Normal file
138
git/JurasicZoo/JurasicZoo/FormPreserves.Designer.cs
generated
Normal file
@ -0,0 +1,138 @@
|
||||
namespace ZooView
|
||||
{
|
||||
partial class FormPreserves
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.dataGridView = new System.Windows.Forms.DataGridView();
|
||||
this.ToolsPanel = new System.Windows.Forms.Panel();
|
||||
this.buttonRef = new System.Windows.Forms.Button();
|
||||
this.buttonDel = new System.Windows.Forms.Button();
|
||||
this.buttonUpd = new System.Windows.Forms.Button();
|
||||
this.buttonAdd = new System.Windows.Forms.Button();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
||||
this.ToolsPanel.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// dataGridView
|
||||
//
|
||||
this.dataGridView.AllowUserToAddRows = false;
|
||||
this.dataGridView.AllowUserToDeleteRows = false;
|
||||
this.dataGridView.BackgroundColor = System.Drawing.Color.White;
|
||||
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dataGridView.Location = new System.Drawing.Point(0, 2);
|
||||
this.dataGridView.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.dataGridView.Name = "dataGridView";
|
||||
this.dataGridView.ReadOnly = true;
|
||||
this.dataGridView.RowHeadersWidth = 51;
|
||||
this.dataGridView.RowTemplate.Height = 29;
|
||||
this.dataGridView.Size = new System.Drawing.Size(519, 360);
|
||||
this.dataGridView.TabIndex = 0;
|
||||
//
|
||||
// ToolsPanel
|
||||
//
|
||||
this.ToolsPanel.Controls.Add(this.dataGridView);
|
||||
this.ToolsPanel.Controls.Add(this.buttonRef);
|
||||
this.ToolsPanel.Controls.Add(this.buttonDel);
|
||||
this.ToolsPanel.Controls.Add(this.buttonUpd);
|
||||
this.ToolsPanel.Controls.Add(this.buttonAdd);
|
||||
this.ToolsPanel.Location = new System.Drawing.Point(-1, -1);
|
||||
this.ToolsPanel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.ToolsPanel.Name = "ToolsPanel";
|
||||
this.ToolsPanel.Size = new System.Drawing.Size(675, 364);
|
||||
this.ToolsPanel.TabIndex = 1;
|
||||
//
|
||||
// buttonRef
|
||||
//
|
||||
this.buttonRef.Location = new System.Drawing.Point(528, 155);
|
||||
this.buttonRef.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.buttonRef.Name = "buttonRef";
|
||||
this.buttonRef.Size = new System.Drawing.Size(110, 27);
|
||||
this.buttonRef.TabIndex = 3;
|
||||
this.buttonRef.Text = "Обновить";
|
||||
this.buttonRef.UseVisualStyleBackColor = true;
|
||||
this.buttonRef.Click += new System.EventHandler(this.ButtonRef_Click);
|
||||
//
|
||||
// buttonDel
|
||||
//
|
||||
this.buttonDel.Location = new System.Drawing.Point(528, 107);
|
||||
this.buttonDel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.buttonDel.Name = "buttonDel";
|
||||
this.buttonDel.Size = new System.Drawing.Size(110, 27);
|
||||
this.buttonDel.TabIndex = 2;
|
||||
this.buttonDel.Text = "Удалить";
|
||||
this.buttonDel.UseVisualStyleBackColor = true;
|
||||
this.buttonDel.Click += new System.EventHandler(this.ButtonDel_Click);
|
||||
//
|
||||
// buttonUpd
|
||||
//
|
||||
this.buttonUpd.Location = new System.Drawing.Point(528, 58);
|
||||
this.buttonUpd.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.buttonUpd.Name = "buttonUpd";
|
||||
this.buttonUpd.Size = new System.Drawing.Size(110, 27);
|
||||
this.buttonUpd.TabIndex = 1;
|
||||
this.buttonUpd.Text = "Изменить";
|
||||
this.buttonUpd.UseVisualStyleBackColor = true;
|
||||
this.buttonUpd.Click += new System.EventHandler(this.ButtonUpd_Click);
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
this.buttonAdd.Location = new System.Drawing.Point(528, 13);
|
||||
this.buttonAdd.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.buttonAdd.Name = "buttonAdd";
|
||||
this.buttonAdd.Size = new System.Drawing.Size(110, 27);
|
||||
this.buttonAdd.TabIndex = 0;
|
||||
this.buttonAdd.Text = "Добавить";
|
||||
this.buttonAdd.UseVisualStyleBackColor = true;
|
||||
this.buttonAdd.Click += new System.EventHandler(this.ButtonAdd_Click);
|
||||
//
|
||||
// FormComponents
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(673, 361);
|
||||
this.Controls.Add(this.ToolsPanel);
|
||||
this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.Name = "FormComponents";
|
||||
this.Text = "Компоненты";
|
||||
this.Load += new System.EventHandler(this.FormComponents_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
||||
this.ToolsPanel.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DataGridView dataGridView;
|
||||
private Panel ToolsPanel;
|
||||
private Button buttonRef;
|
||||
private Button buttonDel;
|
||||
private Button buttonUpd;
|
||||
private Button buttonAdd;
|
||||
}
|
||||
}
|
114
git/JurasicZoo/JurasicZoo/FormPreserves.cs
Normal file
114
git/JurasicZoo/JurasicZoo/FormPreserves.cs
Normal file
@ -0,0 +1,114 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using ZooContracts.BindingModels;
|
||||
using ZooContracts.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;
|
||||
using ZooContracts.BuisnessLogicsContracts;
|
||||
|
||||
namespace ZooView
|
||||
{
|
||||
public partial class FormPreserves : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IPreserveLogic _logic;
|
||||
public FormPreserves(ILogger<FormPreserves> logger, IPreserveLogic logic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_logic = logic;
|
||||
}
|
||||
private void FormComponents_Load(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
private void LoadData()
|
||||
{
|
||||
try
|
||||
{
|
||||
var list = _logic.ReadList(null);
|
||||
if (list != null)
|
||||
{
|
||||
dataGridView.DataSource = list;
|
||||
dataGridView.Columns["Id"].Visible = false;
|
||||
dataGridView.Columns["PreserveName"].AutoSizeMode =
|
||||
DataGridViewAutoSizeColumnMode.Fill;
|
||||
}
|
||||
_logger.LogInformation("Загрузка компонентов");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка загрузки компонентов");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormPreserve));
|
||||
if (service is FormPreserve form)
|
||||
{
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
private void ButtonUpd_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormPreserve));
|
||||
if (service is FormPreserve form)
|
||||
{
|
||||
form.Id =
|
||||
Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private void ButtonDel_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
if (MessageBox.Show("Удалить запись?", "Вопрос",
|
||||
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
int id =
|
||||
Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
_logger.LogInformation("Удаление компонента");
|
||||
try
|
||||
{
|
||||
if (!_logic.Delete(new PreserveBindingModel
|
||||
{
|
||||
Id = id
|
||||
}))
|
||||
{
|
||||
throw new Exception("Ошибка при удалении. Дополнительная информация в логах.");
|
||||
}
|
||||
LoadData();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка удаления компонента");
|
||||
MessageBox.Show(ex.Message, "Ошибка",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private void ButtonRef_Click(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
60
git/JurasicZoo/JurasicZoo/FormPreserves.resx
Normal file
60
git/JurasicZoo/JurasicZoo/FormPreserves.resx
Normal file
@ -0,0 +1,60 @@
|
||||
<root>
|
||||
<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>
|
198
git/JurasicZoo/JurasicZoo/ClientCreateRoute.Designer.cs → git/JurasicZoo/JurasicZoo/FormRoute.Designer.cs
generated
198
git/JurasicZoo/JurasicZoo/ClientCreateRoute.Designer.cs → git/JurasicZoo/JurasicZoo/FormRoute.Designer.cs
generated
@ -1,6 +1,6 @@
|
||||
namespace ZooView
|
||||
{
|
||||
partial class ClientCreateRoute
|
||||
partial class FormRoute
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
@ -28,78 +28,93 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
buttonSave = new Button();
|
||||
buttonCancel = new Button();
|
||||
groupBoxPreserves = new GroupBox();
|
||||
labelName = new Label();
|
||||
textBoxName = new TextBox();
|
||||
labelPrice = new Label();
|
||||
textBoxPrice = new TextBox();
|
||||
groupBoxComponents = new GroupBox();
|
||||
buttonRef = new Button();
|
||||
buttonDel = new Button();
|
||||
buttonAdd = new Button();
|
||||
dataGridView = new DataGridView();
|
||||
textBoxPrice = new TextBox();
|
||||
labelPrice = new Label();
|
||||
textBoxName = new TextBox();
|
||||
labelName = new Label();
|
||||
buttonCancel = new Button();
|
||||
buttonSave = new Button();
|
||||
id = new DataGridViewTextBoxColumn();
|
||||
Preserve = new DataGridViewTextBoxColumn();
|
||||
Price = new DataGridViewTextBoxColumn();
|
||||
groupBoxPreserves.SuspendLayout();
|
||||
Component = new DataGridViewTextBoxColumn();
|
||||
groupBoxComponents.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// buttonSave
|
||||
// labelName
|
||||
//
|
||||
buttonSave.Location = new Point(231, 316);
|
||||
buttonSave.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(110, 26);
|
||||
buttonSave.TabIndex = 13;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
labelName.AutoSize = true;
|
||||
labelName.Location = new Point(14, 11);
|
||||
labelName.Name = "labelName";
|
||||
labelName.Size = new Size(65, 15);
|
||||
labelName.TabIndex = 0;
|
||||
labelName.Text = "Название: ";
|
||||
//
|
||||
// buttonCancel
|
||||
// textBoxName
|
||||
//
|
||||
buttonCancel.Location = new Point(347, 316);
|
||||
buttonCancel.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(110, 26);
|
||||
buttonCancel.TabIndex = 12;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
textBoxName.Location = new Point(98, 9);
|
||||
textBoxName.Margin = new Padding(3, 2, 3, 2);
|
||||
textBoxName.Name = "textBoxName";
|
||||
textBoxName.Size = new Size(246, 23);
|
||||
textBoxName.TabIndex = 1;
|
||||
//
|
||||
// groupBoxPreserves
|
||||
// labelPrice
|
||||
//
|
||||
groupBoxPreserves.Controls.Add(buttonRef);
|
||||
groupBoxPreserves.Controls.Add(buttonDel);
|
||||
groupBoxPreserves.Controls.Add(buttonAdd);
|
||||
groupBoxPreserves.Controls.Add(dataGridView);
|
||||
groupBoxPreserves.Location = new Point(-4, 66);
|
||||
groupBoxPreserves.Margin = new Padding(3, 2, 3, 2);
|
||||
groupBoxPreserves.Name = "groupBoxPreserves";
|
||||
groupBoxPreserves.Padding = new Padding(3, 2, 3, 2);
|
||||
groupBoxPreserves.Size = new Size(562, 239);
|
||||
groupBoxPreserves.TabIndex = 11;
|
||||
groupBoxPreserves.TabStop = false;
|
||||
groupBoxPreserves.Text = "Заповедники";
|
||||
labelPrice.AutoSize = true;
|
||||
labelPrice.Location = new Point(14, 38);
|
||||
labelPrice.Name = "labelPrice";
|
||||
labelPrice.Size = new Size(73, 15);
|
||||
labelPrice.TabIndex = 2;
|
||||
labelPrice.Text = "Стоимость: ";
|
||||
//
|
||||
// textBoxPrice
|
||||
//
|
||||
textBoxPrice.Location = new Point(98, 38);
|
||||
textBoxPrice.Margin = new Padding(3, 2, 3, 2);
|
||||
textBoxPrice.Name = "textBoxPrice";
|
||||
textBoxPrice.Size = new Size(135, 23);
|
||||
textBoxPrice.TabIndex = 3;
|
||||
//
|
||||
// groupBoxComponents
|
||||
//
|
||||
groupBoxComponents.Controls.Add(buttonRef);
|
||||
groupBoxComponents.Controls.Add(buttonDel);
|
||||
groupBoxComponents.Controls.Add(buttonAdd);
|
||||
groupBoxComponents.Controls.Add(dataGridView);
|
||||
groupBoxComponents.Location = new Point(10, 63);
|
||||
groupBoxComponents.Margin = new Padding(3, 2, 3, 2);
|
||||
groupBoxComponents.Name = "groupBoxComponents";
|
||||
groupBoxComponents.Padding = new Padding(3, 2, 3, 2);
|
||||
groupBoxComponents.Size = new Size(562, 239);
|
||||
groupBoxComponents.TabIndex = 4;
|
||||
groupBoxComponents.TabStop = false;
|
||||
groupBoxComponents.Text = "Компоненты";
|
||||
//
|
||||
// buttonRef
|
||||
//
|
||||
buttonRef.Location = new Point(439, 146);
|
||||
buttonRef.Location = new Point(439, 158);
|
||||
buttonRef.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonRef.Name = "buttonRef";
|
||||
buttonRef.Size = new Size(110, 26);
|
||||
buttonRef.TabIndex = 4;
|
||||
buttonRef.Text = "Обновить";
|
||||
buttonRef.UseVisualStyleBackColor = true;
|
||||
buttonRef.Click += ButtonRef_Click;
|
||||
//
|
||||
// buttonDel
|
||||
//
|
||||
buttonDel.Location = new Point(439, 89);
|
||||
buttonDel.Location = new Point(439, 118);
|
||||
buttonDel.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonDel.Name = "buttonDel";
|
||||
buttonDel.Size = new Size(110, 26);
|
||||
buttonDel.TabIndex = 3;
|
||||
buttonDel.Text = "Удалить";
|
||||
buttonDel.UseVisualStyleBackColor = true;
|
||||
buttonDel.Click += ButtonDel_Click;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
@ -110,6 +125,7 @@
|
||||
buttonAdd.TabIndex = 1;
|
||||
buttonAdd.Text = "Добавить";
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += ButtonAdd_Click;
|
||||
//
|
||||
// dataGridView
|
||||
//
|
||||
@ -118,7 +134,7 @@
|
||||
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dataGridView.BackgroundColor = Color.White;
|
||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView.Columns.AddRange(new DataGridViewColumn[] { id, Preserve, Price });
|
||||
dataGridView.Columns.AddRange(new DataGridViewColumn[] { id, Component });
|
||||
dataGridView.Location = new Point(5, 20);
|
||||
dataGridView.Margin = new Padding(3, 2, 3, 2);
|
||||
dataGridView.Name = "dataGridView";
|
||||
@ -128,39 +144,27 @@
|
||||
dataGridView.Size = new Size(416, 215);
|
||||
dataGridView.TabIndex = 0;
|
||||
//
|
||||
// textBoxPrice
|
||||
// buttonCancel
|
||||
//
|
||||
textBoxPrice.Location = new Point(84, 41);
|
||||
textBoxPrice.Margin = new Padding(3, 2, 3, 2);
|
||||
textBoxPrice.Name = "textBoxPrice";
|
||||
textBoxPrice.Size = new Size(135, 23);
|
||||
textBoxPrice.TabIndex = 10;
|
||||
buttonCancel.Location = new Point(361, 313);
|
||||
buttonCancel.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(110, 26);
|
||||
buttonCancel.TabIndex = 5;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += ButtonCancel_Click;
|
||||
//
|
||||
// labelPrice
|
||||
// buttonSave
|
||||
//
|
||||
labelPrice.AutoSize = true;
|
||||
labelPrice.Location = new Point(0, 41);
|
||||
labelPrice.Name = "labelPrice";
|
||||
labelPrice.Size = new Size(73, 15);
|
||||
labelPrice.TabIndex = 9;
|
||||
labelPrice.Text = "Стоимость: ";
|
||||
//
|
||||
// textBoxName
|
||||
//
|
||||
textBoxName.Location = new Point(84, 12);
|
||||
textBoxName.Margin = new Padding(3, 2, 3, 2);
|
||||
textBoxName.Name = "textBoxName";
|
||||
textBoxName.Size = new Size(246, 23);
|
||||
textBoxName.TabIndex = 8;
|
||||
//
|
||||
// labelName
|
||||
//
|
||||
labelName.AutoSize = true;
|
||||
labelName.Location = new Point(0, 14);
|
||||
labelName.Name = "labelName";
|
||||
labelName.Size = new Size(65, 15);
|
||||
labelName.TabIndex = 7;
|
||||
labelName.Text = "Название: ";
|
||||
buttonSave.Location = new Point(245, 313);
|
||||
buttonSave.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(110, 26);
|
||||
buttonSave.TabIndex = 6;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += ButtonSave_Click;
|
||||
//
|
||||
// id
|
||||
//
|
||||
@ -170,35 +174,30 @@
|
||||
id.ReadOnly = true;
|
||||
id.Visible = false;
|
||||
//
|
||||
// Preserve
|
||||
// Component
|
||||
//
|
||||
Preserve.HeaderText = "Заповедник";
|
||||
Preserve.MinimumWidth = 6;
|
||||
Preserve.Name = "Preserve";
|
||||
Preserve.ReadOnly = true;
|
||||
Component.HeaderText = "Компонент";
|
||||
Component.MinimumWidth = 6;
|
||||
Component.Name = "Component";
|
||||
Component.ReadOnly = true;
|
||||
//
|
||||
// Price
|
||||
//
|
||||
Price.HeaderText = "Цена";
|
||||
Price.MinimumWidth = 6;
|
||||
Price.Name = "Price";
|
||||
Price.ReadOnly = true;
|
||||
//
|
||||
// CreateRoute
|
||||
// FormRoute
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(554, 355);
|
||||
ClientSize = new Size(599, 347);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(groupBoxPreserves);
|
||||
Controls.Add(groupBoxComponents);
|
||||
Controls.Add(textBoxPrice);
|
||||
Controls.Add(labelPrice);
|
||||
Controls.Add(textBoxName);
|
||||
Controls.Add(labelName);
|
||||
Name = "CreateRoute";
|
||||
Text = "Создание маршрута";
|
||||
groupBoxPreserves.ResumeLayout(false);
|
||||
Margin = new Padding(3, 2, 3, 2);
|
||||
Name = "FormRoute";
|
||||
Text = "Изделие";
|
||||
Load += FormCanned_Load;
|
||||
groupBoxComponents.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
@ -206,19 +205,18 @@
|
||||
|
||||
#endregion
|
||||
|
||||
private Button buttonSave;
|
||||
private Button buttonCancel;
|
||||
private GroupBox groupBoxPreserves;
|
||||
private Label labelName;
|
||||
private TextBox textBoxName;
|
||||
private Label labelPrice;
|
||||
private TextBox textBoxPrice;
|
||||
private GroupBox groupBoxComponents;
|
||||
private Button buttonRef;
|
||||
private Button buttonDel;
|
||||
private Button buttonAdd;
|
||||
private DataGridView dataGridView;
|
||||
private Button buttonCancel;
|
||||
private Button buttonSave;
|
||||
private DataGridViewTextBoxColumn id;
|
||||
private DataGridViewTextBoxColumn Preserve;
|
||||
private DataGridViewTextBoxColumn Price;
|
||||
private TextBox textBoxPrice;
|
||||
private Label labelPrice;
|
||||
private TextBox textBoxName;
|
||||
private Label labelName;
|
||||
private DataGridViewTextBoxColumn Component;
|
||||
}
|
||||
}
|
214
git/JurasicZoo/JurasicZoo/FormRoute.cs
Normal file
214
git/JurasicZoo/JurasicZoo/FormRoute.cs
Normal file
@ -0,0 +1,214 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using ZooContracts.BindingModels;
|
||||
using ZooContracts.BusinessLogicsContracts;
|
||||
using ZooContracts.SearchModels;
|
||||
using ZooDataModels.Models;
|
||||
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 ZooView
|
||||
{
|
||||
public partial class FormRoute : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IRouteLogic _logic;
|
||||
private int? _id;
|
||||
private Dictionary<int, IPreserveModel> _RoutePreserves;
|
||||
public int Id { set { _id = value; } }
|
||||
public FormRoute(ILogger<FormRoute> logger, IRouteLogic logic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_logic = logic;
|
||||
_RoutePreserves = new Dictionary<int, IPreserveModel>();
|
||||
}
|
||||
private void FormCanned_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (_id.HasValue)
|
||||
{
|
||||
_logger.LogInformation("Загрузка маршрута");
|
||||
try
|
||||
{
|
||||
var view = _logic.ReadElement(new RouteSearchModel
|
||||
{
|
||||
Id = _id.Value
|
||||
});
|
||||
if (view != null)
|
||||
{
|
||||
textBoxName.Text = view.RouteName;
|
||||
textBoxPrice.Text = view.RoutePrice.ToString();
|
||||
_RoutePreserves = view.RoutePreserves ?? new
|
||||
Dictionary<int, IPreserveModel>();
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка загрузки изделия");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
private void LoadData()
|
||||
{
|
||||
_logger.LogInformation("Загрузка компонент изделия");
|
||||
try
|
||||
{
|
||||
if (_RoutePreserves != null)
|
||||
{
|
||||
dataGridView.Rows.Clear();
|
||||
foreach (var pc in _RoutePreserves)
|
||||
{
|
||||
dataGridView.Rows.Add(new object[] { pc.Key, pc.Value.PreserveName });
|
||||
}
|
||||
textBoxPrice.Text = CalcPrice().ToString();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка загрузки компонент изделия");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormRoutePreserves));
|
||||
if (service is FormRoutePreserves form)
|
||||
{
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
if (form.PreserveModel == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_logger.LogInformation("Добавление нового заповедника:{ PreserveName}", form.PreserveModel.PreserveName);
|
||||
if (_RoutePreserves.ContainsKey(form.Id))
|
||||
{
|
||||
_RoutePreserves[form.Id] = (form.PreserveModel
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
_RoutePreserves.Add(form.Id, (form.PreserveModel
|
||||
));
|
||||
}
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
private void ButtonUpd_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormRoutePreserves));
|
||||
if (service is FormRoutePreserves form)
|
||||
{
|
||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value);
|
||||
form.Id = id;
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
if (form.PreserveModel == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_logger.LogInformation("Изменение компонента:{ PreserveName}", form.PreserveModel.PreserveName);
|
||||
_RoutePreserves[form.Id] = (form.PreserveModel);
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private void ButtonDel_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger.LogInformation("Удаление компонента:{ PreserveName}-{ Count}", dataGridView.SelectedRows[0].Cells[1].Value);
|
||||
_RoutePreserves?.Remove(Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
private void ButtonRef_Click(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
private void ButtonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(textBoxName.Text))
|
||||
{
|
||||
MessageBox.Show("Заполните название", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(textBoxPrice.Text))
|
||||
{
|
||||
MessageBox.Show("Заполните цену", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
if (_RoutePreserves == null || _RoutePreserves.Count == 0)
|
||||
{
|
||||
MessageBox.Show("Заполните компоненты", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
_logger.LogInformation("Сохранение изделия");
|
||||
try
|
||||
{
|
||||
var model = new RouteBindingModel
|
||||
{
|
||||
Id = _id ?? 0,
|
||||
ClientId=1,
|
||||
RouteName = textBoxName.Text,
|
||||
RoutePrice = Convert.ToDouble(textBoxPrice.Text),
|
||||
|
||||
RoutePreserves = _RoutePreserves
|
||||
};
|
||||
var operationResult = _id.HasValue ? _logic.Update(model) :
|
||||
_logic.Create(model);
|
||||
if (!operationResult)
|
||||
{
|
||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||
}
|
||||
MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка сохранения изделия");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void ButtonCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
private double CalcPrice()
|
||||
{
|
||||
double price = 0;
|
||||
foreach (var elem in _RoutePreserves)
|
||||
{
|
||||
price += ((elem.Value?.PreservePrice ?? 0));
|
||||
}
|
||||
return Math.Round(price * 1.1, 2);
|
||||
}
|
||||
}
|
||||
}
|
101
git/JurasicZoo/JurasicZoo/FormRoutePreserves.Designer.cs
generated
Normal file
101
git/JurasicZoo/JurasicZoo/FormRoutePreserves.Designer.cs
generated
Normal file
@ -0,0 +1,101 @@
|
||||
namespace ZooView
|
||||
{
|
||||
partial class FormRoutePreserves
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
labelComponent = new Label();
|
||||
comboBoxComponent = new ComboBox();
|
||||
buttonCancel = new Button();
|
||||
buttonSave = new Button();
|
||||
SuspendLayout();
|
||||
//
|
||||
// labelComponent
|
||||
//
|
||||
labelComponent.AutoSize = true;
|
||||
labelComponent.Location = new Point(10, 7);
|
||||
labelComponent.Name = "labelComponent";
|
||||
labelComponent.Size = new Size(72, 15);
|
||||
labelComponent.TabIndex = 0;
|
||||
labelComponent.Text = "Заповедник";
|
||||
//
|
||||
// comboBoxComponent
|
||||
//
|
||||
comboBoxComponent.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxComponent.FormattingEnabled = true;
|
||||
comboBoxComponent.Location = new Point(104, 7);
|
||||
comboBoxComponent.Margin = new Padding(3, 2, 3, 2);
|
||||
comboBoxComponent.Name = "comboBoxComponent";
|
||||
comboBoxComponent.Size = new Size(235, 23);
|
||||
comboBoxComponent.TabIndex = 1;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(253, 70);
|
||||
buttonCancel.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(86, 31);
|
||||
buttonCancel.TabIndex = 4;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += ButtonCancel_Click;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(168, 70);
|
||||
buttonSave.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(79, 31);
|
||||
buttonSave.TabIndex = 5;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += ButtonSave_Click;
|
||||
//
|
||||
// FormRoutePreserves
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(373, 110);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(comboBoxComponent);
|
||||
Controls.Add(labelComponent);
|
||||
Margin = new Padding(3, 2, 3, 2);
|
||||
Name = "FormRoutePreserves";
|
||||
Text = "Заповедник маршрута";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label labelComponent;
|
||||
private ComboBox comboBoxComponent;
|
||||
private Button buttonCancel;
|
||||
private Button buttonSave;
|
||||
}
|
||||
}
|
79
git/JurasicZoo/JurasicZoo/FormRoutePreserves.cs
Normal file
79
git/JurasicZoo/JurasicZoo/FormRoutePreserves.cs
Normal file
@ -0,0 +1,79 @@
|
||||
using ZooContracts.BusinessLogicsContracts;
|
||||
using ZooContracts.ViewModels;
|
||||
using ZooDataModels.Models;
|
||||
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 ZooContracts.BuisnessLogicsContracts;
|
||||
|
||||
namespace ZooView
|
||||
{
|
||||
public partial class FormRoutePreserves : Form
|
||||
{
|
||||
private readonly List<PreserveViewModel>? _list;
|
||||
public int Id
|
||||
{
|
||||
get
|
||||
{
|
||||
return Convert.ToInt32(comboBoxComponent.SelectedValue);
|
||||
}
|
||||
set
|
||||
{
|
||||
comboBoxComponent.SelectedValue = value;
|
||||
}
|
||||
}
|
||||
public IPreserveModel? PreserveModel
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_list == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
foreach (var elem in _list)
|
||||
{
|
||||
if (elem.Id == Id)
|
||||
{
|
||||
return elem;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public FormRoutePreserves(IPreserveLogic logic)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
_list = logic.ReadList(null);
|
||||
if (_list != null)
|
||||
{
|
||||
comboBoxComponent.DisplayMember = "PreserveName";
|
||||
comboBoxComponent.ValueMember = "Id";
|
||||
comboBoxComponent.DataSource = _list;
|
||||
comboBoxComponent.SelectedItem = null;
|
||||
}
|
||||
}
|
||||
private void ButtonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (comboBoxComponent.SelectedValue == null)
|
||||
{
|
||||
MessageBox.Show("Выберите компонент", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
private void ButtonCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
120
git/JurasicZoo/JurasicZoo/FormRoutePreserves.resx
Normal file
120
git/JurasicZoo/JurasicZoo/FormRoutePreserves.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>
|
329
git/JurasicZoo/JurasicZoo/FormRoutes.Designer.cs
generated
329
git/JurasicZoo/JurasicZoo/FormRoutes.Designer.cs
generated
@ -1,191 +1,148 @@
|
||||
namespace JurasicZoo
|
||||
namespace ZooView
|
||||
{
|
||||
partial class FormRoutes
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
partial class FormRoutes
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
menuStrip1 = new MenuStrip();
|
||||
справочникиToolStripMenuItem = new ToolStripMenuItem();
|
||||
заповедникиToolStripMenuItem = new ToolStripMenuItem();
|
||||
отчетыToolStripMenuItem = new ToolStripMenuItem();
|
||||
выводВdocToolStripMenuItem = new ToolStripMenuItem();
|
||||
выводВxlxToolStripMenuItem = new ToolStripMenuItem();
|
||||
отправитьНаПочтуToolStripMenuItem = new ToolStripMenuItem();
|
||||
dataGridView1 = new DataGridView();
|
||||
checkedListBoxPreserves = new CheckedListBox();
|
||||
RouteId = new DataGridViewTextBoxColumn();
|
||||
Preserves = new DataGridViewTextBoxColumn();
|
||||
Datestart = new DataGridViewTextBoxColumn();
|
||||
DateFinish = new DataGridViewTextBoxColumn();
|
||||
Status = new DataGridViewTextBoxColumn();
|
||||
buttonUpd = new Button();
|
||||
menuStrip1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView1).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// menuStrip1
|
||||
//
|
||||
menuStrip1.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, отчетыToolStripMenuItem });
|
||||
menuStrip1.Location = new Point(0, 0);
|
||||
menuStrip1.Name = "menuStrip1";
|
||||
menuStrip1.Size = new Size(876, 24);
|
||||
menuStrip1.TabIndex = 0;
|
||||
menuStrip1.Text = "menuStrip1";
|
||||
//
|
||||
// справочникиToolStripMenuItem
|
||||
//
|
||||
справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { заповедникиToolStripMenuItem });
|
||||
справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
|
||||
справочникиToolStripMenuItem.Size = new Size(94, 20);
|
||||
справочникиToolStripMenuItem.Text = "Справочники";
|
||||
//
|
||||
// заповедникиToolStripMenuItem
|
||||
//
|
||||
заповедникиToolStripMenuItem.Name = "заповедникиToolStripMenuItem";
|
||||
заповедникиToolStripMenuItem.Size = new Size(180, 22);
|
||||
заповедникиToolStripMenuItem.Text = "Заповедники";
|
||||
//
|
||||
// отчетыToolStripMenuItem
|
||||
//
|
||||
отчетыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { выводВdocToolStripMenuItem, выводВxlxToolStripMenuItem, отправитьНаПочтуToolStripMenuItem });
|
||||
отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem";
|
||||
отчетыToolStripMenuItem.Size = new Size(60, 20);
|
||||
отчетыToolStripMenuItem.Text = "Отчеты";
|
||||
//
|
||||
// выводВdocToolStripMenuItem
|
||||
//
|
||||
выводВdocToolStripMenuItem.Name = "выводВdocToolStripMenuItem";
|
||||
выводВdocToolStripMenuItem.Size = new Size(183, 22);
|
||||
выводВdocToolStripMenuItem.Text = "Вывод в .doc";
|
||||
//
|
||||
// выводВxlxToolStripMenuItem
|
||||
//
|
||||
выводВxlxToolStripMenuItem.Name = "выводВxlxToolStripMenuItem";
|
||||
выводВxlxToolStripMenuItem.Size = new Size(183, 22);
|
||||
выводВxlxToolStripMenuItem.Text = "Вывод в .xlsx";
|
||||
//
|
||||
// отправитьНаПочтуToolStripMenuItem
|
||||
//
|
||||
отправитьНаПочтуToolStripMenuItem.Name = "отправитьНаПочтуToolStripMenuItem";
|
||||
отправитьНаПочтуToolStripMenuItem.Size = new Size(183, 22);
|
||||
отправитьНаПочтуToolStripMenuItem.Text = "Отправить на почту";
|
||||
//
|
||||
// dataGridView1
|
||||
//
|
||||
dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView1.Columns.AddRange(new DataGridViewColumn[] { RouteId, Preserves, Datestart, DateFinish, Status });
|
||||
dataGridView1.Location = new Point(12, 27);
|
||||
dataGridView1.Name = "dataGridView1";
|
||||
dataGridView1.RowTemplate.Height = 25;
|
||||
dataGridView1.Size = new Size(728, 331);
|
||||
dataGridView1.TabIndex = 1;
|
||||
//
|
||||
// checkedListBoxPreserves
|
||||
//
|
||||
checkedListBoxPreserves.FormattingEnabled = true;
|
||||
checkedListBoxPreserves.Location = new Point(746, 27);
|
||||
checkedListBoxPreserves.Name = "checkedListBoxPreserves";
|
||||
checkedListBoxPreserves.Size = new Size(120, 94);
|
||||
checkedListBoxPreserves.TabIndex = 2;
|
||||
//
|
||||
// RouteId
|
||||
//
|
||||
RouteId.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
RouteId.HeaderText = "Номер маршрута";
|
||||
RouteId.Name = "RouteId";
|
||||
//
|
||||
// Preserves
|
||||
//
|
||||
Preserves.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
Preserves.HeaderText = "Заповедники";
|
||||
Preserves.Name = "Preserves";
|
||||
//
|
||||
// Datestart
|
||||
//
|
||||
Datestart.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
Datestart.HeaderText = "Дата начала";
|
||||
Datestart.Name = "Datestart";
|
||||
//
|
||||
// DateFinish
|
||||
//
|
||||
DateFinish.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
DateFinish.HeaderText = "Дата окончание";
|
||||
DateFinish.Name = "DateFinish";
|
||||
//
|
||||
// Status
|
||||
//
|
||||
Status.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
Status.HeaderText = "Статус оплаты";
|
||||
Status.Name = "Status";
|
||||
//
|
||||
// buttonUpd
|
||||
//
|
||||
buttonUpd.Location = new Point(746, 273);
|
||||
buttonUpd.Name = "buttonUpd";
|
||||
buttonUpd.Size = new Size(118, 51);
|
||||
buttonUpd.TabIndex = 3;
|
||||
buttonUpd.Text = "Обновить";
|
||||
buttonUpd.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// FormRoutes
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(876, 370);
|
||||
Controls.Add(buttonUpd);
|
||||
Controls.Add(checkedListBoxPreserves);
|
||||
Controls.Add(dataGridView1);
|
||||
Controls.Add(menuStrip1);
|
||||
MainMenuStrip = menuStrip1;
|
||||
Name = "FormRoutes";
|
||||
Text = "Маршруты";
|
||||
menuStrip1.ResumeLayout(false);
|
||||
menuStrip1.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
buttonAddRoute = new Button();
|
||||
buttonUpdateRoute = new Button();
|
||||
buttonRouteDelete = new Button();
|
||||
buttonRoutePay = new Button();
|
||||
menuStrip1 = new MenuStrip();
|
||||
получитьОтчетToolStripMenuItem = new ToolStripMenuItem();
|
||||
dataGridView = new DataGridView();
|
||||
создатьЗаповедникToolStripMenuItem = new ToolStripMenuItem();
|
||||
menuStrip1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// buttonAddRoute
|
||||
//
|
||||
buttonAddRoute.Location = new Point(507, 27);
|
||||
buttonAddRoute.Name = "buttonAddRoute";
|
||||
buttonAddRoute.Size = new Size(129, 37);
|
||||
buttonAddRoute.TabIndex = 2;
|
||||
buttonAddRoute.Text = "Добавить";
|
||||
buttonAddRoute.UseVisualStyleBackColor = true;
|
||||
buttonAddRoute.Click += buttonAddRoute_Click;
|
||||
//
|
||||
// buttonUpdateRoute
|
||||
//
|
||||
buttonUpdateRoute.Location = new Point(508, 97);
|
||||
buttonUpdateRoute.Name = "buttonUpdateRoute";
|
||||
buttonUpdateRoute.Size = new Size(129, 37);
|
||||
buttonUpdateRoute.TabIndex = 3;
|
||||
buttonUpdateRoute.Text = "Изменить";
|
||||
buttonUpdateRoute.UseVisualStyleBackColor = true;
|
||||
buttonUpdateRoute.Click += buttonUpdateRoute_Click;
|
||||
//
|
||||
// buttonRouteDelete
|
||||
//
|
||||
buttonRouteDelete.Location = new Point(507, 161);
|
||||
buttonRouteDelete.Name = "buttonRouteDelete";
|
||||
buttonRouteDelete.Size = new Size(129, 37);
|
||||
buttonRouteDelete.TabIndex = 4;
|
||||
buttonRouteDelete.Text = "Удалить";
|
||||
buttonRouteDelete.UseVisualStyleBackColor = true;
|
||||
buttonRouteDelete.Click += buttonRouteDelete_Click;
|
||||
//
|
||||
// buttonRoutePay
|
||||
//
|
||||
buttonRoutePay.Location = new Point(508, 220);
|
||||
buttonRoutePay.Name = "buttonRoutePay";
|
||||
buttonRoutePay.Size = new Size(129, 37);
|
||||
buttonRoutePay.TabIndex = 5;
|
||||
buttonRoutePay.Text = "Оплатить";
|
||||
buttonRoutePay.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// menuStrip1
|
||||
//
|
||||
menuStrip1.Items.AddRange(new ToolStripItem[] { получитьОтчетToolStripMenuItem, создатьЗаповедникToolStripMenuItem });
|
||||
menuStrip1.Location = new Point(0, 0);
|
||||
menuStrip1.Name = "menuStrip1";
|
||||
menuStrip1.Size = new Size(649, 24);
|
||||
menuStrip1.TabIndex = 6;
|
||||
menuStrip1.Text = "menuStrip1";
|
||||
//
|
||||
// получитьОтчетToolStripMenuItem
|
||||
//
|
||||
получитьОтчетToolStripMenuItem.Name = "получитьОтчетToolStripMenuItem";
|
||||
получитьОтчетToolStripMenuItem.Size = new Size(106, 20);
|
||||
получитьОтчетToolStripMenuItem.Text = "Получить отчет";
|
||||
//
|
||||
// dataGridView
|
||||
//
|
||||
dataGridView.AllowUserToAddRows = false;
|
||||
dataGridView.AllowUserToDeleteRows = false;
|
||||
dataGridView.BackgroundColor = SystemColors.ControlLightLight;
|
||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView.Location = new Point(12, 27);
|
||||
dataGridView.Name = "dataGridView";
|
||||
dataGridView.ReadOnly = true;
|
||||
dataGridView.RowTemplate.Height = 25;
|
||||
dataGridView.Size = new Size(489, 398);
|
||||
dataGridView.TabIndex = 7;
|
||||
//
|
||||
// создатьЗаповедникToolStripMenuItem
|
||||
//
|
||||
создатьЗаповедникToolStripMenuItem.Name = "создатьЗаповедникToolStripMenuItem";
|
||||
создатьЗаповедникToolStripMenuItem.Size = new Size(128, 20);
|
||||
создатьЗаповедникToolStripMenuItem.Text = "Создать заповедник";
|
||||
создатьЗаповедникToolStripMenuItem.Click += создатьЗаповедникToolStripMenuItem_Click;
|
||||
//
|
||||
// FormRoutes
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(649, 450);
|
||||
Controls.Add(dataGridView);
|
||||
Controls.Add(buttonRoutePay);
|
||||
Controls.Add(buttonRouteDelete);
|
||||
Controls.Add(buttonUpdateRoute);
|
||||
Controls.Add(buttonAddRoute);
|
||||
Controls.Add(menuStrip1);
|
||||
MainMenuStrip = menuStrip1;
|
||||
Name = "FormRoutes";
|
||||
Text = "Routes";
|
||||
menuStrip1.ResumeLayout(false);
|
||||
menuStrip1.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private MenuStrip menuStrip1;
|
||||
private ToolStripMenuItem справочникиToolStripMenuItem;
|
||||
private ToolStripMenuItem заповедникиToolStripMenuItem;
|
||||
private ToolStripMenuItem отчетыToolStripMenuItem;
|
||||
private ToolStripMenuItem выводВdocToolStripMenuItem;
|
||||
private ToolStripMenuItem выводВxlxToolStripMenuItem;
|
||||
private ToolStripMenuItem отправитьНаПочтуToolStripMenuItem;
|
||||
private DataGridView dataGridView1;
|
||||
private CheckedListBox checkedListBoxPreserves;
|
||||
private DataGridViewTextBoxColumn RouteId;
|
||||
private DataGridViewTextBoxColumn Preserves;
|
||||
private DataGridViewTextBoxColumn Datestart;
|
||||
private DataGridViewTextBoxColumn DateFinish;
|
||||
private DataGridViewTextBoxColumn Status;
|
||||
private Button buttonUpd;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
private Button buttonAddRoute;
|
||||
private Button buttonUpdateRoute;
|
||||
private Button buttonRouteDelete;
|
||||
private Button buttonRoutePay;
|
||||
private MenuStrip menuStrip1;
|
||||
private ToolStripMenuItem получитьОтчетToolStripMenuItem;
|
||||
private DataGridView dataGridView;
|
||||
private ToolStripMenuItem создатьЗаповедникToolStripMenuItem;
|
||||
}
|
||||
}
|
@ -1,10 +1,86 @@
|
||||
namespace JurasicZoo
|
||||
using Microsoft.Extensions.Logging;
|
||||
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 ZooContracts.BusinessLogicsContracts;
|
||||
|
||||
namespace ZooView
|
||||
{
|
||||
public partial class FormRoutes : Form
|
||||
{
|
||||
public FormRoutes()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
public partial class FormRoutes : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IRouteLogic _logic;
|
||||
public FormRoutes(ILogger<FormRoutes> logger, IRouteLogic logic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_logic = logic;
|
||||
}
|
||||
private void FormCanneds_Load(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
private void LoadData()
|
||||
{
|
||||
try
|
||||
{
|
||||
var list = _logic.ReadList(null);
|
||||
if (list != null)
|
||||
{
|
||||
dataGridView.DataSource = list;
|
||||
dataGridView.Columns["Id"].Visible = false;
|
||||
dataGridView.Columns["RoutePreserves"].Visible = false;
|
||||
dataGridView.Columns["RouteName"].AutoSizeMode =
|
||||
DataGridViewAutoSizeColumnMode.Fill;
|
||||
}
|
||||
_logger.LogInformation("Загрузка маршрутов");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка загрузки маршрутов");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void buttonAddRoute_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormRoute));
|
||||
if (service is FormRoute form)
|
||||
{
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonUpdateRoute_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void buttonRouteDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void создатьЗаповедникToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormPreserves));
|
||||
if (service is FormPreserves form)
|
||||
{
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -120,34 +120,4 @@
|
||||
<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="RouteId.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="Preserves.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="Datestart.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="DateFinish.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="Status.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="RouteId.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="Preserves.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="Datestart.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="DateFinish.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="Status.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
</root>
|
@ -1,17 +1,66 @@
|
||||
namespace JurasicZoo
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using ZooBusinessLogic.BusinessLogic;
|
||||
using ZooContracts.BindingModels;
|
||||
using ZooContracts.BusinessLogicsContracts;
|
||||
using ZooContracts.StorageContracts;
|
||||
using ZooDataBaseImplement.Implements;
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Design;
|
||||
using ZooView;
|
||||
using ZooContracts.BuisnessLogicsContracts;
|
||||
|
||||
namespace ZooView
|
||||
{
|
||||
internal static class Program
|
||||
{
|
||||
/// <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();
|
||||
Application.Run(new FormRoutes());
|
||||
}
|
||||
}
|
||||
}
|
||||
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<FormRoutes>());
|
||||
}
|
||||
private static void ConfigureServices(ServiceCollection services)
|
||||
{
|
||||
services.AddLogging(option =>
|
||||
{
|
||||
option.SetMinimumLevel(LogLevel.Information);
|
||||
});
|
||||
services.AddTransient<IClientStorage, ClientStorage>();
|
||||
services.AddTransient<IEmployeeStorage, EmployeeStorage>();
|
||||
services.AddTransient<IPreserveStorage, PreserveStorage>();
|
||||
services.AddTransient<IRouteStorage, RouteStorage>();
|
||||
|
||||
|
||||
|
||||
services.AddTransient<IClientLogic, ClientLogic>();
|
||||
services.AddTransient<IClientLogic, ClientLogic>();
|
||||
services.AddTransient<IPreserveLogic, PreserveLogic>();
|
||||
services.AddTransient<IEmployeeLogic, EmployeeLogic>();
|
||||
services.AddTransient<IRouteLogic, RouteLogic>();
|
||||
|
||||
|
||||
|
||||
|
||||
services.AddTransient<FormRoutes>();
|
||||
services.AddTransient<FormRoute>();
|
||||
services.AddTransient<FormRoutePreserves>();
|
||||
services.AddTransient<FormPreserves>();
|
||||
services.AddTransient<FormPreserve>();
|
||||
|
||||
services.AddTransient<EntityFrameworkDesignServicesBuilder>();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ZooBusinessLogic\ZooBusinessLogic.csproj" />
|
||||
<ProjectReference Include="..\ZooDataBaseImplement\ZooDataBaseImplement.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
@ -35,6 +35,22 @@ namespace ZooBusinessLogic.BusinessLogic
|
||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||
return list;
|
||||
}
|
||||
public RouteViewModel? ReadElement(RouteSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
_logger.LogInformation("ReadElement.RouteName:{RouteName}.Id:{ Id}", model.RouteName, model.Id);
|
||||
var element = _routeStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
_logger.LogWarning("ReadElement element not found");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
|
||||
return element;
|
||||
}
|
||||
|
||||
public bool Create(RouteBindingModel model)
|
||||
{
|
||||
@ -46,6 +62,27 @@ namespace ZooBusinessLogic.BusinessLogic
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public bool Update(RouteBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_routeStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public bool Delete(RouteBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||
if (_routeStorage.Delete(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public bool CheckRoutePay(RouteBindingModel model, RouteStatus status)
|
||||
{
|
||||
CheckModel(model);
|
||||
@ -69,8 +106,7 @@ namespace ZooBusinessLogic.BusinessLogic
|
||||
{
|
||||
return CheckRoutePay(model, RouteStatus.Оплачен);
|
||||
}
|
||||
private void CheckModel(RouteBindingModel model, bool withParams =
|
||||
true)
|
||||
private void CheckModel(RouteBindingModel model, bool withParams = true)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
@ -82,14 +118,21 @@ namespace ZooBusinessLogic.BusinessLogic
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.RouteName))
|
||||
{
|
||||
throw new ArgumentNullException("Нет названия маршрута",
|
||||
nameof(model.RouteName));
|
||||
throw new ArgumentNullException("Нет названия изделия", nameof(model.RouteName));
|
||||
}
|
||||
if (model.RoutePrice <= 0)
|
||||
{
|
||||
throw new ArgumentNullException("Стоимость маршрута должна быть >0", nameof(model.RoutePrice));
|
||||
throw new ArgumentNullException("Цена изделия должна быть больше 0", nameof(model.RoutePrice));
|
||||
}
|
||||
_logger.LogInformation("Canned. RouteName:{RouteName}.Price:{Price}.Id: { Id}", model.RouteName, model.RoutePrice, model.Id);
|
||||
var element = _routeStorage.GetElement(new RouteSearchModel
|
||||
{
|
||||
RouteName = model.RouteName
|
||||
});
|
||||
if (element != null && element.Id != model.Id)
|
||||
{
|
||||
throw new InvalidOperationException("Изделие с таким названием уже есть");
|
||||
}
|
||||
_logger.LogInformation("Route. RouteName:{RouteName}.RoutePrice:{ RoutePrice} Id: { Id}", model.RouteName, model.RoutePrice, model.Id);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,32 +1,159 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Diagnostics;
|
||||
using ZooClientApp.Models;
|
||||
using ZooContracts.BindingModels;
|
||||
using ZooContracts.ViewModels;
|
||||
|
||||
namespace ZooClientApp.Controllers
|
||||
{
|
||||
public class HomeController : Controller
|
||||
{
|
||||
private readonly ILogger<HomeController> _logger;
|
||||
|
||||
public HomeController(ILogger<HomeController> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public IActionResult Index()
|
||||
{
|
||||
return View();
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return
|
||||
View(APIClient.GetRequest<List<RouteViewModel>>($"api/main/getroutes?clientId={APIClient.Client.Id}"));
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult Privacy()
|
||||
{
|
||||
return View();
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View(APIClient.Client);
|
||||
}
|
||||
|
||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||
[HttpPost]
|
||||
public void Privacy(string login, string password, string fio)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||
}
|
||||
if (string.IsNullOrEmpty(login) ||
|
||||
string.IsNullOrEmpty(password) || string.IsNullOrEmpty(fio))
|
||||
{
|
||||
throw new Exception("Введите логин, пароль и ФИО");
|
||||
}
|
||||
APIClient.PostRequest("api/client/updatedata", new
|
||||
ClientBindingModel
|
||||
{
|
||||
Id = APIClient.Client.Id,
|
||||
ClientFIO = fio,
|
||||
EMail = login,
|
||||
Password = password
|
||||
});
|
||||
APIClient.Client.ClientFIO = fio;
|
||||
APIClient.Client.Email = login;
|
||||
APIClient.Client.Password = password;
|
||||
Response.Redirect("Index");
|
||||
}
|
||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None,
|
||||
NoStore = true)]
|
||||
public IActionResult Error()
|
||||
{
|
||||
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
|
||||
return View(new ErrorViewModel
|
||||
{
|
||||
RequestId =
|
||||
Activity.Current?.Id ?? HttpContext.TraceIdentifier
|
||||
});
|
||||
}
|
||||
[HttpGet]
|
||||
public IActionResult Enter()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
[HttpPost]
|
||||
public void Enter(string login, string password)
|
||||
{
|
||||
if (string.IsNullOrEmpty(login) ||
|
||||
string.IsNullOrEmpty(password))
|
||||
{
|
||||
throw new Exception("Введите логин и пароль");
|
||||
}
|
||||
APIClient.Client =
|
||||
APIClient.GetRequest<ClientViewModel>($"api/client/login?login={login}&password={password}");
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
throw new Exception("Неверный логин/пароль");
|
||||
}
|
||||
Response.Redirect("Index");
|
||||
}
|
||||
[HttpGet]
|
||||
public IActionResult Register()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
[HttpPost]
|
||||
public void Register(string login, string password, string fio)
|
||||
{
|
||||
if (string.IsNullOrEmpty(login) ||
|
||||
string.IsNullOrEmpty(password) || string.IsNullOrEmpty(fio))
|
||||
{
|
||||
throw new Exception("Введите логин, пароль и ФИО");
|
||||
}
|
||||
APIClient.PostRequest("api/client/register", new
|
||||
ClientBindingModel
|
||||
{
|
||||
ClientFIO = fio,
|
||||
EMail = login,
|
||||
Password = password
|
||||
});
|
||||
Response.Redirect("Enter");
|
||||
return;
|
||||
}
|
||||
[HttpGet]
|
||||
public IActionResult Create()
|
||||
{
|
||||
ViewBag.Canneds =
|
||||
APIClient.GetRequest<List<PreserveViewModel>>("api/main/getcannedlist");
|
||||
return View();
|
||||
}
|
||||
[HttpPost]
|
||||
public void Create(int canned, int count)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||
}
|
||||
if (count <= 0)
|
||||
{
|
||||
throw new Exception("Количество и сумма должны быть больше 0");
|
||||
}
|
||||
APIClient.PostRequest("api/main/createorder", new
|
||||
RouteBindingModel
|
||||
{
|
||||
ClientId = APIClient.Client.Id
|
||||
|
||||
});
|
||||
Response.Redirect("Index");
|
||||
}
|
||||
[HttpPost]
|
||||
public double Calc(int count, int canned)
|
||||
{
|
||||
var prod =
|
||||
APIClient.GetRequest<PreserveViewModel>($"api/main/getcanned?cannedId={canned}"
|
||||
);
|
||||
return count * (prod?.PreservePrice ?? 1);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult Mails()
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View();
|
||||
//return View(APIClient.GetRequest<List<MessageInfoViewModel>>($"api/client/getmessages?clientId={APIClient.Client.Id}"));
|
||||
}
|
||||
}
|
||||
}
|
@ -17,7 +17,7 @@ namespace ZooContracts.BindingModels
|
||||
public RouteStatus Status { get; set; } = RouteStatus.Неоплачен;
|
||||
public DateTime DateStart { get; set; }
|
||||
public DateTime DateFinish { get; set; }
|
||||
public Dictionary<int, (IPreserveModel, int)> RoutePreserves
|
||||
public Dictionary<int, IPreserveModel> RoutePreserves
|
||||
{
|
||||
get;
|
||||
set;
|
||||
|
@ -13,7 +13,11 @@ namespace ZooContracts.BusinessLogicsContracts
|
||||
public interface IRouteLogic
|
||||
{
|
||||
List<RouteViewModel>? ReadList(RouteSearchModel? model);
|
||||
|
||||
RouteViewModel? ReadElement(RouteSearchModel model);
|
||||
bool Create(RouteBindingModel model);
|
||||
bool Update(RouteBindingModel model);
|
||||
bool Delete(RouteBindingModel model);
|
||||
bool CheckRoutePay(RouteBindingModel model,RouteStatus status);
|
||||
bool RouteWasPaid(RouteBindingModel model);
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ using ZooDataModels.Models;
|
||||
|
||||
namespace ZooContracts.ViewModels
|
||||
{
|
||||
public class RouteViewModel
|
||||
public class RouteViewModel : IRouteModel
|
||||
{
|
||||
[DisplayName("Номер")]
|
||||
public int Id { get; set; }
|
||||
@ -28,7 +28,7 @@ namespace ZooContracts.ViewModels
|
||||
public DateTime DateStart { get; set; }
|
||||
[DisplayName("Дата окончания")]
|
||||
public DateTime DateFinish { get; set; }
|
||||
public Dictionary<int, (IPreserveModel, int)> Preserves
|
||||
public Dictionary<int, IPreserveModel> RoutePreserves
|
||||
{
|
||||
get;
|
||||
set;
|
||||
|
@ -5,12 +5,13 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ZooContracts.BindingModels;
|
||||
using ZooContracts.SearchModels;
|
||||
using ZooContracts.StorageContracts;
|
||||
using ZooContracts.ViewModels;
|
||||
using ZooDataBaseImplement.Models;
|
||||
|
||||
namespace ZooDataBaseImplement.Implements
|
||||
{
|
||||
public class PreserveStorage
|
||||
public class PreserveStorage :IPreserveStorage
|
||||
{
|
||||
public List<PreserveViewModel> GetFullList()
|
||||
{
|
||||
|
@ -63,14 +63,14 @@ namespace ZooDataBaseImplement.Implements
|
||||
public RouteViewModel? Insert(RouteBindingModel model)
|
||||
{
|
||||
using var context = new ZooDatabase();
|
||||
var newCanned = Route.Create(context, model);
|
||||
if (newCanned == null)
|
||||
var newRoute = Route.Create(context, model);
|
||||
if (newRoute == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
context.Routes.Add(newCanned);
|
||||
context.Routes.Add(newRoute);
|
||||
context.SaveChanges();
|
||||
return newCanned.GetViewModel;
|
||||
return newRoute.GetViewModel;
|
||||
}
|
||||
|
||||
public RouteViewModel? Update(RouteBindingModel model)
|
||||
@ -87,6 +87,7 @@ namespace ZooDataBaseImplement.Implements
|
||||
}
|
||||
route.Update(model);
|
||||
context.SaveChanges();
|
||||
route.UpdateComponents(context, model);
|
||||
transaction.Commit();
|
||||
return route.GetViewModel;
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ using ZooDataBaseImplement;
|
||||
namespace ZooDataBaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(ZooDatabase))]
|
||||
[Migration("20240428140917_InitialCreate")]
|
||||
[Migration("20240530120856_InitialCreate")]
|
||||
partial class InitialCreate
|
||||
{
|
||||
/// <inheritdoc />
|
||||
@ -142,9 +142,6 @@ namespace ZooDataBaseImplement.Migrations
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PreserveID")
|
||||
.HasColumnType("int");
|
||||
|
||||
@ -155,6 +152,8 @@ namespace ZooDataBaseImplement.Migrations
|
||||
|
||||
b.HasIndex("PreserveID");
|
||||
|
||||
b.HasIndex("RouteID");
|
||||
|
||||
b.ToTable("RoutePreserves");
|
||||
});
|
||||
|
||||
@ -186,7 +185,7 @@ namespace ZooDataBaseImplement.Migrations
|
||||
|
||||
b.HasOne("ZooDataBaseImplement.Models.Route", "Route")
|
||||
.WithMany("Preserves")
|
||||
.HasForeignKey("PreserveID")
|
||||
.HasForeignKey("RouteID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
@ -92,8 +92,7 @@ namespace ZooDataBaseImplement.Migrations
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
RouteID = table.Column<int>(type: "int", nullable: false),
|
||||
PreserveID = table.Column<int>(type: "int", nullable: false),
|
||||
Count = table.Column<int>(type: "int", nullable: false)
|
||||
PreserveID = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
@ -105,8 +104,8 @@ namespace ZooDataBaseImplement.Migrations
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_RoutePreserves_Routes_PreserveID",
|
||||
column: x => x.PreserveID,
|
||||
name: "FK_RoutePreserves_Routes_RouteID",
|
||||
column: x => x.RouteID,
|
||||
principalTable: "Routes",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
@ -122,6 +121,11 @@ namespace ZooDataBaseImplement.Migrations
|
||||
table: "RoutePreserves",
|
||||
column: "PreserveID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_RoutePreserves_RouteID",
|
||||
table: "RoutePreserves",
|
||||
column: "RouteID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Routes_ClientId",
|
||||
table: "Routes",
|
@ -139,9 +139,6 @@ namespace ZooDataBaseImplement.Migrations
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PreserveID")
|
||||
.HasColumnType("int");
|
||||
|
||||
@ -152,6 +149,8 @@ namespace ZooDataBaseImplement.Migrations
|
||||
|
||||
b.HasIndex("PreserveID");
|
||||
|
||||
b.HasIndex("RouteID");
|
||||
|
||||
b.ToTable("RoutePreserves");
|
||||
});
|
||||
|
||||
@ -183,7 +182,7 @@ namespace ZooDataBaseImplement.Migrations
|
||||
|
||||
b.HasOne("ZooDataBaseImplement.Models.Route", "Route")
|
||||
.WithMany("Preserves")
|
||||
.HasForeignKey("PreserveID")
|
||||
.HasForeignKey("RouteID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
|
@ -23,23 +23,23 @@ namespace ZooDataBaseImplement.Models
|
||||
public DateTime DateStart { get; private set; }
|
||||
public DateTime DateFinish { get; private set; }
|
||||
|
||||
private Dictionary<int, (IPreserveModel, int)>? _routepreserves =
|
||||
private Dictionary<int, IPreserveModel>? _routePreserves =
|
||||
null;
|
||||
[NotMapped]
|
||||
public Dictionary<int, (IPreserveModel, int)> RoutePreserves
|
||||
public Dictionary<int, IPreserveModel> RoutePreserves
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_routepreserves == null)
|
||||
if (_routePreserves == null)
|
||||
{
|
||||
_routepreserves = Preserves
|
||||
_routePreserves = Preserves
|
||||
.ToDictionary(recRP => recRP.PreserveID, recRP =>
|
||||
(recRP.Preserve as IPreserveModel, recRP.Count));
|
||||
(recRP.Preserve as IPreserveModel));
|
||||
}
|
||||
return _routepreserves;
|
||||
return _routePreserves;
|
||||
}
|
||||
}
|
||||
[ForeignKey("PreserveID")]
|
||||
[ForeignKey("RouteID")]
|
||||
public virtual List<RoutePreserve> Preserves { get; set; } = new();
|
||||
|
||||
public static Route Create(ZooDatabase context, RouteBindingModel model)
|
||||
@ -56,8 +56,7 @@ namespace ZooDataBaseImplement.Models
|
||||
DateFinish = model.DateFinish,
|
||||
Preserves = model.RoutePreserves.Select(x => new RoutePreserve
|
||||
{
|
||||
Preserve = context.Preserves.First(y => y.Id == x.Key),
|
||||
Count = x.Value.Item2
|
||||
Preserve = context.Preserves.First(y => y.Id == x.Key)
|
||||
}).ToList()
|
||||
};
|
||||
}
|
||||
@ -67,6 +66,8 @@ namespace ZooDataBaseImplement.Models
|
||||
{
|
||||
return;
|
||||
}
|
||||
RouteName = model.RouteName;
|
||||
RoutePrice = model.RoutePrice;
|
||||
Status = model.Status;
|
||||
DateStart = model.DateStart;
|
||||
DateFinish = model.DateFinish;
|
||||
@ -83,5 +84,28 @@ namespace ZooDataBaseImplement.Models
|
||||
DateStart= DateStart,
|
||||
DateFinish=DateFinish,
|
||||
};
|
||||
public void UpdateComponents(ZooDatabase context,
|
||||
RouteBindingModel model)
|
||||
{
|
||||
var routePreserves = context.RoutePreserves.Where(rec =>
|
||||
rec.RouteID == model.Id).ToList();
|
||||
if (routePreserves != null && routePreserves.Count > 0)
|
||||
{ // удалили те, которых нет в модели
|
||||
context.RoutePreserves.RemoveRange(routePreserves.Where(rec
|
||||
=> !model.RoutePreserves.ContainsKey(rec.PreserveID)));
|
||||
context.SaveChanges();
|
||||
}
|
||||
var route = context.Routes.First(x => x.Id == Id);
|
||||
foreach (var pc in model.RoutePreserves)
|
||||
{
|
||||
context.RoutePreserves.Add(new RoutePreserve
|
||||
{
|
||||
Route = route,
|
||||
Preserve = context.Preserves.First(x => x.Id == pc.Key)
|
||||
});
|
||||
context.SaveChanges();
|
||||
}
|
||||
_routePreserves = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,8 +16,6 @@ namespace ZooDataBaseImplement.Models
|
||||
public int RouteID { get; set; }
|
||||
[Required]
|
||||
public int PreserveID { get; set; }
|
||||
[Required]
|
||||
public int Count { get; set; }
|
||||
public virtual Preserve Preserve { get; set; } = new();
|
||||
public virtual Route Route { get; set; } = new();
|
||||
}
|
||||
|
@ -19,4 +19,8 @@
|
||||
<ProjectReference Include="..\ZooContracts\ZooContracts.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Migrations\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -15,6 +15,6 @@ namespace ZooDataModels.Models
|
||||
RouteStatus Status { get; }
|
||||
DateTime DateStart { get; }
|
||||
DateTime DateFinish { get; }
|
||||
Dictionary<int, (IPreserveModel, int)> RoutePreserves{ get; }
|
||||
Dictionary<int, IPreserveModel> RoutePreserves{ get; }
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user