Добавлена работа с объявлениями

This commit is contained in:
Denis 2023-03-29 03:45:20 +04:00
parent 29fc8b654f
commit e2cb1bd139
22 changed files with 1243 additions and 137 deletions

View File

@ -0,0 +1,39 @@
using Npgsql;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WebsiteForPlacingAds
{
public abstract class AbstractDatabase
{
private NpgsqlConnection connection;
public AbstractDatabase(string connectionString)
{
connection = new NpgsqlConnection(connectionString);
}
protected DataTable ExecuteQuery(string query)
{
connection.Open();
NpgsqlCommand command = new NpgsqlCommand(query, connection);
NpgsqlDataAdapter adapter = new NpgsqlDataAdapter(command);
DataTable result = new DataTable();
adapter.Fill(result);
connection.Close();
return result;
}
protected void ExecuteNonQuery(string query)
{
connection.Open();
NpgsqlCommand command = new NpgsqlCommand(query, connection);
command.ExecuteNonQuery();
connection.Close();
}
}
}

View File

@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WebsiteForPlacingAds
{
public class ConnectionSingleton
{
private static PostgreSqlDatabase postgreSqlDatabase;
private ConnectionSingleton()
{ }
public static PostgreSqlDatabase getPostgreSqlDatabase(string connectionString)
{
if (postgreSqlDatabase == null)
postgreSqlDatabase = new PostgreSqlDatabase(connectionString);
return postgreSqlDatabase;
}
}
}

View File

