Большой коммит первой лабы

This commit is contained in:
Роман Пермяков 2024-11-22 13:30:07 +04:00
parent e057439874
commit e78a74d712
71 changed files with 5208 additions and 77 deletions

View File

@ -0,0 +1,36 @@
using RealEstateTransactions.Entities.Enums;
namespace RealEstateTransactions.Entities
{
public class Apartment
{
public int Id { get; private set; }
public AgencyType AgencyId { get; private set; }
public FormFactorType FormFactorId { get; private set; }
public float Area { get; private set; }
public float PricePerSM { get; private set; }
public float BasePrice { get; private set; }
public float DesiredPrice { get; private set; }
public static Apartment CreateApartment(int id, AgencyType agencyId, FormFactorType formFactorId, float area,
float pricePerSM, float basePrice, float desiredPrice)
{
return new Apartment
{
Id = id,
AgencyId = agencyId,
FormFactorId = formFactorId,
Area = area,
PricePerSM = pricePerSM,
BasePrice = basePrice,
DesiredPrice = desiredPrice
};
}
}
}

View File

@ -0,0 +1,24 @@
namespace RealEstateTransactions.Entities
{
public class Buyer
{
public int Id { get; private set; }
public string FullName { get; private set; } = string.Empty;
public int PassportSeries { get; private set; }
public int PassportNumber { get; private set; }
public static Buyer CreateBuyer(int id, string fullName, int passportSeries, int passportNumber)
{
return new Buyer
{
Id = id,
FullName = fullName,
PassportSeries = passportSeries,
PassportNumber = passportNumber
};
}
}
}

View File

@ -0,0 +1,27 @@
namespace RealEstateTransactions.Entities
{
public class Deal
{
public int Id { get; private set; }
public int ApartmentId { get; private set; }
public int BuyerId { get; private set; }
public float DealPrice { get; private set; }
public DateTime DealDate { get; private set; }
public static Deal CreateDeal(int id, int apartmentId, int buyerId, float dealPrice, DateTime dealDate)
{
return new Deal
{
Id = id,
ApartmentId = apartmentId,
BuyerId = buyerId,
DealPrice = dealPrice,
DealDate = dealDate
};
}
}
}

View File

@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RealEstateTransactions.Entities.Enums
{
public enum AgencyType
{
None = 0,
Sniper = 1,
Shark = 2,
Hammer = 3
}
}

View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RealEstateTransactions.Entities.Enums
{
[Flags]
public enum FormFactorType
{
None = 0,
Kitchen = 1,
Hall = 2,
BedRoom = 4,
Lounge = 8
}
}

View File

@ -0,0 +1,24 @@
namespace RealEstateTransactions.Entities
{
public class PreSalesServices
{
public int Id { get; private set; }
public int ApartmentId { get; private set; }
public string Name { get; private set; } = string.Empty;
public float Cost { get; private set; }
public static PreSalesServices CreatePreSalesServices(int id, int apartmentId, string name, float cost)
{
return new PreSalesServices
{
Id = id,
ApartmentId = apartmentId,
Name = name,
Cost = cost
};
}
}
}

View File

@ -0,0 +1,21 @@
namespace RealEstateTransactions.Entities
{
public class Services
{
public int Id { get; private set; }
public string Name { get; private set; } = string.Empty;
public float Price { get; private set; }
public static Services CreateService(int id, string name, float price)
{
return new Services
{
Id = id,
Name = name,
Price = price
};
}
}
}

View File

@ -0,0 +1,21 @@
namespace RealEstateTransactions.Entities
{
public class ServicesDeal
{
public int ServicesId { get; private set; }
public int DealId { get; private set; }
public float ExecutionTime { get; private set; }
public static ServicesDeal CreateServicesDeal(int servicesId, int dealId, float executionTime)
{
return new ServicesDeal
{
ServicesId = servicesId,
DealId = dealId,
ExecutionTime = executionTime
};
}
}
}

View File

@ -1,39 +0,0 @@
namespace RealEstateTransactions
{
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

@ -1,10 +0,0 @@
namespace RealEstateTransactions
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,148 @@
namespace RealEstateTransactions
{
partial class FormGeneral
{
/// <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();
отчётToolStripMenuItem = new ToolStripMenuItem();
menuStrip1.SuspendLayout();
SuspendLayout();
//
// menuStrip1
//
menuStrip1.ImageScalingSize = new Size(20, 20);
menuStrip1.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, операцииToolStripMenuItem, отчётToolStripMenuItem });
menuStrip1.Location = new Point(0, 0);
menuStrip1.Name = "menuStrip1";
menuStrip1.Size = new Size(800, 28);
menuStrip1.TabIndex = 0;
menuStrip1.Text = "menuStrip1";
//
// справочникиToolStripMenuItem
//
справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { квартирыToolStripMenuItem, покупателиToolStripMenuItem, сделкиToolStripMenuItem, услугиToolStripMenuItem });
справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
справочникиToolStripMenuItem.Size = new Size(117, 24);
справочникиToolStripMenuItem.Text = "Справочники";
//
// квартирыToolStripMenuItem
//
квартирыToolStripMenuItem.Name = "квартирыToolStripMenuItem";
квартирыToolStripMenuItem.Size = new Size(174, 26);
квартирыToolStripMenuItem.Text = "Квартиры";
квартирыToolStripMenuItem.Click += КвартирыToolStripMenuItem_Click;
//
// покупателиToolStripMenuItem
//
покупателиToolStripMenuItem.Name = "покупателиToolStripMenuItem";
покупателиToolStripMenuItem.Size = new Size(174, 26);
покупателиToolStripMenuItem.Text = "Покупатели";
покупателиToolStripMenuItem.Click += ПокупателиToolStripMenuItem_Click;
//
// сделкиToolStripMenuItem
//
сделкиToolStripMenuItem.Name = "сделкиToolStripMenuItem";
сделкиToolStripMenuItem.Size = new Size(174, 26);
сделкиToolStripMenuItem.Text = "Сделки";
сделкиToolStripMenuItem.Click += СделкиToolStripMenuItem_Click;
//
// услугиToolStripMenuItem
//
услугиToolStripMenuItem.Name = "услугиToolStripMenuItem";
услугиToolStripMenuItem.Size = new Size(174, 26);
услугиToolStripMenuItem.Text = "Услуги";
услугиToolStripMenuItem.Click += УслугиToolStripMenuItem_Click;
//
// операцииToolStripMenuItem
//
операцииToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { допродажныеУслугиToolStripMenuItem, услугиПродажиToolStripMenuItem });
операцииToolStripMenuItem.Name = "операцииToolStripMenuItem";
операцииToolStripMenuItem.Size = new Size(95, 24);
операцииToolStripMenuItem.Text = "Операции";
//
// допродажныеУслугиToolStripMenuItem
//
допродажныеУслугиToolStripMenuItem.Name = опродажныеУслугиToolStripMenuItem";
допродажныеУслугиToolStripMenuItem.Size = new Size(241, 26);
допродажныеУслугиToolStripMenuItem.Text = "Допродажные услуги";
допродажныеУслугиToolStripMenuItem.Click += ДопродажныеУслугиToolStripMenuItem_Click;
//
// услугиПродажиToolStripMenuItem
//
услугиПродажиToolStripMenuItem.Name = "услугиПродажиToolStripMenuItem";
услугиПродажиToolStripMenuItem.Size = new Size(241, 26);
услугиПродажиToolStripMenuItem.Text = "Услуги продажи";
услугиПродажиToolStripMenuItem.Click += УслугиПродажиToolStripMenuItem_Click;
//
// отчётToolStripMenuItem
//
отчётToolStripMenuItem.Name = "отчётToolStripMenuItem";
отчётToolStripMenuItem.Size = new Size(73, 24);
отчётToolStripMenuItem.Text = "Отчёты";
//
// FormGeneral
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
BackgroundImage = Properties.Resources.фон;
BackgroundImageLayout = ImageLayout.Stretch;
ClientSize = new Size(800, 450);
Controls.Add(menuStrip1);
DoubleBuffered = true;
MainMenuStrip = menuStrip1;
Name = "FormGeneral";
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;
private ToolStripMenuItem отчётToolStripMenuItem;
}
}

View File

