Compare commits

...

9 Commits

39 changed files with 2287 additions and 67 deletions

View File

@ -0,0 +1,31 @@
using ProjectTourAgency.Enities.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectTourAgency.Enities;
public class Client
{
public int Id { get;private set; }
public string FullName { get; private set; } = string.Empty;
public DateTime BirthDate { get; private set; }
public string PhoneNumber { get; private set; } = string.Empty;
public ClientSocialStatus ClientSocialStatus { get; private set; }
public static Client CreateEntity(int id, string fullName,
DateTime birthDate, string phoneNumber, ClientSocialStatus clientSocialStatus)
{
return new Client
{
Id = id,
FullName = fullName,
BirthDate = birthDate,
PhoneNumber = phoneNumber,
ClientSocialStatus = clientSocialStatus
};
}
}

View File

@ -0,0 +1,26 @@
using ProjectTourAgency.Enities.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectTourAgency.Enities;
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)
{
return new ClientTour
{
ClientId = clientId,
TourId = tourId,
ClientSocialStatus = clientSocialStatus
};
}
}

View File

@ -0,0 +1,27 @@
using ProjectTourAgency.Enities.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectTourAgency.Enities;
public class Discount
{
public int Id { get; private set; }
public float 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)
{
return new Discount
{
Id = id,
ClientId = clientId,
ClientSocialStatus = clientSocialStatus,
DiscountPercent = discountPercent
};
}
}

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectTourAgency.Enities.Enums;
public enum ClientSocialStatus
{
None = 0,
Student = 1,
Veteran = 2,
aged = 3
}

View File

@ -0,0 +1,32 @@
using ProjectTourAgency.Enities.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace ProjectTourAgency.Enities;
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)
{
return new Receipt
{
ClientId = clientId,
TourId = tourId,
Date = DateTime.Now,
Duration = duration,
FinalCost = finalCost
};
}
}

View File

@ -0,0 +1,31 @@
using ProjectTourAgency.Enities.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectTourAgency.Enities;
public class Tour
{
public int Id { get; private set; }
public string Destination { get; private set; } = string.Empty;
public string Departure { get; private set; } = string.Empty;
public DateTime DepartureDate { get; private set; }
public int Duration { get; private set; }
public int Cost { get; private set; }
public static Tour CreateEntity(int id, string destination,
DateTime date, string departure, int cost, int duration)
{
return new Tour
{
Id = id,
Destination = destination,
Departure = departure,
DepartureDate = date,
Cost = cost,
Duration = duration
};
}
}

View File

@ -1,39 +0,0 @@
namespace ProjectTourAgency
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Text = "Form1";
}
#endregion
}
}

View File