@ -0,0 +1,218 @@
namespace WebsiteForPlacingAds
{
partial class CreateAdsForm
{
/// <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.button1 = new System.Windows.Forms.Button();
this.labelHeading = new System.Windows.Forms.Label();
this.textBoxHeading = new System.Windows.Forms.TextBox();
this.textBoxPrice = new System.Windows.Forms.TextBox();
this.labelPrice = new System.Windows.Forms.Label();
this.textBoxDate = new System.Windows.Forms.TextBox();
this.labelDate = new System.Windows.Forms.Label();
this.labelSubcategory = new System.Windows.Forms.Label();
this.labelCategory = new System.Windows.Forms.Label();
this.textBoxStatus = new System.Windows.Forms.TextBox();
this.labelStatus = new System.Windows.Forms.Label();
this.labelClient = new System.Windows.Forms.Label();
this.comboBoxSubcategory = new System.Windows.Forms.ComboBox();
this.comboBoxCategory = new System.Windows.Forms.ComboBox();
this.comboBoxClient = new System.Windows.Forms.ComboBox();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(49, 456);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(125, 67);
this.button1.TabIndex = 0;
this.button1.Text = "Разместить объявление";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// labelHeading
//
this.labelHeading.AutoSize = true;
this.labelHeading.Location = new System.Drawing.Point(49, 11);
this.labelHeading.Name = "labelHeading";
this.labelHeading.Size = new System.Drawing.Size(81, 20);
this.labelHeading.TabIndex = 1;
this.labelHeading.Text = "Заголовок";
//
// textBoxHeading
//
this.textBoxHeading.Location = new System.Drawing.Point(49, 34);
this.textBoxHeading.Name = "textBoxHeading";
this.textBoxHeading.Size = new System.Drawing.Size(125, 27);
this.textBoxHeading.TabIndex = 2;
//
// textBoxPrice
//
this.textBoxPrice.Location = new System.Drawing.Point(49, 96);
this.textBoxPrice.Name = "textBoxPrice";
this.textBoxPrice.Size = new System.Drawing.Size(125, 27);
this.textBoxPrice.TabIndex = 4;
//
// labelPrice
//
this.labelPrice.AutoSize = true;
this.labelPrice.Location = new System.Drawing.Point(49, 73);
this.labelPrice.Name = "labelPrice";
this.labelPrice.Size = new System.Drawing.Size(45, 20);
this.labelPrice.TabIndex = 3;
this.labelPrice.Text = "Цена";
//
// textBoxDate
//
this.textBoxDate.Location = new System.Drawing.Point(49, 158);
this.textBoxDate.Name = "textBoxDate";
this.textBoxDate.Size = new System.Drawing.Size(125, 27);
this.textBoxDate.TabIndex = 6;
//
// labelDate
//
this.labelDate.AutoSize = true;
this.labelDate.Location = new System.Drawing.Point(49, 135);
this.labelDate.Name = "labelDate";
this.labelDate.Size = new System.Drawing.Size(134, 20);
this.labelDate.TabIndex = 5;
this.labelDate.Text = "Дата размещения";
//
// labelSubcategory
//
this.labelSubcategory.AutoSize = true;
this.labelSubcategory.Location = new System.Drawing.Point(49, 390);
this.labelSubcategory.Name = "labelSubcategory";
this.labelSubcategory.Size = new System.Drawing.Size(107, 20);
this.labelSubcategory.TabIndex = 11;
this.labelSubcategory.Text = "Подкатегория";
//
// labelCategory
//
this.labelCategory.AutoSize = true;
this.labelCategory.Location = new System.Drawing.Point(49, 328);
this.labelCategory.Name = "labelCategory";
this.labelCategory.Size = new System.Drawing.Size(81, 20);
this.labelCategory.TabIndex = 9;
this.labelCategory.Text = "Категория";
//
// textBoxStatus
//
this.textBoxStatus.Location = new System.Drawing.Point(49, 221);
this.textBoxStatus.Name = "textBoxStatus";
this.textBoxStatus.Size = new System.Drawing.Size(125, 27);
this.textBoxStatus.TabIndex = 8;
//
// labelStatus
//
this.labelStatus.AutoSize = true;
this.labelStatus.Location = new System.Drawing.Point(49, 198);
this.labelStatus.Name = "labelStatus";
this.labelStatus.Size = new System.Drawing.Size(52, 20);
this.labelStatus.TabIndex = 7;
this.labelStatus.Text = "Статус";
//
// labelClient
//
this.labelClient.AutoSize = true;
this.labelClient.Location = new System.Drawing.Point(49, 261);
this.labelClient.Name = "labelClient";
this.labelClient.Size = new System.Drawing.Size(58, 20);
this.labelClient.TabIndex = 13;
this.labelClient.Text = "Клиент";
//
// comboBoxSubcategory
//
this.comboBoxSubcategory.FormattingEnabled = true;
this.comboBoxSubcategory.Location = new System.Drawing.Point(49, 413);
this.comboBoxSubcategory.Name = "comboBoxSubcategory";
this.comboBoxSubcategory.Size = new System.Drawing.Size(125, 28);
this.comboBoxSubcategory.TabIndex = 15;
//
// comboBoxCategory
//
this.comboBoxCategory.FormattingEnabled = true;
this.comboBoxCategory.Location = new System.Drawing.Point(49, 351);
this.comboBoxCategory.Name = "comboBoxCategory";
this.comboBoxCategory.Size = new System.Drawing.Size(125, 28);
this.comboBoxCategory.TabIndex = 16;
//
// comboBoxClient
//
this.comboBoxClient.FormattingEnabled = true;
this.comboBoxClient.Location = new System.Drawing.Point(49, 284);
this.comboBoxClient.Name = "comboBoxClient";
this.comboBoxClient.Size = new System.Drawing.Size(125, 28);
this.comboBoxClient.TabIndex = 17;
//
// CreateAdsForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(228, 558);
this.Controls.Add(this.comboBoxClient);
this.Controls.Add(this.comboBoxCategory);
this.Controls.Add(this.comboBoxSubcategory);
this.Controls.Add(this.labelClient);
this.Controls.Add(this.labelSubcategory);
this.Controls.Add(this.labelCategory);
this.Controls.Add(this.textBoxStatus);
this.Controls.Add(this.labelStatus);
this.Controls.Add(this.textBoxDate);
this.Controls.Add(this.labelDate);
this.Controls.Add(this.textBoxPrice);
this.Controls.Add(this.labelPrice);
this.Controls.Add(this.textBoxHeading);
this.Controls.Add(this.labelHeading);
this.Controls.Add(this.button1);
this.Name = "CreateAdsForm";
this.Text = "Объявления";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private Button button1;
private Label labelHeading;
private TextBox textBoxHeading;
private TextBox textBoxPrice;
private Label labelPrice;
private TextBox textBoxDate;
private Label labelDate;
private Label labelSubcategory;
private Label labelCategory;
private TextBox textBoxStatus;
private Label labelStatus;
private Label labelClient;
private ComboBox comboBoxSubcategory;
private ComboBox comboBoxCategory;
private ComboBox comboBoxClient;
}
}

