Хочется плакать... Видео кончились, а проблемы нет...
This commit is contained in:
parent
47d6fe77ed
commit
4b6a46d586
@ -11,15 +11,16 @@ public class ClientTour
|
||||
{
|
||||
public int ClientId { get; private set; }
|
||||
public int TourId { get; private set; }
|
||||
public ClientSocialStatus ClientSocialStatus { get; private set; }
|
||||
|
||||
public static ClientTour CreateEntity(int clientId, int tourId, ClientSocialStatus clientSocialStatus)
|
||||
public int Count { get; private set; }
|
||||
|
||||
public static ClientTour CreateEntity(int clientId, int tourId, int count)
|
||||
{
|
||||
return new ClientTour
|
||||
{
|
||||
ClientId = clientId,
|
||||
TourId = tourId,
|
||||
ClientSocialStatus = clientSocialStatus
|
||||
Count = count
|
||||
};
|
||||
}
|
||||
|
||||
|
95
project/ProjectTourAgency/FormTourAgency.Designer.cs
generated
95
project/ProjectTourAgency/FormTourAgency.Designer.cs
generated
@ -29,69 +29,74 @@
|
||||
private void InitializeComponent()
|
||||
{
|
||||
menuStrip1 = new MenuStrip();
|
||||
справочникиToolStripMenuItem = new ToolStripMenuItem();
|
||||
клиентыToolStripMenuItem = new ToolStripMenuItem();
|
||||
турыToolStripMenuItem = new ToolStripMenuItem();
|
||||
чекиToolStripMenuItem = new ToolStripMenuItem();
|
||||
предостовляемыеСкидкиToolStripMenuItem = new ToolStripMenuItem();
|
||||
операцииToolStripMenuItem = new ToolStripMenuItem();
|
||||
оформитПоездкуToolStripMenuItem = new ToolStripMenuItem();
|
||||
MenuToolStripMenuItem = new ToolStripMenuItem();
|
||||
ClientsToolStripMenuItem = new ToolStripMenuItem();
|
||||
ToursToolStripMenuItem = new ToolStripMenuItem();
|
||||
ReceiptsToolStripMenuItem = new ToolStripMenuItem();
|
||||
DiscountsToolStripMenuItem = new ToolStripMenuItem();
|
||||
OperationsToolStripMenuItem = new ToolStripMenuItem();
|
||||
CLientTourToolStripMenuItem = new ToolStripMenuItem();
|
||||
отчетыToolStripMenuItem = new ToolStripMenuItem();
|
||||
menuStrip1.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// menuStrip1
|
||||
//
|
||||
menuStrip1.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, операцииToolStripMenuItem, отчетыToolStripMenuItem });
|
||||
menuStrip1.Items.AddRange(new ToolStripItem[] { MenuToolStripMenuItem, OperationsToolStripMenuItem, отчетыToolStripMenuItem });
|
||||
menuStrip1.Location = new Point(0, 0);
|
||||
menuStrip1.Name = "menuStrip1";
|
||||
menuStrip1.Size = new Size(784, 24);
|
||||
menuStrip1.TabIndex = 0;
|
||||
menuStrip1.Text = "menuStrip1";
|
||||
//
|
||||
// справочникиToolStripMenuItem
|
||||
// MenuToolStripMenuItem
|
||||
//
|
||||
справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { клиентыToolStripMenuItem, турыToolStripMenuItem, чекиToolStripMenuItem, предостовляемыеСкидкиToolStripMenuItem });
|
||||
справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
|
||||
справочникиToolStripMenuItem.Size = new Size(94, 20);
|
||||
справочникиToolStripMenuItem.Text = "Справочники";
|
||||
MenuToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { ClientsToolStripMenuItem, ToursToolStripMenuItem, ReceiptsToolStripMenuItem, DiscountsToolStripMenuItem });
|
||||
MenuToolStripMenuItem.Name = "MenuToolStripMenuItem";
|
||||
MenuToolStripMenuItem.Size = new Size(94, 20);
|
||||
MenuToolStripMenuItem.Text = "Справочники";
|
||||
//
|
||||
// клиентыToolStripMenuItem
|
||||
// ClientsToolStripMenuItem
|
||||
//
|
||||
клиентыToolStripMenuItem.Name = "клиентыToolStripMenuItem";
|
||||
клиентыToolStripMenuItem.Size = new Size(217, 22);
|
||||
клиентыToolStripMenuItem.Text = "Клиенты";
|
||||
ClientsToolStripMenuItem.Name = "ClientsToolStripMenuItem";
|
||||
ClientsToolStripMenuItem.Size = new Size(217, 22);
|
||||
ClientsToolStripMenuItem.Text = "Клиенты";
|
||||
ClientsToolStripMenuItem.Click += ClientsToolStripMenuItem_Click;
|
||||
//
|
||||
// турыToolStripMenuItem
|
||||
// ToursToolStripMenuItem
|
||||
//
|
||||
турыToolStripMenuItem.Name = "турыToolStripMenuItem";
|
||||
турыToolStripMenuItem.Size = new Size(217, 22);
|
||||
турыToolStripMenuItem.Text = "Туры";
|
||||
ToursToolStripMenuItem.Name = "ToursToolStripMenuItem";
|
||||
ToursToolStripMenuItem.Size = new Size(217, 22);
|
||||
ToursToolStripMenuItem.Text = "Туры";
|
||||
ToursToolStripMenuItem.Click += ToursToolStripMenuItem_Click;
|
||||
//
|
||||
// чекиToolStripMenuItem
|
||||
// ReceiptsToolStripMenuItem
|
||||
//
|
||||
чекиToolStripMenuItem.Name = "чекиToolStripMenuItem";
|
||||
чекиToolStripMenuItem.Size = new Size(217, 22);
|
||||
чекиToolStripMenuItem.Text = "Чеки";
|
||||
ReceiptsToolStripMenuItem.Name = "ReceiptsToolStripMenuItem";
|
||||
ReceiptsToolStripMenuItem.Size = new Size(217, 22);
|
||||
ReceiptsToolStripMenuItem.Text = "Чеки";
|
||||
ReceiptsToolStripMenuItem.Click += ReceiptsToolStripMenuItem_Click;
|
||||
//
|
||||
// предостовляемыеСкидкиToolStripMenuItem
|
||||
// DiscountsToolStripMenuItem
|
||||
//
|
||||
предостовляемыеСкидкиToolStripMenuItem.Name = "предостовляемыеСкидкиToolStripMenuItem";
|
||||
предостовляемыеСкидкиToolStripMenuItem.Size = new Size(217, 22);
|
||||
предостовляемыеСкидкиToolStripMenuItem.Text = "Предостовляемые скидки";
|
||||
DiscountsToolStripMenuItem.Name = "DiscountsToolStripMenuItem";
|
||||
DiscountsToolStripMenuItem.Size = new Size(217, 22);
|
||||
DiscountsToolStripMenuItem.Text = "Предостовляемые скидки";
|
||||
DiscountsToolStripMenuItem.Click += DiscountsToolStripMenuItem_Click;
|
||||
//
|
||||
// операцииToolStripMenuItem
|
||||
// OperationsToolStripMenuItem
|
||||
//
|
||||
операцииToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { оформитПоездкуToolStripMenuItem });
|
||||
операцииToolStripMenuItem.Name = "операцииToolStripMenuItem";
|
||||
операцииToolStripMenuItem.Size = new Size(75, 20);
|
||||
операцииToolStripMenuItem.Text = "Операции";
|
||||
OperationsToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { CLientTourToolStripMenuItem });
|
||||
OperationsToolStripMenuItem.Name = "OperationsToolStripMenuItem";
|
||||
OperationsToolStripMenuItem.Size = new Size(75, 20);
|
||||
OperationsToolStripMenuItem.Text = "Операции";
|
||||
//
|
||||
// оформитПоездкуToolStripMenuItem
|
||||
// CLientTourToolStripMenuItem
|
||||
//
|
||||
оформитПоездкуToolStripMenuItem.Name = "оформитПоездкуToolStripMenuItem";
|
||||
оформитПоездкуToolStripMenuItem.Size = new Size(173, 22);
|
||||
оформитПоездкуToolStripMenuItem.Text = "Оформит поездку";
|
||||
CLientTourToolStripMenuItem.Name = "CLientTourToolStripMenuItem";
|
||||
CLientTourToolStripMenuItem.Size = new Size(180, 22);
|
||||
CLientTourToolStripMenuItem.Text = "Оформит поездку";
|
||||
CLientTourToolStripMenuItem.Click += CLientTourToolStripMenuItem_Click;
|
||||
//
|
||||
// отчетыToolStripMenuItem
|
||||
//
|
||||
@ -121,13 +126,13 @@
|
||||
#endregion
|
||||
|
||||
private MenuStrip menuStrip1;
|
||||
private ToolStripMenuItem справочникиToolStripMenuItem;
|
||||
private ToolStripMenuItem операцииToolStripMenuItem;
|
||||
private ToolStripMenuItem MenuToolStripMenuItem;
|
||||
private ToolStripMenuItem OperationsToolStripMenuItem;
|
||||
private ToolStripMenuItem отчетыToolStripMenuItem;
|
||||
private ToolStripMenuItem клиентыToolStripMenuItem;
|
||||
private ToolStripMenuItem турыToolStripMenuItem;
|
||||
private ToolStripMenuItem чекиToolStripMenuItem;
|
||||
private ToolStripMenuItem предостовляемыеСкидкиToolStripMenuItem;
|
||||
private ToolStripMenuItem оформитПоездкуToolStripMenuItem;
|
||||
private ToolStripMenuItem ClientsToolStripMenuItem;
|
||||
private ToolStripMenuItem ToursToolStripMenuItem;
|
||||
private ToolStripMenuItem ReceiptsToolStripMenuItem;
|
||||
private ToolStripMenuItem DiscountsToolStripMenuItem;
|
||||
private ToolStripMenuItem CLientTourToolStripMenuItem;
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,75 @@
|
||||
namespace ProjectTourAgency
|
||||
using ProjectTourAgency.Forms;
|
||||
using Unity;
|
||||
|
||||
namespace ProjectTourAgency;
|
||||
|
||||
public partial class FormTourAgency : Form
|
||||
{
|
||||
public partial class FormTourAgency : Form
|
||||
private readonly IUnityContainer _container;
|
||||
public FormTourAgency(IUnityContainer container)
|
||||
{
|
||||
public FormTourAgency()
|
||||
InitializeComponent();
|
||||
_container = container ??
|
||||
throw new ArgumentNullException(nameof(container));
|
||||
}
|
||||
|
||||
private void ClientsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
InitializeComponent();
|
||||
_container.Resolve<FormClients>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void ToursToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormTours>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void ReceiptsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormReceipts>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void DiscountsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormDiscounts>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void CLientTourToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormClientTour>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
149
project/ProjectTourAgency/Forms/FormClientTour.Designer.cs
generated
Normal file
149
project/ProjectTourAgency/Forms/FormClientTour.Designer.cs
generated
Normal file
@ -0,0 +1,149 @@
|
||||
namespace ProjectTourAgency.Forms
|
||||
{
|
||||
partial class FormClientTour
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
comboBoxClientId = new ComboBox();
|
||||
labelCLientId = new Label();
|
||||
groupBox1 = new GroupBox();
|
||||
dataGridViewReceipts = new DataGridView();
|
||||
ColumnTour = new DataGridViewComboBoxColumn();
|
||||
ColumnReceipt = new DataGridViewTextBoxColumn();
|
||||
buttonCancel = new Button();
|
||||
buttonSave = new Button();
|
||||
groupBox1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewReceipts).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// comboBoxClientId
|
||||
//
|
||||
comboBoxClientId.FormattingEnabled = true;
|
||||
comboBoxClientId.Location = new Point(208, 9);
|
||||
comboBoxClientId.Name = "comboBoxClientId";
|
||||
comboBoxClientId.Size = new Size(164, 23);
|
||||
comboBoxClientId.TabIndex = 7;
|
||||
//
|
||||
// labelCLientId
|
||||
//
|
||||
labelCLientId.AutoSize = true;
|
||||
labelCLientId.Location = new Point(37, 12);
|
||||
labelCLientId.Name = "labelCLientId";
|
||||
labelCLientId.Size = new Size(142, 15);
|
||||
labelCLientId.TabIndex = 6;
|
||||
labelCLientId.Text = "Идентификатор Клиента";
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
groupBox1.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
groupBox1.Controls.Add(dataGridViewReceipts);
|
||||
groupBox1.Location = new Point(37, 38);
|
||||
groupBox1.Name = "groupBox1";
|
||||
groupBox1.Size = new Size(326, 337);
|
||||
groupBox1.TabIndex = 8;
|
||||
groupBox1.TabStop = false;
|
||||
groupBox1.Text = "groupBox1";
|
||||
//
|
||||
// dataGridViewReceipts
|
||||
//
|
||||
dataGridViewReceipts.AllowUserToResizeColumns = false;
|
||||
dataGridViewReceipts.AllowUserToResizeRows = false;
|
||||
dataGridViewReceipts.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
dataGridViewReceipts.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dataGridViewReceipts.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridViewReceipts.Columns.AddRange(new DataGridViewColumn[] { ColumnTour, ColumnReceipt });
|
||||
dataGridViewReceipts.Location = new Point(6, 22);
|
||||
dataGridViewReceipts.MultiSelect = false;
|
||||
dataGridViewReceipts.Name = "dataGridViewReceipts";
|
||||
dataGridViewReceipts.RowHeadersVisible = false;
|
||||
dataGridViewReceipts.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridViewReceipts.Size = new Size(314, 309);
|
||||
dataGridViewReceipts.TabIndex = 9;
|
||||
//
|
||||
// ColumnTour
|
||||
//
|
||||
ColumnTour.HeaderText = "Туры";
|
||||
ColumnTour.Name = "ColumnTour";
|
||||
//
|
||||
// ColumnReceipt
|
||||
//
|
||||
ColumnReceipt.HeaderText = "Ид Чека";
|
||||
ColumnReceipt.Name = "ColumnReceipt";
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonCancel.Location = new Point(285, 397);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(75, 23);
|
||||
buttonCancel.TabIndex = 10;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonSave.Location = new Point(43, 397);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(75, 23);
|
||||
buttonSave.TabIndex = 11;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += buttonSave_Click;
|
||||
//
|
||||
// FormClientTour
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(398, 432);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(groupBox1);
|
||||
Controls.Add(comboBoxClientId);
|
||||
Controls.Add(labelCLientId);
|
||||
Name = "FormClientTour";
|
||||
Text = "FormClientTour";
|
||||
groupBox1.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewReceipts).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private ComboBox comboBoxClientId;
|
||||
private Label labelCLientId;
|
||||
private GroupBox groupBox1;
|
||||
private DataGridView dataGridViewReceipts;
|
||||
private DataGridViewCheckBoxColumn Column1;
|
||||
private Button button1;
|
||||
private Button buttonCancel;
|
||||
private Button buttonSave;
|
||||
private DataGridViewComboBoxColumn ColumnTour;
|
||||
private DataGridViewTextBoxColumn ColumnReceipt;
|
||||
}
|
||||
}
|
70
project/ProjectTourAgency/Forms/FormClientTour.cs
Normal file
70
project/ProjectTourAgency/Forms/FormClientTour.cs
Normal file
@ -0,0 +1,70 @@
|
||||
using ProjectTourAgency.Enities;
|
||||
using ProjectTourAgency.Repositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ProjectTourAgency.Forms
|
||||
{
|
||||
public partial class FormClientTour : Form
|
||||
{
|
||||
private readonly IReceiptRepository _receiptRepository;
|
||||
public FormClientTour(IReceiptRepository receiptRepository,
|
||||
IClientRepository clientRepository, ITourRepository tourRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_receiptRepository = receiptRepository ??
|
||||
throw new ArgumentNullException(nameof(receiptRepository));
|
||||
|
||||
comboBoxClientId.DataSource = clientRepository.ReadClients();
|
||||
comboBoxClientId.DisplayMember = "FullName";
|
||||
comboBoxClientId.ValueMember = "Id";
|
||||
|
||||
ColumnTour.DataSource = tourRepository.ReadTours();
|
||||
ColumnTour.DisplayMember = "Departure";
|
||||
ColumnTour.ValueMember = "Id";
|
||||
|
||||
|
||||
}
|
||||
private void buttonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (dataGridViewReceipts.RowCount < 1 ||
|
||||
comboBoxClientId.SelectedIndex < 0)
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
|
||||
_receiptRepository.CreateReceipt(Receipt.CreateEntity((int)comboBoxClientId.SelectedValue!, Convert.ToInt32(ColumnTour.ValueMember), 0, 0));
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private List<Receipt> CreateListClientTourFromDataGrid()
|
||||
{
|
||||
var list = new List<Receipt>();
|
||||
foreach(DataGridViewRow row in dataGridViewReceipts.Rows)
|
||||
{
|
||||
if (row.Cells["ColumnTour"].Value == null || row.Cells["ColumnReceipt"].Value == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
list.Add(Receipt.CreateEntity((int)comboBoxClientId.SelectedValue!,Convert.ToInt32(ColumnTour.ValueMember),0,0));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
}
|
126
project/ProjectTourAgency/Forms/FormClientTour.resx
Normal file
126
project/ProjectTourAgency/Forms/FormClientTour.resx
Normal file
@ -0,0 +1,126 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="ColumnTour.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="ColumnReceipt.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
</root>
|
97
project/ProjectTourAgency/Forms/FormReceipts.Designer.cs
generated
Normal file
97
project/ProjectTourAgency/Forms/FormReceipts.Designer.cs
generated
Normal file
@ -0,0 +1,97 @@
|
||||
namespace ProjectTourAgency.Forms
|
||||
{
|
||||
partial class FormReceipts
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
dataGridViewData = new DataGridView();
|
||||
panel1 = new Panel();
|
||||
buttonAdd = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
|
||||
panel1.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// dataGridViewData
|
||||
//
|
||||
dataGridViewData.AllowUserToAddRows = false;
|
||||
dataGridViewData.AllowUserToDeleteRows = false;
|
||||
dataGridViewData.AllowUserToResizeColumns = false;
|
||||
dataGridViewData.AllowUserToResizeRows = false;
|
||||
dataGridViewData.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dataGridViewData.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridViewData.Dock = DockStyle.Fill;
|
||||
dataGridViewData.Location = new Point(0, 0);
|
||||
dataGridViewData.MultiSelect = false;
|
||||
dataGridViewData.Name = "dataGridViewData";
|
||||
dataGridViewData.ReadOnly = true;
|
||||
dataGridViewData.RowHeadersVisible = false;
|
||||
dataGridViewData.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridViewData.Size = new Size(775, 371);
|
||||
dataGridViewData.TabIndex = 5;
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
panel1.Controls.Add(buttonAdd);
|
||||
panel1.Dock = DockStyle.Right;
|
||||
panel1.Location = new Point(775, 0);
|
||||
panel1.Name = "panel1";
|
||||
panel1.Size = new Size(149, 371);
|
||||
panel1.TabIndex = 4;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.BackgroundImage = Properties.Resources.free_icon_add_button_5974633;
|
||||
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonAdd.Location = new Point(43, 25);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(61, 59);
|
||||
buttonAdd.TabIndex = 1;
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += buttonAdd_Click;
|
||||
//
|
||||
// FormReceipts
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(924, 371);
|
||||
Controls.Add(dataGridViewData);
|
||||
Controls.Add(panel1);
|
||||
Name = "FormReceipts";
|
||||
Text = "FormReceipts";
|
||||
Load += FormReceipts_Load;
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
|
||||
panel1.ResumeLayout(false);
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DataGridView dataGridViewData;
|
||||
private Panel panel1;
|
||||
private Button buttonAdd;
|
||||
}
|
||||
}
|
68
project/ProjectTourAgency/Forms/FormReceipts.cs
Normal file
68
project/ProjectTourAgency/Forms/FormReceipts.cs
Normal file
@ -0,0 +1,68 @@
|
||||
using ProjectTourAgency.Repositories;
|
||||
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 Unity;
|
||||
|
||||
namespace ProjectTourAgency.Forms
|
||||
{
|
||||
public partial class FormReceipts : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
|
||||
private readonly IReceiptRepository _receiptRepository;
|
||||
|
||||
public FormReceipts(IReceiptRepository ReceiptRepository, IUnityContainer container)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ?? throw new ArgumentNullException(nameof(container));
|
||||
_receiptRepository = ReceiptRepository ?? throw new ArgumentNullException(nameof(_receiptRepository));
|
||||
}
|
||||
|
||||
private void FormReceipts_Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormReceipt>().ShowDialog();
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void LoadList() => dataGridViewData.DataSource = _receiptRepository.ReadReceipts();
|
||||
|
||||
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||
{
|
||||
id = 0;
|
||||
if (dataGridViewData.SelectedRows.Count < 1)
|
||||
{
|
||||
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return false;
|
||||
}
|
||||
id = Convert.ToInt32(dataGridViewData.SelectedRows[0].Cells["ID"].Value);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
120
project/ProjectTourAgency/Forms/FormReceipts.resx
Normal file
120
project/ProjectTourAgency/Forms/FormReceipts.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>
|
@ -25,7 +25,7 @@ namespace ProjectTourAgency
|
||||
container.RegisterType<IClientRepository, ClientRepository>();
|
||||
container.RegisterType<IDiscountRepository, DiscountRepository>();
|
||||
container.RegisterType<IReceiptRepository, ReceiptRepository>();
|
||||
container.RegisterType<ITourRepositiry, TourRepositiry>();
|
||||
container.RegisterType<ITourRepository, TourRepositiry>();
|
||||
|
||||
return container;
|
||||
}
|
||||
|
@ -0,0 +1,18 @@
|
||||
using ProjectTourAgency.Enities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectTourAgency.Repositories
|
||||
{
|
||||
public interface IClientTourRepisitory
|
||||
{
|
||||
IEnumerable<ClientTour> ReadClientTours(DateTime? dateFrom = null,
|
||||
DateTime? dateTo = null, int? clientId = null, int? tourId = null);
|
||||
|
||||
|
||||
void CreateReceipt(Receipt receipt);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user