@ -0,0 +1,133 @@
namespace ProjectTourAgency
{
partial class FormTourAgency
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
menuStrip1 = new MenuStrip();
справочникиToolStripMenuItem = new ToolStripMenuItem();
клиентыToolStripMenuItem = new ToolStripMenuItem();
турыToolStripMenuItem = new ToolStripMenuItem();
чекиToolStripMenuItem = new ToolStripMenuItem();
предостовляемыеСкидкиToolStripMenuItem = new ToolStripMenuItem();
операцииToolStripMenuItem = new ToolStripMenuItem();
оформитПоездкуToolStripMenuItem = new ToolStripMenuItem();
отчетыToolStripMenuItem = new ToolStripMenuItem();
menuStrip1.SuspendLayout();
SuspendLayout();
//
// menuStrip1
//
menuStrip1.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, операцииToolStripMenuItem, отчетыToolStripMenuItem });
menuStrip1.Location = new Point(0, 0);
menuStrip1.Name = "menuStrip1";
menuStrip1.Size = new Size(784, 24);
menuStrip1.TabIndex = 0;
menuStrip1.Text = "menuStrip1";
//
// справочникиToolStripMenuItem
//
справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { клиентыToolStripMenuItem, турыToolStripMenuItem, чекиToolStripMenuItem, предостовляемыеСкидкиToolStripMenuItem });
справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
справочникиToolStripMenuItem.Size = new Size(94, 20);
справочникиToolStripMenuItem.Text = "Справочники";
//
// клиентыToolStripMenuItem
//
клиентыToolStripMenuItem.Name = "клиентыToolStripMenuItem";
клиентыToolStripMenuItem.Size = new Size(217, 22);
клиентыToolStripMenuItem.Text = "Клиенты";
//
// турыToolStripMenuItem
//
турыToolStripMenuItem.Name = урыToolStripMenuItem";
турыToolStripMenuItem.Size = new Size(217, 22);
турыToolStripMenuItem.Text = "Туры";
//
// чекиToolStripMenuItem
//
чекиToolStripMenuItem.Name = екиToolStripMenuItem";
чекиToolStripMenuItem.Size = new Size(217, 22);
чекиToolStripMenuItem.Text = "Чеки";
//
// предостовляемыеСкидкиToolStripMenuItem
//
предостовляемыеСкидкиToolStripMenuItem.Name = "предостовляемыеСкидкиToolStripMenuItem";
предостовляемыеСкидкиToolStripMenuItem.Size = new Size(217, 22);
предостовляемыеСкидкиToolStripMenuItem.Text = "Предостовляемые скидки";
//
// операцииToolStripMenuItem
//
операцииToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { оформитПоездкуToolStripMenuItem });
операцииToolStripMenuItem.Name = "операцииToolStripMenuItem";
операцииToolStripMenuItem.Size = new Size(75, 20);
операцииToolStripMenuItem.Text = "Операции";
//
// оформитПоездкуToolStripMenuItem
//
оформитПоездкуToolStripMenuItem.Name = "оформитПоездкуToolStripMenuItem";
оформитПоездкуToolStripMenuItem.Size = new Size(173, 22);
оформитПоездкуToolStripMenuItem.Text = "Оформит поездку";
//
// отчетыToolStripMenuItem
//
отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem";
отчетыToolStripMenuItem.Size = new Size(60, 20);
отчетыToolStripMenuItem.Text = "Отчеты";
//
// FormTourAgency
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
BackgroundImage = Properties.Resources.Снимок_экрана_2024_11_08_2139261;
BackgroundImageLayout = ImageLayout.Stretch;
ClientSize = new Size(784, 411);
Controls.Add(menuStrip1);
DoubleBuffered = true;
MainMenuStrip = menuStrip1;
Name = "FormTourAgency";
StartPosition = FormStartPosition.CenterScreen;
Text = "Тур Агенство";
menuStrip1.ResumeLayout(false);
menuStrip1.PerformLayout();
ResumeLayout(false);
PerformLayout();
}
#endregion
private MenuStrip menuStrip1;
private ToolStripMenuItem справочникиToolStripMenuItem;
private ToolStripMenuItem операцииToolStripMenuItem;
private ToolStripMenuItem отчетыToolStripMenuItem;
private ToolStripMenuItem клиентыToolStripMenuItem;
private ToolStripMenuItem турыToolStripMenuItem;
private ToolStripMenuItem чекиToolStripMenuItem;
private ToolStripMenuItem предостовляемыеСкидкиToolStripMenuItem;
private ToolStripMenuItem оформитПоездкуToolStripMenuItem;
}
}

View File