View File

@ -0,0 +1,49 @@
using System.Data;
namespace WebsiteForPlacingAds
{
public partial class CreateAdsForm : Form
{
PostgreSqlDatabase psd;
public CreateAdsForm(PostgreSqlDatabase psd)
{
InitializeComponent();
this.psd = psd;
FillComboBox();
}
private void button1_Click(object sender, EventArgs e)
{
string[] client = comboBoxClient.SelectedItem.ToString().Split(" ");
string[] category = comboBoxCategory.SelectedItem.ToString().Split(" ");
string[] subcategory = comboBoxSubcategory.SelectedItem.ToString().Split(" ");
psd.addAd(textBoxHeading.Text, int.Parse(textBoxPrice.Text), textBoxDate.Text, textBoxStatus.Text, int.Parse(client[0]), int.Parse(category[0]), int.Parse(subcategory[0]));
}
private void FillComboBox()
{
DataTable result = psd.getAllCategories();
string[] id_names = new string[result.Rows.Count];
for (int i = 0; i < result.Rows.Count; i++)
{
id_names[i] = result.Rows[i]["category_id"].ToString() + " " + (string)result.Rows[i]["name"];
comboBoxCategory.Items.Add(id_names[i]);
}
result = psd.getAllSubcategories();
id_names = new string[result.Rows.Count];
for (int i = 0; i < result.Rows.Count; i++)
{
id_names[i] = result.Rows[i]["subcategory_id"].ToString() + " " + (string)result.Rows[i]["name"];
comboBoxSubcategory.Items.Add(id_names[i]);
}
result = psd.getAllClients();
string[] id_names_surnames = new string[result.Rows.Count];
for (int i = 0; i < result.Rows.Count; i++)
{
id_names_surnames[i] = result.Rows[i]["client_id"].ToString() + " " +(string)result.Rows[i]["name"] + " " + (string)result.Rows[i]["surname"];
comboBoxClient.Items.Add(id_names_surnames[i]);
}
}
}
}

View File

@ -0,0 +1,60 @@
<root>
<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,83 @@
namespace WebsiteForPlacingAds
{
partial class DeleteAdsForm
{
/// <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.label1 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(40, 23);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(338, 20);
this.label1.TabIndex = 0;
this.label1.Text = "Выберите объявление, которое хотите удалить";
//
// button1
//
this.button1.Location = new System.Drawing.Point(136, 117);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(132, 55);
this.button1.TabIndex = 1;
this.button1.Text = "Удалить";
this.button1.UseVisualStyleBackColor = true;
//
// comboBox1
//
this.comboBox1.FormattingEnabled = true;
this.comboBox1.Location = new System.Drawing.Point(40, 64);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(338, 28);
this.comboBox1.TabIndex = 2;
//
// UpdateAdsForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(415, 216);
this.Controls.Add(this.comboBox1);
this.Controls.Add(this.button1);
this.Controls.Add(this.label1);
this.Name = "UpdateAdsForm";
this.Text = "UpdateAdsForm";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private Label label1;
private Button button1;
private ComboBox comboBox1;
}
}

View File

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WebsiteForPlacingAds
{
public partial class DeleteAdsForm : Form
{
public DeleteAdsForm()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,60 @@
<root>
<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,10 +0,0 @@
namespace WebsiteForPlacingAds
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
}
}

