Фикс вывода клиентов и писем
This commit is contained in:
parent
8d859ddc9f
commit
28b40aa929
@ -1,7 +1,6 @@
|
|||||||
using PizzeriaContracts.Attributes;
|
using PizzeriaContracts.Attributes;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
43
Pizzeria/PizzeriaView/FormClients.Designer.cs
generated
43
Pizzeria/PizzeriaView/FormClients.Designer.cs
generated
@ -1,4 +1,4 @@
|
|||||||
namespace Pizzeria
|
namespace PizzeriaView
|
||||||
{
|
{
|
||||||
partial class FormClients
|
partial class FormClients
|
||||||
{
|
{
|
||||||
@ -36,50 +36,51 @@
|
|||||||
//
|
//
|
||||||
// dataGridView
|
// dataGridView
|
||||||
//
|
//
|
||||||
|
this.dataGridView.AllowUserToAddRows = false;
|
||||||
|
this.dataGridView.AllowUserToDeleteRows = false;
|
||||||
this.dataGridView.BackgroundColor = System.Drawing.SystemColors.ControlLightLight;
|
this.dataGridView.BackgroundColor = System.Drawing.SystemColors.ControlLightLight;
|
||||||
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
this.dataGridView.Location = new System.Drawing.Point(1, 1);
|
this.dataGridView.Dock = System.Windows.Forms.DockStyle.Left;
|
||||||
this.dataGridView.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
this.dataGridView.Location = new System.Drawing.Point(0, 0);
|
||||||
this.dataGridView.Name = "dataGridView";
|
this.dataGridView.Name = "dataGridView";
|
||||||
|
this.dataGridView.ReadOnly = true;
|
||||||
this.dataGridView.RowHeadersVisible = false;
|
this.dataGridView.RowHeadersVisible = false;
|
||||||
this.dataGridView.RowHeadersWidth = 51;
|
|
||||||
this.dataGridView.RowTemplate.Height = 29;
|
|
||||||
this.dataGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
|
this.dataGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
|
||||||
this.dataGridView.Size = new System.Drawing.Size(569, 302);
|
this.dataGridView.Size = new System.Drawing.Size(350, 312);
|
||||||
this.dataGridView.TabIndex = 0;
|
this.dataGridView.TabIndex = 0;
|
||||||
//
|
//
|
||||||
// buttonDel
|
// buttonDel
|
||||||
//
|
//
|
||||||
this.buttonDel.Location = new System.Drawing.Point(584, 9);
|
this.buttonDel.Location = new System.Drawing.Point(368, 12);
|
||||||
this.buttonDel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
|
||||||
this.buttonDel.Name = "buttonDel";
|
this.buttonDel.Name = "buttonDel";
|
||||||
this.buttonDel.Size = new System.Drawing.Size(89, 22);
|
this.buttonDel.Size = new System.Drawing.Size(75, 23);
|
||||||
this.buttonDel.TabIndex = 1;
|
this.buttonDel.TabIndex = 3;
|
||||||
this.buttonDel.Text = "Удалить";
|
this.buttonDel.Text = "Удалить";
|
||||||
this.buttonDel.UseVisualStyleBackColor = true;
|
this.buttonDel.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonDel.Click += new System.EventHandler(this.ButtonDel_Click);
|
||||||
//
|
//
|
||||||
// buttonRef
|
// buttonRef
|
||||||
//
|
//
|
||||||
this.buttonRef.Location = new System.Drawing.Point(584, 35);
|
this.buttonRef.Location = new System.Drawing.Point(368, 53);
|
||||||
this.buttonRef.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
|
||||||
this.buttonRef.Name = "buttonRef";
|
this.buttonRef.Name = "buttonRef";
|
||||||
this.buttonRef.Size = new System.Drawing.Size(89, 22);
|
this.buttonRef.Size = new System.Drawing.Size(75, 23);
|
||||||
this.buttonRef.TabIndex = 2;
|
this.buttonRef.TabIndex = 4;
|
||||||
this.buttonRef.Text = "Обновить";
|
this.buttonRef.Text = "Обновить";
|
||||||
this.buttonRef.UseVisualStyleBackColor = true;
|
this.buttonRef.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonRef.Click += new System.EventHandler(this.ButtonRef_Click);
|
||||||
//
|
//
|
||||||
// FormClients
|
// FormClients
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(684, 302);
|
this.ClientSize = new System.Drawing.Size(464, 312);
|
||||||
this.Controls.Add(this.buttonRef);
|
this.Controls.Add(this.buttonRef);
|
||||||
this.Controls.Add(this.buttonDel);
|
this.Controls.Add(this.buttonDel);
|
||||||
this.Controls.Add(this.dataGridView);
|
this.Controls.Add(this.dataGridView);
|
||||||
this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
|
||||||
this.Name = "FormClients";
|
this.Name = "FormClients";
|
||||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||||
this.Text = "Клиенты";
|
this.Text = "Клиенты";
|
||||||
|
this.Load += new System.EventHandler(this.FormClients_Load);
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
@ -87,8 +88,8 @@
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private DataGridView dataGridView;
|
private System.Windows.Forms.DataGridView dataGridView;
|
||||||
private Button buttonDel;
|
private System.Windows.Forms.Button buttonDel;
|
||||||
private Button buttonRef;
|
private System.Windows.Forms.Button buttonRef;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,13 +1,22 @@
|
|||||||
using PizzeriaContracts.BindingModels;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using PizzeriaContracts.BindingModels;
|
||||||
using PizzeriaContracts.BusinessLogicsContracts;
|
using PizzeriaContracts.BusinessLogicsContracts;
|
||||||
using Microsoft.Extensions.Logging;
|
using System;
|
||||||
using PizzeriaView;
|
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 Pizzeria
|
namespace PizzeriaView
|
||||||
{
|
{
|
||||||
public partial class FormClients : Form
|
public partial class FormClients : Form
|
||||||
{
|
{
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
private readonly IClientLogic _logic;
|
private readonly IClientLogic _logic;
|
||||||
|
|
||||||
public FormClients(ILogger<FormClients> logger, IClientLogic logic)
|
public FormClients(ILogger<FormClients> logger, IClientLogic logic)
|
||||||
@ -40,24 +49,23 @@ namespace Pizzeria
|
|||||||
{
|
{
|
||||||
if (dataGridView.SelectedRows.Count == 1)
|
if (dataGridView.SelectedRows.Count == 1)
|
||||||
{
|
{
|
||||||
if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) ==
|
if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||||
DialogResult.Yes)
|
|
||||||
{
|
{
|
||||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||||
_logger.LogInformation("Удаление клиента");
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (!_logic.Delete(new ClientBindingModel { Id = id }))
|
if (!_logic.Delete(new ClientBindingModel { Id = id }))
|
||||||
{
|
{
|
||||||
throw new Exception("Ошибка при удалении. Дополнительная информация в логах.");
|
throw new Exception("Ошибка при удалении. Дополнительная информация в логах.");
|
||||||
}
|
}
|
||||||
LoadData();
|
_logger.LogInformation("Удаление клиента");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "Ошибка удаления клиента");
|
_logger.LogError(ex, "Ошибка удаления клиента");
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
}
|
}
|
||||||
|
LoadData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,64 @@
|
|||||||
<root>
|
<?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: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:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
@ -32,15 +32,8 @@ namespace PizzeriaView
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var list = _logic.ReadList(null);
|
dataGridView.FillAndConfigGrid(_logic.ReadList(null));
|
||||||
if (list != null)
|
_logger.LogInformation("Загрузка компонентов");
|
||||||
{
|
|
||||||
dataGridView.DataSource = list;
|
|
||||||
dataGridView.Columns["Id"].Visible = false;
|
|
||||||
dataGridView.Columns["ComponentName"].AutoSizeMode =
|
|
||||||
DataGridViewAutoSizeColumnMode.Fill;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Загрузка ингридиентов");
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
1
Pizzeria/PizzeriaView/FormMessages.Designer.cs
generated
1
Pizzeria/PizzeriaView/FormMessages.Designer.cs
generated
@ -55,6 +55,7 @@
|
|||||||
this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||||
this.Name = "FormMessages";
|
this.Name = "FormMessages";
|
||||||
this.Text = "Входящие письма";
|
this.Text = "Входящие письма";
|
||||||
|
this.Load += new System.EventHandler(this.FormMessages_Load);
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user