@ -1,8 +1,8 @@
namespace ProjectTourAgency
{
public partial class Form1 : Form
public partial class FormTourAgency : Form
{
public Form1()
public FormTourAgency()
{
InitializeComponent();
}

View File

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@ -0,0 +1,165 @@
namespace ProjectTourAgency.Forms
{
partial class FormClient
{
/// <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()
{
labelName = new Label();
textBoxName = new TextBox();
labelBirthDate = new Label();
textBoxNumber = new TextBox();
labelNumber = new Label();
dateTimePickerBirth = new DateTimePicker();
labelSocialStatus = new Label();
buttonSave = new Button();
buttonCancel = new Button();
comboBoxSocialStatus = new ComboBox();
SuspendLayout();
//
// labelName
//
labelName.AutoSize = true;
labelName.Location = new Point(12, 9);
labelName.Name = "labelName";
labelName.Size = new Size(75, 15);
labelName.TabIndex = 0;
labelName.Text = "Полное имя";
//
// textBoxName
//
textBoxName.Location = new Point(156, 6);
textBoxName.Name = "textBoxName";
textBoxName.Size = new Size(100, 23);
textBoxName.TabIndex = 1;
//
// labelBirthDate
//
labelBirthDate.AutoSize = true;
labelBirthDate.Location = new Point(12, 64);
labelBirthDate.Name = "labelBirthDate";
labelBirthDate.Size = new Size(90, 15);
labelBirthDate.TabIndex = 2;
labelBirthDate.Text = "Дата рождения";
//
// textBoxNumber
//
textBoxNumber.Location = new Point(156, 116);
textBoxNumber.Name = "textBoxNumber";
textBoxNumber.Size = new Size(100, 23);
textBoxNumber.TabIndex = 5;
textBoxNumber.Text = "+7";
//
// labelNumber
//
labelNumber.AutoSize = true;
labelNumber.Location = new Point(12, 119);
labelNumber.Name = "labelNumber";
labelNumber.Size = new Size(101, 15);
labelNumber.TabIndex = 4;
labelNumber.Text = "Номер телефона";
//
// dateTimePickerBirth
//
dateTimePickerBirth.Location = new Point(156, 58);
dateTimePickerBirth.Name = "dateTimePickerBirth";
dateTimePickerBirth.Size = new Size(200, 23);
dateTimePickerBirth.TabIndex = 6;
//
// labelSocialStatus
//
labelSocialStatus.AutoSize = true;
labelSocialStatus.Location = new Point(12, 187);
labelSocialStatus.Name = "labelSocialStatus";
labelSocialStatus.Size = new Size(131, 15);
labelSocialStatus.TabIndex = 7;
labelSocialStatus.Text = "Основания для скидки";
//
// buttonSave
//
buttonSave.Location = new Point(38, 272);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(75, 23);
buttonSave.TabIndex = 9;
buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true;
buttonSave.Click += buttonSave_Click;
//
// buttonCancel
//
buttonCancel.Location = new Point(201, 272);
buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(75, 23);
buttonCancel.TabIndex = 10;
buttonCancel.Text = "Отменить";
buttonCancel.UseVisualStyleBackColor = true;
buttonCancel.Click += buttonCancel_Click;
//
// comboBoxSocialStatus
//
comboBoxSocialStatus.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxSocialStatus.FormattingEnabled = true;
comboBoxSocialStatus.Location = new Point(156, 179);
comboBoxSocialStatus.Name = "comboBoxSocialStatus";
comboBoxSocialStatus.Size = new Size(121, 23);
comboBoxSocialStatus.TabIndex = 11;
//
// FormClient
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(369, 314);
Controls.Add(comboBoxSocialStatus);
Controls.Add(buttonCancel);
Controls.Add(buttonSave);
Controls.Add(labelSocialStatus);
Controls.Add(dateTimePickerBirth);
Controls.Add(textBoxNumber);
Controls.Add(labelNumber);
Controls.Add(labelBirthDate);
Controls.Add(textBoxName);
Controls.Add(labelName);
Name = "FormClient";
StartPosition = FormStartPosition.CenterScreen;
Text = "Клиенты";
ResumeLayout(false);
PerformLayout();
}
#endregion
private Label labelName;
private TextBox textBoxName;
private Label labelBirthDate;
private TextBox textBoxNumber;
private Label labelNumber;
private DateTimePicker dateTimePickerBirth;
private Label labelSocialStatus;
private Button buttonSave;
private Button buttonCancel;
private ComboBox comboBoxSocialStatus;
}
}

View File

@ -0,0 +1,85 @@
using ProjectTourAgency.Enities;
using ProjectTourAgency.Enities.Enums;
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 FormClient : Form
{
private readonly IClientRepository _clientRepository;
private int? _clientId;
public int Id
{
set
{
try
{
var client = _clientRepository.ReadClientById(value);
if (client == null)
{
throw new InvalidDataException(nameof(client));
}
textBoxName.Text = client.FullName;
textBoxNumber.Text = client.PhoneNumber;
comboBoxSocialStatus.SelectedItem = client.ClientSocialStatus;
dateTimePickerBirth.Value = client.BirthDate;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при получении данных",
MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
}
public FormClient(IClientRepository clientRepository)
{
InitializeComponent();
_clientRepository = clientRepository ??
throw new ArgumentNullException(nameof(clientRepository));
comboBoxSocialStatus.DataSource = Enum.GetValues(typeof(ClientSocialStatus));
}
private void buttonSave_Click(object sender, EventArgs e)
{
try
{
if(string.IsNullOrWhiteSpace(textBoxName.Text) ||
string.IsNullOrWhiteSpace(textBoxNumber.Text) || comboBoxSocialStatus.SelectedIndex < 0)
{
throw new Exception("Имеются незаполненные поля");
}
if(_clientId.HasValue)
{
_clientRepository.UpdateClient(CreateClient(_clientId.Value));
}
else
{
_clientRepository.CreateClient(CreateClient(0));
}
Close();
}
catch(Exception ex)
{
MessageBox.Show(ex.Message,"Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void buttonCancel_Click(object sender, EventArgs e) => Close();
private Client CreateClient(int id) => Client.CreateEntity(id, textBoxName.Text,
dateTimePickerBirth.Value, textBoxNumber.Text, (ClientSocialStatus)comboBoxSocialStatus.SelectedItem!);
}

View File

@ -1,17 +1,17 @@
<?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
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>
@ -26,36 +26,36 @@
<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
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
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
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
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
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
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
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->

View File

@ -0,0 +1,126 @@
namespace ProjectTourAgency.Forms
{
partial class FormClients
{
/// <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()
{
panel1 = new Panel();
buttonDelete = new Button();
buttonUpdate = new Button();
buttonAdd = new Button();
dataGridViewData = new DataGridView();
panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
SuspendLayout();
//
// panel1
//
panel1.Controls.Add(buttonDelete);
panel1.Controls.Add(buttonUpdate);
panel1.Controls.Add(buttonAdd);
panel1.Dock = DockStyle.Right;
panel1.Location = new Point(778, 0);
panel1.Name = "panel1";
panel1.Size = new Size(149, 378);
panel1.TabIndex = 0;
//
// 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;
//
// 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(778, 378);
dataGridViewData.TabIndex = 1;
//
// FormClients
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(927, 378);
Controls.Add(dataGridViewData);
Controls.Add(panel1);
Name = "FormClients";
StartPosition = FormStartPosition.CenterParent;
Text = "Клиенты";
Load += FormClients_Load;
panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
ResumeLayout(false);
}
#endregion
private Panel panel1;
private Button buttonDelete;
private Button buttonUpdate;
private Button buttonAdd;
private DataGridView dataGridViewData;
}
}

View 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 FormClients : Form
{
private readonly IUnityContainer _container;
private readonly IClientRepository _clientRepository;
public FormClients(IClientRepository clientRepository, IUnityContainer container)
{
InitializeComponent();
_container = container ?? throw new ArgumentNullException(nameof(container));
_clientRepository = clientRepository ?? throw new ArgumentNullException(nameof(_clientRepository));
}
private void FormClients_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<FormClient>().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<FormClient>();
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
{
_clientRepository.DeleteClient(findId);
LoadList();
}
catch(Exception ex)
{
MessageBox.Show(ex.Message,"Ошибка при удалении", MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}
private void LoadList() => dataGridViewData.DataSource = _clientRepository.ReadClients();
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;
}
}
}

View 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>

View File

@ -0,0 +1,183 @@
namespace ProjectTourAgency.Forms
{
partial class FormTour
{
/// <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()
{
dateTimePickerDepartureDate = new DateTimePicker();
textBoxDestination = new TextBox();
labelDestination = new Label();
labelDeparture = new Label();
textBoxDuration = new TextBox();
labelPrice = new Label();
textBoxDeparture = new TextBox();
labelDate = new Label();
labelDuration = new Label();
textBoxPrice = new TextBox();
buttonSave = new Button();
buttonCancel = new Button();
SuspendLayout();
//
// dateTimePickerDepartureDate
//
dateTimePickerDepartureDate.Location = new Point(144, 114);
dateTimePickerDepartureDate.Name = "dateTimePickerDepartureDate";
dateTimePickerDepartureDate.Size = new Size(226, 23);
dateTimePickerDepartureDate.TabIndex = 2;
//
// textBoxDestination
//
textBoxDestination.Location = new Point(144, 32);
textBoxDestination.Name = "textBoxDestination";
textBoxDestination.Size = new Size(226, 23);
textBoxDestination.TabIndex = 4;
//
// labelDestination
//
labelDestination.AutoSize = true;
labelDestination.Location = new Point(38, 32);
labelDestination.Name = "labelDestination";
labelDestination.Size = new Size(100, 15);
labelDestination.TabIndex = 3;
labelDestination.Text = "Место прибытия";
//
// labelDeparture
//
labelDeparture.AutoSize = true;
labelDeparture.Location = new Point(38, 78);
labelDeparture.Name = "labelDeparture";
labelDeparture.Size = new Size(91, 15);
labelDeparture.TabIndex = 5;
labelDeparture.Text = "Место отбытия";
//
// textBoxDuration
//
textBoxDuration.Location = new Point(144, 162);
textBoxDuration.Name = "textBoxDuration";
textBoxDuration.Size = new Size(226, 23);
textBoxDuration.TabIndex = 7;
//
// labelPrice
//
labelPrice.AutoSize = true;
labelPrice.Location = new Point(35, 205);
labelPrice.Name = "labelPrice";
labelPrice.Size = new Size(94, 15);
labelPrice.TabIndex = 6;
labelPrice.Text = "Стоимость тура";
//
// textBoxDeparture
//
textBoxDeparture.Location = new Point(144, 75);
textBoxDeparture.Name = "textBoxDeparture";
textBoxDeparture.Size = new Size(226, 23);
textBoxDeparture.TabIndex = 8;
//
// labelDate
//
labelDate.AutoSize = true;
labelDate.Location = new Point(38, 120);
labelDate.Name = "labelDate";
labelDate.Size = new Size(84, 15);
labelDate.TabIndex = 9;
labelDate.Text = "Дата отбытия";
//
// labelDuration
//
labelDuration.AutoSize = true;
labelDuration.Location = new Point(38, 162);
labelDuration.Name = "labelDuration";
labelDuration.Size = new Size(84, 15);
labelDuration.TabIndex = 10;
labelDuration.Text = "Дата отбытия";
//
// textBoxPrice
//
textBoxPrice.Location = new Point(144, 205);
textBoxPrice.Name = "textBoxPrice";
textBoxPrice.Size = new Size(226, 23);
textBoxPrice.TabIndex = 11;
//
// buttonSave
//
buttonSave.Location = new Point(63, 251);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(75, 23);
buttonSave.TabIndex = 12;
buttonSave.Text = "button1";
buttonSave.UseVisualStyleBackColor = true;
buttonSave.Click += buttonSave_Click;
//
// buttonCancel
//
buttonCancel.Location = new Point(256, 251);
buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(75, 23);
buttonCancel.TabIndex = 13;
buttonCancel.Text = "button2";
buttonCancel.UseVisualStyleBackColor = true;
buttonCancel.Click += buttonCancel_Click;
//
// FormTour
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(414, 301);
Controls.Add(buttonCancel);
Controls.Add(buttonSave);
Controls.Add(textBoxPrice);
Controls.Add(labelDuration);
Controls.Add(labelDate);
Controls.Add(textBoxDeparture);
Controls.Add(textBoxDuration);
Controls.Add(labelPrice);
Controls.Add(labelDeparture);
Controls.Add(textBoxDestination);
Controls.Add(labelDestination);
Controls.Add(dateTimePickerDepartureDate);
Name = "FormTour";
StartPosition = FormStartPosition.CenterParent;
Text = "Тур";
ResumeLayout(false);
PerformLayout();
}
#endregion
private DateTimePicker dateTimePickerDepartureDate;
private TextBox textBoxDestination;
private Label labelDestination;
private Label labelDeparture;
private TextBox textBoxDuration;
private Label labelPrice;
private TextBox textBoxDeparture;
private Label labelDate;
private Label labelDuration;
private TextBox textBoxPrice;
private Button buttonSave;
private Button buttonCancel;
}
}

View File

@ -0,0 +1,88 @@
using ProjectTourAgency.Enities;
using ProjectTourAgency.Implementations;
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 FormTour : Form
{
private readonly ITourRepository _tourRepository;
private int? _tourId;
public int Id
{
set
{
try
{
var tour = _tourRepository.ReadTourById(value);
if (tour == null)
{
throw new InvalidOperationException(nameof(tour));
}
textBoxDestination.Text = tour.Destination;
textBoxDeparture.Text = tour.Departure;
dateTimePickerDepartureDate.Value = tour.DepartureDate;
textBoxDuration.Text = tour.Duration.ToString();
textBoxPrice.Text = tour.Cost.ToString();
}
catch(Exception ex)
{
MessageBox.Show(ex.Message,"Ошибка при получении ланных", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
}
public FormTour(ITourRepository tourRepository)
{
InitializeComponent();
_tourRepository = tourRepository ??
throw new ArgumentNullException(nameof(tourRepository));
}
private void buttonSave_Click(object sender, EventArgs e)
{
try
{
if (string.IsNullOrWhiteSpace(textBoxDestination.Text) ||
string.IsNullOrWhiteSpace(textBoxDeparture.Text) || string.IsNullOrWhiteSpace(textBoxDuration.Text)
|| string.IsNullOrWhiteSpace(textBoxPrice.Text) || string.IsNullOrWhiteSpace(dateTimePickerDepartureDate.Text))
{
throw new Exception("Имеются незаполненные поля");
}
if (_tourId.HasValue)
{
_tourRepository.UpdateTour(CreateTour(_tourId.Value));
}
else
{
_tourRepository.CreateTour(CreateTour(_tourId.Value));
}
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void buttonCancel_Click(object sender, EventArgs e) => Close();
private Tour CreateTour(int id) => Tour.CreateEntity(id, textBoxDestination.Text, dateTimePickerDepartureDate.Value,
textBoxDeparture.Text, int.Parse(textBoxPrice.Text),
int.Parse(textBoxDuration.Text));
}
}

View 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>

View File

@ -0,0 +1,125 @@
namespace ProjectTourAgency.Forms
{
partial class FormTours
{
/// <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(651, 450);
dataGridViewData.TabIndex = 3;
//
// panel1
//
panel1.Controls.Add(buttonDelete);
panel1.Controls.Add(buttonUpdate);
panel1.Controls.Add(buttonAdd);
panel1.Dock = DockStyle.Right;
panel1.Location = new Point(651, 0);
panel1.Name = "panel1";
panel1.Size = new Size(149, 450);
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;
//
// FormTours
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450);
Controls.Add(dataGridViewData);
Controls.Add(panel1);
Name = "FormTours";
Text = "Туры";
Load += FormTours_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;
}
}

View 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 FormTours : Form
{
private readonly IUnityContainer _container;
private readonly ITourRepository _tourRepository;
public FormTours(ITourRepository tourRepository, IUnityContainer container)
{
InitializeComponent();
_container = container ?? throw new ArgumentNullException(nameof(container));
_tourRepository = tourRepository ?? throw new ArgumentNullException(nameof(_tourRepository));
}
private void FormTours_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<FormTour>().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<FormTour>();
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
{
_tourRepository.DeleteTour(findId);
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void LoadList() => dataGridViewData.DataSource = _tourRepository.ReadTours();
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;
}
}
}

View 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>

View File

@ -0,0 +1,34 @@
using ProjectTourAgency.Enities;
using ProjectTourAgency.Repositories;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectTourAgency.Implementations;
public class ClientRepository : IClientRepository
{
public void CreateClient(Client client)
{
}
public void DeleteClient(int id)
{
}
public Client ReadClientById(int id)
{
return Client.CreateEntity(0, string.Empty, DateTime.Now, string.Empty, 0);
}
public IEnumerable<Client> ReadClients()
{
return [];
}
public void UpdateClient(Client client)
{
}
}

View File

@ -0,0 +1,36 @@
using ProjectTourAgency.Enities;
using ProjectTourAgency.Repositories;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectTourAgency.Implementations;
public class DiscountRepository : IDiscountRepository
{
public void CreateDiscount(Discount discount)
{
}
public void DeleteDiscount(int id)
{
}
public Discount ReadDiscountById(int id)
{
return Discount.CreateEntity(0, 0, 0, 0);
}
public IEnumerable<Discount> ReadDiscounts()
{
return [];
}
public void UpdateDiscount(Discount discount)
{
}
}

View File

@ -0,0 +1,21 @@
using ProjectTourAgency.Enities;
using ProjectTourAgency.Repositories;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectTourAgency.Implementations;
public class ReceiptRepository : IReceiptRepository
{
public void CreateReceipt(Receipt receipt)
{
}
public IEnumerable<Receipt> ReadReceipts(DateTime? dateFrom = null, DateTime? dateTo = null, int? clientId = null, int? tourId = null)
{
return [];
}
}

View File

@ -0,0 +1,35 @@
using ProjectTourAgency.Enities;
using ProjectTourAgency.Repositories;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectTourAgency.Implementations;
public class TourRepositiry : ITourRepository
{
public void CreateTour(Tour tour)
{
}
public void DeleteTour(int id)
{
}
public Tour ReadTourById(int id)
{
return Tour.CreateEntity(0, string.Empty, DateTime.Now, string.Empty, 0,0);
}
public IEnumerable<Tour> ReadTours()
{
return [];
}
public void UpdateTour(Tour tour)
{
}
}

View File

@ -1,3 +1,7 @@
using ProjectTourAgency.Implementations;
using ProjectTourAgency.Repositories;
using Unity;
namespace ProjectTourAgency
{
internal static class Program
@ -11,7 +15,19 @@ namespace ProjectTourAgency
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
Application.Run(new Form1());
Application.Run(CreateContainer().Resolve<FormTourAgency>());
}
private static IUnityContainer CreateContainer()
{
var container = new UnityContainer();
container.RegisterType<IClientRepository, ClientRepository>();
container.RegisterType<IDiscountRepository, DiscountRepository>();
container.RegisterType<IReceiptRepository, ReceiptRepository>();
container.RegisterType<ITourRepositiry, TourRepositiry>();
return container;
}
}
}

View File

@ -8,4 +8,23 @@
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Unity" Version="5.11.10" />
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
</Project>

View File

@ -0,0 +1,113 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Этот код создан программой.
// Исполняемая версия:4.0.30319.42000
//
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
// повторной генерации кода.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ProjectTourAgency.Properties {
using System;
/// <summary>
/// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
/// </summary>
// Этот класс создан автоматически классом StronglyTypedResourceBuilder
// с помощью такого средства, как ResGen или Visual Studio.
// Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen
// с параметром /str или перестройте свой проект VS.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ProjectTourAgency.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Перезаписывает свойство CurrentUICulture текущего потока для всех
/// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap free_icon_add_button_5974633 {
get {
object obj = ResourceManager.GetObject("free-icon-add-button-5974633", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap free_icon_delete_3807871 {
get {
object obj = ResourceManager.GetObject("free-icon-delete-3807871", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap free_icon_edit_8679935 {
get {
object obj = ResourceManager.GetObject("free-icon-edit-8679935", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Снимок_экрана_2024_11_08_213926 {
get {
object obj = ResourceManager.GetObject("Снимок экрана 2024-11-08 213926", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Снимок_экрана_2024_11_08_2139261 {
get {
object obj = ResourceManager.GetObject("Снимок экрана 2024-11-08 2139261", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}

View File

@ -0,0 +1,136 @@
<?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>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="free-icon-edit-8679935" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\free-icon-edit-8679935.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Снимок экрана 2024-11-08 213926" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Снимок экрана 2024-11-08 213926.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="free-icon-add-button-5974633" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\free-icon-add-button-5974633.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Снимок экрана 2024-11-08 2139261" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Снимок экрана 2024-11-08 2139261.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="free-icon-delete-3807871" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\free-icon-delete-3807871.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View File

@ -0,0 +1,20 @@
using ProjectTourAgency.Enities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectTourAgency.Repositories;
public interface IClientRepository
{
IEnumerable<Client> ReadClients();
Client ReadClientById(int id);
void CreateClient(Client client);
void UpdateClient(Client client);
void DeleteClient(int id);
}

View File

@ -0,0 +1,20 @@
using ProjectTourAgency.Enities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectTourAgency.Repositories;
public interface IDiscountRepository
{
IEnumerable<Discount> ReadDiscounts();
Discount ReadDiscountById(int id);
void CreateDiscount(Discount discount);
void UpdateDiscount(Discount discount);
void DeleteDiscount(int id);
}

View File

@ -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 IReceiptRepository
{
IEnumerable<Receipt> ReadReceipts(DateTime? dateFrom = null,
DateTime? dateTo = null, int? clientId = null,int? tourId = null);
void CreateReceipt(Receipt receipt);
}

View File

@ -0,0 +1,21 @@
using ProjectTourAgency.Enities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectTourAgency.Repositories;
public interface ITourRepository
{
IEnumerable<Tour> ReadTours();
Tour ReadTourById(int id);
void CreateTour(Tour tour);
void UpdateTour(Tour tour);
void DeleteTour(int id);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 404 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 404 KiB