View File

@ -1,120 +0,0 @@
<?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,72 @@
namespace WebsiteForPlacingAds
{
partial class ListAdsForm
{
/// <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.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 9);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(149, 20);
this.label1.TabIndex = 0;
this.label1.Text = "Список объявлений";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(12, 47);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(0, 20);
this.label2.TabIndex = 1;
this.label2.Click += new System.EventHandler(this.label2_Click);
//
// ListAdsForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Name = "ListAdsForm";
this.Text = "ListAdsForm";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private Label label1;
private Label label2;
}
}

View File

@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WebsiteForPlacingAds
{
public partial class ListAdsForm : Form
{
public ListAdsForm()
{
InitializeComponent();
}
private void label2_Click(object sender, EventArgs e)
{
string s = "Первое объявление\nВторое объявление";
label2.Text = s;
}
}
}

View File

@ -0,0 +1,60 @@
<root>
<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,256 @@
namespace WebsiteForPlacingAds
{
partial class MainForm
{
/// <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.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.клиентыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.объявленияToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.категорииToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.подкатегорииToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.создатьКлиентаToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.удалитьКлиентаToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.изменитьДанныеКлиентаToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.создатьОбъявлениеToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.списокКлиентвToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.удалитьОбъявлениеToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.изменитьОбъявлениеэToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.списокОбъявленийToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.создатьКатегориюToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.удалитьКатегориюToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.изменитьКатегориюToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.списокКатегорийToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.создатьПодкатеориюToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.удалитьПодкатегориюToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.изменитьПодкатегориюToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.списокПодкатегоийToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip1.SuspendLayout();
this.SuspendLayout();
//
// menuStrip1
//
this.menuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.клиентыToolStripMenuItem,
this.объявленияToolStripMenuItem,
this.категорииToolStripMenuItem,
this.подкатегорииToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(800, 28);
this.menuStrip1.TabIndex = 0;
this.menuStrip1.Text = "menuStrip1";
//
// клиентыToolStripMenuItem
//
this.клиентыToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.создатьКлиентаToolStripMenuItem,
this.удалитьКлиентаToolStripMenuItem,
this.изменитьДанныеКлиентаToolStripMenuItem,
this.списокКлиентвToolStripMenuItem});
this.клиентыToolStripMenuItem.Name = "клиентыToolStripMenuItem";
this.клиентыToolStripMenuItem.Size = new System.Drawing.Size(83, 24);
this.клиентыToolStripMenuItem.Text = "Клиенты";
//
// объявленияToolStripMenuItem
//
this.объявленияToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.создатьОбъявлениеToolStripMenuItem,
this.удалитьОбъявлениеToolStripMenuItem,
this.изменитьОбъявлениеэToolStripMenuItem,
this.списокОбъявленийToolStripMenuItem});
this.объявленияToolStripMenuItem.Name = "объявленияToolStripMenuItem";
this.объявленияToolStripMenuItem.Size = new System.Drawing.Size(110, 24);
this.объявленияToolStripMenuItem.Text = "Объявления";
//
// категорииToolStripMenuItem
//
this.категорииToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.создатьКатегориюToolStripMenuItem,
this.удалитьКатегориюToolStripMenuItem,
this.изменитьКатегориюToolStripMenuItem,
this.списокКатегорийToolStripMenuItem});
this.категорииToolStripMenuItem.Name = атегорииToolStripMenuItem";
this.категорииToolStripMenuItem.Size = new System.Drawing.Size(96, 24);
this.категорииToolStripMenuItem.Text = "Категории";
//
// подкатегорииToolStripMenuItem
//
this.подкатегорииToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.создатьПодкатеориюToolStripMenuItem,
this.удалитьПодкатегориюToolStripMenuItem,
this.изменитьПодкатегориюToolStripMenuItem,
this.списокПодкатегоийToolStripMenuItem});
this.подкатегорииToolStripMenuItem.Name = "подкатегорииToolStripMenuItem";
this.подкатегорииToolStripMenuItem.Size = new System.Drawing.Size(122, 24);
this.подкатегорииToolStripMenuItem.Text = "Подкатегории";
//
// создатьКлиентаToolStripMenuItem
//
this.создатьКлиентаToolStripMenuItem.Name = "создатьКлиентаToolStripMenuItem";
this.создатьКлиентаToolStripMenuItem.Size = new System.Drawing.Size(277, 26);
this.создатьКлиентаToolStripMenuItem.Text = "Создать клиента";
//
// удалитьКлиентаToolStripMenuItem
//
this.удалитьКлиентаToolStripMenuItem.Name = "удалитьКлиентаToolStripMenuItem";
this.удалитьКлиентаToolStripMenuItem.Size = new System.Drawing.Size(277, 26);
this.удалитьКлиентаToolStripMenuItem.Text = "Удалить клиента";
//
// изменитьДанныеКлиентаToolStripMenuItem
//
this.изменитьДанныеКлиентаToolStripMenuItem.Name = "изменитьДанныеКлиентаToolStripMenuItem";
this.изменитьДанныеКлиентаToolStripMenuItem.Size = new System.Drawing.Size(277, 26);
this.изменитьДанныеКлиентаToolStripMenuItem.Text = "Изменить данные клиента";
//
// создатьОбъявлениеToolStripMenuItem
//
this.создатьОбъявлениеToolStripMenuItem.Name = "создатьОбъявлениеToolStripMenuItem";
this.создатьОбъявлениеToolStripMenuItem.Size = new System.Drawing.Size(250, 26);
this.создатьОбъявлениеToolStripMenuItem.Text = "Создать объявление";
this.создатьОбъявлениеToolStripMenuItem.Click += new System.EventHandler(this.создатьОбъявлениеToolStripMenuItem_Click);
//
// списокКлиентвToolStripMenuItem
//
this.списокКлиентвToolStripMenuItem.Name = "списокКлиентвToolStripMenuItem";
this.списокКлиентвToolStripMenuItem.Size = new System.Drawing.Size(277, 26);
this.списокКлиентвToolStripMenuItem.Text = "Список клиентов";
this.списокКлиентвToolStripMenuItem.Click += new System.EventHandler(this.списокКлиентвToolStripMenuItem_Click);
//
// удалитьОбъявлениеToolStripMenuItem
//
this.удалитьОбъявлениеToolStripMenuItem.Name = "удалитьОбъявлениеToolStripMenuItem";
this.удалитьОбъявлениеToolStripMenuItem.Size = new System.Drawing.Size(250, 26);
this.удалитьОбъявлениеToolStripMenuItem.Text = "Удалить объявление";
this.удалитьОбъявлениеToolStripMenuItem.Click += new System.EventHandler(this.удалитьОбъявлениеToolStripMenuItem_Click);
//
// изменитьОбъявлениеэToolStripMenuItem
//
this.изменитьОбъявлениеэToolStripMenuItem.Name = "изменитьОбъявлениеэToolStripMenuItem";
this.изменитьОбъявлениеэToolStripMenuItem.Size = new System.Drawing.Size(250, 26);
this.изменитьОбъявлениеэToolStripMenuItem.Text = "Изменить объявление";
this.изменитьОбъявлениеэToolStripMenuItem.Click += new System.EventHandler(this.изменитьОбъявлениеэToolStripMenuItem_Click);
//
// списокОбъявленийToolStripMenuItem
//
this.списокОбъявленийToolStripMenuItem.Name = "списокОбъявленийToolStripMenuItem";
this.списокОбъявленийToolStripMenuItem.Size = new System.Drawing.Size(250, 26);
this.списокОбъявленийToolStripMenuItem.Text = "Список объявлений";
this.списокОбъявленийToolStripMenuItem.Click += new System.EventHandler(this.списокОбъявленийToolStripMenuItem_Click);
//
// создатьКатегориюToolStripMenuItem
//
this.создатьКатегориюToolStripMenuItem.Name = "создатьКатегориюToolStripMenuItem";
this.создатьКатегориюToolStripMenuItem.Size = new System.Drawing.Size(239, 26);
this.создатьКатегориюToolStripMenuItem.Text = "Создать категорию";
this.создатьКатегориюToolStripMenuItem.Click += new System.EventHandler(this.создатьКатегориюToolStripMenuItem_Click);
//
// удалитьКатегориюToolStripMenuItem
//
this.удалитьКатегориюToolStripMenuItem.Name = "удалитьКатегориюToolStripMenuItem";
this.удалитьКатегориюToolStripMenuItem.Size = new System.Drawing.Size(239, 26);
this.удалитьКатегориюToolStripMenuItem.Text = "Удалить категорию";
this.удалитьКатегориюToolStripMenuItem.Click += new System.EventHandler(this.удалитьКатегориюToolStripMenuItem_Click);
//
// изменитьКатегориюToolStripMenuItem
//
this.изменитьКатегориюToolStripMenuItem.Name = "изменитьКатегориюToolStripMenuItem";
this.изменитьКатегориюToolStripMenuItem.Size = new System.Drawing.Size(239, 26);
this.изменитьКатегориюToolStripMenuItem.Text = "Изменить категорию";
//
// списокКатегорийToolStripMenuItem
//
this.списокКатегорийToolStripMenuItem.Name = "списокКатегорийToolStripMenuItem";
this.списокКатегорийToolStripMenuItem.Size = new System.Drawing.Size(239, 26);
this.списокКатегорийToolStripMenuItem.Text = "Список категорий";
//
// создатьПодкатеориюToolStripMenuItem
//
this.создатьПодкатеориюToolStripMenuItem.Name = "создатьПодкатеориюToolStripMenuItem";
this.создатьПодкатеориюToolStripMenuItem.Size = new System.Drawing.Size(265, 26);
this.создатьПодкатеориюToolStripMenuItem.Text = "Создать подкатегорию";
//
// удалитьПодкатегориюToolStripMenuItem
//
this.удалитьПодкатегориюToolStripMenuItem.Name = "удалитьПодкатегориюToolStripMenuItem";
this.удалитьПодкатегориюToolStripMenuItem.Size = new System.Drawing.Size(265, 26);
this.удалитьПодкатегориюToolStripMenuItem.Text = "Удалить подкатегорию";
//
// изменитьПодкатегориюToolStripMenuItem
//
this.изменитьПодкатегориюToolStripMenuItem.Name = "изменитьПодкатегориюToolStripMenuItem";
this.изменитьПодкатегориюToolStripMenuItem.Size = new System.Drawing.Size(265, 26);
this.изменитьПодкатегориюToolStripMenuItem.Text = "Изменить подкатегорию";
//
// списокПодкатегоийToolStripMenuItem
//
this.списокПодкатегоийToolStripMenuItem.Name = "списокПодкатегоийToolStripMenuItem";
this.списокПодкатегоийToolStripMenuItem.Size = new System.Drawing.Size(265, 26);
this.списокПодкатегоийToolStripMenuItem.Text = "Список подкатегорий";
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Controls.Add(this.menuStrip1);
this.MainMenuStrip = this.menuStrip1;
this.Name = "MainForm";
this.Text = "MainForm";
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.ResumeLayout(false);
this.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;
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;
private ToolStripMenuItem изменитьПодкатегориюToolStripMenuItem;
private ToolStripMenuItem списокПодкатегоийToolStripMenuItem;
}
}

