Compare commits
3 Commits
a6fbd1de2e
...
4b6a46d586
Author | SHA1 | Date | |
---|---|---|---|
4b6a46d586 | |||
47d6fe77ed | |||
80ea9fa153 |
@ -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
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -10,16 +10,14 @@ namespace ProjectTourAgency.Enities;
|
||||
public class Discount
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public float DiscountPercent { get; private set; }
|
||||
public decimal DiscountPercent { get; private set; }
|
||||
public ClientSocialStatus ClientSocialStatus { get; private set; }
|
||||
public int ClientId { get; private set; }
|
||||
public static Discount CreateEntity(int id, int clientId,
|
||||
ClientSocialStatus clientSocialStatus,float discountPercent)
|
||||
public static Discount CreateEntity(int id,
|
||||
ClientSocialStatus clientSocialStatus,decimal discountPercent)
|
||||
{
|
||||
return new Discount
|
||||
{
|
||||
Id = id,
|
||||
ClientId = clientId,
|
||||
ClientSocialStatus = clientSocialStatus,
|
||||
DiscountPercent = discountPercent
|
||||
};
|
||||
|
@ -12,18 +12,19 @@ public class Receipt
|
||||
{
|
||||
public int ClientId { get; private set; }
|
||||
public DateTime Date { get; private set; }
|
||||
public int Duration { get; private set; }
|
||||
public int TourId { get; private set; }
|
||||
public int FinalCost { get; private set; }
|
||||
|
||||
public static Receipt CreateEntity(int clientId, int tourId, int duration, int finalCost)
|
||||
public int DiscountId { get; private set; }
|
||||
public decimal FinalCost { get; private set; }
|
||||
|
||||
public static Receipt CreateEntity(int clientId, int tourId,int discountId, decimal finalCost)
|
||||
{
|
||||
return new Receipt
|
||||
{
|
||||
ClientId = clientId,
|
||||
TourId = tourId,
|
||||
DiscountId = discountId,
|
||||
Date = DateTime.Now,
|
||||
Duration = duration,
|
||||
FinalCost = finalCost
|
||||
|
||||
};
|
||||
|
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>
|
@ -43,9 +43,9 @@
|
||||
panel1.Controls.Add(buttonUpdate);
|
||||
panel1.Controls.Add(buttonAdd);
|
||||
panel1.Dock = DockStyle.Right;
|
||||
panel1.Location = new Point(778, 0);
|
||||
panel1.Location = new Point(775, 0);
|
||||
panel1.Name = "panel1";
|
||||
panel1.Size = new Size(149, 378);
|
||||
panel1.Size = new Size(149, 371);
|
||||
panel1.TabIndex = 0;
|
||||
//
|
||||
// buttonDelete
|
||||
@ -96,14 +96,14 @@
|
||||
dataGridViewData.ReadOnly = true;
|
||||
dataGridViewData.RowHeadersVisible = false;
|
||||
dataGridViewData.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridViewData.Size = new Size(778, 378);
|
||||
dataGridViewData.Size = new Size(775, 371);
|
||||
dataGridViewData.TabIndex = 1;
|
||||
//
|
||||
// FormClients
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(927, 378);
|
||||
ClientSize = new Size(924, 371);
|
||||
Controls.Add(dataGridViewData);
|
||||
Controls.Add(panel1);
|
||||
Name = "FormClients";
|
||||
|
@ -46,7 +46,7 @@ namespace ProjectTourAgency.Forms
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка рот добавлении", MessageBoxButtons.OK,MessageBoxIcon.Error);
|
||||
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK,MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
122
project/ProjectTourAgency/Forms/FormDiscount.Designer.cs
generated
Normal file
122
project/ProjectTourAgency/Forms/FormDiscount.Designer.cs
generated
Normal file
@ -0,0 +1,122 @@
|
||||
namespace ProjectTourAgency.Forms
|
||||
{
|
||||
partial class FormDiscount
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
labelDiscount = new Label();
|
||||
comboBoxSocialStatus = new ComboBox();
|
||||
labelSocialStatus = new Label();
|
||||
buttonCancel = new Button();
|
||||
buttonSave = new Button();
|
||||
numericUpDownDiscount = new NumericUpDown();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownDiscount).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// labelDiscount
|
||||
//
|
||||
labelDiscount.AutoSize = true;
|
||||
labelDiscount.Location = new Point(25, 82);
|
||||
labelDiscount.Name = "labelDiscount";
|
||||
labelDiscount.Size = new Size(88, 15);
|
||||
labelDiscount.TabIndex = 0;
|
||||
labelDiscount.Text = "Размер скидки";
|
||||
//
|
||||
// comboBoxSocialStatus
|
||||
//
|
||||
comboBoxSocialStatus.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxSocialStatus.FormattingEnabled = true;
|
||||
comboBoxSocialStatus.Location = new Point(182, 33);
|
||||
comboBoxSocialStatus.Name = "comboBoxSocialStatus";
|
||||
comboBoxSocialStatus.Size = new Size(121, 23);
|
||||
comboBoxSocialStatus.TabIndex = 13;
|
||||
//
|
||||
// labelSocialStatus
|
||||
//
|
||||
labelSocialStatus.AutoSize = true;
|
||||
labelSocialStatus.Location = new Point(25, 33);
|
||||
labelSocialStatus.Name = "labelSocialStatus";
|
||||
labelSocialStatus.Size = new Size(131, 15);
|
||||
labelSocialStatus.TabIndex = 12;
|
||||
labelSocialStatus.Text = "Основания для скидки";
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(228, 139);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(75, 23);
|
||||
buttonCancel.TabIndex = 15;
|
||||
buttonCancel.Text = "Отменить";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(65, 139);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(75, 23);
|
||||
buttonSave.TabIndex = 14;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// numericUpDownDiscount
|
||||
//
|
||||
numericUpDownDiscount.DecimalPlaces = 2;
|
||||
numericUpDownDiscount.Increment = new decimal(new int[] { 1, 0, 0, 131072 });
|
||||
numericUpDownDiscount.Location = new Point(182, 82);
|
||||
numericUpDownDiscount.Maximum = new decimal(new int[] { 1, 0, 0, 0 });
|
||||
numericUpDownDiscount.Name = "numericUpDownDiscount";
|
||||
numericUpDownDiscount.Size = new Size(121, 23);
|
||||
numericUpDownDiscount.TabIndex = 16;
|
||||
//
|
||||
// FormDiscount
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(383, 174);
|
||||
Controls.Add(numericUpDownDiscount);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(comboBoxSocialStatus);
|
||||
Controls.Add(labelSocialStatus);
|
||||
Controls.Add(labelDiscount);
|
||||
Name = "FormDiscount";
|
||||
Text = "FormDiscount";
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownDiscount).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label labelDiscount;
|
||||
private ComboBox comboBoxSocialStatus;
|
||||
private Label labelSocialStatus;
|
||||
private Button buttonCancel;
|
||||
private Button buttonSave;
|
||||
private NumericUpDown numericUpDownDiscount;
|
||||
}
|
||||
}
|
81
project/ProjectTourAgency/Forms/FormDiscount.cs
Normal file
81
project/ProjectTourAgency/Forms/FormDiscount.cs
Normal file
@ -0,0 +1,81 @@
|
||||
using ProjectTourAgency.Enities.Enums;
|
||||
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.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ProjectTourAgency.Forms;
|
||||
|
||||
public partial class FormDiscount : Form
|
||||
{
|
||||
private readonly IDiscountRepository _discountRepository;
|
||||
|
||||
private int? _discountId;
|
||||
|
||||
public int Id
|
||||
{
|
||||
set
|
||||
{
|
||||
try
|
||||
{
|
||||
var discount = _discountRepository.ReadDiscountById(value);
|
||||
if (discount == null)
|
||||
{
|
||||
throw new InvalidDataException(nameof(discount));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при получении данных",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
public FormDiscount(IDiscountRepository discountRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_discountRepository = discountRepository ??
|
||||
throw new ArgumentNullException(nameof(discountRepository));
|
||||
comboBoxSocialStatus.DataSource = Enum.GetValues(typeof(ClientSocialStatus));
|
||||
}
|
||||
|
||||
private void buttonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(numericUpDownDiscount.Text)
|
||||
|| comboBoxSocialStatus.SelectedIndex < 0)
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
|
||||
if (_discountId.HasValue)
|
||||
{
|
||||
_discountRepository.UpdateDiscount(CreateDiscount(_discountId.Value));
|
||||
}
|
||||
else
|
||||
{
|
||||
_discountRepository.CreateDiscount(CreateDiscount(0));
|
||||
}
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonCancel_Click(object sender, EventArgs e) => Close();
|
||||
|
||||
private Discount CreateDiscount(int id) => Discount.CreateEntity(id, (ClientSocialStatus)comboBoxSocialStatus.SelectedItem!,numericUpDownDiscount.Value );
|
||||
}
|
120
project/ProjectTourAgency/Forms/FormDiscount.resx
Normal file
120
project/ProjectTourAgency/Forms/FormDiscount.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>
|
125
project/ProjectTourAgency/Forms/FormDiscounts.Designer.cs
generated
Normal file
125
project/ProjectTourAgency/Forms/FormDiscounts.Designer.cs
generated
Normal file
@ -0,0 +1,125 @@
|
||||
namespace ProjectTourAgency.Forms
|
||||
{
|
||||
partial class FormDiscounts
|
||||
{
|
||||
/// <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();
|
||||
buttonDelete = new Button();
|
||||
buttonUpdate = new Button();
|
||||
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 = 3;
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
panel1.Controls.Add(buttonDelete);
|
||||
panel1.Controls.Add(buttonUpdate);
|
||||
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 = 2;
|
||||
//
|
||||
// buttonDelete
|
||||
//
|
||||
buttonDelete.BackgroundImage = Properties.Resources.free_icon_delete_3807871;
|
||||
buttonDelete.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonDelete.Location = new Point(43, 276);
|
||||
buttonDelete.Name = "buttonDelete";
|
||||
buttonDelete.Size = new Size(61, 59);
|
||||
buttonDelete.TabIndex = 3;
|
||||
buttonDelete.UseVisualStyleBackColor = true;
|
||||
buttonDelete.Click += buttonDelete_Click;
|
||||
//
|
||||
// buttonUpdate
|
||||
//
|
||||
buttonUpdate.BackgroundImage = Properties.Resources.free_icon_edit_8679935;
|
||||
buttonUpdate.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonUpdate.Location = new Point(43, 142);
|
||||
buttonUpdate.Name = "buttonUpdate";
|
||||
buttonUpdate.Size = new Size(61, 59);
|
||||
buttonUpdate.TabIndex = 2;
|
||||
buttonUpdate.UseVisualStyleBackColor = true;
|
||||
buttonUpdate.Click += buttonUpdate_Click;
|
||||
//
|
||||
// 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;
|
||||
//
|
||||
// FormDiscounts
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(924, 371);
|
||||
Controls.Add(dataGridViewData);
|
||||
Controls.Add(panel1);
|
||||
Name = "FormDiscounts";
|
||||
Text = "FormDiscounts";
|
||||
Load += FormDiscounts_Load;
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
|
||||
panel1.ResumeLayout(false);
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DataGridView dataGridViewData;
|
||||
private Panel panel1;
|
||||
private Button buttonDelete;
|
||||
private Button buttonUpdate;
|
||||
private Button buttonAdd;
|
||||
}
|
||||
}
|
110
project/ProjectTourAgency/Forms/FormDiscounts.cs
Normal file
110
project/ProjectTourAgency/Forms/FormDiscounts.cs
Normal file
@ -0,0 +1,110 @@
|
||||
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 FormDiscounts : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
|
||||
private readonly IDiscountRepository _discountRepository;
|
||||
|
||||
public FormDiscounts(IDiscountRepository discountRepository, IUnityContainer container)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ?? throw new ArgumentNullException(nameof(container));
|
||||
_discountRepository = discountRepository ?? throw new ArgumentNullException(nameof(_discountRepository));
|
||||
}
|
||||
|
||||
private void FormDiscounts_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<FormDiscount>().ShowDialog();
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK,MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonUpdate_Click(object sender, EventArgs e)
|
||||
{
|
||||
if(!TryGetIdentifierFromSelectedRow(out var findId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
var form = _container.Resolve<FormDiscount>();
|
||||
form.Id = findId;
|
||||
form.ShowDialog();
|
||||
LoadList();
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
if(!TryGetIdentifierFromSelectedRow(out var findId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
_discountRepository.DeleteDiscount(findId);
|
||||
LoadList();
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message,"Ошибка при удалении", MessageBoxButtons.OK,MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadList() => dataGridViewData.DataSource = _discountRepository.ReadDiscounts();
|
||||
|
||||
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/FormDiscounts.resx
Normal file
120
project/ProjectTourAgency/Forms/FormDiscounts.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>
|
167
project/ProjectTourAgency/Forms/FormReceipt.Designer.cs
generated
Normal file
167
project/ProjectTourAgency/Forms/FormReceipt.Designer.cs
generated
Normal file
@ -0,0 +1,167 @@
|
||||
namespace ProjectTourAgency.Forms
|
||||
{
|
||||
partial class FormReceipt
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
labelCLientId = new Label();
|
||||
labelTourId = new Label();
|
||||
labelDIscountId = new Label();
|
||||
label1 = new Label();
|
||||
textBoxFinalCost = new TextBox();
|
||||
comboBoxClientId = new ComboBox();
|
||||
comboBoxDIscountId = new ComboBox();
|
||||
comboBoxTourId = new ComboBox();
|
||||
buttonCancel = new Button();
|
||||
buttonSave = new Button();
|
||||
SuspendLayout();
|
||||
//
|
||||
// labelCLientId
|
||||
//
|
||||
labelCLientId.AutoSize = true;
|
||||
labelCLientId.Location = new Point(12, 29);
|
||||
labelCLientId.Name = "labelCLientId";
|
||||
labelCLientId.Size = new Size(142, 15);
|
||||
labelCLientId.TabIndex = 0;
|
||||
labelCLientId.Text = "Идентификатор Клиента";
|
||||
//
|
||||
// labelTourId
|
||||
//
|
||||
labelTourId.AutoSize = true;
|
||||
labelTourId.Location = new Point(12, 73);
|
||||
labelTourId.Name = "labelTourId";
|
||||
labelTourId.Size = new Size(122, 15);
|
||||
labelTourId.TabIndex = 1;
|
||||
labelTourId.Text = "Идентификатор Тура";
|
||||
//
|
||||
// labelDIscountId
|
||||
//
|
||||
labelDIscountId.AutoSize = true;
|
||||
labelDIscountId.Location = new Point(12, 118);
|
||||
labelDIscountId.Name = "labelDIscountId";
|
||||
labelDIscountId.Size = new Size(137, 15);
|
||||
labelDIscountId.TabIndex = 2;
|
||||
labelDIscountId.Text = "Идентификатор Скидки";
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new Point(12, 156);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(95, 15);
|
||||
label1.TabIndex = 3;
|
||||
label1.Text = "Сумма к опалет";
|
||||
//
|
||||
// textBoxFinalCost
|
||||
//
|
||||
textBoxFinalCost.Location = new Point(160, 153);
|
||||
textBoxFinalCost.Name = "textBoxFinalCost";
|
||||
textBoxFinalCost.Size = new Size(100, 23);
|
||||
textBoxFinalCost.TabIndex = 4;
|
||||
//
|
||||
// comboBoxClientId
|
||||
//
|
||||
comboBoxClientId.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxClientId.FormattingEnabled = true;
|
||||
comboBoxClientId.Location = new Point(160, 26);
|
||||
comboBoxClientId.Name = "comboBoxClientId";
|
||||
comboBoxClientId.Size = new Size(121, 23);
|
||||
comboBoxClientId.TabIndex = 5;
|
||||
//
|
||||
// comboBoxDIscountId
|
||||
//
|
||||
comboBoxDIscountId.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxDIscountId.FormattingEnabled = true;
|
||||
comboBoxDIscountId.Location = new Point(160, 110);
|
||||
comboBoxDIscountId.Name = "comboBoxDIscountId";
|
||||
comboBoxDIscountId.Size = new Size(121, 23);
|
||||
comboBoxDIscountId.TabIndex = 6;
|
||||
//
|
||||
// comboBoxTourId
|
||||
//
|
||||
comboBoxTourId.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxTourId.FormattingEnabled = true;
|
||||
comboBoxTourId.Location = new Point(160, 65);
|
||||
comboBoxTourId.Name = "comboBoxTourId";
|
||||
comboBoxTourId.Size = new Size(121, 23);
|
||||
comboBoxTourId.TabIndex = 7;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(250, 211);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(75, 23);
|
||||
buttonCancel.TabIndex = 15;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += buttonCancel_Click;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(57, 211);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(75, 23);
|
||||
buttonSave.TabIndex = 14;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += buttonSave_Click;
|
||||
//
|
||||
// FormReceipt
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(361, 254);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(comboBoxTourId);
|
||||
Controls.Add(comboBoxDIscountId);
|
||||
Controls.Add(comboBoxClientId);
|
||||
Controls.Add(textBoxFinalCost);
|
||||
Controls.Add(label1);
|
||||
Controls.Add(labelDIscountId);
|
||||
Controls.Add(labelTourId);
|
||||
Controls.Add(labelCLientId);
|
||||
Name = "FormReceipt";
|
||||
Text = "FormReceipt";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label labelCLientId;
|
||||
private Label labelTourId;
|
||||
private Label labelDIscountId;
|
||||
private Label label1;
|
||||
private TextBox textBoxFinalCost;
|
||||
private ComboBox comboBoxClientId;
|
||||
private ComboBox comboBoxDIscountId;
|
||||
private ComboBox comboBoxTourId;
|
||||
private Button buttonCancel;
|
||||
private Button buttonSave;
|
||||
}
|
||||
}
|
68
project/ProjectTourAgency/Forms/FormReceipt.cs
Normal file
68
project/ProjectTourAgency/Forms/FormReceipt.cs
Normal file
@ -0,0 +1,68 @@
|
||||
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.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ProjectTourAgency.Forms;
|
||||
|
||||
public partial class FormReceipt : Form
|
||||
{
|
||||
private readonly IReceiptRepository _receiptRepository;
|
||||
public FormReceipt(IReceiptRepository receiptRepository,
|
||||
IClientRepository clientRepository,
|
||||
ITourRepository tourRepository,
|
||||
IDiscountRepository discountRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_receiptRepository = receiptRepository ??
|
||||
throw new ArgumentNullException(nameof(receiptRepository));
|
||||
comboBoxClientId.DataSource = clientRepository.ReadClients();
|
||||
comboBoxClientId.DisplayMember = "FullName";
|
||||
comboBoxClientId.ValueMember = "Id";
|
||||
|
||||
comboBoxTourId.DataSource = tourRepository.ReadTours();
|
||||
comboBoxTourId.DisplayMember = "Destination";
|
||||
comboBoxTourId.ValueMember = "Id";
|
||||
|
||||
comboBoxDIscountId.DataSource = discountRepository.ReadDiscounts();
|
||||
comboBoxDIscountId.DisplayMember = "DiscountPercent";
|
||||
comboBoxDIscountId.ValueMember = "Id";
|
||||
}
|
||||
|
||||
private void buttonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (comboBoxClientId.SelectedIndex < 0 ||
|
||||
comboBoxDIscountId.SelectedIndex < 0 ||
|
||||
comboBoxTourId.SelectedIndex < 0)
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
|
||||
var selectedTour = (Tour)comboBoxTourId.SelectedItem;
|
||||
var selectedDiscount = (Discount)comboBoxDIscountId.SelectedItem;
|
||||
|
||||
decimal finalCost = selectedTour.Cost - (selectedTour.Cost * (selectedDiscount.DiscountPercent /100));
|
||||
textBoxFinalCost.Text = finalCost.ToString();
|
||||
|
||||
|
||||
_receiptRepository.CreateReceipt(Receipt.CreateEntity( (int)(comboBoxClientId.SelectedValue!), (int)(comboBoxTourId.SelectedValue!), (int)(comboBoxDIscountId.SelectedValue!),Convert.ToDecimal(finalCost)));
|
||||
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonCancel_Click(object sender, EventArgs e) => Close();
|
||||
}
|
120
project/ProjectTourAgency/Forms/FormReceipt.resx
Normal file
120
project/ProjectTourAgency/Forms/FormReceipt.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>
|
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>
|
@ -128,7 +128,7 @@
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(75, 23);
|
||||
buttonSave.TabIndex = 12;
|
||||
buttonSave.Text = "button1";
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += buttonSave_Click;
|
||||
//
|
||||
@ -138,7 +138,7 @@
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(75, 23);
|
||||
buttonCancel.TabIndex = 13;
|
||||
buttonCancel.Text = "button2";
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += buttonCancel_Click;
|
||||
//
|
||||
|
@ -52,7 +52,7 @@
|
||||
dataGridViewData.ReadOnly = true;
|
||||
dataGridViewData.RowHeadersVisible = false;
|
||||
dataGridViewData.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridViewData.Size = new Size(651, 450);
|
||||
dataGridViewData.Size = new Size(775, 371);
|
||||
dataGridViewData.TabIndex = 3;
|
||||
//
|
||||
// panel1
|
||||
@ -61,9 +61,9 @@
|
||||
panel1.Controls.Add(buttonUpdate);
|
||||
panel1.Controls.Add(buttonAdd);
|
||||
panel1.Dock = DockStyle.Right;
|
||||
panel1.Location = new Point(651, 0);
|
||||
panel1.Location = new Point(775, 0);
|
||||
panel1.Name = "panel1";
|
||||
panel1.Size = new Size(149, 450);
|
||||
panel1.Size = new Size(149, 371);
|
||||
panel1.TabIndex = 2;
|
||||
//
|
||||
// buttonDelete
|
||||
@ -103,7 +103,7 @@
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(800, 450);
|
||||
ClientSize = new Size(924, 371);
|
||||
Controls.Add(dataGridViewData);
|
||||
Controls.Add(panel1);
|
||||
Name = "FormTours";
|
||||
|
@ -22,7 +22,7 @@ public class DiscountRepository : IDiscountRepository
|
||||
|
||||
public Discount ReadDiscountById(int id)
|
||||
{
|
||||
return Discount.CreateEntity(0, 0, 0, 0);
|
||||
return Discount.CreateEntity(0, 0, 0);
|
||||
}
|
||||
|
||||
public IEnumerable<Discount> ReadDiscounts()
|
||||
|
@ -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