@ -0,0 +1,89 @@
using Unity;
using RealEstateTransactions.Forms;
using RealEstateTransactions.Entities;
namespace RealEstateTransactions
{
public partial class FormGeneral : Form
{
private readonly IUnityContainer _container;
public FormGeneral(IUnityContainer container)
{
InitializeComponent();
_container = container ?? throw new ArgumentNullException(nameof(container));
}
private void ÊâàðòèðûToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormApartments>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ÏîêóïàòåëèToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormBuyers>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ÑäåëêèToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormDeals>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ÓñëóãèToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormServices>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ÄîïðîäàæíûåÓñëóãèToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormPreSalesServices>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ÓñëóãèÏðîäàæèToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormServicesDeals>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}

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,268 @@
namespace RealEstateTransactions.Forms
{
partial class FormApartment
{
/// <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()
{
comboBoxAgency = new ComboBox();
labelAgency = new Label();
labelformFactor = new Label();
labelArea = new Label();
labelPricePerSM = new Label();
labelBasePrice = new Label();
labelDesiredPrice = new Label();
buttonSave = new Button();
buttonCancel = new Button();
numericUpDownArea = new NumericUpDown();
numericUpDownPricePerSM = new NumericUpDown();
numericUpDownDesiredPrice = new NumericUpDown();
numericUpDownBasePrice = new NumericUpDown();
checkedListBoxFormFactor = new CheckedListBox();
((System.ComponentModel.ISupportInitialize)numericUpDownArea).BeginInit();
((System.ComponentModel.ISupportInitialize)numericUpDownPricePerSM).BeginInit();
((System.ComponentModel.ISupportInitialize)numericUpDownDesiredPrice).BeginInit();
((System.ComponentModel.ISupportInitialize)numericUpDownBasePrice).BeginInit();
SuspendLayout();
//
// comboBoxAgency
//
comboBoxAgency.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxAgency.Font = new Font("Segoe UI", 14F);
comboBoxAgency.FormattingEnabled = true;
comboBoxAgency.Location = new Point(336, 6);
comboBoxAgency.Name = "comboBoxAgency";
comboBoxAgency.Size = new Size(217, 39);
comboBoxAgency.TabIndex = 0;
//
// labelAgency
//
labelAgency.AutoSize = true;
labelAgency.Font = new Font("Segoe UI", 14F);
labelAgency.Location = new Point(12, 9);
labelAgency.Name = "labelAgency";
labelAgency.Size = new Size(312, 32);
labelAgency.TabIndex = 10;
labelAgency.Text = "Агенство - - - - - - - -";
//
// labelformFactor
//
labelformFactor.AutoSize = true;
labelformFactor.Font = new Font("Segoe UI", 14F);
labelformFactor.Location = new Point(12, 73);
labelformFactor.Name = "labelformFactor";
labelformFactor.Size = new Size(271, 32);
labelformFactor.TabIndex = 2;
labelformFactor.Text = "Вид квартиры - - - -";
//
// labelArea
//
labelArea.AutoSize = true;
labelArea.Font = new Font("Segoe UI", 14F);
labelArea.Location = new Point(12, 265);
labelArea.Name = "labelArea";
labelArea.Size = new Size(382, 32);
labelArea.TabIndex = 4;
labelArea.Text = "Площадь квартиры (м2) - - - -";
//
// labelPricePerSM
//
labelPricePerSM.AutoSize = true;
labelPricePerSM.Font = new Font("Segoe UI", 14F);
labelPricePerSM.Location = new Point(12, 332);
labelPricePerSM.Name = "labelPricePerSM";
labelPricePerSM.Size = new Size(380, 32);
labelPricePerSM.TabIndex = 11;
labelPricePerSM.Text = "Цена квадратного метра (руб) -";
//
// labelBasePrice
//
labelBasePrice.AutoSize = true;
labelBasePrice.Font = new Font("Segoe UI", 14F);
labelBasePrice.Location = new Point(12, 397);
labelBasePrice.Name = "labelBasePrice";
labelBasePrice.Size = new Size(278, 32);
labelBasePrice.TabIndex = 12;
labelBasePrice.Text = "Базовая цена (руб) - -";
//
// labelDesiredPrice
//
labelDesiredPrice.AutoSize = true;
labelDesiredPrice.Font = new Font("Segoe UI", 14F);
labelDesiredPrice.Location = new Point(12, 451);
labelDesiredPrice.Name = "labelDesiredPrice";
labelDesiredPrice.Size = new Size(281, 32);
labelDesiredPrice.TabIndex = 13;
labelDesiredPrice.Text = "Цена от агенства (руб) -";
//
// buttonSave
//
buttonSave.Font = new Font("Segoe UI", 14F);
buttonSave.Location = new Point(77, 517);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(150, 41);
buttonSave.TabIndex = 5;
buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true;
buttonSave.Click += ButtonSave_Click;
//
// buttonCancel
//
buttonCancel.Font = new Font("Segoe UI", 14F);
buttonCancel.Location = new Point(336, 517);
buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(150, 41);
buttonCancel.TabIndex = 6;
buttonCancel.Text = "Отмена";
buttonCancel.UseVisualStyleBackColor = true;
buttonCancel.Click += ButtonCancel_Click;
//
// numericUpDownArea
//
numericUpDownArea.BorderStyle = BorderStyle.FixedSingle;
numericUpDownArea.DecimalPlaces = 1;
numericUpDownArea.Font = new Font("Segoe UI", 14F);
numericUpDownArea.Increment = new decimal(new int[] { 5, 0, 0, 0 });
numericUpDownArea.Location = new Point(403, 272);
numericUpDownArea.Maximum = new decimal(new int[] { 1000, 0, 0, 0 });
numericUpDownArea.Minimum = new decimal(new int[] { 1, 0, 0, 0 });
numericUpDownArea.Name = "numericUpDownArea";
numericUpDownArea.Size = new Size(150, 39);
numericUpDownArea.TabIndex = 2;
numericUpDownArea.TextAlign = HorizontalAlignment.Center;
numericUpDownArea.Value = new decimal(new int[] { 1, 0, 0, 0 });
numericUpDownArea.ValueChanged += NumericUpDownArea_ValueChanged;
//
// numericUpDownPricePerSM
//
numericUpDownPricePerSM.BorderStyle = BorderStyle.FixedSingle;
numericUpDownPricePerSM.DecimalPlaces = 2;
numericUpDownPricePerSM.Font = new Font("Segoe UI", 14F);
numericUpDownPricePerSM.Increment = new decimal(new int[] { 5, 0, 0, 0 });
numericUpDownPricePerSM.Location = new Point(403, 330);
numericUpDownPricePerSM.Maximum = new decimal(new int[] { 1000000, 0, 0, 0 });
numericUpDownPricePerSM.Minimum = new decimal(new int[] { 1, 0, 0, 0 });
numericUpDownPricePerSM.Name = "numericUpDownPricePerSM";
numericUpDownPricePerSM.Size = new Size(150, 39);
numericUpDownPricePerSM.TabIndex = 3;
numericUpDownPricePerSM.TextAlign = HorizontalAlignment.Center;
numericUpDownPricePerSM.ThousandsSeparator = true;
numericUpDownPricePerSM.Value = new decimal(new int[] { 1, 0, 0, 0 });
numericUpDownPricePerSM.ValueChanged += NumericUpDownPricePerSM_ValueChanged;
//
// numericUpDownDesiredPrice
//
numericUpDownDesiredPrice.BorderStyle = BorderStyle.FixedSingle;
numericUpDownDesiredPrice.DecimalPlaces = 2;
numericUpDownDesiredPrice.Font = new Font("Segoe UI", 14F);
numericUpDownDesiredPrice.Increment = new decimal(new int[] { 5, 0, 0, 0 });
numericUpDownDesiredPrice.Location = new Point(294, 449);
numericUpDownDesiredPrice.Maximum = new decimal(new int[] { 1000000000, 0, 0, 0 });
numericUpDownDesiredPrice.Minimum = new decimal(new int[] { 1, 0, 0, 0 });
numericUpDownDesiredPrice.Name = "numericUpDownDesiredPrice";
numericUpDownDesiredPrice.Size = new Size(259, 39);
numericUpDownDesiredPrice.TabIndex = 4;
numericUpDownDesiredPrice.TextAlign = HorizontalAlignment.Center;
numericUpDownDesiredPrice.ThousandsSeparator = true;
numericUpDownDesiredPrice.Value = new decimal(new int[] { 1, 0, 0, 0 });
//
// numericUpDownBasePrice
//
numericUpDownBasePrice.BorderStyle = BorderStyle.FixedSingle;
numericUpDownBasePrice.DecimalPlaces = 2;
numericUpDownBasePrice.Font = new Font("Segoe UI", 14F);
numericUpDownBasePrice.Increment = new decimal(new int[] { 5, 0, 0, 0 });
numericUpDownBasePrice.InterceptArrowKeys = false;
numericUpDownBasePrice.Location = new Point(294, 395);
numericUpDownBasePrice.Maximum = new decimal(new int[] { 1000000000, 0, 0, 0 });
numericUpDownBasePrice.Minimum = new decimal(new int[] { 1, 0, 0, 0 });
numericUpDownBasePrice.Name = "numericUpDownBasePrice";
numericUpDownBasePrice.ReadOnly = true;
numericUpDownBasePrice.Size = new Size(259, 39);
numericUpDownBasePrice.TabIndex = 14;
numericUpDownBasePrice.TabStop = false;
numericUpDownBasePrice.TextAlign = HorizontalAlignment.Center;
numericUpDownBasePrice.ThousandsSeparator = true;
numericUpDownBasePrice.Value = new decimal(new int[] { 1, 0, 0, 0 });
//
// checkedListBoxFormFactor
//
checkedListBoxFormFactor.BorderStyle = BorderStyle.FixedSingle;
checkedListBoxFormFactor.Font = new Font("Segoe UI", 14F);
checkedListBoxFormFactor.FormattingEnabled = true;
checkedListBoxFormFactor.Location = new Point(289, 73);
checkedListBoxFormFactor.Name = "checkedListBoxFormFactor";
checkedListBoxFormFactor.Size = new Size(264, 172);
checkedListBoxFormFactor.TabIndex = 1;
//
// FormApartment
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(577, 575);
Controls.Add(checkedListBoxFormFactor);
Controls.Add(numericUpDownBasePrice);
Controls.Add(numericUpDownDesiredPrice);
Controls.Add(numericUpDownPricePerSM);
Controls.Add(numericUpDownArea);
Controls.Add(buttonCancel);
Controls.Add(buttonSave);
Controls.Add(labelDesiredPrice);
Controls.Add(labelBasePrice);
Controls.Add(labelPricePerSM);
Controls.Add(labelArea);
Controls.Add(labelformFactor);
Controls.Add(labelAgency);
Controls.Add(comboBoxAgency);
Name = "FormApartment";
StartPosition = FormStartPosition.CenterParent;
Text = "Квартира";
((System.ComponentModel.ISupportInitialize)numericUpDownArea).EndInit();
((System.ComponentModel.ISupportInitialize)numericUpDownPricePerSM).EndInit();
((System.ComponentModel.ISupportInitialize)numericUpDownDesiredPrice).EndInit();
((System.ComponentModel.ISupportInitialize)numericUpDownBasePrice).EndInit();
ResumeLayout(false);
PerformLayout();
}
#endregion
private ComboBox comboBoxAgency;
private Label labelAgency;
private Label labelformFactor;
private Label labelArea;
private Label labelPricePerSM;
private Label labelBasePrice;
private Label labelDesiredPrice;
private Button buttonSave;
private Button buttonCancel;
private NumericUpDown numericUpDownArea;
private NumericUpDown numericUpDownPricePerSM;
private NumericUpDown numericUpDownDesiredPrice;
private NumericUpDown numericUpDownBasePrice;
private CheckedListBox checkedListBoxFormFactor;
}
}

View File

@ -0,0 +1,101 @@
using RealEstateTransactions.Entities;
using RealEstateTransactions.Repositories;
using RealEstateTransactions.Entities.Enums;
namespace RealEstateTransactions.Forms
{
public partial class FormApartment : Form
{
private readonly IApartmentRepository _repository;
private int? _apartmentId;
public int Id
{
set
{
try
{
var apartment = _repository.ReadApartment(value);
if (apartment == null) throw new InvalidDataException(nameof(apartment));
foreach (FormFactorType elem in Enum.GetValues(typeof(FormFactorType)))
{
if ((elem & apartment.FormFactorId) != 0)
checkedListBoxFormFactor.SetItemChecked(checkedListBoxFormFactor.Items.IndexOf(elem), true);
}
comboBoxAgency.SelectedIndex = (int)apartment.AgencyId;
numericUpDownArea.Value = (decimal)apartment.Area;
numericUpDownPricePerSM.Value = (decimal)apartment.PricePerSM;
numericUpDownBasePrice.Value = (decimal)apartment.BasePrice;
numericUpDownDesiredPrice.Value = (decimal)apartment.DesiredPrice;
_apartmentId = value;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при получении данных",
MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
}
public FormApartment(IApartmentRepository repository)
{
InitializeComponent();
_repository = repository ?? throw new ArgumentNullException(nameof(repository));
comboBoxAgency.DataSource = Enum.GetValues(typeof(AgencyType));
foreach (var elem in Enum.GetValues(typeof(FormFactorType))) checkedListBoxFormFactor.Items.Add(elem);
}
private void ButtonSave_Click(object sender, EventArgs e)
{
try
{
if (comboBoxAgency.SelectedIndex == -1 || checkedListBoxFormFactor.CheckedItems.Count == 0)
{
throw new Exception("Имеются незаполненные поля");
}
if (_apartmentId.HasValue)
{
_repository.UpdateApartment(CreateApartment(_apartmentId.Value));
}
else
{
_repository.CreateApartment(CreateApartment(0));
}
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
private Apartment CreateApartment(int Id)
{
FormFactorType formFactorType = FormFactorType.None;
foreach (FormFactorType elem in checkedListBoxFormFactor.CheckedItems) formFactorType |= elem;
return Apartment.CreateApartment(Id,
(AgencyType)comboBoxAgency.SelectedIndex, formFactorType,
(float)numericUpDownArea.Value, (float)numericUpDownPricePerSM.Value,
(float)numericUpDownBasePrice.Value, (float)numericUpDownDesiredPrice.Value);
}
private void NumericUpDownArea_ValueChanged(object sender, EventArgs e) =>
numericUpDownBasePrice.Value = numericUpDownArea.Value * numericUpDownPricePerSM.Value;
private void NumericUpDownPricePerSM_ValueChanged(object sender, EventArgs e) =>
numericUpDownBasePrice.Value = numericUpDownArea.Value * numericUpDownPricePerSM.Value;
}
}

View File

@ -1,17 +1,17 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<root> <root>
<!-- <!--
Microsoft ResX Schema Microsoft ResX Schema
Version 2.0 Version 2.0
The primary goals of this format is to allow a simple XML format The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes various data types are done through the TypeConverter classes
associated with the data types. associated with the data types.
Example: Example:
... ado.net/XML headers & schema ... ... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader> <resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</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> <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment> <comment>This is a comment</comment>
</data> </data>
There are any number of "resheader" rows that contain simple There are any number of "resheader" rows that contain simple
name/value pairs. name/value pairs.
Each data row contains a name, and value. The row also contains a Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture. text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the Classes that don't support this are serialized and stored with the
mimetype set. mimetype set.
The mimetype is used for serialized objects, and tells the The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly: extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below. read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64 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 : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64 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 : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64 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 : using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
--> -->

View File

@ -0,0 +1,128 @@
namespace RealEstateTransactions.Forms
{
partial class FormApartments
{
/// <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()
{
panelTools = new Panel();
buttonDelete = new Button();
buttonUpdate = new Button();
buttonAdd = new Button();
dataGridView = new DataGridView();
panelTools.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
SuspendLayout();
//
// panelTools
//
panelTools.Controls.Add(buttonDelete);
panelTools.Controls.Add(buttonUpdate);
panelTools.Controls.Add(buttonAdd);
panelTools.Dock = DockStyle.Right;
panelTools.Location = new Point(851, 0);
panelTools.Name = "panelTools";
panelTools.Size = new Size(131, 553);
panelTools.TabIndex = 0;
//
// buttonDelete
//
buttonDelete.BackgroundImage = Properties.Resources.Delete;
buttonDelete.BackgroundImageLayout = ImageLayout.Stretch;
buttonDelete.Location = new Point(28, 333);
buttonDelete.Name = "buttonDelete";
buttonDelete.Size = new Size(80, 80);
buttonDelete.TabIndex = 2;
buttonDelete.UseVisualStyleBackColor = true;
buttonDelete.Click += ButtonDelete_Click;
//
// buttonUpdate
//
buttonUpdate.BackgroundImage = Properties.Resources.Update;
buttonUpdate.BackgroundImageLayout = ImageLayout.Stretch;
buttonUpdate.Location = new Point(28, 204);
buttonUpdate.Name = "buttonUpdate";
buttonUpdate.Size = new Size(80, 80);
buttonUpdate.TabIndex = 1;
buttonUpdate.UseVisualStyleBackColor = true;
buttonUpdate.Click += ButtonUpdate_Click;
//
// buttonAdd
//
buttonAdd.BackgroundImage = Properties.Resources.Add;
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
buttonAdd.Location = new Point(28, 73);
buttonAdd.Name = "buttonAdd";
buttonAdd.Size = new Size(80, 80);
buttonAdd.TabIndex = 0;
buttonAdd.UseVisualStyleBackColor = true;
buttonAdd.Click += ButtonAdd_Click;
//
// dataGridView
//
dataGridView.AllowUserToAddRows = false;
dataGridView.AllowUserToDeleteRows = false;
dataGridView.AllowUserToResizeColumns = false;
dataGridView.AllowUserToResizeRows = false;
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView.Dock = DockStyle.Fill;
dataGridView.Location = new Point(0, 0);
dataGridView.MultiSelect = false;
dataGridView.Name = "dataGridView";
dataGridView.ReadOnly = true;
dataGridView.RowHeadersVisible = false;
dataGridView.RowHeadersWidth = 51;
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridView.Size = new Size(851, 553);
dataGridView.TabIndex = 1;
dataGridView.TabStop = false;
//
// FormApartments
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(982, 553);
Controls.Add(dataGridView);
Controls.Add(panelTools);
Name = "FormApartments";
StartPosition = FormStartPosition.CenterParent;
Text = "Квартиры";
Load += FormApartments_Load;
panelTools.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
ResumeLayout(false);
}
#endregion
private Panel panelTools;
private Button buttonDelete;
private Button buttonUpdate;
private Button buttonAdd;
private DataGridView dataGridView;
}
}

View File

@ -0,0 +1,95 @@
using Unity;
using RealEstateTransactions.Repositories;
namespace RealEstateTransactions.Forms
{
public partial class FormApartments : Form
{
private readonly IUnityContainer _container;
private readonly IApartmentRepository _repository;
public FormApartments(IUnityContainer container, IApartmentRepository repository)
{
InitializeComponent();
_container = container ?? throw new ArgumentNullException(nameof(container));
_repository = repository ?? throw new ArgumentNullException(nameof(repository));
}
private void FormApartments_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<FormApartment>().ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonUpdate_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFormSelectedRow(out var findId)) return;
try
{
var form = _container.Resolve<FormApartment>();
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 (!TryGetIdentifierFormSelectedRow(out var findId)) return;
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
!= DialogResult.Yes) return;
try
{
_repository.DeleteApartment(findId);
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void LoadList() => dataGridView.DataSource = _repository.ReadApartments();
private bool TryGetIdentifierFormSelectedRow(out int id)
{
id = 0;
if (dataGridView.SelectedRows.Count < 1)
{
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
id = Convert.ToInt32(dataGridView.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,164 @@
namespace RealEstateTransactions.Forms
{
partial class FormBuyer
{
/// <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()
{
labelFullName = new Label();
textBoxFullName = new TextBox();
labelPassportSeries = new Label();
numericUpDownPassportSeries = new NumericUpDown();
labelPassportNumber = new Label();
numericUpDownPassportNumber = new NumericUpDown();
buttonSave = new Button();
buttonCancel = new Button();
((System.ComponentModel.ISupportInitialize)numericUpDownPassportSeries).BeginInit();
((System.ComponentModel.ISupportInitialize)numericUpDownPassportNumber).BeginInit();
SuspendLayout();
//
// labelFullName
//
labelFullName.AutoSize = true;
labelFullName.Font = new Font("Segoe UI", 14F);
labelFullName.Location = new Point(12, 9);
labelFullName.Name = "labelFullName";
labelFullName.Size = new Size(67, 32);
labelFullName.TabIndex = 0;
labelFullName.Text = "ФИО";
//
// textBoxFullName
//
textBoxFullName.BorderStyle = BorderStyle.FixedSingle;
textBoxFullName.Font = new Font("Segoe UI", 14F);
textBoxFullName.Location = new Point(85, 7);
textBoxFullName.Name = "textBoxFullName";
textBoxFullName.Size = new Size(357, 39);
textBoxFullName.TabIndex = 0;
textBoxFullName.TextAlign = HorizontalAlignment.Center;
//
// labelPassportSeries
//
labelPassportSeries.AutoSize = true;
labelPassportSeries.Font = new Font("Segoe UI", 14F);
labelPassportSeries.Location = new Point(12, 68);
labelPassportSeries.Name = "labelPassportSeries";
labelPassportSeries.Size = new Size(317, 32);
labelPassportSeries.TabIndex = 1;
labelPassportSeries.Text = "Серия паспорта - - - - -";
//
// numericUpDownPassportSeries
//
numericUpDownPassportSeries.BorderStyle = BorderStyle.FixedSingle;
numericUpDownPassportSeries.Font = new Font("Segoe UI", 14F);
numericUpDownPassportSeries.Location = new Point(345, 66);
numericUpDownPassportSeries.Maximum = new decimal(new int[] { 9999, 0, 0, 0 });
numericUpDownPassportSeries.Minimum = new decimal(new int[] { 1111, 0, 0, 0 });
numericUpDownPassportSeries.Name = "numericUpDownPassportSeries";
numericUpDownPassportSeries.Size = new Size(97, 39);
numericUpDownPassportSeries.TabIndex = 1;
numericUpDownPassportSeries.TextAlign = HorizontalAlignment.Center;
numericUpDownPassportSeries.Value = new decimal(new int[] { 1111, 0, 0, 0 });
//
// labelPassportNumber
//
labelPassportNumber.AutoSize = true;
labelPassportNumber.Font = new Font("Segoe UI", 14F);
labelPassportNumber.Location = new Point(12, 130);
labelPassportNumber.Name = "labelPassportNumber";
labelPassportNumber.Size = new Size(300, 32);
labelPassportNumber.TabIndex = 2;
labelPassportNumber.Text = "Номер паспорта - - - -";
//
// numericUpDownPassportNumber
//
numericUpDownPassportNumber.BorderStyle = BorderStyle.FixedSingle;
numericUpDownPassportNumber.Font = new Font("Segoe UI", 14F);
numericUpDownPassportNumber.Location = new Point(318, 128);
numericUpDownPassportNumber.Maximum = new decimal(new int[] { 999999, 0, 0, 0 });
numericUpDownPassportNumber.Minimum = new decimal(new int[] { 111111, 0, 0, 0 });
numericUpDownPassportNumber.Name = "numericUpDownPassportNumber";
numericUpDownPassportNumber.Size = new Size(124, 39);
numericUpDownPassportNumber.TabIndex = 2;
numericUpDownPassportNumber.TextAlign = HorizontalAlignment.Center;
numericUpDownPassportNumber.Value = new decimal(new int[] { 111111, 0, 0, 0 });
//
// buttonSave
//
buttonSave.Font = new Font("Segoe UI", 14F);
buttonSave.Location = new Point(49, 176);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(147, 50);
buttonSave.TabIndex = 3;
buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true;
buttonSave.Click += ButtonSave_Click;
//
// buttonCancel
//
buttonCancel.Font = new Font("Segoe UI", 14F);
buttonCancel.Location = new Point(258, 176);
buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(147, 50);
buttonCancel.TabIndex = 4;
buttonCancel.Text = "Отмена";
buttonCancel.UseVisualStyleBackColor = true;
buttonCancel.Click += buttonCancel_Click;
//
// FormBuyer
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(455, 238);
Controls.Add(buttonCancel);
Controls.Add(buttonSave);
Controls.Add(numericUpDownPassportNumber);
Controls.Add(labelPassportNumber);
Controls.Add(numericUpDownPassportSeries);
Controls.Add(labelPassportSeries);
Controls.Add(textBoxFullName);
Controls.Add(labelFullName);
Name = "FormBuyer";
StartPosition = FormStartPosition.CenterParent;
Text = "Покупатель";
((System.ComponentModel.ISupportInitialize)numericUpDownPassportSeries).EndInit();
((System.ComponentModel.ISupportInitialize)numericUpDownPassportNumber).EndInit();
ResumeLayout(false);
PerformLayout();
}
#endregion
private Label labelFullName;
private TextBox textBoxFullName;
private Label labelPassportSeries;
private NumericUpDown numericUpDownPassportSeries;
private Label labelPassportNumber;
private NumericUpDown numericUpDownPassportNumber;
private Button buttonSave;
private Button buttonCancel;
}
}

View File

@ -0,0 +1,71 @@
using RealEstateTransactions.Entities;
using RealEstateTransactions.Repositories;
namespace RealEstateTransactions.Forms
{
public partial class FormBuyer : Form
{
private readonly IBuyerRepository _repository;
private int? _buyerId;
public int Id
{
set
{
try
{
var buyer = _repository.ReadBuyer(value);
if (buyer == null) throw new InvalidDataException(nameof(buyer));
textBoxFullName.Text = buyer.FullName;
numericUpDownPassportSeries.Value = buyer.PassportSeries;
numericUpDownPassportNumber.Value = buyer.PassportNumber;
_buyerId = value;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
}
public FormBuyer(IBuyerRepository repository)
{
InitializeComponent();
_repository = repository ?? throw new ArgumentNullException(nameof(repository));
}
private void ButtonSave_Click(object sender, EventArgs e)
{
try
{
if (string.IsNullOrWhiteSpace(textBoxFullName.Text))
throw new Exception("Имеются не заполненные поля");
if (_buyerId.HasValue)
{
_repository.UpdateBuyer(CreateBuyer(_buyerId.Value));
}
else
{
_repository.CreateBuyer(CreateBuyer(0));
}
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void buttonCancel_Click(object sender, EventArgs e) => Close();
private Buyer CreateBuyer(int id) => Buyer.CreateBuyer(id, textBoxFullName.Text,
(int)numericUpDownPassportSeries.Value, (int)numericUpDownPassportNumber.Value);
}
}

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,128 @@
namespace RealEstateTransactions.Forms
{
partial class FormBuyers
{
/// <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()
{
panelTools = new Panel();
buttonDelete = new Button();
buttonUpdate = new Button();
buttonAdd = new Button();
dataGridView = new DataGridView();
panelTools.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
SuspendLayout();
//
// panelTools
//
panelTools.Controls.Add(buttonDelete);
panelTools.Controls.Add(buttonUpdate);
panelTools.Controls.Add(buttonAdd);
panelTools.Dock = DockStyle.Right;
panelTools.Location = new Point(850, 0);
panelTools.Name = "panelTools";
panelTools.Size = new Size(132, 553);
panelTools.TabIndex = 0;
//
// buttonDelete
//
buttonDelete.BackgroundImage = Properties.Resources.Delete;
buttonDelete.BackgroundImageLayout = ImageLayout.Stretch;
buttonDelete.Location = new Point(27, 358);
buttonDelete.Name = "buttonDelete";
buttonDelete.Size = new Size(80, 80);
buttonDelete.TabIndex = 2;
buttonDelete.UseVisualStyleBackColor = true;
buttonDelete.Click += ButtonDelete_Click;
//
// buttonUpdate
//
buttonUpdate.BackgroundImage = Properties.Resources.Update;
buttonUpdate.BackgroundImageLayout = ImageLayout.Stretch;
buttonUpdate.Location = new Point(27, 223);
buttonUpdate.Name = "buttonUpdate";
buttonUpdate.Size = new Size(80, 80);
buttonUpdate.TabIndex = 1;
buttonUpdate.UseVisualStyleBackColor = true;
buttonUpdate.Click += ButtonUpdate_Click;
//
// buttonAdd
//
buttonAdd.BackgroundImage = Properties.Resources.Add;
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
buttonAdd.Location = new Point(27, 88);
buttonAdd.Name = "buttonAdd";
buttonAdd.Size = new Size(80, 80);
buttonAdd.TabIndex = 0;
buttonAdd.UseVisualStyleBackColor = true;
buttonAdd.Click += ButtonAdd_Click;
//
// dataGridView
//
dataGridView.AllowUserToAddRows = false;
dataGridView.AllowUserToDeleteRows = false;
dataGridView.AllowUserToResizeColumns = false;
dataGridView.AllowUserToResizeRows = false;
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView.Dock = DockStyle.Fill;
dataGridView.Location = new Point(0, 0);
dataGridView.MultiSelect = false;
dataGridView.Name = "dataGridView";
dataGridView.ReadOnly = true;
dataGridView.RowHeadersVisible = false;
dataGridView.RowHeadersWidth = 51;
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridView.Size = new Size(850, 553);
dataGridView.TabIndex = 1;
dataGridView.TabStop = false;
//
// FormBuyers
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(982, 553);
Controls.Add(dataGridView);
Controls.Add(panelTools);
Name = "FormBuyers";
StartPosition = FormStartPosition.CenterParent;
Text = "Покупатели";
Load += FormBuyers_Load;
panelTools.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
ResumeLayout(false);
}
#endregion
private Panel panelTools;
private Button buttonAdd;
private Button buttonDelete;
private Button buttonUpdate;
private DataGridView dataGridView;
}
}

View File

@ -0,0 +1,96 @@
using RealEstateTransactions.Repositories;
using Unity;
namespace RealEstateTransactions.Forms
{
public partial class FormBuyers : Form
{
private readonly IUnityContainer _container;
private readonly IBuyerRepository _repository;
public FormBuyers(IUnityContainer container, IBuyerRepository repository)
{
InitializeComponent();
_container = container ?? throw new ArgumentNullException(nameof(container));
_repository = repository ?? throw new ArgumentNullException(nameof(repository));
}
private void FormBuyers_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<FormBuyer>().ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonUpdate_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFormSelectedRow(out var findId)) return;
try
{
var form = _container.Resolve<FormBuyer>();
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 (!TryGetIdentifierFormSelectedRow(out var findId)) return;
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo,
MessageBoxIcon.Question) == DialogResult.No) return;
try
{
_repository.DeleteBuyer(findId);
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void LoadList() => dataGridView.DataSource = _repository.ReadBuyers();
private bool TryGetIdentifierFormSelectedRow(out int id)
{
id = 0;
if (dataGridView.SelectedRows.Count < 1)
{
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
id = Convert.ToInt32(dataGridView.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,186 @@
namespace RealEstateTransactions.Forms
{
partial class FormDeal
{
/// <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()
{
labelApartmentId = new Label();
comboBoxApartmentId = new ComboBox();
labelFullName = new Label();
comboBoxFullName = new ComboBox();
labelDealPrice = new Label();
numericUpDownDealPrice = new NumericUpDown();
labelDealDate = new Label();
dateTimePickerDealDate = new DateTimePicker();
buttonSave = new Button();
buttonCancel = new Button();
((System.ComponentModel.ISupportInitialize)numericUpDownDealPrice).BeginInit();
SuspendLayout();
//
// labelApartmentId
//
labelApartmentId.AutoSize = true;
labelApartmentId.Font = new Font("Segoe UI", 14F);
labelApartmentId.Location = new Point(12, 9);
labelApartmentId.Name = "labelApartmentId";
labelApartmentId.Size = new Size(345, 32);
labelApartmentId.TabIndex = 0;
labelApartmentId.Text = "ID квартиты - - - - - - - -";
//
// comboBoxApartmentId
//
comboBoxApartmentId.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxApartmentId.Font = new Font("Segoe UI", 14F);
comboBoxApartmentId.FormattingEnabled = true;
comboBoxApartmentId.Location = new Point(370, 6);
comboBoxApartmentId.Name = "comboBoxApartmentId";
comboBoxApartmentId.Size = new Size(151, 39);
comboBoxApartmentId.TabIndex = 0;
//
// labelFullName
//
labelFullName.AutoSize = true;
labelFullName.Font = new Font("Segoe UI", 14F);
labelFullName.Location = new Point(12, 76);
labelFullName.Name = "labelFullName";
labelFullName.Size = new Size(200, 32);
labelFullName.TabIndex = 1;
labelFullName.Text = "ФИО покупателя";
//
// comboBoxFullName
//
comboBoxFullName.Font = new Font("Segoe UI", 14F);
comboBoxFullName.FormattingEnabled = true;
comboBoxFullName.Location = new Point(218, 73);
comboBoxFullName.Name = "comboBoxFullName";
comboBoxFullName.Size = new Size(303, 39);
comboBoxFullName.TabIndex = 1;
//
// labelDealPrice
//
labelDealPrice.AutoSize = true;
labelDealPrice.Font = new Font("Segoe UI", 14F);
labelDealPrice.Location = new Point(12, 152);
labelDealPrice.Name = "labelDealPrice";
labelDealPrice.Size = new Size(214, 32);
labelDealPrice.TabIndex = 3;
labelDealPrice.Text = "Стоимость сделки";
//
// numericUpDownDealPrice
//
numericUpDownDealPrice.BorderStyle = BorderStyle.FixedSingle;
numericUpDownDealPrice.DecimalPlaces = 2;
numericUpDownDealPrice.Font = new Font("Segoe UI", 14F);
numericUpDownDealPrice.Location = new Point(232, 150);
numericUpDownDealPrice.Maximum = new decimal(new int[] { 1410065408, 2, 0, 0 });
numericUpDownDealPrice.Name = "numericUpDownDealPrice";
numericUpDownDealPrice.Size = new Size(289, 39);
numericUpDownDealPrice.TabIndex = 2;
numericUpDownDealPrice.TextAlign = HorizontalAlignment.Center;
numericUpDownDealPrice.ThousandsSeparator = true;
//
// labelDealDate
//
labelDealDate.AutoSize = true;
labelDealDate.Font = new Font("Segoe UI", 14F);
labelDealDate.Location = new Point(12, 219);
labelDealDate.Name = "labelDealDate";
labelDealDate.Size = new Size(251, 32);
labelDealDate.TabIndex = 4;
labelDealDate.Text = "Дата сделки - - - -";
//
// dateTimePickerDealDate
//
dateTimePickerDealDate.CalendarFont = new Font("Segoe UI", 14F);
dateTimePickerDealDate.Enabled = false;
dateTimePickerDealDate.Font = new Font("Segoe UI", 14F);
dateTimePickerDealDate.Location = new Point(271, 213);
dateTimePickerDealDate.Name = "dateTimePickerDealDate";
dateTimePickerDealDate.Size = new Size(250, 39);
dateTimePickerDealDate.TabIndex = 5;
dateTimePickerDealDate.TabStop = false;
dateTimePickerDealDate.Value = new DateTime(2024, 11, 22, 10, 0, 0, 0);
//
// buttonSave
//
buttonSave.Font = new Font("Segoe UI", 14F);
buttonSave.Location = new Point(66, 281);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(146, 63);
buttonSave.TabIndex = 3;
buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true;
buttonSave.Click += ButtonSave_Click;
//
// buttonCancel
//
buttonCancel.Font = new Font("Segoe UI", 14F);
buttonCancel.Location = new Point(328, 281);
buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(146, 63);
buttonCancel.TabIndex = 4;
buttonCancel.Text = "Отмена";
buttonCancel.UseVisualStyleBackColor = true;
buttonCancel.Click += ButtonCancel_Click;
//
// FormDeal
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(534, 356);
Controls.Add(buttonCancel);
Controls.Add(buttonSave);
Controls.Add(dateTimePickerDealDate);
Controls.Add(labelDealDate);
Controls.Add(numericUpDownDealPrice);
Controls.Add(labelDealPrice);
Controls.Add(comboBoxFullName);
Controls.Add(labelFullName);
Controls.Add(comboBoxApartmentId);
Controls.Add(labelApartmentId);
Name = "FormDeal";
StartPosition = FormStartPosition.CenterParent;
Text = "Сделка";
((System.ComponentModel.ISupportInitialize)numericUpDownDealPrice).EndInit();
ResumeLayout(false);
PerformLayout();
}
#endregion
private Label labelApartmentId;
private ComboBox comboBoxApartmentId;
private Label labelFullName;
private ComboBox comboBoxFullName;
private Label labelDealPrice;
private NumericUpDown numericUpDownDealPrice;
private Label labelDealDate;
private DateTimePicker dateTimePickerDealDate;
private Button buttonSave;
private Button buttonCancel;
}
}

View File

@ -0,0 +1,87 @@
using RealEstateTransactions.Entities;
using RealEstateTransactions.Repositories;
namespace RealEstateTransactions.Forms
{
public partial class FormDeal : Form
{
private readonly IDealRepository _repository;
private readonly IApartmentRepository _apartmentRepository;
private readonly IBuyerRepository _buyerRepository;
private int? _dealId;
public int Id
{
set
{
try
{
var deal = _repository.ReadDeal(value);
if (deal == null) throw new InvalidDataException(nameof(deal));
comboBoxApartmentId.SelectedItem = _apartmentRepository.ReadApartment(deal.ApartmentId);
comboBoxFullName.SelectedItem = _buyerRepository.ReadBuyer(deal.BuyerId);
numericUpDownDealPrice.Value = (decimal)deal.DealPrice;
dateTimePickerDealDate.Value = deal.DealDate;
_dealId = value;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
}
public FormDeal(IDealRepository repository, IApartmentRepository apartmentRepository,
IBuyerRepository buyerRepository)
{
InitializeComponent();
_repository = repository ?? throw new ArgumentNullException(nameof(repository));
_apartmentRepository = apartmentRepository ?? throw new ArgumentNullException(nameof(apartmentRepository));
_buyerRepository = buyerRepository ?? throw new ArgumentNullException(nameof(buyerRepository));
comboBoxApartmentId.DataSource = apartmentRepository.ReadApartments();
comboBoxApartmentId.DisplayMember = "Id";
comboBoxApartmentId.ValueMember = "Id";
comboBoxFullName.DataSource = buyerRepository.ReadBuyers();
comboBoxFullName.DisplayMember = "FullName";
comboBoxFullName.ValueMember = "Id";
dateTimePickerDealDate.Value = DateTime.Now;
}
private void ButtonSave_Click(object sender, EventArgs e)
{
try
{
if (comboBoxApartmentId.SelectedItem == null || comboBoxFullName.SelectedItem == null)
throw new Exception("Имеются не заполненные поля");
if (_dealId.HasValue)
{
_repository.UpdateDeal(CreateDeal(_dealId.Value));
}
else
{
_repository.CreateDeal(CreateDeal(0));
}
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
private Deal CreateDeal(int id) => Deal.CreateDeal(id, (int)comboBoxApartmentId.SelectedValue!,
(int)comboBoxFullName.SelectedValue!, (float)numericUpDownDealPrice.Value, dateTimePickerDealDate.Value);
}
}

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,128 @@
namespace RealEstateTransactions.Entities
{
partial class FormDeals
{
/// <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()
{
panelTools = new Panel();
buttonDelete = new Button();
buttonUpdate = new Button();
buttonAdd = new Button();
dataGridView = new DataGridView();
panelTools.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
SuspendLayout();
//
// panelTools
//
panelTools.Controls.Add(buttonDelete);
panelTools.Controls.Add(buttonUpdate);
panelTools.Controls.Add(buttonAdd);
panelTools.Dock = DockStyle.Right;
panelTools.Location = new Point(851, 0);
panelTools.Name = "panelTools";
panelTools.Size = new Size(131, 553);
panelTools.TabIndex = 1;
//
// buttonDelete
//
buttonDelete.BackgroundImage = Properties.Resources.Delete;
buttonDelete.BackgroundImageLayout = ImageLayout.Stretch;
buttonDelete.Location = new Point(28, 333);
buttonDelete.Name = "buttonDelete";
buttonDelete.Size = new Size(80, 80);
buttonDelete.TabIndex = 2;
buttonDelete.UseVisualStyleBackColor = true;
buttonDelete.Click += ButtonDelete_Click;
//
// buttonUpdate
//
buttonUpdate.BackgroundImage = Properties.Resources.Update;
buttonUpdate.BackgroundImageLayout = ImageLayout.Stretch;
buttonUpdate.Location = new Point(28, 204);
buttonUpdate.Name = "buttonUpdate";
buttonUpdate.Size = new Size(80, 80);
buttonUpdate.TabIndex = 1;
buttonUpdate.UseVisualStyleBackColor = true;
buttonUpdate.Click += ButtonUpdate_Click;
//
// buttonAdd
//
buttonAdd.BackgroundImage = Properties.Resources.Add;
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
buttonAdd.Location = new Point(28, 73);
buttonAdd.Name = "buttonAdd";
buttonAdd.Size = new Size(80, 80);
buttonAdd.TabIndex = 0;
buttonAdd.UseVisualStyleBackColor = true;
buttonAdd.Click += ButtonAdd_Click;
//
// dataGridView
//
dataGridView.AllowUserToAddRows = false;
dataGridView.AllowUserToDeleteRows = false;
dataGridView.AllowUserToResizeColumns = false;
dataGridView.AllowUserToResizeRows = false;
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView.Dock = DockStyle.Fill;
dataGridView.Location = new Point(0, 0);
dataGridView.MultiSelect = false;
dataGridView.Name = "dataGridView";
dataGridView.ReadOnly = true;
dataGridView.RowHeadersVisible = false;
dataGridView.RowHeadersWidth = 51;
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridView.Size = new Size(851, 553);
dataGridView.TabIndex = 2;
dataGridView.TabStop = false;
//
// FormDeals
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(982, 553);
Controls.Add(dataGridView);
Controls.Add(panelTools);
Name = "FormDeals";
StartPosition = FormStartPosition.CenterParent;
Text = "Сделки";
Load += FormDeals_Load;
panelTools.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
ResumeLayout(false);
}
#endregion
private Panel panelTools;
private Button buttonDelete;
private Button buttonUpdate;
private Button buttonAdd;
private DataGridView dataGridView;
}
}

View File

@ -0,0 +1,96 @@
using RealEstateTransactions.Forms;
using RealEstateTransactions.Repositories;
using Unity;
namespace RealEstateTransactions.Entities
{
public partial class FormDeals : Form
{
private readonly IUnityContainer _container;
private readonly IDealRepository _repository;
public FormDeals(IUnityContainer container, IDealRepository repository)
{
InitializeComponent();
_container = container ?? throw new ArgumentNullException(nameof(container));
_repository = repository ?? throw new ArgumentNullException(nameof(repository));
}
private void FormDeals_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<FormDeal>().ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonUpdate_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFormSelectedRow(out var findId)) return;
try
{
var form = _container.Resolve<FormDeal>();
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 (!TryGetIdentifierFormSelectedRow(out var findId)) return;
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
!= DialogResult.Yes) return;
try
{
_repository.DeleteDeal(findId);
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void LoadList() => dataGridView.DataSource = _repository.ReadDeals();
private bool TryGetIdentifierFormSelectedRow(out int id)
{
id = 0;
if (dataGridView.SelectedRows.Count < 1)
{
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
id = Convert.ToInt32(dataGridView.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,159 @@
namespace RealEstateTransactions.Forms
{
partial class FormPreSalesService
{
/// <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()
{
labelApartmentId = new Label();
comboBoxApartmentId = new ComboBox();
labelName = new Label();
textBoxName = new TextBox();
labelCost = new Label();
numericUpDownCost = new NumericUpDown();
buttonSave = new Button();
buttonCancel = new Button();
((System.ComponentModel.ISupportInitialize)numericUpDownCost).BeginInit();
SuspendLayout();
//
// labelApartmentId
//
labelApartmentId.AutoSize = true;
labelApartmentId.Font = new Font("Segoe UI", 14F);
labelApartmentId.Location = new Point(12, 9);
labelApartmentId.Name = "labelApartmentId";
labelApartmentId.Size = new Size(270, 32);
labelApartmentId.TabIndex = 0;
labelApartmentId.Text = "ID квартиры - - - - -";
//
// comboBoxApartmentId
//
comboBoxApartmentId.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxApartmentId.Font = new Font("Segoe UI", 14F);
comboBoxApartmentId.FormattingEnabled = true;
comboBoxApartmentId.Location = new Point(292, 6);
comboBoxApartmentId.Name = "comboBoxApartmentId";
comboBoxApartmentId.Size = new Size(151, 39);
comboBoxApartmentId.TabIndex = 0;
//
// labelName
//
labelName.AutoSize = true;
labelName.Font = new Font("Segoe UI", 14F);
labelName.Location = new Point(12, 83);
labelName.Name = "labelName";
labelName.Size = new Size(198, 32);
labelName.TabIndex = 1;
labelName.Text = "Название услуги";
//
// textBoxName
//
textBoxName.BorderStyle = BorderStyle.FixedSingle;
textBoxName.Font = new Font("Segoe UI", 14F);
textBoxName.Location = new Point(216, 81);
textBoxName.Name = "textBoxName";
textBoxName.Size = new Size(227, 39);
textBoxName.TabIndex = 1;
textBoxName.TextAlign = HorizontalAlignment.Center;
//
// labelCost
//
labelCost.AutoSize = true;
labelCost.Font = new Font("Segoe UI", 14F);
labelCost.Location = new Point(12, 169);
labelCost.Name = "labelCost";
labelCost.Size = new Size(264, 32);
labelCost.TabIndex = 2;
labelCost.Text = "Стоимость услуги - -";
//
// numericUpDownCost
//
numericUpDownCost.BorderStyle = BorderStyle.FixedSingle;
numericUpDownCost.DecimalPlaces = 2;
numericUpDownCost.Font = new Font("Segoe UI", 14F);
numericUpDownCost.Location = new Point(272, 167);
numericUpDownCost.Maximum = new decimal(new int[] { 1000000, 0, 0, 0 });
numericUpDownCost.Name = "numericUpDownCost";
numericUpDownCost.Size = new Size(171, 39);
numericUpDownCost.TabIndex = 2;
numericUpDownCost.TextAlign = HorizontalAlignment.Center;
numericUpDownCost.ThousandsSeparator = true;
//
// buttonSave
//
buttonSave.Font = new Font("Segoe UI", 14F);
buttonSave.Location = new Point(48, 228);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(144, 57);
buttonSave.TabIndex = 3;
buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true;
buttonSave.Click += ButtonSave_Click;
//
// buttonCancel
//
buttonCancel.Font = new Font("Segoe UI", 14F);
buttonCancel.Location = new Point(254, 228);
buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(144, 57);
buttonCancel.TabIndex = 4;
buttonCancel.Text = "Отмена";
buttonCancel.UseVisualStyleBackColor = true;
buttonCancel.Click += ButtonCancel_Click;
//
// FormPreSalesService
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(455, 294);
Controls.Add(buttonCancel);
Controls.Add(buttonSave);
Controls.Add(numericUpDownCost);
Controls.Add(labelCost);
Controls.Add(textBoxName);
Controls.Add(labelName);
Controls.Add(comboBoxApartmentId);
Controls.Add(labelApartmentId);
Name = "FormPreSalesService";
StartPosition = FormStartPosition.CenterParent;
Text = "Допродажная услуга";
((System.ComponentModel.ISupportInitialize)numericUpDownCost).EndInit();
ResumeLayout(false);
PerformLayout();
}
#endregion
private Label labelApartmentId;
private ComboBox comboBoxApartmentId;
private Label labelName;
private TextBox textBoxName;
private Label labelCost;
private NumericUpDown numericUpDownCost;
private Button buttonSave;
private Button buttonCancel;
}
}

View File

@ -0,0 +1,42 @@
using RealEstateTransactions.Entities;
using RealEstateTransactions.Repositories;
namespace RealEstateTransactions.Forms
{
public partial class FormPreSalesService : Form
{
private readonly IPreSalesServicesRepository _repository;
public FormPreSalesService(IPreSalesServicesRepository repository, IApartmentRepository apartmentRepository)
{
InitializeComponent();
_repository = repository ?? throw new ArgumentNullException(nameof(repository));
comboBoxApartmentId.DataSource = apartmentRepository.ReadApartments();
comboBoxApartmentId.DisplayMember = "Id";
comboBoxApartmentId.ValueMember = "Id";
}
private void ButtonSave_Click(object sender, EventArgs e)
{
try
{
if (comboBoxApartmentId.SelectedItem == null || string.IsNullOrWhiteSpace(textBoxName.Text))
{
throw new Exception("Имеются незаполненные поля");
}
_repository.CreatePreSalesService(PreSalesServices.CreatePreSalesServices(0, (int)comboBoxApartmentId.SelectedValue!,
textBoxName.Text, (float)numericUpDownCost.Value));
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
}
}

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,114 @@
namespace RealEstateTransactions.Forms
{
partial class FormPreSalesServices
{
/// <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()
{
panelTools = new Panel();
buttonDelete = new Button();
buttonAdd = new Button();
dataGridView = new DataGridView();
panelTools.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
SuspendLayout();
//
// panelTools
//
panelTools.Controls.Add(buttonDelete);
panelTools.Controls.Add(buttonAdd);
panelTools.Dock = DockStyle.Right;
panelTools.Location = new Point(851, 0);
panelTools.Name = "panelTools";
panelTools.Size = new Size(131, 553);
panelTools.TabIndex = 1;
//
// buttonDelete
//
buttonDelete.BackgroundImage = Properties.Resources.Delete;
buttonDelete.BackgroundImageLayout = ImageLayout.Stretch;
buttonDelete.Location = new Point(28, 307);
buttonDelete.Name = "buttonDelete";
buttonDelete.Size = new Size(80, 80);
buttonDelete.TabIndex = 1;
buttonDelete.UseVisualStyleBackColor = true;
buttonDelete.Click += ButtonDelete_Click;
//
// buttonAdd
//
buttonAdd.BackgroundImage = Properties.Resources.Add;
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
buttonAdd.Location = new Point(28, 139);
buttonAdd.Name = "buttonAdd";
buttonAdd.Size = new Size(80, 80);
buttonAdd.TabIndex = 0;
buttonAdd.UseVisualStyleBackColor = true;
buttonAdd.Click += ButtonAdd_Click;
//
// dataGridView
//
dataGridView.AllowUserToAddRows = false;
dataGridView.AllowUserToDeleteRows = false;
dataGridView.AllowUserToResizeColumns = false;
dataGridView.AllowUserToResizeRows = false;
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView.Dock = DockStyle.Fill;
dataGridView.Location = new Point(0, 0);
dataGridView.MultiSelect = false;
dataGridView.Name = "dataGridView";
dataGridView.ReadOnly = true;
dataGridView.RowHeadersVisible = false;
dataGridView.RowHeadersWidth = 51;
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridView.Size = new Size(851, 553);
dataGridView.TabIndex = 2;
dataGridView.TabStop = false;
//
// FormPreSalesServices
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(982, 553);
Controls.Add(dataGridView);
Controls.Add(panelTools);
Name = "FormPreSalesServices";
StartPosition = FormStartPosition.CenterParent;
Text = "Допродажные услуги";
Load += FormPreSalesServices_Load;
panelTools.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
ResumeLayout(false);
}
#endregion
private Panel panelTools;
private Button buttonDelete;
private Button buttonAdd;
private DataGridView dataGridView;
}
}

View File

@ -0,0 +1,78 @@
using RealEstateTransactions.Repositories;
using Unity;
namespace RealEstateTransactions.Forms
{
public partial class FormPreSalesServices : Form
{
private readonly IUnityContainer _container;
private readonly IPreSalesServicesRepository _repository;
public FormPreSalesServices(IUnityContainer container, IPreSalesServicesRepository repository)
{
InitializeComponent();
_container = container ?? throw new ArgumentNullException(nameof(container));
_repository = repository ?? throw new ArgumentNullException(nameof(repository));
}
private void FormPreSalesServices_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<FormPreSalesService>().ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonDelete_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFormSelectedRow(out var findId)) return;
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
!= DialogResult.Yes) return;
try
{
_repository.DeletePreSalesService(findId);
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void LoadList() => dataGridView.DataSource = _repository.ReadPreSalesServices();
private bool TryGetIdentifierFormSelectedRow(out int id)
{
id = 0;
if (dataGridView.SelectedRows.Count < 1)
{
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
id = Convert.ToInt32(dataGridView.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,133 @@
namespace RealEstateTransactions.Forms
{
partial class FormService
{
/// <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();
labelPrice = new Label();
textBoxName = new TextBox();
numericUpDownPrice = new NumericUpDown();
buttonSave = new Button();
buttonCancel = new Button();
((System.ComponentModel.ISupportInitialize)numericUpDownPrice).BeginInit();
SuspendLayout();
//
// labelName
//
labelName.AutoSize = true;
labelName.Font = new Font("Segoe UI", 14F);
labelName.Location = new Point(12, 9);
labelName.Name = "labelName";
labelName.Size = new Size(198, 32);
labelName.TabIndex = 0;
labelName.Text = "Название услуги";
//
// labelPrice
//
labelPrice.AutoSize = true;
labelPrice.Font = new Font("Segoe UI", 14F);
labelPrice.Location = new Point(12, 80);
labelPrice.Name = "labelPrice";
labelPrice.Size = new Size(209, 32);
labelPrice.TabIndex = 1;
labelPrice.Text = "Стоимость услуги";
//
// textBoxName
//
textBoxName.BorderStyle = BorderStyle.FixedSingle;
textBoxName.Font = new Font("Segoe UI", 14F);
textBoxName.Location = new Point(232, 7);
textBoxName.Name = "textBoxName";
textBoxName.Size = new Size(186, 39);
textBoxName.TabIndex = 0;
textBoxName.TextAlign = HorizontalAlignment.Center;
//
// numericUpDownPrice
//
numericUpDownPrice.BorderStyle = BorderStyle.FixedSingle;
numericUpDownPrice.DecimalPlaces = 2;
numericUpDownPrice.Font = new Font("Segoe UI", 14F);
numericUpDownPrice.Location = new Point(232, 73);
numericUpDownPrice.Maximum = new decimal(new int[] { 1000000, 0, 0, 0 });
numericUpDownPrice.Name = "numericUpDownPrice";
numericUpDownPrice.Size = new Size(186, 39);
numericUpDownPrice.TabIndex = 1;
numericUpDownPrice.TextAlign = HorizontalAlignment.Center;
numericUpDownPrice.ThousandsSeparator = true;
//
// buttonSave
//
buttonSave.Font = new Font("Segoe UI", 14F);
buttonSave.Location = new Point(32, 137);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(148, 49);
buttonSave.TabIndex = 2;
buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true;
buttonSave.Click += ButtonSave_Click;
//
// buttonCancel
//
buttonCancel.Font = new Font("Segoe UI", 14F);
buttonCancel.Location = new Point(232, 137);
buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(148, 49);
buttonCancel.TabIndex = 3;
buttonCancel.Text = "Отмена";
buttonCancel.UseVisualStyleBackColor = true;
buttonCancel.Click += buttonCancel_Click;
//
// FormService
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(429, 194);
Controls.Add(buttonCancel);
Controls.Add(buttonSave);
Controls.Add(numericUpDownPrice);
Controls.Add(textBoxName);
Controls.Add(labelPrice);
Controls.Add(labelName);
Name = "FormService";
StartPosition = FormStartPosition.CenterParent;
Text = "Услуга";
((System.ComponentModel.ISupportInitialize)numericUpDownPrice).EndInit();
ResumeLayout(false);
PerformLayout();
}
#endregion
private Label labelName;
private Label labelPrice;
private TextBox textBoxName;
private NumericUpDown numericUpDownPrice;
private Button buttonSave;
private Button buttonCancel;
}
}

View File

@ -0,0 +1,73 @@
using RealEstateTransactions.Entities;
using RealEstateTransactions.Repositories;
namespace RealEstateTransactions.Forms
{
public partial class FormService : Form
{
private readonly IServicesRepository _repository;
private int? _serviceId;
public int Id
{
set
{
try
{
var service = _repository.ReadService(value);
if (service == null) throw new InvalidDataException(nameof(service));
textBoxName.Text = service.Name;
numericUpDownPrice.Value = (decimal)service.Price;
_serviceId = value;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при получении данных",
MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
}
public FormService(IServicesRepository repository)
{
InitializeComponent();
_repository = repository ?? throw new ArgumentNullException(nameof(repository));
}
private void ButtonSave_Click(object sender, EventArgs e)
{
try
{
if (string.IsNullOrWhiteSpace(textBoxName.Text))
{
throw new Exception("Имеются незаполненные поля");
}
if (_serviceId.HasValue)
{
_repository.UpdateService(CreateService(_serviceId.Value));
}
else
{
_repository.CreateService(CreateService(0));
}
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void buttonCancel_Click(object sender, EventArgs e) => Close();
private Services CreateService(int id) => Services.CreateService(id, textBoxName.Text, (float)numericUpDownPrice.Value);
}
}

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,128 @@
namespace RealEstateTransactions.Entities
{
partial class FormServices
{
/// <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()
{
panelTools = new Panel();
buttonDelete = new Button();
buttonUpdate = new Button();
buttonAdd = new Button();
dataGridView = new DataGridView();
panelTools.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
SuspendLayout();
//
// panelTools
//
panelTools.Controls.Add(buttonDelete);
panelTools.Controls.Add(buttonUpdate);
panelTools.Controls.Add(buttonAdd);
panelTools.Dock = DockStyle.Right;
panelTools.Location = new Point(851, 0);
panelTools.Name = "panelTools";
panelTools.Size = new Size(131, 553);
panelTools.TabIndex = 1;
//
// buttonDelete
//
buttonDelete.BackgroundImage = Properties.Resources.Delete;
buttonDelete.BackgroundImageLayout = ImageLayout.Stretch;
buttonDelete.Location = new Point(28, 333);
buttonDelete.Name = "buttonDelete";
buttonDelete.Size = new Size(80, 80);
buttonDelete.TabIndex = 2;
buttonDelete.UseVisualStyleBackColor = true;
buttonDelete.Click += ButtonDelete_Click;
//
// buttonUpdate
//
buttonUpdate.BackgroundImage = Properties.Resources.Update;
buttonUpdate.BackgroundImageLayout = ImageLayout.Stretch;
buttonUpdate.Location = new Point(28, 204);
buttonUpdate.Name = "buttonUpdate";
buttonUpdate.Size = new Size(80, 80);
buttonUpdate.TabIndex = 1;
buttonUpdate.UseVisualStyleBackColor = true;
buttonUpdate.Click += ButtonUpdate_Click;
//
// buttonAdd
//
buttonAdd.BackgroundImage = Properties.Resources.Add;
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
buttonAdd.Location = new Point(28, 73);
buttonAdd.Name = "buttonAdd";
buttonAdd.Size = new Size(80, 80);
buttonAdd.TabIndex = 0;
buttonAdd.UseVisualStyleBackColor = true;
buttonAdd.Click += ButtonAdd_Click;
//
// dataGridView
//
dataGridView.AllowUserToAddRows = false;
dataGridView.AllowUserToDeleteRows = false;
dataGridView.AllowUserToResizeColumns = false;
dataGridView.AllowUserToResizeRows = false;
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView.Dock = DockStyle.Fill;
dataGridView.Location = new Point(0, 0);
dataGridView.MultiSelect = false;
dataGridView.Name = "dataGridView";
dataGridView.ReadOnly = true;
dataGridView.RowHeadersVisible = false;
dataGridView.RowHeadersWidth = 51;
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridView.Size = new Size(851, 553);
dataGridView.TabIndex = 2;
dataGridView.TabStop = false;
//
// FormServices
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(982, 553);
Controls.Add(dataGridView);
Controls.Add(panelTools);
Name = "FormServices";
StartPosition = FormStartPosition.CenterParent;
Text = "Услуги";
Load += FormServices_Load;
panelTools.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
ResumeLayout(false);
}
#endregion
private Panel panelTools;
private Button buttonDelete;
private Button buttonUpdate;
private Button buttonAdd;
private DataGridView dataGridView;
}
}

View File

@ -0,0 +1,96 @@
using RealEstateTransactions.Forms;
using RealEstateTransactions.Repositories;
using Unity;
namespace RealEstateTransactions.Entities
{
public partial class FormServices : Form
{
private readonly IUnityContainer _container;
private readonly IServicesRepository _repository;
public FormServices(IUnityContainer container, IServicesRepository repository)
{
InitializeComponent();
_container = container ?? throw new ArgumentNullException(nameof(container));
_repository = repository ?? throw new ArgumentNullException(nameof(_repository));
}
private void FormServices_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<FormService>().ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonUpdate_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFormSelectedRow(out var findId)) return;
try
{
var form = _container.Resolve<FormService>();
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 (!TryGetIdentifierFormSelectedRow(out var findId)) return;
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
!= DialogResult.Yes) return;
try
{
_repository.DeleteService(findId);
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void LoadList() => dataGridView.DataSource = _repository.ReadServices();
private bool TryGetIdentifierFormSelectedRow(out int id)
{
id = 0;
if (dataGridView.SelectedRows.Count < 1)
{
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
id = Convert.ToInt32(dataGridView.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,158 @@
namespace RealEstateTransactions.Forms
{
partial class FormServicesDeal
{
/// <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()
{
labelServicesId = new Label();
comboBoxServicesId = new ComboBox();
labelApartmentId = new Label();
comboBoxDealId = new ComboBox();
labelTimeSpan = new Label();
numericUpDownTimeSpan = new NumericUpDown();
buttonSave = new Button();
buttonCancel = new Button();
((System.ComponentModel.ISupportInitialize)numericUpDownTimeSpan).BeginInit();
SuspendLayout();
//
// labelServicesId
//
labelServicesId.AutoSize = true;
labelServicesId.Font = new Font("Segoe UI", 14F);
labelServicesId.Location = new Point(12, 9);
labelServicesId.Name = "labelServicesId";
labelServicesId.Size = new Size(212, 32);
labelServicesId.TabIndex = 0;
labelServicesId.Text = "Услуга - - - - -";
//
// comboBoxServicesId
//
comboBoxServicesId.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxServicesId.Font = new Font("Segoe UI", 14F);
comboBoxServicesId.FormattingEnabled = true;
comboBoxServicesId.Location = new Point(237, 6);
comboBoxServicesId.Name = "comboBoxServicesId";
comboBoxServicesId.Size = new Size(192, 39);
comboBoxServicesId.TabIndex = 0;
//
// labelApartmentId
//
labelApartmentId.AutoSize = true;
labelApartmentId.Font = new Font("Segoe UI", 14F);
labelApartmentId.Location = new Point(12, 70);
labelApartmentId.Name = "labelApartmentId";
labelApartmentId.Size = new Size(271, 32);
labelApartmentId.TabIndex = 1;
labelApartmentId.Text = "ID сделки - - - - - -";
//
// comboBoxDealId
//
comboBoxDealId.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxDealId.Font = new Font("Segoe UI", 14F);
comboBoxDealId.FormattingEnabled = true;
comboBoxDealId.Location = new Point(301, 70);
comboBoxDealId.Name = "comboBoxDealId";
comboBoxDealId.Size = new Size(128, 39);
comboBoxDealId.TabIndex = 1;
//
// labelTimeSpan
//
labelTimeSpan.AutoSize = true;
labelTimeSpan.Font = new Font("Segoe UI", 14F);
labelTimeSpan.Location = new Point(12, 141);
labelTimeSpan.Name = "labelTimeSpan";
labelTimeSpan.Size = new Size(268, 32);
labelTimeSpan.TabIndex = 2;
labelTimeSpan.Text = "Затраченное время (ч)";
//
// numericUpDownTimeSpan
//
numericUpDownTimeSpan.BorderStyle = BorderStyle.FixedSingle;
numericUpDownTimeSpan.DecimalPlaces = 1;
numericUpDownTimeSpan.Font = new Font("Segoe UI", 14F);
numericUpDownTimeSpan.Location = new Point(301, 139);
numericUpDownTimeSpan.Maximum = new decimal(new int[] { 1000, 0, 0, 0 });
numericUpDownTimeSpan.Name = "numericUpDownTimeSpan";
numericUpDownTimeSpan.Size = new Size(128, 39);
numericUpDownTimeSpan.TabIndex = 2;
numericUpDownTimeSpan.TextAlign = HorizontalAlignment.Center;
//
// buttonSave
//
buttonSave.Font = new Font("Segoe UI", 14F);
buttonSave.Location = new Point(38, 205);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(141, 56);
buttonSave.TabIndex = 3;
buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true;
buttonSave.Click += ButtonSave_Click;
//
// buttonCancel
//
buttonCancel.Font = new Font("Segoe UI", 14F);
buttonCancel.Location = new Point(237, 205);
buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(141, 56);
buttonCancel.TabIndex = 4;
buttonCancel.Text = "Отмена";
buttonCancel.UseVisualStyleBackColor = true;
buttonCancel.Click += ButtonCancel_Click;
//
// FormServicesDeal
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(440, 269);
Controls.Add(buttonCancel);
Controls.Add(buttonSave);
Controls.Add(numericUpDownTimeSpan);
Controls.Add(labelTimeSpan);
Controls.Add(comboBoxDealId);
Controls.Add(labelApartmentId);
Controls.Add(comboBoxServicesId);
Controls.Add(labelServicesId);
Name = "FormServicesDeal";
StartPosition = FormStartPosition.CenterParent;
Text = "Услуга в сделке";
((System.ComponentModel.ISupportInitialize)numericUpDownTimeSpan).EndInit();
ResumeLayout(false);
PerformLayout();
}
#endregion
private Label labelServicesId;
private ComboBox comboBoxServicesId;
private Label labelApartmentId;
private ComboBox comboBoxDealId;
private Label labelTimeSpan;
private NumericUpDown numericUpDownTimeSpan;
private Button buttonSave;
private Button buttonCancel;
}
}

View File

@ -0,0 +1,47 @@
using RealEstateTransactions.Entities;
using RealEstateTransactions.Repositories;
namespace RealEstateTransactions.Forms
{
public partial class FormServicesDeal : Form
{
private readonly IServicesDealRepository _repository;
public FormServicesDeal(IServicesDealRepository repository,
IDealRepository dealRepository, IServicesRepository servicesRepository)
{
InitializeComponent();
_repository = repository ?? throw new ArgumentNullException(nameof(repository));
comboBoxDealId.DataSource = dealRepository.ReadDeals();
comboBoxDealId.DisplayMember = "Id";
comboBoxDealId.ValueMember = "Id";
comboBoxServicesId.DataSource = servicesRepository.ReadServices();
comboBoxServicesId.DisplayMember = "Name";
comboBoxServicesId.ValueMember = "Id";
}
private void ButtonSave_Click(object sender, EventArgs e)
{
try
{
if (comboBoxDealId.SelectedItem == null || comboBoxServicesId.SelectedItem == null)
{
throw new Exception("Имеются незаполненные поля");
}
_repository.CreateServicesDeal(ServicesDeal.CreateServicesDeal((int)comboBoxServicesId.SelectedValue!,
(int)comboBoxDealId.SelectedValue!, (float)numericUpDownTimeSpan.Value));
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
}
}

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,100 @@
namespace RealEstateTransactions.Forms
{
partial class FormServicesDeals
{
/// <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()
{
panelTools = new Panel();
buttonAdd = new Button();
dataGridView = new DataGridView();
panelTools.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
SuspendLayout();
//
// panelTools
//
panelTools.Controls.Add(buttonAdd);
panelTools.Dock = DockStyle.Right;
panelTools.Location = new Point(851, 0);
panelTools.Name = "panelTools";
panelTools.Size = new Size(131, 553);
panelTools.TabIndex = 2;
//
// buttonAdd
//
buttonAdd.BackgroundImage = Properties.Resources.Add;
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
buttonAdd.Location = new Point(28, 226);
buttonAdd.Name = "buttonAdd";
buttonAdd.Size = new Size(80, 80);
buttonAdd.TabIndex = 0;
buttonAdd.UseVisualStyleBackColor = true;
buttonAdd.Click += ButtonAdd_Click;
//
// dataGridView
//
dataGridView.AllowUserToAddRows = false;
dataGridView.AllowUserToDeleteRows = false;
dataGridView.AllowUserToResizeColumns = false;
dataGridView.AllowUserToResizeRows = false;
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView.Dock = DockStyle.Fill;
dataGridView.Location = new Point(0, 0);
dataGridView.MultiSelect = false;
dataGridView.Name = "dataGridView";
dataGridView.ReadOnly = true;
dataGridView.RowHeadersVisible = false;
dataGridView.RowHeadersWidth = 51;
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridView.Size = new Size(851, 553);
dataGridView.TabIndex = 3;
dataGridView.TabStop = false;
//
// FormServicesDeals
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(982, 553);
Controls.Add(dataGridView);
Controls.Add(panelTools);
Name = "FormServicesDeals";
StartPosition = FormStartPosition.CenterParent;
Text = "Услуги в сделках";
Load += FormServicesDeals_Load;
panelTools.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
ResumeLayout(false);
}
#endregion
private Panel panelTools;
private Button buttonAdd;
private DataGridView dataGridView;
}
}

View File

@ -0,0 +1,46 @@
using RealEstateTransactions.Repositories;
using Unity;
namespace RealEstateTransactions.Forms
{
public partial class FormServicesDeals : Form
{
private readonly IUnityContainer _container;
private readonly IServicesDealRepository _repository;
public FormServicesDeals(IUnityContainer container, IServicesDealRepository repository)
{
InitializeComponent();
_container = container ?? throw new ArgumentNullException(nameof(container));
_repository = repository ?? throw new ArgumentNullException(nameof(repository));
}
private void FormServicesDeals_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<FormServicesDeal>().ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void LoadList() => dataGridView.DataSource = _repository.ReadServicesDeal();
}
}

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

@ -1,3 +1,7 @@
using RealEstateTransactions.Repositories;
using RealEstateTransactions.Repositories.Implementations;
using Unity;
namespace RealEstateTransactions namespace RealEstateTransactions
{ {
internal static class Program internal static class Program
@ -11,7 +15,21 @@ namespace RealEstateTransactions
// To customize application configuration such as set high DPI settings or default font, // To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration. // see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize(); ApplicationConfiguration.Initialize();
Application.Run(new Form1()); Application.Run(CreateContainer().Resolve<FormGeneral>());
}
private static IUnityContainer CreateContainer()
{
var container = new UnityContainer();
container.RegisterType<IApartmentRepository, ApartmentRepository>();
container.RegisterType<IBuyerRepository, BuyerRepository>();
container.RegisterType<IDealRepository, DealRepository>();
container.RegisterType<IPreSalesServicesRepository, PreSalesServicesRepository>();
container.RegisterType<IServicesDealRepository, ServicesDealRepository>();
container.RegisterType<IServicesRepository, ServicesRepository>();
return container;
} }
} }
} }

View File

@ -0,0 +1,113 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Этот код создан программой.
// Исполняемая версия:4.0.30319.42000
//
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
// повторной генерации кода.
// </auto-generated>
//------------------------------------------------------------------------------
namespace RealEstateTransactions.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("RealEstateTransactions.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 Add {
get {
object obj = ResourceManager.GetObject("Add", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Delete {
get {
object obj = ResourceManager.GetObject("Delete", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap ERka {
get {
object obj = ResourceManager.GetObject("ERka", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Update {
get {
object obj = ResourceManager.GetObject("Update", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap фон {
get {
object obj = ResourceManager.GetObject("фон", 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="фон" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\фон.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Add" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Add.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Delete" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Delete.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ERka" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ERka.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Update" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Update.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View File

@ -8,4 +8,23 @@
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup> </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> </Project>

View File

@ -0,0 +1,17 @@
using RealEstateTransactions.Entities;
namespace RealEstateTransactions.Repositories
{
public interface IApartmentRepository
{
IEnumerable<Apartment> ReadApartments();
Apartment ReadApartment(int id);
void CreateApartment(Apartment apartment);
void UpdateApartment(Apartment apartment);
void DeleteApartment(int id);
}
}

View File

@ -0,0 +1,17 @@
using RealEstateTransactions.Entities;
namespace RealEstateTransactions.Repositories
{
public interface IBuyerRepository
{
IEnumerable<Buyer> ReadBuyers();
Buyer ReadBuyer(int id);
void CreateBuyer(Buyer buyer);
void UpdateBuyer(Buyer buyer);
void DeleteBuyer(int id);
}
}

View File

@ -0,0 +1,17 @@
using RealEstateTransactions.Entities;
namespace RealEstateTransactions.Repositories
{
public interface IDealRepository
{
IEnumerable<Deal> ReadDeals();
Deal ReadDeal(int id);
void CreateDeal(Deal deal);
void UpdateDeal(Deal deal);
void DeleteDeal(int id);
}
}

View File

@ -0,0 +1,13 @@
using RealEstateTransactions.Entities;
namespace RealEstateTransactions.Repositories
{
public interface IPreSalesServicesRepository
{
IEnumerable<PreSalesServices> ReadPreSalesServices();
void CreatePreSalesService(PreSalesServices preSalesServices);
void DeletePreSalesService(int id);
}
}

View File

@ -0,0 +1,11 @@
using RealEstateTransactions.Entities;
namespace RealEstateTransactions.Repositories
{
public interface IServicesDealRepository
{
IEnumerable<ServicesDeal> ReadServicesDeal();
void CreateServicesDeal(ServicesDeal servicesDeal);
}
}

View File

@ -0,0 +1,17 @@
using RealEstateTransactions.Entities;
namespace RealEstateTransactions.Repositories
{
public interface IServicesRepository
{
IEnumerable<Services> ReadServices();
Services ReadService(int id);
void CreateService(Services service);
void UpdateService(Services service);
void DeleteService(int id);
}
}

View File

@ -0,0 +1,38 @@
using RealEstateTransactions.Entities;
using RealEstateTransactions.Entities.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RealEstateTransactions.Repositories.Implementations
{
public class ApartmentRepository : IApartmentRepository
{
public Apartment ReadApartment(int id)
{
return Apartment.CreateApartment(0, AgencyType.None, FormFactorType.None, 0, 0, 0, 0);
}
public IEnumerable<Apartment> ReadApartments()
{
return [];
}
public void CreateApartment(Apartment apartment)
{
}
public void DeleteApartment(int id)
{
}
public void UpdateApartment(Apartment apartment)
{
}
}
}

View File

@ -0,0 +1,38 @@
using RealEstateTransactions.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection.Metadata.Ecma335;
using System.Text;
using System.Threading.Tasks;
namespace RealEstateTransactions.Repositories.Implementations
{
public class BuyerRepository : IBuyerRepository
{
public void CreateBuyer(Buyer buyer)
{
}
public void DeleteBuyer(int id)
{
}
public Buyer ReadBuyer(int id)
{
return Buyer.CreateBuyer(0, "", 0, 0);
}
public IEnumerable<Buyer> ReadBuyers()
{
return [];
}
public void UpdateBuyer(Buyer buyer)
{
}
}
}

View File

@ -0,0 +1,37 @@
using RealEstateTransactions.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RealEstateTransactions.Repositories.Implementations
{
public class DealRepository : IDealRepository
{
public void CreateDeal(Deal deal)
{
}
public void DeleteDeal(int id)
{
}
public Deal ReadDeal(int id)
{
return Deal.CreateDeal(0, 0, 0, 0, DateTime.Now);
}
public IEnumerable<Deal> ReadDeals()
{
return [];
}
public void UpdateDeal(Deal deal)
{
}
}
}

View File

@ -0,0 +1,28 @@
using RealEstateTransactions.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RealEstateTransactions.Repositories.Implementations
{
public class PreSalesServicesRepository : IPreSalesServicesRepository
{
public void CreatePreSalesService(PreSalesServices preSalesServices)
{
}
public void DeletePreSalesService(int id)
{
}
public IEnumerable<PreSalesServices> ReadPreSalesServices()
{
return [];
}
}
}

View File

@ -0,0 +1,27 @@
using RealEstateTransactions.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RealEstateTransactions.Repositories.Implementations
{
public class ServicesDealRepository : IServicesDealRepository
{
public void CreateServicesDeal(ServicesDeal servicesDeal)
{
}
public void DeleteServicesDeal(int id)
{
}
public IEnumerable<ServicesDeal> ReadServicesDeal()
{
return [];
}
}
}

View File

@ -0,0 +1,37 @@
using RealEstateTransactions.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RealEstateTransactions.Repositories.Implementations
{
public class ServicesRepository : IServicesRepository
{
public void CreateService(Services service)
{
}
public void DeleteService(int id)
{
}
public Services ReadService(int id)
{
return Services.CreateService(0, "", 0);
}
public IEnumerable<Services> ReadServices()
{
return [];
}
public void UpdateService(Services service)
{
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 954 KiB

View File

@ -0,0 +1 @@