View File

@ -0,0 +1,61 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WebsiteForPlacingAds
{
public partial class MainForm : Form
{
PostgreSqlDatabase psd;
public MainForm()
{
InitializeComponent();
psd = new PostgreSqlDatabase("Server=localhost;Port=5432;User Id=postgres;Password=aswdqq;Database=alina_refactor;");
}
private void списокКлиентвToolStripMenuItem_Click(object sender, EventArgs e)
{
}
private void создатьКатегориюToolStripMenuItem_Click(object sender, EventArgs e)
{
}
private void удалитьКатегориюToolStripMenuItem_Click(object sender, EventArgs e)
{
}
private void создатьОбъявлениеToolStripMenuItem_Click(object sender, EventArgs e)
{
CreateAdsForm caf = new CreateAdsForm(psd);
caf.Show();
}
private void удалитьОбъявлениеToolStripMenuItem_Click(object sender, EventArgs e)
{
UpdateAdsForm daf = new UpdateAdsForm();
daf.Show();
}
private void изменитьОбъявлениеэToolStripMenuItem_Click(object sender, EventArgs e)
{
DeleteAdsForm uaf = new DeleteAdsForm();
uaf.Show();
}
private void списокОбъявленийToolStripMenuItem_Click(object sender, EventArgs e)
{
ListAdsForm laf = new ListAdsForm();
laf.Show();
}
}
}

View File

@ -0,0 +1,63 @@
<root>
<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,62 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WebsiteForPlacingAds
{
public class PostgreSqlDatabase : AbstractDatabase
{
public PostgreSqlDatabase(string connectionString) : base(connectionString)
{
}
public void addAd(string heading, int price, string date, string status, int id_client, int id_category, int id_subcategory)
{
string query = String.Format("INSERT INTO ads VALUES (nextval('seq_ads'), '{0}', {1}, '{2}', '{3}', {4}, {5}, {6})", heading, price, date, status, id_client, id_category, id_subcategory);
ExecuteNonQuery(query);
}
public void addClient(string name, string surname, string patronymic, string email, string phone_number, string registration_date, int client_rating)
{
string query = String.Format($"INSERT INTO clients VALUES (nextval('seq_clients'), {name}', '{surname}', '{patronymic}', '{email}', '{phone_number}', '{registration_date}', '{client_rating}')");
ExecuteNonQuery(query);
}
public void addClientsRating(int number_of_reviews, int number_of_sales, int number_of_subscribers, float average_rating)
{
string query = String.Format($"INSERT INTO clients_rating VALUES (nextval('seq_user_rating'), {number_of_reviews}', '{number_of_sales}', '{number_of_subscribers}', '{average_rating}')");
ExecuteNonQuery(query);
}
public void addSubcategory(string name)
{
string query = String.Format($"INSERT INTO subcategories VALUES (nextval('seq_subcategory'), {name}')");
ExecuteNonQuery(query);
}
public void addCategory(string name)
{
string query = String.Format($"INSERT INTO categories VALUES (nextval('seq_category'), {name}')");
ExecuteNonQuery(query);
}
public DataTable getAllCategories()
{
string query = "SELECT category_id, name FROM categories";
return ExecuteQuery(query);
}
public DataTable getAllSubcategories()
{
string query = "SELECT subcategory_id, name FROM subcategories";
return ExecuteQuery(query);
}
public DataTable getAllClients()
{
string query = "SELECT client_id, name, surname FROM clients";
return ExecuteQuery(query);
}
public DataTable getClient(int id_client)
{
string query = $"SELECT * FROM clients where id = {id_client}";
return ExecuteQuery(query);
}
}
}

View File

@ -11,7 +11,7 @@ namespace WebsiteForPlacingAds
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
Application.Run(new Form1());
Application.Run(new MainForm());
}
}
}

View File

@ -1,6 +1,6 @@
namespace WebsiteForPlacingAds
{
partial class Form1
partial class UpdateAdsForm
{
/// <summary>
/// Required designer variable.
@ -31,7 +31,7 @@
this.components = new System.ComponentModel.Container();
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Text = "Form1";
this.Text = "DeleteAdsForm";
}
#endregion

View File

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WebsiteForPlacingAds
{
public partial class UpdateAdsForm : Form
{
public UpdateAdsForm()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,60 @@
<root>
<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

@ -8,4 +8,8 @@
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Npgsql" Version="7.0.2" />
</ItemGroup>
</Project>