From 4d16f07d68f3b24310dd4adca3135ccd601723b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B8=D0=BD=D0=B0=20=D0=91=D0=B0=D1=82=D1=8B?= =?UTF-8?q?=D0=BB=D0=BA=D0=B8=D0=BD=D0=B0?= Date: Wed, 29 Mar 2023 23:06:23 +0400 Subject: [PATCH] =?UTF-8?q?=D0=A0=D0=B5=D0=B0=D0=BB=D0=B8=D0=B7=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0=D0=BD=D0=B0=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=B0?= =?UTF-8?q?=20=D1=81=D0=BE=20=D0=B2=D1=81=D0=B5=D0=BC=D0=B8=20=D1=81=D1=83?= =?UTF-8?q?=D1=89=D0=BD=D0=BE=D1=81=D1=82=D1=8F=D0=BC=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{ => AdsForm}/CreateAdsForm.Designer.cs | 0 .../{ => AdsForm}/CreateAdsForm.cs | 22 +- .../{ => AdsForm}/CreateAdsForm.resx | 0 .../{ => AdsForm}/DeleteAdsForm.Designer.cs | 0 .../{ => AdsForm}/DeleteAdsForm.cs | 30 +-- .../{ => AdsForm}/DeleteAdsForm.resx | 0 .../{ => AdsForm}/ListAdsForm.Designer.cs | 0 .../AdsForm/ListAdsForm.cs | 42 +++ .../{ => AdsForm}/ListAdsForm.resx | 0 .../{ => AdsForm}/UpdateAdsForm.Designer.cs | 0 .../{ => AdsForm}/UpdateAdsForm.cs | 0 .../{ => AdsForm}/UpdateAdsForm.resx | 0 .../CreateCategoriesForm.Designer.cs | 86 ++++++ .../CategoriesForm/CreateCategoriesForm.cs | 29 ++ .../CategoriesForm/CreateCategoriesForm.resx | 60 +++++ .../DeleteCategoriesForm.Designer.cs | 87 ++++++ .../CategoriesForm/DeleteCategoriesForm.cs | 55 ++++ .../CategoriesForm/DeleteCategoriesForm.resx | 60 +++++ .../ListCategoriesForm.Designer.cs | 75 ++++++ .../CategoriesForm/ListCategoriesForm.cs | 36 +++ .../CategoriesForm/ListCategoriesForm.resx | 60 +++++ .../UpdateCategoriesForm.Designer.cs | 110 ++++++++ .../CategoriesForm/UpdateCategoriesForm.cs | 80 ++++++ .../CategoriesForm/UpdateCategoriesForm.resx | 60 +++++ .../ClientsForm/CreateClientsForm.Designer.cs | 224 ++++++++++++++++ .../ClientsForm/CreateClientsForm.cs | 37 +++ .../ClientsForm/CreateClientsForm.resx | 60 +++++ .../ClientsForm/DeleteClientsForm.Designer.cs | 87 ++++++ .../ClientsForm/DeleteClientsForm.cs | 63 +++++ .../ClientsForm/DeleteClientsForm.resx | 60 +++++ .../ClientsForm/ListClientsForm.Designer.cs | 75 ++++++ .../ClientsForm/ListClientsForm.cs | 42 +++ .../ClientsForm/ListClientsForm.resx | 60 +++++ .../ClientsForm/UpdateClientsForm.Designer.cs | 248 ++++++++++++++++++ .../ClientsForm/UpdateClientsForm.cs | 110 ++++++++ .../ClientsForm/UpdateClientsForm.resx | 60 +++++ .../WebsiteForPlacingAds/DatabaseLogic.cs | 24 +- .../WebsiteForPlacingAds/IDatabaseLogic.cs | 4 + .../WebsiteForPlacingAds/ListAdsForm.cs | 42 --- .../WebsiteForPlacingAds/MainForm.Designer.cs | 199 +++++++------- .../WebsiteForPlacingAds/MainForm.cs | 76 +++++- .../CreateSubcategoriesForm.Designer.cs | 86 ++++++ .../CreateSubcategoriesForm.cs | 29 ++ .../CreateSubcategoriesForm.resx | 60 +++++ .../DeleteSubcategoriesForm.Designer.cs | 87 ++++++ .../DeleteSubcategoriesForm.cs | 55 ++++ .../DeleteSubcategoriesForm.resx | 60 +++++ .../ListSubcategoriesForm.Designer.cs | 75 ++++++ .../ListSubcategoriesForm.cs | 36 +++ .../ListSubcategoriesForm.resx | 60 +++++ .../UpdateSubcategoriesForm.Designer.cs | 111 ++++++++ .../UpdateSubcategoriesForm.cs | 82 ++++++ .../UpdateSubcategoriesForm.resx | 60 +++++ .../WebsiteForPlacingAds.csproj | 15 ++ 54 files changed, 3004 insertions(+), 175 deletions(-) rename WebsiteForPlacingAds/WebsiteForPlacingAds/{ => AdsForm}/CreateAdsForm.Designer.cs (100%) rename WebsiteForPlacingAds/WebsiteForPlacingAds/{ => AdsForm}/CreateAdsForm.cs (63%) rename WebsiteForPlacingAds/WebsiteForPlacingAds/{ => AdsForm}/CreateAdsForm.resx (100%) rename WebsiteForPlacingAds/WebsiteForPlacingAds/{ => AdsForm}/DeleteAdsForm.Designer.cs (100%) rename WebsiteForPlacingAds/WebsiteForPlacingAds/{ => AdsForm}/DeleteAdsForm.cs (50%) rename WebsiteForPlacingAds/WebsiteForPlacingAds/{ => AdsForm}/DeleteAdsForm.resx (100%) rename WebsiteForPlacingAds/WebsiteForPlacingAds/{ => AdsForm}/ListAdsForm.Designer.cs (100%) create mode 100644 WebsiteForPlacingAds/WebsiteForPlacingAds/AdsForm/ListAdsForm.cs rename WebsiteForPlacingAds/WebsiteForPlacingAds/{ => AdsForm}/ListAdsForm.resx (100%) rename WebsiteForPlacingAds/WebsiteForPlacingAds/{ => AdsForm}/UpdateAdsForm.Designer.cs (100%) rename WebsiteForPlacingAds/WebsiteForPlacingAds/{ => AdsForm}/UpdateAdsForm.cs (100%) rename WebsiteForPlacingAds/WebsiteForPlacingAds/{ => AdsForm}/UpdateAdsForm.resx (100%) create mode 100644 WebsiteForPlacingAds/WebsiteForPlacingAds/CategoriesForm/CreateCategoriesForm.Designer.cs create mode 100644 WebsiteForPlacingAds/WebsiteForPlacingAds/CategoriesForm/CreateCategoriesForm.cs create mode 100644 WebsiteForPlacingAds/WebsiteForPlacingAds/CategoriesForm/CreateCategoriesForm.resx create mode 100644 WebsiteForPlacingAds/WebsiteForPlacingAds/CategoriesForm/DeleteCategoriesForm.Designer.cs create mode 100644 WebsiteForPlacingAds/WebsiteForPlacingAds/CategoriesForm/DeleteCategoriesForm.cs create mode 100644 WebsiteForPlacingAds/WebsiteForPlacingAds/CategoriesForm/DeleteCategoriesForm.resx create mode 100644 WebsiteForPlacingAds/WebsiteForPlacingAds/CategoriesForm/ListCategoriesForm.Designer.cs create mode 100644 WebsiteForPlacingAds/WebsiteForPlacingAds/CategoriesForm/ListCategoriesForm.cs create mode 100644 WebsiteForPlacingAds/WebsiteForPlacingAds/CategoriesForm/ListCategoriesForm.resx create mode 100644 WebsiteForPlacingAds/WebsiteForPlacingAds/CategoriesForm/UpdateCategoriesForm.Designer.cs create mode 100644 WebsiteForPlacingAds/WebsiteForPlacingAds/CategoriesForm/UpdateCategoriesForm.cs create mode 100644 WebsiteForPlacingAds/WebsiteForPlacingAds/CategoriesForm/UpdateCategoriesForm.resx create mode 100644 WebsiteForPlacingAds/WebsiteForPlacingAds/ClientsForm/CreateClientsForm.Designer.cs create mode 100644 WebsiteForPlacingAds/WebsiteForPlacingAds/ClientsForm/CreateClientsForm.cs create mode 100644 WebsiteForPlacingAds/WebsiteForPlacingAds/ClientsForm/CreateClientsForm.resx create mode 100644 WebsiteForPlacingAds/WebsiteForPlacingAds/ClientsForm/DeleteClientsForm.Designer.cs create mode 100644 WebsiteForPlacingAds/WebsiteForPlacingAds/ClientsForm/DeleteClientsForm.cs create mode 100644 WebsiteForPlacingAds/WebsiteForPlacingAds/ClientsForm/DeleteClientsForm.resx create mode 100644 WebsiteForPlacingAds/WebsiteForPlacingAds/ClientsForm/ListClientsForm.Designer.cs create mode 100644 WebsiteForPlacingAds/WebsiteForPlacingAds/ClientsForm/ListClientsForm.cs create mode 100644 WebsiteForPlacingAds/WebsiteForPlacingAds/ClientsForm/ListClientsForm.resx create mode 100644 WebsiteForPlacingAds/WebsiteForPlacingAds/ClientsForm/UpdateClientsForm.Designer.cs create mode 100644 WebsiteForPlacingAds/WebsiteForPlacingAds/ClientsForm/UpdateClientsForm.cs create mode 100644 WebsiteForPlacingAds/WebsiteForPlacingAds/ClientsForm/UpdateClientsForm.resx delete mode 100644 WebsiteForPlacingAds/WebsiteForPlacingAds/ListAdsForm.cs create mode 100644 WebsiteForPlacingAds/WebsiteForPlacingAds/SubcategoriesForm/CreateSubcategoriesForm.Designer.cs create mode 100644 WebsiteForPlacingAds/WebsiteForPlacingAds/SubcategoriesForm/CreateSubcategoriesForm.cs create mode 100644 WebsiteForPlacingAds/WebsiteForPlacingAds/SubcategoriesForm/CreateSubcategoriesForm.resx create mode 100644 WebsiteForPlacingAds/WebsiteForPlacingAds/SubcategoriesForm/DeleteSubcategoriesForm.Designer.cs create mode 100644 WebsiteForPlacingAds/WebsiteForPlacingAds/SubcategoriesForm/DeleteSubcategoriesForm.cs create mode 100644 WebsiteForPlacingAds/WebsiteForPlacingAds/SubcategoriesForm/DeleteSubcategoriesForm.resx create mode 100644 WebsiteForPlacingAds/WebsiteForPlacingAds/SubcategoriesForm/ListSubcategoriesForm.Designer.cs create mode 100644 WebsiteForPlacingAds/WebsiteForPlacingAds/SubcategoriesForm/ListSubcategoriesForm.cs create mode 100644 WebsiteForPlacingAds/WebsiteForPlacingAds/SubcategoriesForm/ListSubcategoriesForm.resx create mode 100644 WebsiteForPlacingAds/WebsiteForPlacingAds/SubcategoriesForm/UpdateSubcategoriesForm.Designer.cs create mode 100644 WebsiteForPlacingAds/WebsiteForPlacingAds/SubcategoriesForm/UpdateSubcategoriesForm.cs create mode 100644 WebsiteForPlacingAds/WebsiteForPlacingAds/SubcategoriesForm/UpdateSubcategoriesForm.resx diff --git a/WebsiteForPlacingAds/WebsiteForPlacingAds/CreateAdsForm.Designer.cs b/WebsiteForPlacingAds/WebsiteForPlacingAds/AdsForm/CreateAdsForm.Designer.cs similarity index 100% rename from WebsiteForPlacingAds/WebsiteForPlacingAds/CreateAdsForm.Designer.cs rename to WebsiteForPlacingAds/WebsiteForPlacingAds/AdsForm/CreateAdsForm.Designer.cs diff --git a/WebsiteForPlacingAds/WebsiteForPlacingAds/CreateAdsForm.cs b/WebsiteForPlacingAds/WebsiteForPlacingAds/AdsForm/CreateAdsForm.cs similarity index 63% rename from WebsiteForPlacingAds/WebsiteForPlacingAds/CreateAdsForm.cs rename to WebsiteForPlacingAds/WebsiteForPlacingAds/AdsForm/CreateAdsForm.cs index ad75434..6c3f1b0 100644 --- a/WebsiteForPlacingAds/WebsiteForPlacingAds/CreateAdsForm.cs +++ b/WebsiteForPlacingAds/WebsiteForPlacingAds/AdsForm/CreateAdsForm.cs @@ -4,11 +4,11 @@ namespace WebsiteForPlacingAds { public partial class CreateAdsForm : Form { - PostgreSqlDatabase psd; - public CreateAdsForm(PostgreSqlDatabase psd) + IDatabaseLogic databaseLogic; + public CreateAdsForm(IDatabaseLogic databaseLogic) { InitializeComponent(); - this.psd = psd; + this.databaseLogic = databaseLogic; LoadData(); } @@ -26,11 +26,9 @@ namespace WebsiteForPlacingAds string category_id = category[0]; string subcategory_id = subcategory[0]; - string query = $"INSERT INTO ads VALUES (nextval('seq_ads'), '{heading}', {price}, '{date}', '{status}', {client_id}, {category_id}, {subcategory_id})"; try { - - psd.ExecuteNonQuery(query); + databaseLogic.insertInto("ads", $"'{heading}'", price, $"'{date}'", $"'{status}'", client_id, category_id, subcategory_id); MessageBox.Show("!"); LoadData(); } @@ -45,25 +43,25 @@ namespace WebsiteForPlacingAds comboBoxCategory.Items.Clear(); comboBoxSubcategory.Items.Clear(); comboBoxClient.Items.Clear(); - DataTable result = psd.ExecuteQuery("SELECT * FROM CATEGORIES"); + DataTable result = databaseLogic.getAllEntry("CATEGORIES"); string[] id_names = new string[result.Rows.Count]; for (int i = 0; i < result.Rows.Count; i++) { - id_names[i] = result.Rows[i]["categories_id"].ToString() + ". " + (string)result.Rows[i]["name"]; + id_names[i] = databaseLogic.getRowTableById(result, "categories_id", i).ToString() + ". " + databaseLogic.getRowTableById(result, "name", i).ToString(); comboBoxCategory.Items.Add(id_names[i]); } - result = psd.ExecuteQuery("SELECT * FROM SUBCATEGORIES"); + result = databaseLogic.getAllEntry("SUBCATEGORIES"); id_names = new string[result.Rows.Count]; for (int i = 0; i < result.Rows.Count; i++) { - id_names[i] = result.Rows[i]["subcategories_id"].ToString() + ". " + (string)result.Rows[i]["name"]; + id_names[i] = databaseLogic.getRowTableById(result, "subcategories_id", i).ToString() + ". " + databaseLogic.getRowTableById(result, "name", i).ToString(); comboBoxSubcategory.Items.Add(id_names[i]); } - result = psd.ExecuteQuery("SELECT * FROM CLIENTS"); + result = databaseLogic.getAllEntry("CLIENTS"); 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]["clients_id"].ToString().Trim() + ". " + ((string)result.Rows[i]["name"]).Trim() + " " + ((string)result.Rows[i]["surname"]).Trim(); + id_names_surnames[i] = databaseLogic.getRowTableById(result, "clients_id", i).ToString().Trim() + ". " + databaseLogic.getRowTableById(result, "name", i).ToString().Trim() + " " + databaseLogic.getRowTableById(result, "surname", i).ToString().Trim(); comboBoxClient.Items.Add(id_names_surnames[i]); } } diff --git a/WebsiteForPlacingAds/WebsiteForPlacingAds/CreateAdsForm.resx b/WebsiteForPlacingAds/WebsiteForPlacingAds/AdsForm/CreateAdsForm.resx similarity index 100% rename from WebsiteForPlacingAds/WebsiteForPlacingAds/CreateAdsForm.resx rename to WebsiteForPlacingAds/WebsiteForPlacingAds/AdsForm/CreateAdsForm.resx diff --git a/WebsiteForPlacingAds/WebsiteForPlacingAds/DeleteAdsForm.Designer.cs b/WebsiteForPlacingAds/WebsiteForPlacingAds/AdsForm/DeleteAdsForm.Designer.cs similarity index 100% rename from WebsiteForPlacingAds/WebsiteForPlacingAds/DeleteAdsForm.Designer.cs rename to WebsiteForPlacingAds/WebsiteForPlacingAds/AdsForm/DeleteAdsForm.Designer.cs diff --git a/WebsiteForPlacingAds/WebsiteForPlacingAds/DeleteAdsForm.cs b/WebsiteForPlacingAds/WebsiteForPlacingAds/AdsForm/DeleteAdsForm.cs similarity index 50% rename from WebsiteForPlacingAds/WebsiteForPlacingAds/DeleteAdsForm.cs rename to WebsiteForPlacingAds/WebsiteForPlacingAds/AdsForm/DeleteAdsForm.cs index ee7bcdd..d9f349d 100644 --- a/WebsiteForPlacingAds/WebsiteForPlacingAds/DeleteAdsForm.cs +++ b/WebsiteForPlacingAds/WebsiteForPlacingAds/AdsForm/DeleteAdsForm.cs @@ -12,12 +12,12 @@ namespace WebsiteForPlacingAds { public partial class DeleteAdsForm : Form { - PostgreSqlDatabase psd; + IDatabaseLogic databaseLogic; private int setval_seq; - public DeleteAdsForm(PostgreSqlDatabase psd) + public DeleteAdsForm(IDatabaseLogic databaseLogic) { InitializeComponent(); - this.psd = psd; + this.databaseLogic = databaseLogic; LoadData(); } @@ -29,9 +29,8 @@ namespace WebsiteForPlacingAds string query_seq_reduction = $"SELECT setval('seq_ads', {setval_seq - 1});"; try { - - psd.ExecuteNonQuery(query); - psd.ExecuteNonQuery(query_seq_reduction); + databaseLogic.deleteEntry("ads", int.Parse(ad_id)); + databaseLogic.reduceSeq("seq_ads", setval_seq); MessageBox.Show("Удалено!"); LoadData(); } @@ -43,19 +42,20 @@ namespace WebsiteForPlacingAds public void LoadData() { comboBoxDeleteAds.Items.Clear(); - DataTable result = psd.ExecuteQuery("SELECT * FROM ADS"); + DataTable result = databaseLogic.getAllEntry("ADS"); setval_seq = result.Rows.Count; string Ads = ""; for (int i = 0; i < result.Rows.Count; i++) { - Ads = result.Rows[i]["ads_id"].ToString() + " | " + - (string)result.Rows[i]["heading"] + " | " + - result.Rows[i]["price"].ToString() + " | " + - ((DateTime)result.Rows[i]["date_of_placement"]).ToString("d") + " | " + - (string)result.Rows[i]["status"] + " | " + - result.Rows[i]["id_client"].ToString() + " | " + - result.Rows[i]["id_category"].ToString() + " | " + - result.Rows[i]["id_subcategory"].ToString() + "\n"; + if (i == result.Rows.Count - 1) setval_seq = Convert.ToInt32(databaseLogic.getRowTableById(result, "ads_id", i)); + Ads = databaseLogic.getRowTableById(result, "ads_id", i).ToString() + " | " + + databaseLogic.getRowTableById(result, "heading", i).ToString() + " | " + + databaseLogic.getRowTableById(result, "price", i).ToString() + " | " + + ((DateTime)databaseLogic.getRowTableById(result, "date_of_placement", i)).ToString("dd.MM.yyy") + " | " + + databaseLogic.getRowTableById(result, "status", i).ToString() + " | " + + databaseLogic.getRowTableById(result, "id_client", i).ToString() + " | " + + databaseLogic.getRowTableById(result, "id_category", i).ToString() + " | " + + databaseLogic.getRowTableById(result, "id_subcategory", i).ToString() + "\n"; comboBoxDeleteAds.Items.Add(Ads); } } diff --git a/WebsiteForPlacingAds/WebsiteForPlacingAds/DeleteAdsForm.resx b/WebsiteForPlacingAds/WebsiteForPlacingAds/AdsForm/DeleteAdsForm.resx similarity index 100% rename from WebsiteForPlacingAds/WebsiteForPlacingAds/DeleteAdsForm.resx rename to WebsiteForPlacingAds/WebsiteForPlacingAds/AdsForm/DeleteAdsForm.resx diff --git a/WebsiteForPlacingAds/WebsiteForPlacingAds/ListAdsForm.Designer.cs b/WebsiteForPlacingAds/WebsiteForPlacingAds/AdsForm/ListAdsForm.Designer.cs similarity index 100% rename from WebsiteForPlacingAds/WebsiteForPlacingAds/ListAdsForm.Designer.cs rename to WebsiteForPlacingAds/WebsiteForPlacingAds/AdsForm/ListAdsForm.Designer.cs diff --git a/WebsiteForPlacingAds/WebsiteForPlacingAds/AdsForm/ListAdsForm.cs b/WebsiteForPlacingAds/WebsiteForPlacingAds/AdsForm/ListAdsForm.cs new file mode 100644 index 0000000..76e0ea3 --- /dev/null +++ b/WebsiteForPlacingAds/WebsiteForPlacingAds/AdsForm/ListAdsForm.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using System.Windows.Forms.VisualStyles; + +namespace WebsiteForPlacingAds +{ + public partial class ListAdsForm : Form + { + IDatabaseLogic databaseLogic; + public ListAdsForm(IDatabaseLogic databaseLogic) + { + InitializeComponent(); + this.databaseLogic = databaseLogic; + LoadData(); + } + + private void LoadData() + { + DataTable result = databaseLogic.getAllEntry("ADS"); + string listAds = ""; + for (int i = 0; i < result.Rows.Count; i++) + { + listAds += databaseLogic.getRowTableById(result, "ads_id", i).ToString() + " | " + + databaseLogic.getRowTableById(result, "heading", i).ToString() + " | " + + databaseLogic.getRowTableById(result, "price", i).ToString() + " | " + + ((DateTime)databaseLogic.getRowTableById(result, "date_of_placement", i)).ToString("dd.MM.yyy") + " | " + + databaseLogic.getRowTableById(result, "status", i).ToString() + " | " + + databaseLogic.getRowTableById(result, "id_client", i).ToString() + " | " + + databaseLogic.getRowTableById(result, "id_category", i).ToString() + " | " + + databaseLogic.getRowTableById(result, "id_subcategory", i).ToString() + "\n"; + } + labelListAds.Text = listAds; + } + } +} diff --git a/WebsiteForPlacingAds/WebsiteForPlacingAds/ListAdsForm.resx b/WebsiteForPlacingAds/WebsiteForPlacingAds/AdsForm/ListAdsForm.resx similarity index 100% rename from WebsiteForPlacingAds/WebsiteForPlacingAds/ListAdsForm.resx rename to WebsiteForPlacingAds/WebsiteForPlacingAds/AdsForm/ListAdsForm.resx diff --git a/WebsiteForPlacingAds/WebsiteForPlacingAds/UpdateAdsForm.Designer.cs b/WebsiteForPlacingAds/WebsiteForPlacingAds/AdsForm/UpdateAdsForm.Designer.cs similarity index 100% rename from WebsiteForPlacingAds/WebsiteForPlacingAds/UpdateAdsForm.Designer.cs rename to WebsiteForPlacingAds/WebsiteForPlacingAds/AdsForm/UpdateAdsForm.Designer.cs diff --git a/WebsiteForPlacingAds/WebsiteForPlacingAds/UpdateAdsForm.cs b/WebsiteForPlacingAds/WebsiteForPlacingAds/AdsForm/UpdateAdsForm.cs similarity index 100% rename from WebsiteForPlacingAds/WebsiteForPlacingAds/UpdateAdsForm.cs rename to WebsiteForPlacingAds/WebsiteForPlacingAds/AdsForm/UpdateAdsForm.cs diff --git a/WebsiteForPlacingAds/WebsiteForPlacingAds/UpdateAdsForm.resx b/WebsiteForPlacingAds/WebsiteForPlacingAds/AdsForm/UpdateAdsForm.resx similarity index 100% rename from WebsiteForPlacingAds/WebsiteForPlacingAds/UpdateAdsForm.resx rename to WebsiteForPlacingAds/WebsiteForPlacingAds/AdsForm/UpdateAdsForm.resx diff --git a/WebsiteForPlacingAds/WebsiteForPlacingAds/CategoriesForm/CreateCategoriesForm.Designer.cs b/WebsiteForPlacingAds/WebsiteForPlacingAds/CategoriesForm/CreateCategoriesForm.Designer.cs new file mode 100644 index 0000000..d75018b --- /dev/null +++ b/WebsiteForPlacingAds/WebsiteForPlacingAds/CategoriesForm/CreateCategoriesForm.Designer.cs @@ -0,0 +1,86 @@ +namespace WebsiteForPlacingAds +{ + partial class CreateCategoriesForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.buttonCreateCategory = new System.Windows.Forms.Button(); + this.labelName = new System.Windows.Forms.Label(); + this.textBoxName = new System.Windows.Forms.TextBox(); + this.SuspendLayout(); + // + // buttonCreateCategory + // + this.buttonCreateCategory.Location = new System.Drawing.Point(43, 70); + this.buttonCreateCategory.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.buttonCreateCategory.Name = "buttonCreateCategory"; + this.buttonCreateCategory.Size = new System.Drawing.Size(239, 29); + this.buttonCreateCategory.TabIndex = 0; + this.buttonCreateCategory.Text = "Добавить категорию"; + this.buttonCreateCategory.UseVisualStyleBackColor = true; + this.buttonCreateCategory.Click += new System.EventHandler(this.buttonCreateCategory_Click); + // + // labelName + // + this.labelName.AutoSize = true; + this.labelName.Location = new System.Drawing.Point(43, 8); + this.labelName.Name = "labelName"; + this.labelName.Size = new System.Drawing.Size(59, 15); + this.labelName.TabIndex = 1; + this.labelName.Text = "Название"; + // + // textBoxName + // + this.textBoxName.Location = new System.Drawing.Point(43, 26); + this.textBoxName.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.textBoxName.Name = "textBoxName"; + this.textBoxName.Size = new System.Drawing.Size(239, 23); + this.textBoxName.TabIndex = 2; + // + // CreateCategoriesForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(324, 127); + this.Controls.Add(this.textBoxName); + this.Controls.Add(this.labelName); + this.Controls.Add(this.buttonCreateCategory); + this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.Name = "CreateCategoriesForm"; + this.Text = "Категория"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private Button buttonCreateCategory; + private Label labelName; + private TextBox textBoxName; + } +} \ No newline at end of file diff --git a/WebsiteForPlacingAds/WebsiteForPlacingAds/CategoriesForm/CreateCategoriesForm.cs b/WebsiteForPlacingAds/WebsiteForPlacingAds/CategoriesForm/CreateCategoriesForm.cs new file mode 100644 index 0000000..45d9b9a --- /dev/null +++ b/WebsiteForPlacingAds/WebsiteForPlacingAds/CategoriesForm/CreateCategoriesForm.cs @@ -0,0 +1,29 @@ +using System.Data; + +namespace WebsiteForPlacingAds +{ + public partial class CreateCategoriesForm : Form + { + IDatabaseLogic databaseLogic; + public CreateCategoriesForm(IDatabaseLogic databaseLogic) + { + InitializeComponent(); + this.databaseLogic = databaseLogic; + } + + private void buttonCreateCategory_Click(object sender, EventArgs e) + { + string name = textBoxName.Text; + + try + { + databaseLogic.insertInto("categories", $"'{name}'"); + MessageBox.Show("!"); + } + catch (Exception ex) + { + MessageBox.Show(" "); + } + } + } +} \ No newline at end of file diff --git a/WebsiteForPlacingAds/WebsiteForPlacingAds/CategoriesForm/CreateCategoriesForm.resx b/WebsiteForPlacingAds/WebsiteForPlacingAds/CategoriesForm/CreateCategoriesForm.resx new file mode 100644 index 0000000..f298a7b --- /dev/null +++ b/WebsiteForPlacingAds/WebsiteForPlacingAds/CategoriesForm/CreateCategoriesForm.resx @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/WebsiteForPlacingAds/WebsiteForPlacingAds/CategoriesForm/DeleteCategoriesForm.Designer.cs b/WebsiteForPlacingAds/WebsiteForPlacingAds/CategoriesForm/DeleteCategoriesForm.Designer.cs new file mode 100644 index 0000000..344c0b8 --- /dev/null +++ b/WebsiteForPlacingAds/WebsiteForPlacingAds/CategoriesForm/DeleteCategoriesForm.Designer.cs @@ -0,0 +1,87 @@ +namespace WebsiteForPlacingAds +{ + partial class DeleteCategoriesForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.buttonDeleteCategory = new System.Windows.Forms.Button(); + this.comboBoxDeleteCategories = new System.Windows.Forms.ComboBox(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(70, 16); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(262, 15); + this.label1.TabIndex = 0; + this.label1.Text = "Выберите категорию, которую хотите удалить"; + // + // buttonDeleteCategory + // + this.buttonDeleteCategory.Location = new System.Drawing.Point(132, 85); + this.buttonDeleteCategory.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.buttonDeleteCategory.Name = "buttonDeleteCategory"; + this.buttonDeleteCategory.Size = new System.Drawing.Size(163, 28); + this.buttonDeleteCategory.TabIndex = 1; + this.buttonDeleteCategory.Text = "Удалить"; + this.buttonDeleteCategory.UseVisualStyleBackColor = true; + this.buttonDeleteCategory.Click += new System.EventHandler(this.buttonDeleteCategory_Click); + // + // comboBoxDeleteCategories + // + this.comboBoxDeleteCategories.FormattingEnabled = true; + this.comboBoxDeleteCategories.Location = new System.Drawing.Point(35, 48); + this.comboBoxDeleteCategories.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.comboBoxDeleteCategories.Name = "comboBoxDeleteCategories"; + this.comboBoxDeleteCategories.Size = new System.Drawing.Size(367, 23); + this.comboBoxDeleteCategories.TabIndex = 2; + // + // DeleteCategoriesForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(442, 131); + this.Controls.Add(this.comboBoxDeleteCategories); + this.Controls.Add(this.buttonDeleteCategory); + this.Controls.Add(this.label1); + this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.Name = "DeleteCategoriesForm"; + this.Text = "Удалить категорию"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private Label label1; + private Button buttonDeleteCategory; + private ComboBox comboBoxDeleteCategories; + } +} \ No newline at end of file diff --git a/WebsiteForPlacingAds/WebsiteForPlacingAds/CategoriesForm/DeleteCategoriesForm.cs b/WebsiteForPlacingAds/WebsiteForPlacingAds/CategoriesForm/DeleteCategoriesForm.cs new file mode 100644 index 0000000..0b31b36 --- /dev/null +++ b/WebsiteForPlacingAds/WebsiteForPlacingAds/CategoriesForm/DeleteCategoriesForm.cs @@ -0,0 +1,55 @@ +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 DeleteCategoriesForm : Form + { + IDatabaseLogic databaseLogic; + private int setval_seq; + public DeleteCategoriesForm(IDatabaseLogic databaseLogic) + { + InitializeComponent(); + this.databaseLogic = databaseLogic; + LoadData(); + } + + private void buttonDeleteCategory_Click(object sender, EventArgs e) + { + string[] categories = comboBoxDeleteCategories.SelectedItem.ToString().Split("|"); + string category_id = categories[0].Trim(); + try + { + databaseLogic.deleteEntry("categories", int.Parse(category_id)); + LoadData(); + databaseLogic.reduceSeq("seq_categories", setval_seq); + MessageBox.Show("Удалено!"); + } + catch (Exception ex) + { + MessageBox.Show("Не удалось удалить"); + } + } + public void LoadData() + { + comboBoxDeleteCategories.Items.Clear(); + DataTable result = databaseLogic.getAllEntry("Categories"); + setval_seq = result.Rows.Count; + string Categories = ""; + for (int i = 0; i < result.Rows.Count; i++) + { + if (i == result.Rows.Count - 1) setval_seq = Convert.ToInt32(databaseLogic.getRowTableById(result, "categories_id", i)); + Categories = databaseLogic.getRowTableById(result, "categories_id", i).ToString() + " | " + + databaseLogic.getRowTableById(result, "name", i).ToString() + "\n"; + comboBoxDeleteCategories.Items.Add(Categories); + } + } + } +} diff --git a/WebsiteForPlacingAds/WebsiteForPlacingAds/CategoriesForm/DeleteCategoriesForm.resx b/WebsiteForPlacingAds/WebsiteForPlacingAds/CategoriesForm/DeleteCategoriesForm.resx new file mode 100644 index 0000000..f298a7b --- /dev/null +++ b/WebsiteForPlacingAds/WebsiteForPlacingAds/CategoriesForm/DeleteCategoriesForm.resx @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/WebsiteForPlacingAds/WebsiteForPlacingAds/CategoriesForm/ListCategoriesForm.Designer.cs b/WebsiteForPlacingAds/WebsiteForPlacingAds/CategoriesForm/ListCategoriesForm.Designer.cs new file mode 100644 index 0000000..589ddeb --- /dev/null +++ b/WebsiteForPlacingAds/WebsiteForPlacingAds/CategoriesForm/ListCategoriesForm.Designer.cs @@ -0,0 +1,75 @@ +namespace WebsiteForPlacingAds +{ + partial class ListCategoriesForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.labelListCategories = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.BackColor = System.Drawing.SystemColors.Control; + this.label1.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this.label1.Location = new System.Drawing.Point(10, 7); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(134, 20); + this.label1.TabIndex = 0; + this.label1.Text = "Список категорий"; + // + // labelListCategories + // + this.labelListCategories.AutoSize = true; + this.labelListCategories.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this.labelListCategories.Location = new System.Drawing.Point(10, 35); + this.labelListCategories.Name = "labelListCategories"; + this.labelListCategories.Size = new System.Drawing.Size(0, 19); + this.labelListCategories.TabIndex = 1; + // + // ListCategoriesForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(700, 338); + this.Controls.Add(this.labelListCategories); + this.Controls.Add(this.label1); + this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.Name = "ListCategoriesForm"; + this.Text = "Список категорий"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private Label label1; + private Label labelListCategories; + } +} \ No newline at end of file diff --git a/WebsiteForPlacingAds/WebsiteForPlacingAds/CategoriesForm/ListCategoriesForm.cs b/WebsiteForPlacingAds/WebsiteForPlacingAds/CategoriesForm/ListCategoriesForm.cs new file mode 100644 index 0000000..254d088 --- /dev/null +++ b/WebsiteForPlacingAds/WebsiteForPlacingAds/CategoriesForm/ListCategoriesForm.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using System.Windows.Forms.VisualStyles; + +namespace WebsiteForPlacingAds +{ + public partial class ListCategoriesForm : Form + { + IDatabaseLogic databaseLogic; + public ListCategoriesForm(IDatabaseLogic databaseLogic) + { + InitializeComponent(); + this.databaseLogic = databaseLogic; + LoadData(); + } + + private void LoadData() + { + DataTable result = databaseLogic.getAllEntry("Categories"); + string listCategories = ""; + for (int i = 0; i < result.Rows.Count; i++) + { + listCategories += databaseLogic.getRowTableById(result, "categories_id", i).ToString() + " | " + + databaseLogic.getRowTableById(result, "name", i).ToString() + "\n"; + } + labelListCategories.Text = listCategories; + } + } +} diff --git a/WebsiteForPlacingAds/WebsiteForPlacingAds/CategoriesForm/ListCategoriesForm.resx b/WebsiteForPlacingAds/WebsiteForPlacingAds/CategoriesForm/ListCategoriesForm.resx new file mode 100644 index 0000000..f298a7b --- /dev/null +++ b/WebsiteForPlacingAds/WebsiteForPlacingAds/CategoriesForm/ListCategoriesForm.resx @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/WebsiteForPlacingAds/WebsiteForPlacingAds/CategoriesForm/UpdateCategoriesForm.Designer.cs b/WebsiteForPlacingAds/WebsiteForPlacingAds/CategoriesForm/UpdateCategoriesForm.Designer.cs new file mode 100644 index 0000000..6d9452e --- /dev/null +++ b/WebsiteForPlacingAds/WebsiteForPlacingAds/CategoriesForm/UpdateCategoriesForm.Designer.cs @@ -0,0 +1,110 @@ +namespace WebsiteForPlacingAds +{ + partial class UpdateCategoriesForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.comboBoxUpdateCategory = new System.Windows.Forms.ComboBox(); + this.textBoxName = new System.Windows.Forms.TextBox(); + this.labelName = new System.Windows.Forms.Label(); + this.buttonUpdateCategory = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(51, 15); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(271, 15); + this.label1.TabIndex = 33; + this.label1.Text = "Выберите категорию, которую хотите обновить"; + // + // comboBoxUpdateCategory + // + this.comboBoxUpdateCategory.FormattingEnabled = true; + this.comboBoxUpdateCategory.Location = new System.Drawing.Point(10, 39); + this.comboBoxUpdateCategory.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.comboBoxUpdateCategory.Name = "comboBoxUpdateCategory"; + this.comboBoxUpdateCategory.Size = new System.Drawing.Size(377, 23); + this.comboBoxUpdateCategory.TabIndex = 34; + this.comboBoxUpdateCategory.SelectedIndexChanged += new System.EventHandler(this.comboBoxUpdateCategory_SelectedIndexChanged); + // + // textBoxName + // + this.textBoxName.Location = new System.Drawing.Point(78, 96); + this.textBoxName.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.textBoxName.Name = "textBoxName"; + this.textBoxName.Size = new System.Drawing.Size(239, 23); + this.textBoxName.TabIndex = 37; + // + // labelName + // + this.labelName.AutoSize = true; + this.labelName.Location = new System.Drawing.Point(78, 78); + this.labelName.Name = "labelName"; + this.labelName.Size = new System.Drawing.Size(59, 15); + this.labelName.TabIndex = 36; + this.labelName.Text = "Название"; + // + // buttonUpdateCategory + // + this.buttonUpdateCategory.Location = new System.Drawing.Point(78, 140); + this.buttonUpdateCategory.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.buttonUpdateCategory.Name = "buttonUpdateCategory"; + this.buttonUpdateCategory.Size = new System.Drawing.Size(239, 29); + this.buttonUpdateCategory.TabIndex = 35; + this.buttonUpdateCategory.Text = "Обновить категорию"; + this.buttonUpdateCategory.UseVisualStyleBackColor = true; + this.buttonUpdateCategory.Click += new System.EventHandler(this.buttonUpdateCategory_Click_1); + // + // UpdateCategoriesForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(397, 190); + this.Controls.Add(this.textBoxName); + this.Controls.Add(this.labelName); + this.Controls.Add(this.buttonUpdateCategory); + this.Controls.Add(this.comboBoxUpdateCategory); + this.Controls.Add(this.label1); + this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.Name = "UpdateCategoriesForm"; + this.Text = "Обновить категорию"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + private Label label1; + private ComboBox comboBoxUpdateCategory; + private TextBox textBoxName; + private Label labelName; + private Button buttonUpdateCategory; + } +} \ No newline at end of file diff --git a/WebsiteForPlacingAds/WebsiteForPlacingAds/CategoriesForm/UpdateCategoriesForm.cs b/WebsiteForPlacingAds/WebsiteForPlacingAds/CategoriesForm/UpdateCategoriesForm.cs new file mode 100644 index 0000000..0813379 --- /dev/null +++ b/WebsiteForPlacingAds/WebsiteForPlacingAds/CategoriesForm/UpdateCategoriesForm.cs @@ -0,0 +1,80 @@ +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 UpdateCategoriesForm : Form + { + IDatabaseLogic databaseLogic; + public UpdateCategoriesForm(IDatabaseLogic databaseLogic) + { + InitializeComponent(); + this.databaseLogic = databaseLogic; + LoadData(); + } + public void LoadData() + { + comboBoxUpdateCategory.Items.Clear(); + DataTable result = databaseLogic.getAllEntry("Categories"); + string Categories = ""; + for (int i = 0; i < result.Rows.Count; i++) + { + Categories = result.Rows[i]["categories_id"].ToString() + " | " + + (string)result.Rows[i]["name"] + "\n"; + comboBoxUpdateCategory.Items.Add(Categories); + } + } + public void LoadDataSelectedItem(int categories_id) + { + DataTable result = databaseLogic.getEntryById("categories", categories_id); + textBoxName.Text = databaseLogic.getRowTableById(result, "name", 0).ToString(); + } + + private void comboBoxUpdateCategory_SelectedIndexChanged(object sender, EventArgs e) + { + string[] selectedItems = comboBoxUpdateCategory.SelectedItem.ToString().Split("|"); + int category_id = int.Parse(selectedItems[0].Trim()); + LoadDataSelectedItem(category_id); + } + + private void buttonUpdateCategory_Click_1(object sender, EventArgs e) + { + string[] selectedCategory = comboBoxUpdateCategory.SelectedItem.ToString().Split("|"); + int category_id = int.Parse(selectedCategory[0].Trim()); + + string query = $"UPDATE Categories SET "; + int len = query.Length; + + + string oldName = databaseLogic.getRowTableById("categories", "name", category_id).ToString(); + + string newName = textBoxName.Text; + + + query = oldName == newName ? query : query + $"name = '{newName}', "; + if (len != query.Length) + { + query = query.TrimEnd(' '); + query = query.TrimEnd(','); + query += $" WHERE Categories_ID = {category_id};"; + } + try + { + databaseLogic.ExecuteNonQuery(query); + MessageBox.Show("Данные успешно обновлены!"); + } + catch (Exception) + { + + MessageBox.Show("Данные не обновились"); + } + } + } +} diff --git a/WebsiteForPlacingAds/WebsiteForPlacingAds/CategoriesForm/UpdateCategoriesForm.resx b/WebsiteForPlacingAds/WebsiteForPlacingAds/CategoriesForm/UpdateCategoriesForm.resx new file mode 100644 index 0000000..f298a7b --- /dev/null +++ b/WebsiteForPlacingAds/WebsiteForPlacingAds/CategoriesForm/UpdateCategoriesForm.resx @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/WebsiteForPlacingAds/WebsiteForPlacingAds/ClientsForm/CreateClientsForm.Designer.cs b/WebsiteForPlacingAds/WebsiteForPlacingAds/ClientsForm/CreateClientsForm.Designer.cs new file mode 100644 index 0000000..c4aded6 --- /dev/null +++ b/WebsiteForPlacingAds/WebsiteForPlacingAds/ClientsForm/CreateClientsForm.Designer.cs @@ -0,0 +1,224 @@ +namespace WebsiteForPlacingAds +{ + partial class CreateClientsForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.buttonCreateClient = new System.Windows.Forms.Button(); + this.labelName = new System.Windows.Forms.Label(); + this.textBoxName = new System.Windows.Forms.TextBox(); + this.textBoxSurname = new System.Windows.Forms.TextBox(); + this.labelSurname = new System.Windows.Forms.Label(); + this.textBoxPatronymic = new System.Windows.Forms.TextBox(); + this.labelPatronymic = new System.Windows.Forms.Label(); + this.labelRating = new System.Windows.Forms.Label(); + this.labelDate = new System.Windows.Forms.Label(); + this.textBoxEmail = new System.Windows.Forms.TextBox(); + this.labelEmail = new System.Windows.Forms.Label(); + this.labelPhoneNumber = new System.Windows.Forms.Label(); + this.textBoxPhoneNumber = new System.Windows.Forms.TextBox(); + this.textBoxDate = new System.Windows.Forms.TextBox(); + this.textBoxRating = new System.Windows.Forms.TextBox(); + this.SuspendLayout(); + // + // buttonCreateClient + // + this.buttonCreateClient.Location = new System.Drawing.Point(43, 346); + this.buttonCreateClient.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.buttonCreateClient.Name = "buttonCreateClient"; + this.buttonCreateClient.Size = new System.Drawing.Size(239, 29); + this.buttonCreateClient.TabIndex = 0; + this.buttonCreateClient.Text = "Создать клиента"; + this.buttonCreateClient.UseVisualStyleBackColor = true; + this.buttonCreateClient.Click += new System.EventHandler(this.buttonCreateClient_Click); + // + // labelName + // + this.labelName.AutoSize = true; + this.labelName.Location = new System.Drawing.Point(43, 8); + this.labelName.Name = "labelName"; + this.labelName.Size = new System.Drawing.Size(31, 15); + this.labelName.TabIndex = 1; + this.labelName.Text = "Имя"; + // + // textBoxName + // + this.textBoxName.Location = new System.Drawing.Point(43, 26); + this.textBoxName.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.textBoxName.Name = "textBoxName"; + this.textBoxName.Size = new System.Drawing.Size(239, 23); + this.textBoxName.TabIndex = 2; + // + // textBoxSurname + // + this.textBoxSurname.Location = new System.Drawing.Point(43, 72); + this.textBoxSurname.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.textBoxSurname.Name = "textBoxSurname"; + this.textBoxSurname.Size = new System.Drawing.Size(239, 23); + this.textBoxSurname.TabIndex = 4; + // + // labelSurname + // + this.labelSurname.AutoSize = true; + this.labelSurname.Location = new System.Drawing.Point(43, 55); + this.labelSurname.Name = "labelSurname"; + this.labelSurname.Size = new System.Drawing.Size(58, 15); + this.labelSurname.TabIndex = 3; + this.labelSurname.Text = "Фамилия"; + // + // textBoxPatronymic + // + this.textBoxPatronymic.Location = new System.Drawing.Point(43, 118); + this.textBoxPatronymic.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.textBoxPatronymic.Name = "textBoxPatronymic"; + this.textBoxPatronymic.Size = new System.Drawing.Size(239, 23); + this.textBoxPatronymic.TabIndex = 6; + // + // labelPatronymic + // + this.labelPatronymic.AutoSize = true; + this.labelPatronymic.Location = new System.Drawing.Point(43, 101); + this.labelPatronymic.Name = "labelPatronymic"; + this.labelPatronymic.Size = new System.Drawing.Size(58, 15); + this.labelPatronymic.TabIndex = 5; + this.labelPatronymic.Text = "Отчество"; + // + // labelRating + // + this.labelRating.AutoSize = true; + this.labelRating.Location = new System.Drawing.Point(43, 291); + this.labelRating.Name = "labelRating"; + this.labelRating.Size = new System.Drawing.Size(51, 15); + this.labelRating.TabIndex = 11; + this.labelRating.Text = "Рейтинг"; + // + // labelDate + // + this.labelDate.AutoSize = true; + this.labelDate.Location = new System.Drawing.Point(43, 246); + this.labelDate.Name = "labelDate"; + this.labelDate.Size = new System.Drawing.Size(105, 15); + this.labelDate.TabIndex = 9; + this.labelDate.Text = "Дата регистрации"; + // + // textBoxEmail + // + this.textBoxEmail.Location = new System.Drawing.Point(43, 166); + this.textBoxEmail.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.textBoxEmail.Name = "textBoxEmail"; + this.textBoxEmail.Size = new System.Drawing.Size(239, 23); + this.textBoxEmail.TabIndex = 8; + // + // labelEmail + // + this.labelEmail.AutoSize = true; + this.labelEmail.Location = new System.Drawing.Point(43, 148); + this.labelEmail.Name = "labelEmail"; + this.labelEmail.Size = new System.Drawing.Size(41, 15); + this.labelEmail.TabIndex = 7; + this.labelEmail.Text = "Почта"; + // + // labelPhoneNumber + // + this.labelPhoneNumber.AutoSize = true; + this.labelPhoneNumber.Location = new System.Drawing.Point(43, 196); + this.labelPhoneNumber.Name = "labelPhoneNumber"; + this.labelPhoneNumber.Size = new System.Drawing.Size(101, 15); + this.labelPhoneNumber.TabIndex = 13; + this.labelPhoneNumber.Text = "Номер телефона"; + // + // textBoxPhoneNumber + // + this.textBoxPhoneNumber.Location = new System.Drawing.Point(43, 213); + this.textBoxPhoneNumber.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.textBoxPhoneNumber.Name = "textBoxPhoneNumber"; + this.textBoxPhoneNumber.Size = new System.Drawing.Size(239, 23); + this.textBoxPhoneNumber.TabIndex = 14; + // + // textBoxDate + // + this.textBoxDate.Location = new System.Drawing.Point(43, 263); + this.textBoxDate.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.textBoxDate.Name = "textBoxDate"; + this.textBoxDate.Size = new System.Drawing.Size(239, 23); + this.textBoxDate.TabIndex = 15; + // + // textBoxRating + // + this.textBoxRating.Location = new System.Drawing.Point(43, 308); + this.textBoxRating.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.textBoxRating.Name = "textBoxRating"; + this.textBoxRating.Size = new System.Drawing.Size(239, 23); + this.textBoxRating.TabIndex = 16; + // + // CreateClientsForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(324, 398); + this.Controls.Add(this.textBoxRating); + this.Controls.Add(this.textBoxDate); + this.Controls.Add(this.textBoxPhoneNumber); + this.Controls.Add(this.labelPhoneNumber); + this.Controls.Add(this.labelRating); + this.Controls.Add(this.labelDate); + this.Controls.Add(this.textBoxEmail); + this.Controls.Add(this.labelEmail); + this.Controls.Add(this.textBoxPatronymic); + this.Controls.Add(this.labelPatronymic); + this.Controls.Add(this.textBoxSurname); + this.Controls.Add(this.labelSurname); + this.Controls.Add(this.textBoxName); + this.Controls.Add(this.labelName); + this.Controls.Add(this.buttonCreateClient); + this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.Name = "CreateClientsForm"; + this.Text = "Клиенты"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private Button buttonCreateClient; + private Label labelName; + private TextBox textBoxName; + private TextBox textBoxSurname; + private Label labelSurname; + private TextBox textBoxPatronymic; + private Label labelPatronymic; + private Label labelRating; + private Label labelDate; + private TextBox textBoxEmail; + private Label labelEmail; + private Label labelPhoneNumber; + private TextBox textBoxPhoneNumber; + private TextBox textBoxDate; + private TextBox textBoxRating; + } +} \ No newline at end of file diff --git a/WebsiteForPlacingAds/WebsiteForPlacingAds/ClientsForm/CreateClientsForm.cs b/WebsiteForPlacingAds/WebsiteForPlacingAds/ClientsForm/CreateClientsForm.cs new file mode 100644 index 0000000..31bb9f0 --- /dev/null +++ b/WebsiteForPlacingAds/WebsiteForPlacingAds/ClientsForm/CreateClientsForm.cs @@ -0,0 +1,37 @@ +using System.Data; + +namespace WebsiteForPlacingAds +{ + public partial class CreateClientsForm : Form + { + //PostgreSqlDatabase psd; + IDatabaseLogic databaseLogic; + public CreateClientsForm(IDatabaseLogic databaseLogic) + { + InitializeComponent(); + this.databaseLogic = databaseLogic; + } + + private void buttonCreateClient_Click(object sender, EventArgs e) + { + string name = textBoxName.Text; + string surname = textBoxSurname.Text; + string patronymic = textBoxPatronymic.Text; + string email = textBoxEmail.Text; + string phoneNumber = textBoxPhoneNumber.Text; + string date = textBoxDate.Text; + string rating = textBoxRating.Text; + + try + { + if (patronymic != null) databaseLogic.insertInto("clients", $"'{name}'", $"'{surname}'", $"'{patronymic}'", $"'{email}'", $"{phoneNumber}", $"'{date}'", $"{rating}"); + else databaseLogic.insertInto("clients", $"'{name}'", $"'{surname}'", $"{patronymic}", $"'{email}'", $"{phoneNumber}", $"'{date}'", $"{rating}"); + MessageBox.Show("!"); + } + catch (Exception ex) + { + MessageBox.Show(" "); + } + } + } +} \ No newline at end of file diff --git a/WebsiteForPlacingAds/WebsiteForPlacingAds/ClientsForm/CreateClientsForm.resx b/WebsiteForPlacingAds/WebsiteForPlacingAds/ClientsForm/CreateClientsForm.resx new file mode 100644 index 0000000..f298a7b --- /dev/null +++ b/WebsiteForPlacingAds/WebsiteForPlacingAds/ClientsForm/CreateClientsForm.resx @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/WebsiteForPlacingAds/WebsiteForPlacingAds/ClientsForm/DeleteClientsForm.Designer.cs b/WebsiteForPlacingAds/WebsiteForPlacingAds/ClientsForm/DeleteClientsForm.Designer.cs new file mode 100644 index 0000000..dcacef2 --- /dev/null +++ b/WebsiteForPlacingAds/WebsiteForPlacingAds/ClientsForm/DeleteClientsForm.Designer.cs @@ -0,0 +1,87 @@ +namespace WebsiteForPlacingAds +{ + partial class DeleteClientsForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.buttonDeleteClient = new System.Windows.Forms.Button(); + this.comboBoxDeleteClients = new System.Windows.Forms.ComboBox(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(70, 16); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(266, 15); + this.label1.TabIndex = 0; + this.label1.Text = "Выберите объявление, которое хотите удалить"; + // + // buttonDeleteClient + // + this.buttonDeleteClient.Location = new System.Drawing.Point(132, 85); + this.buttonDeleteClient.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.buttonDeleteClient.Name = "buttonDeleteClient"; + this.buttonDeleteClient.Size = new System.Drawing.Size(163, 28); + this.buttonDeleteClient.TabIndex = 1; + this.buttonDeleteClient.Text = "Удалить"; + this.buttonDeleteClient.UseVisualStyleBackColor = true; + this.buttonDeleteClient.Click += new System.EventHandler(this.buttonDeleteAd_Click); + // + // comboBoxDeleteClients + // + this.comboBoxDeleteClients.FormattingEnabled = true; + this.comboBoxDeleteClients.Location = new System.Drawing.Point(35, 48); + this.comboBoxDeleteClients.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.comboBoxDeleteClients.Name = "comboBoxDeleteClients"; + this.comboBoxDeleteClients.Size = new System.Drawing.Size(367, 23); + this.comboBoxDeleteClients.TabIndex = 2; + // + // DeleteClientsForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(442, 131); + this.Controls.Add(this.comboBoxDeleteClients); + this.Controls.Add(this.buttonDeleteClient); + this.Controls.Add(this.label1); + this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.Name = "DeleteClientsForm"; + this.Text = "Удалить объявление"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private Label label1; + private Button buttonDeleteClient; + private ComboBox comboBoxDeleteClients; + } +} \ No newline at end of file diff --git a/WebsiteForPlacingAds/WebsiteForPlacingAds/ClientsForm/DeleteClientsForm.cs b/WebsiteForPlacingAds/WebsiteForPlacingAds/ClientsForm/DeleteClientsForm.cs new file mode 100644 index 0000000..d4df5d6 --- /dev/null +++ b/WebsiteForPlacingAds/WebsiteForPlacingAds/ClientsForm/DeleteClientsForm.cs @@ -0,0 +1,63 @@ +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 DeleteClientsForm : Form + { + IDatabaseLogic databaseLogic; + private int setval_seq; + public DeleteClientsForm(IDatabaseLogic databaseLogic) + { + InitializeComponent(); + this.databaseLogic = databaseLogic; + LoadData(); + } + + private void buttonDeleteAd_Click(object sender, EventArgs e) + { + string[] clients = comboBoxDeleteClients.SelectedItem.ToString().Split("|"); + string client_id = clients[0].Trim(); + //string query = $"DELETE FROM ADS WHERE ads_id = {ad_id}"; + //string query_seq_reduction = $"SELECT setval('seq_ads', {setval_seq - 1});"; + try + { + databaseLogic.deleteEntry("clients", int.Parse(client_id)); + LoadData(); + databaseLogic.reduceSeq("seq_clients", setval_seq); + MessageBox.Show("Удалено!"); + } + catch (Exception ex) + { + MessageBox.Show("Не удалось удалить"); + } + } + public void LoadData() + { + comboBoxDeleteClients.Items.Clear(); + DataTable result = databaseLogic.getAllEntry("Clients"); + setval_seq = result.Rows.Count; + string Clients = ""; + for (int i = 0; i < result.Rows.Count; i++) + { + if (i == result.Rows.Count - 1) setval_seq = Convert.ToInt32(databaseLogic.getRowTableById(result, "clients_id", i)); + Clients = databaseLogic.getRowTableById(result, "clients_id", i).ToString() + " | " + + databaseLogic.getRowTableById(result, "name", i).ToString() + " | " + + databaseLogic.getRowTableById(result, "surname", i).ToString() + " | " + + databaseLogic.getRowTableById(result, "patronymic", i).ToString() + " | " + + databaseLogic.getRowTableById(result, "email", i).ToString() + " | " + + databaseLogic.getRowTableById(result, "phone_number", i).ToString() + " | " + + ((DateTime)databaseLogic.getRowTableById(result, "registration_date", i)).ToString("dd.MM.yyy") + " | " + + databaseLogic.getRowTableById(result, "rating", i).ToString() + "\n"; + comboBoxDeleteClients.Items.Add(Clients); + } + } + } +} diff --git a/WebsiteForPlacingAds/WebsiteForPlacingAds/ClientsForm/DeleteClientsForm.resx b/WebsiteForPlacingAds/WebsiteForPlacingAds/ClientsForm/DeleteClientsForm.resx new file mode 100644 index 0000000..f298a7b --- /dev/null +++ b/WebsiteForPlacingAds/WebsiteForPlacingAds/ClientsForm/DeleteClientsForm.resx @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/WebsiteForPlacingAds/WebsiteForPlacingAds/ClientsForm/ListClientsForm.Designer.cs b/WebsiteForPlacingAds/WebsiteForPlacingAds/ClientsForm/ListClientsForm.Designer.cs new file mode 100644 index 0000000..48c2e6f --- /dev/null +++ b/WebsiteForPlacingAds/WebsiteForPlacingAds/ClientsForm/ListClientsForm.Designer.cs @@ -0,0 +1,75 @@ +namespace WebsiteForPlacingAds +{ + partial class ListClientsForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.labelListClients = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.BackColor = System.Drawing.SystemColors.Control; + this.label1.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this.label1.Location = new System.Drawing.Point(10, 7); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(127, 20); + this.label1.TabIndex = 0; + this.label1.Text = "Список клиентов"; + // + // labelListClients + // + this.labelListClients.AutoSize = true; + this.labelListClients.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this.labelListClients.Location = new System.Drawing.Point(10, 35); + this.labelListClients.Name = "labelListClients"; + this.labelListClients.Size = new System.Drawing.Size(0, 19); + this.labelListClients.TabIndex = 1; + // + // ListClientsForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(700, 338); + this.Controls.Add(this.labelListClients); + this.Controls.Add(this.label1); + this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.Name = "ListClientsForm"; + this.Text = "Список клиентов"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private Label label1; + private Label labelListClients; + } +} \ No newline at end of file diff --git a/WebsiteForPlacingAds/WebsiteForPlacingAds/ClientsForm/ListClientsForm.cs b/WebsiteForPlacingAds/WebsiteForPlacingAds/ClientsForm/ListClientsForm.cs new file mode 100644 index 0000000..53086d5 --- /dev/null +++ b/WebsiteForPlacingAds/WebsiteForPlacingAds/ClientsForm/ListClientsForm.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using System.Windows.Forms.VisualStyles; + +namespace WebsiteForPlacingAds +{ + public partial class ListClientsForm : Form + { + IDatabaseLogic databaseLogic; + public ListClientsForm(IDatabaseLogic databaseLogic) + { + InitializeComponent(); + this.databaseLogic = databaseLogic; + LoadData(); + } + + private void LoadData() + { + DataTable result = databaseLogic.getAllEntry("clients"); + string listClients = ""; + for (int i = 0; i < result.Rows.Count; i++) + { + listClients += databaseLogic.getRowTableById(result, "clients_id", i).ToString() + " | " + + databaseLogic.getRowTableById(result, "name", i).ToString() + " | " + + databaseLogic.getRowTableById(result, "surname", i).ToString() + " | " + + databaseLogic.getRowTableById(result, "patronymic", i).ToString() + " | " + + databaseLogic.getRowTableById(result, "email", i).ToString() + " | " + + databaseLogic.getRowTableById(result, "phone_number", i).ToString() + " | " + + ((DateTime)databaseLogic.getRowTableById(result, "registration_date", i)).ToString("dd.MM.yyy") + " | " + + databaseLogic.getRowTableById(result, "rating", i).ToString() + "\n"; + } + labelListClients.Text = listClients; + } + } +} diff --git a/WebsiteForPlacingAds/WebsiteForPlacingAds/ClientsForm/ListClientsForm.resx b/WebsiteForPlacingAds/WebsiteForPlacingAds/ClientsForm/ListClientsForm.resx new file mode 100644 index 0000000..f298a7b --- /dev/null +++ b/WebsiteForPlacingAds/WebsiteForPlacingAds/ClientsForm/ListClientsForm.resx @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/WebsiteForPlacingAds/WebsiteForPlacingAds/ClientsForm/UpdateClientsForm.Designer.cs b/WebsiteForPlacingAds/WebsiteForPlacingAds/ClientsForm/UpdateClientsForm.Designer.cs new file mode 100644 index 0000000..b63508a --- /dev/null +++ b/WebsiteForPlacingAds/WebsiteForPlacingAds/ClientsForm/UpdateClientsForm.Designer.cs @@ -0,0 +1,248 @@ +namespace WebsiteForPlacingAds +{ + partial class UpdateClientsForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.buttonUpdateClient = new System.Windows.Forms.Button(); + this.label1 = new System.Windows.Forms.Label(); + this.comboBoxUpdateClient = new System.Windows.Forms.ComboBox(); + this.textBoxRating = new System.Windows.Forms.TextBox(); + this.textBoxDate = new System.Windows.Forms.TextBox(); + this.textBoxPhoneNumber = new System.Windows.Forms.TextBox(); + this.labelPhoneNumber = new System.Windows.Forms.Label(); + this.labelRating = new System.Windows.Forms.Label(); + this.labelDate = new System.Windows.Forms.Label(); + this.textBoxEmail = new System.Windows.Forms.TextBox(); + this.labelEmail = new System.Windows.Forms.Label(); + this.textBoxPatronymic = new System.Windows.Forms.TextBox(); + this.labelPatronymic = new System.Windows.Forms.Label(); + this.textBoxSurname = new System.Windows.Forms.TextBox(); + this.labelSurname = new System.Windows.Forms.Label(); + this.textBoxName = new System.Windows.Forms.TextBox(); + this.labelName = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // buttonUpdateClient + // + this.buttonUpdateClient.Location = new System.Drawing.Point(81, 407); + this.buttonUpdateClient.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.buttonUpdateClient.Name = "buttonUpdateClient"; + this.buttonUpdateClient.Size = new System.Drawing.Size(239, 29); + this.buttonUpdateClient.TabIndex = 18; + this.buttonUpdateClient.Text = "Обновить клиента"; + this.buttonUpdateClient.UseVisualStyleBackColor = true; + this.buttonUpdateClient.Click += new System.EventHandler(this.buttonUpdateClient_Click); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(51, 15); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(259, 15); + this.label1.TabIndex = 33; + this.label1.Text = "Выберите клиента, которого хотите обновить"; + // + // comboBoxUpdateAd + // + this.comboBoxUpdateClient.FormattingEnabled = true; + this.comboBoxUpdateClient.Location = new System.Drawing.Point(10, 39); + this.comboBoxUpdateClient.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.comboBoxUpdateClient.Name = "comboBoxUpdateAd"; + this.comboBoxUpdateClient.Size = new System.Drawing.Size(377, 23); + this.comboBoxUpdateClient.TabIndex = 34; + this.comboBoxUpdateClient.SelectedIndexChanged += new System.EventHandler(this.comboBoxUpdateClient_SelectedIndexChanged); + // + // textBoxRating + // + this.textBoxRating.Location = new System.Drawing.Point(79, 371); + this.textBoxRating.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.textBoxRating.Name = "textBoxRating"; + this.textBoxRating.Size = new System.Drawing.Size(239, 23); + this.textBoxRating.TabIndex = 48; + // + // textBoxDate + // + this.textBoxDate.Location = new System.Drawing.Point(79, 326); + this.textBoxDate.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.textBoxDate.Name = "textBoxDate"; + this.textBoxDate.Size = new System.Drawing.Size(239, 23); + this.textBoxDate.TabIndex = 47; + // + // textBoxPhoneNumber + // + this.textBoxPhoneNumber.Location = new System.Drawing.Point(79, 276); + this.textBoxPhoneNumber.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.textBoxPhoneNumber.Name = "textBoxPhoneNumber"; + this.textBoxPhoneNumber.Size = new System.Drawing.Size(239, 23); + this.textBoxPhoneNumber.TabIndex = 46; + // + // labelPhoneNumber + // + this.labelPhoneNumber.AutoSize = true; + this.labelPhoneNumber.Location = new System.Drawing.Point(79, 259); + this.labelPhoneNumber.Name = "labelPhoneNumber"; + this.labelPhoneNumber.Size = new System.Drawing.Size(101, 15); + this.labelPhoneNumber.TabIndex = 45; + this.labelPhoneNumber.Text = "Номер телефона"; + // + // labelRating + // + this.labelRating.AutoSize = true; + this.labelRating.Location = new System.Drawing.Point(79, 354); + this.labelRating.Name = "labelRating"; + this.labelRating.Size = new System.Drawing.Size(51, 15); + this.labelRating.TabIndex = 44; + this.labelRating.Text = "Рейтинг"; + // + // labelDate + // + this.labelDate.AutoSize = true; + this.labelDate.Location = new System.Drawing.Point(79, 309); + this.labelDate.Name = "labelDate"; + this.labelDate.Size = new System.Drawing.Size(105, 15); + this.labelDate.TabIndex = 43; + this.labelDate.Text = "Дата регистрации"; + // + // textBoxEmail + // + this.textBoxEmail.Location = new System.Drawing.Point(79, 229); + this.textBoxEmail.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.textBoxEmail.Name = "textBoxEmail"; + this.textBoxEmail.Size = new System.Drawing.Size(239, 23); + this.textBoxEmail.TabIndex = 42; + // + // labelEmail + // + this.labelEmail.AutoSize = true; + this.labelEmail.Location = new System.Drawing.Point(79, 211); + this.labelEmail.Name = "labelEmail"; + this.labelEmail.Size = new System.Drawing.Size(41, 15); + this.labelEmail.TabIndex = 41; + this.labelEmail.Text = "Почта"; + // + // textBoxPatronymic + // + this.textBoxPatronymic.Location = new System.Drawing.Point(79, 181); + this.textBoxPatronymic.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.textBoxPatronymic.Name = "textBoxPatronymic"; + this.textBoxPatronymic.Size = new System.Drawing.Size(239, 23); + this.textBoxPatronymic.TabIndex = 40; + // + // labelPatronymic + // + this.labelPatronymic.AutoSize = true; + this.labelPatronymic.Location = new System.Drawing.Point(79, 164); + this.labelPatronymic.Name = "labelPatronymic"; + this.labelPatronymic.Size = new System.Drawing.Size(58, 15); + this.labelPatronymic.TabIndex = 39; + this.labelPatronymic.Text = "Отчество"; + // + // textBoxSurname + // + this.textBoxSurname.Location = new System.Drawing.Point(79, 135); + this.textBoxSurname.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.textBoxSurname.Name = "textBoxSurname"; + this.textBoxSurname.Size = new System.Drawing.Size(239, 23); + this.textBoxSurname.TabIndex = 38; + // + // labelSurname + // + this.labelSurname.AutoSize = true; + this.labelSurname.Location = new System.Drawing.Point(79, 118); + this.labelSurname.Name = "labelSurname"; + this.labelSurname.Size = new System.Drawing.Size(58, 15); + this.labelSurname.TabIndex = 37; + this.labelSurname.Text = "Фамилия"; + // + // textBoxName + // + this.textBoxName.Location = new System.Drawing.Point(79, 89); + this.textBoxName.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.textBoxName.Name = "textBoxName"; + this.textBoxName.Size = new System.Drawing.Size(239, 23); + this.textBoxName.TabIndex = 36; + // + // labelName + // + this.labelName.AutoSize = true; + this.labelName.Location = new System.Drawing.Point(79, 71); + this.labelName.Name = "labelName"; + this.labelName.Size = new System.Drawing.Size(31, 15); + this.labelName.TabIndex = 35; + this.labelName.Text = "Имя"; + // + // UpdateClientsForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(397, 464); + this.Controls.Add(this.textBoxRating); + this.Controls.Add(this.textBoxDate); + this.Controls.Add(this.textBoxPhoneNumber); + this.Controls.Add(this.labelPhoneNumber); + this.Controls.Add(this.labelRating); + this.Controls.Add(this.labelDate); + this.Controls.Add(this.textBoxEmail); + this.Controls.Add(this.labelEmail); + this.Controls.Add(this.textBoxPatronymic); + this.Controls.Add(this.labelPatronymic); + this.Controls.Add(this.textBoxSurname); + this.Controls.Add(this.labelSurname); + this.Controls.Add(this.textBoxName); + this.Controls.Add(this.labelName); + this.Controls.Add(this.comboBoxUpdateClient); + this.Controls.Add(this.label1); + this.Controls.Add(this.buttonUpdateClient); + this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.Name = "UpdateClientsForm"; + this.Text = "Обновить клиента"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + private Button buttonUpdateClient; + private Label label1; + private ComboBox comboBoxUpdateClient; + private TextBox textBoxRating; + private TextBox textBoxDate; + private TextBox textBoxPhoneNumber; + private Label labelPhoneNumber; + private Label labelRating; + private Label labelDate; + private TextBox textBoxEmail; + private Label labelEmail; + private TextBox textBoxPatronymic; + private Label labelPatronymic; + private TextBox textBoxSurname; + private Label labelSurname; + private TextBox textBoxName; + private Label labelName; + } +} \ No newline at end of file diff --git a/WebsiteForPlacingAds/WebsiteForPlacingAds/ClientsForm/UpdateClientsForm.cs b/WebsiteForPlacingAds/WebsiteForPlacingAds/ClientsForm/UpdateClientsForm.cs new file mode 100644 index 0000000..7bffade --- /dev/null +++ b/WebsiteForPlacingAds/WebsiteForPlacingAds/ClientsForm/UpdateClientsForm.cs @@ -0,0 +1,110 @@ +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 UpdateClientsForm : Form + { + IDatabaseLogic databaseLogic; + public UpdateClientsForm(IDatabaseLogic databaseLogic) + { + InitializeComponent(); + this.databaseLogic = databaseLogic; + LoadData(); + } + public void LoadData() + { + comboBoxUpdateClient.Items.Clear(); + DataTable result = databaseLogic.getAllEntry("Clients"); + string Clients = ""; + for (int i = 0; i < result.Rows.Count; i++) + { + Clients = result.Rows[i]["clients_id"].ToString() + " | " + + (string)result.Rows[i]["name"] + " | " + + result.Rows[i]["surname"].ToString() + " | " + + (string)result.Rows[i]["patronymic"] + " | " + + result.Rows[i]["email"].ToString() + " | " + + result.Rows[i]["phone_number"].ToString() + " | " + + ((DateTime)result.Rows[i]["registration_date"]).ToString("dd.MM.yyyy") + " | " + + result.Rows[i]["rating"].ToString() + "\n"; + comboBoxUpdateClient.Items.Add(Clients); + } + } + private void buttonUpdateClient_Click(object sender, EventArgs e) + { + string[] selectedClients = comboBoxUpdateClient.SelectedItem.ToString().Split("|"); + int clients_id = int.Parse(selectedClients[0].Trim()); + + string query = $"UPDATE clients SET "; + int len = query.Length; + + + string oldName = databaseLogic.getRowTableById("clients", "name", clients_id).ToString(); + string oldSurname = databaseLogic.getRowTableById("clients", "surname", clients_id).ToString(); + string oldPatronymic = databaseLogic.getRowTableById("clients", "patronymic", clients_id).ToString(); + string oldEmail = databaseLogic.getRowTableById("clients", "email", clients_id).ToString(); + string oldPhoneNumber = databaseLogic.getRowTableById("clients", "phone_number", clients_id).ToString(); + string oldDate = ((DateTime)databaseLogic.getRowTableById("clients", "registration_date", clients_id)).ToString("dd.MM.yyyy"); + string oldRating = databaseLogic.getRowTableById("clients", "rating", clients_id).ToString(); + + string newName = textBoxName.Text; + string newSurname = textBoxSurname.Text; + string newPatronymic = textBoxPatronymic.Text; + string newEmail = textBoxEmail.Text; + string newPhoneNumber = textBoxPhoneNumber.Text; + string newDate = textBoxDate.Text; + string newRating = textBoxRating.Text; + + + query = oldName == newName ? query : query + $"name = '{newName}', "; + query = oldSurname == newSurname ? query : query + $"surname = '{newSurname}', "; + query = oldPatronymic == newPatronymic ? query : query + $"patronymic = '{newPatronymic}', "; + query = oldEmail == newEmail ? query : query + $"email = '{newEmail}', "; + query = oldPhoneNumber == newPhoneNumber ? query : query + $"phone_number = {newPhoneNumber}, "; + query = oldDate == newDate ? query : query + $"registration_date = '{newDate}', "; + query = oldRating == newRating ? query : query + $"rating = {newRating}, "; + + if (len != query.Length) + { + query = query.TrimEnd(' '); + query = query.TrimEnd(','); + query += $" WHERE Clients_ID = {clients_id};"; + } + try + { + databaseLogic.ExecuteNonQuery(query); + MessageBox.Show("Данные успешно обновлены!"); + } + catch (Exception) + { + + MessageBox.Show("Данные не обновились"); + } + } + public void LoadDataSelectedItem(int clients_id) + { + DataTable result = databaseLogic.getEntryById("clients", clients_id); + textBoxName.Text = databaseLogic.getRowTableById(result, "name", 0).ToString(); + textBoxSurname.Text = databaseLogic.getRowTableById(result, "surname", 0).ToString(); + textBoxPatronymic.Text = databaseLogic.getRowTableById(result, "patronymic", 0).ToString(); + textBoxEmail.Text = databaseLogic.getRowTableById(result, "email", 0).ToString(); + textBoxPhoneNumber.Text = databaseLogic.getRowTableById(result, "phone_number", 0).ToString(); + textBoxDate.Text = ((DateTime)databaseLogic.getRowTableById(result, "registration_date", 0)).ToString("dd.MM.yyyy"); + textBoxRating.Text = databaseLogic.getRowTableById(result, "rating", 0).ToString(); + } + + private void comboBoxUpdateClient_SelectedIndexChanged(object sender, EventArgs e) + { + string[] selectedItems = comboBoxUpdateClient.SelectedItem.ToString().Split("|"); + int clients_id = int.Parse(selectedItems[0].Trim()); + LoadDataSelectedItem(clients_id); + } + } +} diff --git a/WebsiteForPlacingAds/WebsiteForPlacingAds/ClientsForm/UpdateClientsForm.resx b/WebsiteForPlacingAds/WebsiteForPlacingAds/ClientsForm/UpdateClientsForm.resx new file mode 100644 index 0000000..f298a7b --- /dev/null +++ b/WebsiteForPlacingAds/WebsiteForPlacingAds/ClientsForm/UpdateClientsForm.resx @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/WebsiteForPlacingAds/WebsiteForPlacingAds/DatabaseLogic.cs b/WebsiteForPlacingAds/WebsiteForPlacingAds/DatabaseLogic.cs index 99649e2..f48af26 100644 --- a/WebsiteForPlacingAds/WebsiteForPlacingAds/DatabaseLogic.cs +++ b/WebsiteForPlacingAds/WebsiteForPlacingAds/DatabaseLogic.cs @@ -15,12 +15,14 @@ namespace WebsiteForPlacingAds { this.database = database; } - public Object getRowTableById(string tableName, string columnName, int id) { return database.ExecuteQuery($"SELECT {columnName} FROM {tableName} WHERE {tableName}_id = {id}").Rows[0][$"{columnName}"]; } - + public Object getRowTableById(DataTable table, string columnName, int i) + { + return table.Rows[i][columnName]; + } public DataTable getEntryById(string tableName, int id) { return database.ExecuteQuery($"SELECT * FROM {tableName} WHERE {tableName}_id = {id}"); @@ -37,5 +39,23 @@ namespace WebsiteForPlacingAds { return database.ExecuteQuery($"SELECT * FROM {tableName}"); } + public void insertInto(string tableName, params string[] values) + { + string query = $"INSERT INTO {tableName} VALUES (nextval('seq_{tableName.ToLower()}'), "; + for (int i = 0; i < values.Length; i++) + { + if (i < values.Length - 1) query += $"{values[i]}, "; + else query += $"{values[i]})"; + } + database.ExecuteNonQuery(query); + } + public void deleteEntry(string tableName, int id) + { + database.ExecuteNonQuery($"DELETE FROM {tableName} WHERE {tableName}_id = {id}"); + } + public void reduceSeq(string seq, int currval) + { + database.ExecuteNonQuery($"SELECT setval('{seq}', {currval});"); + } } } diff --git a/WebsiteForPlacingAds/WebsiteForPlacingAds/IDatabaseLogic.cs b/WebsiteForPlacingAds/WebsiteForPlacingAds/IDatabaseLogic.cs index d01544d..ca300a2 100644 --- a/WebsiteForPlacingAds/WebsiteForPlacingAds/IDatabaseLogic.cs +++ b/WebsiteForPlacingAds/WebsiteForPlacingAds/IDatabaseLogic.cs @@ -11,8 +11,12 @@ namespace WebsiteForPlacingAds { public DataTable getEntryById(string tableName, int id); public Object getRowTableById(string tableName, string columnName, int id); + public Object getRowTableById(DataTable table, string columnName, int i); public DataTable ExecuteQuery(string query); public void ExecuteNonQuery(string query); DataTable getAllEntry(string tableName); + public void insertInto(string tableName, params string[] values); + public void deleteEntry(string tableName, int id); + public void reduceSeq(string seq, int currval); } } diff --git a/WebsiteForPlacingAds/WebsiteForPlacingAds/ListAdsForm.cs b/WebsiteForPlacingAds/WebsiteForPlacingAds/ListAdsForm.cs deleted file mode 100644 index 39898d4..0000000 --- a/WebsiteForPlacingAds/WebsiteForPlacingAds/ListAdsForm.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; -using System.Windows.Forms.VisualStyles; - -namespace WebsiteForPlacingAds -{ - public partial class ListAdsForm : Form - { - PostgreSqlDatabase psd; - public ListAdsForm(PostgreSqlDatabase psd) - { - InitializeComponent(); - this.psd = psd; - LoadData(); - } - - private void LoadData() - { - DataTable result = psd.ExecuteQuery("SELECT * FROM ADS"); - string listAds = ""; - for (int i = 0; i < result.Rows.Count; i++) - { - listAds += result.Rows[i]["ads_id"].ToString() + " | " + - (string)result.Rows[i]["heading"] + " | " + - result.Rows[i]["price"].ToString() + " | " + - ((DateTime)result.Rows[i]["date_of_placement"]).ToString("d") + " | " + - (string)result.Rows[i]["status"] + " | " + - result.Rows[i]["id_client"].ToString() + " | " + - result.Rows[i]["id_category"].ToString() + " | " + - result.Rows[i]["id_subcategory"].ToString() + "\n"; - } - labelListAds.Text = listAds; - } - } -} diff --git a/WebsiteForPlacingAds/WebsiteForPlacingAds/MainForm.Designer.cs b/WebsiteForPlacingAds/WebsiteForPlacingAds/MainForm.Designer.cs index 38f65a0..f7946d6 100644 --- a/WebsiteForPlacingAds/WebsiteForPlacingAds/MainForm.Designer.cs +++ b/WebsiteForPlacingAds/WebsiteForPlacingAds/MainForm.Designer.cs @@ -30,21 +30,21 @@ { 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.создатьПодкатеориюToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.удалитьПодкатегориюToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.изменитьПодкатегориюToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -62,7 +62,8 @@ 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.Padding = new System.Windows.Forms.Padding(5, 2, 0, 2); + this.menuStrip1.Size = new System.Drawing.Size(700, 24); this.menuStrip1.TabIndex = 0; this.menuStrip1.Text = "menuStrip1"; // @@ -74,9 +75,37 @@ this.изменитьДанныеКлиентаToolStripMenuItem, this.списокКлиентвToolStripMenuItem}); this.клиентыToolStripMenuItem.Name = "клиентыToolStripMenuItem"; - this.клиентыToolStripMenuItem.Size = new System.Drawing.Size(83, 24); + this.клиентыToolStripMenuItem.Size = new System.Drawing.Size(67, 20); this.клиентыToolStripMenuItem.Text = "Клиенты"; // + // создатьКлиентаToolStripMenuItem + // + this.создатьКлиентаToolStripMenuItem.Name = "создатьКлиентаToolStripMenuItem"; + this.создатьКлиентаToolStripMenuItem.Size = new System.Drawing.Size(219, 22); + this.создатьКлиентаToolStripMenuItem.Text = "Создать клиента"; + this.создатьКлиентаToolStripMenuItem.Click += new System.EventHandler(this.создатьКлиентаToolStripMenuItem_Click); + // + // удалитьКлиентаToolStripMenuItem + // + this.удалитьКлиентаToolStripMenuItem.Name = "удалитьКлиентаToolStripMenuItem"; + this.удалитьКлиентаToolStripMenuItem.Size = new System.Drawing.Size(219, 22); + this.удалитьКлиентаToolStripMenuItem.Text = "Удалить клиента"; + this.удалитьКлиентаToolStripMenuItem.Click += new System.EventHandler(this.удалитьКлиентаToolStripMenuItem_Click); + // + // изменитьДанныеКлиентаToolStripMenuItem + // + this.изменитьДанныеКлиентаToolStripMenuItem.Name = "изменитьДанныеКлиентаToolStripMenuItem"; + this.изменитьДанныеКлиентаToolStripMenuItem.Size = new System.Drawing.Size(219, 22); + this.изменитьДанныеКлиентаToolStripMenuItem.Text = "Изменить данные клиента"; + this.изменитьДанныеКлиентаToolStripMenuItem.Click += new System.EventHandler(this.изменитьДанныеКлиентаToolStripMenuItem_Click); + // + // списокКлиентвToolStripMenuItem + // + this.списокКлиентвToolStripMenuItem.Name = "списокКлиентвToolStripMenuItem"; + this.списокКлиентвToolStripMenuItem.Size = new System.Drawing.Size(219, 22); + this.списокКлиентвToolStripMenuItem.Text = "Список клиентов"; + this.списокКлиентвToolStripMenuItem.Click += new System.EventHandler(this.списокКлиентвToolStripMenuItem_Click); + // // объявленияToolStripMenuItem // this.объявленияToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -85,9 +114,37 @@ this.изменитьОбъявлениеэToolStripMenuItem, this.списокОбъявленийToolStripMenuItem}); this.объявленияToolStripMenuItem.Name = "объявленияToolStripMenuItem"; - this.объявленияToolStripMenuItem.Size = new System.Drawing.Size(110, 24); + this.объявленияToolStripMenuItem.Size = new System.Drawing.Size(87, 20); this.объявленияToolStripMenuItem.Text = "Объявления"; // + // создатьОбъявлениеToolStripMenuItem + // + this.создатьОбъявлениеToolStripMenuItem.Name = "создатьОбъявлениеToolStripMenuItem"; + this.создатьОбъявлениеToolStripMenuItem.Size = new System.Drawing.Size(197, 22); + this.создатьОбъявлениеToolStripMenuItem.Text = "Создать объявление"; + this.создатьОбъявлениеToolStripMenuItem.Click += new System.EventHandler(this.создатьОбъявлениеToolStripMenuItem_Click); + // + // удалитьОбъявлениеToolStripMenuItem + // + this.удалитьОбъявлениеToolStripMenuItem.Name = "удалитьОбъявлениеToolStripMenuItem"; + this.удалитьОбъявлениеToolStripMenuItem.Size = new System.Drawing.Size(197, 22); + this.удалитьОбъявлениеToolStripMenuItem.Text = "Удалить объявление"; + this.удалитьОбъявлениеToolStripMenuItem.Click += new System.EventHandler(this.удалитьОбъявлениеToolStripMenuItem_Click); + // + // изменитьОбъявлениеэToolStripMenuItem + // + this.изменитьОбъявлениеэToolStripMenuItem.Name = "изменитьОбъявлениеэToolStripMenuItem"; + this.изменитьОбъявлениеэToolStripMenuItem.Size = new System.Drawing.Size(197, 22); + this.изменитьОбъявлениеэToolStripMenuItem.Text = "Изменить объявление"; + this.изменитьОбъявлениеэToolStripMenuItem.Click += new System.EventHandler(this.изменитьОбъявлениеэToolStripMenuItem_Click); + // + // списокОбъявленийToolStripMenuItem + // + this.списокОбъявленийToolStripMenuItem.Name = "списокОбъявленийToolStripMenuItem"; + this.списокОбъявленийToolStripMenuItem.Size = new System.Drawing.Size(197, 22); + this.списокОбъявленийToolStripMenuItem.Text = "Список объявлений"; + this.списокОбъявленийToolStripMenuItem.Click += new System.EventHandler(this.списокОбъявленийToolStripMenuItem_Click); + // // категорииToolStripMenuItem // this.категорииToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -96,9 +153,37 @@ this.изменитьКатегориюToolStripMenuItem, this.списокКатегорийToolStripMenuItem}); this.категорииToolStripMenuItem.Name = "категорииToolStripMenuItem"; - this.категорииToolStripMenuItem.Size = new System.Drawing.Size(96, 24); + this.категорииToolStripMenuItem.Size = new System.Drawing.Size(76, 20); this.категорииToolStripMenuItem.Text = "Категории"; // + // создатьКатегориюToolStripMenuItem + // + this.создатьКатегориюToolStripMenuItem.Name = "создатьКатегориюToolStripMenuItem"; + this.создатьКатегориюToolStripMenuItem.Size = new System.Drawing.Size(190, 22); + this.создатьКатегориюToolStripMenuItem.Text = "Создать категорию"; + this.создатьКатегориюToolStripMenuItem.Click += new System.EventHandler(this.создатьКатегориюToolStripMenuItem_Click); + // + // удалитьКатегориюToolStripMenuItem + // + this.удалитьКатегориюToolStripMenuItem.Name = "удалитьКатегориюToolStripMenuItem"; + this.удалитьКатегориюToolStripMenuItem.Size = new System.Drawing.Size(190, 22); + this.удалитьКатегориюToolStripMenuItem.Text = "Удалить категорию"; + this.удалитьКатегориюToolStripMenuItem.Click += new System.EventHandler(this.удалитьКатегориюToolStripMenuItem_Click); + // + // изменитьКатегориюToolStripMenuItem + // + this.изменитьКатегориюToolStripMenuItem.Name = "изменитьКатегориюToolStripMenuItem"; + this.изменитьКатегориюToolStripMenuItem.Size = new System.Drawing.Size(190, 22); + this.изменитьКатегориюToolStripMenuItem.Text = "Изменить категорию"; + this.изменитьКатегориюToolStripMenuItem.Click += new System.EventHandler(this.изменитьКатегориюToolStripMenuItem_Click); + // + // списокКатегорийToolStripMenuItem + // + this.списокКатегорийToolStripMenuItem.Name = "списокКатегорийToolStripMenuItem"; + this.списокКатегорийToolStripMenuItem.Size = new System.Drawing.Size(190, 22); + this.списокКатегорийToolStripMenuItem.Text = "Список категорий"; + this.списокКатегорийToolStripMenuItem.Click += new System.EventHandler(this.списокКатегорийToolStripMenuItem_Click); + // // подкатегорииToolStripMenuItem // this.подкатегорииToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -107,119 +192,45 @@ this.изменитьПодкатегориюToolStripMenuItem, this.списокПодкатегоийToolStripMenuItem}); this.подкатегорииToolStripMenuItem.Name = "подкатегорииToolStripMenuItem"; - this.подкатегорииToolStripMenuItem.Size = new System.Drawing.Size(122, 24); + this.подкатегорииToolStripMenuItem.Size = new System.Drawing.Size(97, 20); 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.Size = new System.Drawing.Size(210, 22); this.создатьПодкатеориюToolStripMenuItem.Text = "Создать подкатегорию"; + this.создатьПодкатеориюToolStripMenuItem.Click += new System.EventHandler(this.создатьПодкатеориюToolStripMenuItem_Click); // // удалитьПодкатегориюToolStripMenuItem // this.удалитьПодкатегориюToolStripMenuItem.Name = "удалитьПодкатегориюToolStripMenuItem"; - this.удалитьПодкатегориюToolStripMenuItem.Size = new System.Drawing.Size(265, 26); + this.удалитьПодкатегориюToolStripMenuItem.Size = new System.Drawing.Size(210, 22); this.удалитьПодкатегориюToolStripMenuItem.Text = "Удалить подкатегорию"; + this.удалитьПодкатегориюToolStripMenuItem.Click += new System.EventHandler(this.удалитьПодкатегориюToolStripMenuItem_Click); // // изменитьПодкатегориюToolStripMenuItem // this.изменитьПодкатегориюToolStripMenuItem.Name = "изменитьПодкатегориюToolStripMenuItem"; - this.изменитьПодкатегориюToolStripMenuItem.Size = new System.Drawing.Size(265, 26); + this.изменитьПодкатегориюToolStripMenuItem.Size = new System.Drawing.Size(210, 22); this.изменитьПодкатегориюToolStripMenuItem.Text = "Изменить подкатегорию"; + this.изменитьПодкатегориюToolStripMenuItem.Click += new System.EventHandler(this.изменитьПодкатегориюToolStripMenuItem_Click); // // списокПодкатегоийToolStripMenuItem // this.списокПодкатегоийToolStripMenuItem.Name = "списокПодкатегоийToolStripMenuItem"; - this.списокПодкатегоийToolStripMenuItem.Size = new System.Drawing.Size(265, 26); + this.списокПодкатегоийToolStripMenuItem.Size = new System.Drawing.Size(210, 22); this.списокПодкатегоийToolStripMenuItem.Text = "Список подкатегорий"; + this.списокПодкатегоийToolStripMenuItem.Click += new System.EventHandler(this.списокПодкатегоийToolStripMenuItem_Click); // // MainForm // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F); + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(800, 450); + this.ClientSize = new System.Drawing.Size(700, 338); this.Controls.Add(this.menuStrip1); this.MainMenuStrip = this.menuStrip1; + this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.Name = "MainForm"; this.Text = "MainForm"; this.menuStrip1.ResumeLayout(false); diff --git a/WebsiteForPlacingAds/WebsiteForPlacingAds/MainForm.cs b/WebsiteForPlacingAds/WebsiteForPlacingAds/MainForm.cs index e7eddd0..4a263c8 100644 --- a/WebsiteForPlacingAds/WebsiteForPlacingAds/MainForm.cs +++ b/WebsiteForPlacingAds/WebsiteForPlacingAds/MainForm.cs @@ -22,30 +22,27 @@ namespace WebsiteForPlacingAds databaseLogic = new DatabaseLogic(psd); } - private void списокКлиентвToolStripMenuItem_Click(object sender, EventArgs e) - { - - } - private void создатьКатегориюToolStripMenuItem_Click(object sender, EventArgs e) { - + CreateCategoriesForm ccf = new CreateCategoriesForm(databaseLogic); + ccf.Show(); } private void удалитьКатегориюToolStripMenuItem_Click(object sender, EventArgs e) { - + DeleteCategoriesForm dcf = new DeleteCategoriesForm(databaseLogic); + dcf.Show(); } private void создатьОбъявлениеToolStripMenuItem_Click(object sender, EventArgs e) { - CreateAdsForm caf = new CreateAdsForm((PostgreSqlDatabase)psd); + CreateAdsForm caf = new CreateAdsForm(databaseLogic); caf.Show(); } private void удалитьОбъявлениеToolStripMenuItem_Click(object sender, EventArgs e) { - DeleteAdsForm uaf = new DeleteAdsForm((PostgreSqlDatabase)psd); + DeleteAdsForm uaf = new DeleteAdsForm(databaseLogic); uaf.Show(); } @@ -57,8 +54,67 @@ namespace WebsiteForPlacingAds private void списокОбъявленийToolStripMenuItem_Click(object sender, EventArgs e) { - ListAdsForm laf = new ListAdsForm((PostgreSqlDatabase)psd); + ListAdsForm laf = new ListAdsForm(databaseLogic); laf.Show(); } + + private void создатьКлиентаToolStripMenuItem_Click(object sender, EventArgs e) + { + CreateClientsForm ccf = new CreateClientsForm(databaseLogic); + ccf.Show(); + } + + private void удалитьКлиентаToolStripMenuItem_Click(object sender, EventArgs e) + { + DeleteClientsForm dcf = new DeleteClientsForm(databaseLogic); + dcf.Show(); + } + + private void изменитьДанныеКлиентаToolStripMenuItem_Click(object sender, EventArgs e) + { + UpdateClientsForm ucf = new UpdateClientsForm(databaseLogic); + ucf.Show(); + } + private void списокКлиентвToolStripMenuItem_Click(object sender, EventArgs e) + { + ListClientsForm lcf = new ListClientsForm(databaseLogic); + lcf.Show(); + } + + private void изменитьКатегориюToolStripMenuItem_Click(object sender, EventArgs e) + { + UpdateCategoriesForm ucf = new UpdateCategoriesForm(databaseLogic); + ucf.Show(); + } + + private void списокКатегорийToolStripMenuItem_Click(object sender, EventArgs e) + { + ListCategoriesForm lcf = new ListCategoriesForm(databaseLogic); + lcf.Show(); + } + + private void создатьПодкатеориюToolStripMenuItem_Click(object sender, EventArgs e) + { + CreateSubcategoriesForm csf = new CreateSubcategoriesForm(databaseLogic); + csf.Show(); + } + + private void удалитьПодкатегориюToolStripMenuItem_Click(object sender, EventArgs e) + { + DeleteSubcategoriesForm dsf = new DeleteSubcategoriesForm(databaseLogic); + dsf.Show(); + } + + private void изменитьПодкатегориюToolStripMenuItem_Click(object sender, EventArgs e) + { + UpdateSubcategoriesForm usf = new UpdateSubcategoriesForm(databaseLogic); + usf.Show(); + } + + private void списокПодкатегоийToolStripMenuItem_Click(object sender, EventArgs e) + { + ListSubcategoriesForm lsf = new ListSubcategoriesForm(databaseLogic); + lsf.Show(); + } } } diff --git a/WebsiteForPlacingAds/WebsiteForPlacingAds/SubcategoriesForm/CreateSubcategoriesForm.Designer.cs b/WebsiteForPlacingAds/WebsiteForPlacingAds/SubcategoriesForm/CreateSubcategoriesForm.Designer.cs new file mode 100644 index 0000000..2ed3666 --- /dev/null +++ b/WebsiteForPlacingAds/WebsiteForPlacingAds/SubcategoriesForm/CreateSubcategoriesForm.Designer.cs @@ -0,0 +1,86 @@ +namespace WebsiteForPlacingAds +{ + partial class CreateSubcategoriesForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.textBoxName = new System.Windows.Forms.TextBox(); + this.labelName = new System.Windows.Forms.Label(); + this.buttonCreateSubcategory = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // textBoxName + // + this.textBoxName.Location = new System.Drawing.Point(37, 35); + this.textBoxName.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.textBoxName.Name = "textBoxName"; + this.textBoxName.Size = new System.Drawing.Size(239, 23); + this.textBoxName.TabIndex = 5; + // + // labelName + // + this.labelName.AutoSize = true; + this.labelName.Location = new System.Drawing.Point(37, 17); + this.labelName.Name = "labelName"; + this.labelName.Size = new System.Drawing.Size(59, 15); + this.labelName.TabIndex = 4; + this.labelName.Text = "Название"; + // + // buttonCreateSubcategory + // + this.buttonCreateSubcategory.Location = new System.Drawing.Point(37, 79); + this.buttonCreateSubcategory.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.buttonCreateSubcategory.Name = "buttonCreateSubcategory"; + this.buttonCreateSubcategory.Size = new System.Drawing.Size(239, 29); + this.buttonCreateSubcategory.TabIndex = 3; + this.buttonCreateSubcategory.Text = "Добавить подкатегорию"; + this.buttonCreateSubcategory.UseVisualStyleBackColor = true; + this.buttonCreateSubcategory.Click += new System.EventHandler(this.buttonCreateSubcategory_Click_1); + // + // CreateSubcategoriesForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(324, 122); + this.Controls.Add(this.textBoxName); + this.Controls.Add(this.labelName); + this.Controls.Add(this.buttonCreateSubcategory); + this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.Name = "CreateSubcategoriesForm"; + this.Text = "Подкатегория"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private TextBox textBoxName; + private Label labelName; + private Button buttonCreateSubcategory; + } +} \ No newline at end of file diff --git a/WebsiteForPlacingAds/WebsiteForPlacingAds/SubcategoriesForm/CreateSubcategoriesForm.cs b/WebsiteForPlacingAds/WebsiteForPlacingAds/SubcategoriesForm/CreateSubcategoriesForm.cs new file mode 100644 index 0000000..cac9997 --- /dev/null +++ b/WebsiteForPlacingAds/WebsiteForPlacingAds/SubcategoriesForm/CreateSubcategoriesForm.cs @@ -0,0 +1,29 @@ +using System.Data; + +namespace WebsiteForPlacingAds +{ + public partial class CreateSubcategoriesForm : Form + { + IDatabaseLogic databaseLogic; + public CreateSubcategoriesForm(IDatabaseLogic databaseLogic) + { + InitializeComponent(); + this.databaseLogic = databaseLogic; + } + + private void buttonCreateSubcategory_Click_1(object sender, EventArgs e) + { + string name = textBoxName.Text; + + try + { + databaseLogic.insertInto("subcategories", $"'{name}'"); + MessageBox.Show("!"); + } + catch (Exception ex) + { + MessageBox.Show(" "); + } + } + } +} \ No newline at end of file diff --git a/WebsiteForPlacingAds/WebsiteForPlacingAds/SubcategoriesForm/CreateSubcategoriesForm.resx b/WebsiteForPlacingAds/WebsiteForPlacingAds/SubcategoriesForm/CreateSubcategoriesForm.resx new file mode 100644 index 0000000..f298a7b --- /dev/null +++ b/WebsiteForPlacingAds/WebsiteForPlacingAds/SubcategoriesForm/CreateSubcategoriesForm.resx @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/WebsiteForPlacingAds/WebsiteForPlacingAds/SubcategoriesForm/DeleteSubcategoriesForm.Designer.cs b/WebsiteForPlacingAds/WebsiteForPlacingAds/SubcategoriesForm/DeleteSubcategoriesForm.Designer.cs new file mode 100644 index 0000000..85c4b69 --- /dev/null +++ b/WebsiteForPlacingAds/WebsiteForPlacingAds/SubcategoriesForm/DeleteSubcategoriesForm.Designer.cs @@ -0,0 +1,87 @@ +namespace WebsiteForPlacingAds +{ + partial class DeleteSubcategoriesForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.comboBoxDeleteSubcategories = new System.Windows.Forms.ComboBox(); + this.buttonDeleteSubcategory = new System.Windows.Forms.Button(); + this.label1 = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // comboBoxDeleteSubcategories + // + this.comboBoxDeleteSubcategories.FormattingEnabled = true; + this.comboBoxDeleteSubcategories.Location = new System.Drawing.Point(38, 49); + this.comboBoxDeleteSubcategories.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.comboBoxDeleteSubcategories.Name = "comboBoxDeleteSubcategories"; + this.comboBoxDeleteSubcategories.Size = new System.Drawing.Size(367, 23); + this.comboBoxDeleteSubcategories.TabIndex = 5; + // + // buttonDeleteSubcategory + // + this.buttonDeleteSubcategory.Location = new System.Drawing.Point(135, 86); + this.buttonDeleteSubcategory.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.buttonDeleteSubcategory.Name = "buttonDeleteSubcategory"; + this.buttonDeleteSubcategory.Size = new System.Drawing.Size(163, 28); + this.buttonDeleteSubcategory.TabIndex = 4; + this.buttonDeleteSubcategory.Text = "Удалить"; + this.buttonDeleteSubcategory.UseVisualStyleBackColor = true; + this.buttonDeleteSubcategory.Click += new System.EventHandler(this.buttonDeleteSubcategory_Click_1); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(73, 17); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(282, 15); + this.label1.TabIndex = 3; + this.label1.Text = "Выберите подкатегорию, которую хотите удалить"; + // + // DeleteSubcategoriesForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(442, 131); + this.Controls.Add(this.comboBoxDeleteSubcategories); + this.Controls.Add(this.buttonDeleteSubcategory); + this.Controls.Add(this.label1); + this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.Name = "DeleteSubcategoriesForm"; + this.Text = "Удалить подкатегорию"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private ComboBox comboBoxDeleteSubcategories; + private Button buttonDeleteSubcategory; + private Label label1; + } +} \ No newline at end of file diff --git a/WebsiteForPlacingAds/WebsiteForPlacingAds/SubcategoriesForm/DeleteSubcategoriesForm.cs b/WebsiteForPlacingAds/WebsiteForPlacingAds/SubcategoriesForm/DeleteSubcategoriesForm.cs new file mode 100644 index 0000000..f2d6cc2 --- /dev/null +++ b/WebsiteForPlacingAds/WebsiteForPlacingAds/SubcategoriesForm/DeleteSubcategoriesForm.cs @@ -0,0 +1,55 @@ +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 DeleteSubcategoriesForm : Form + { + IDatabaseLogic databaseLogic; + private int setval_seq; + public DeleteSubcategoriesForm(IDatabaseLogic databaseLogic) + { + InitializeComponent(); + this.databaseLogic = databaseLogic; + LoadData(); + } + public void LoadData() + { + comboBoxDeleteSubcategories.Items.Clear(); + DataTable result = databaseLogic.getAllEntry("Subcategories"); + setval_seq = result.Rows.Count; + string Subcategories = ""; + for (int i = 0; i < result.Rows.Count; i++) + { + if (i == result.Rows.Count - 1) setval_seq = Convert.ToInt32(databaseLogic.getRowTableById(result, "subcategories_id", i)); + Subcategories = databaseLogic.getRowTableById(result, "subcategories_id", i).ToString() + " | " + + databaseLogic.getRowTableById(result, "name", i).ToString() + "\n"; + comboBoxDeleteSubcategories.Items.Add(Subcategories); + } + } + + private void buttonDeleteSubcategory_Click_1(object sender, EventArgs e) + { + string[] subcategories = comboBoxDeleteSubcategories.SelectedItem.ToString().Split("|"); + string subcategory_id = subcategories[0].Trim(); + try + { + databaseLogic.deleteEntry("subcategories", int.Parse(subcategory_id)); + LoadData(); + databaseLogic.reduceSeq("seq_subcategories", setval_seq); + MessageBox.Show("Удалено!"); + } + catch (Exception ex) + { + MessageBox.Show("Не удалось удалить"); + } + } + } +} diff --git a/WebsiteForPlacingAds/WebsiteForPlacingAds/SubcategoriesForm/DeleteSubcategoriesForm.resx b/WebsiteForPlacingAds/WebsiteForPlacingAds/SubcategoriesForm/DeleteSubcategoriesForm.resx new file mode 100644 index 0000000..f298a7b --- /dev/null +++ b/WebsiteForPlacingAds/WebsiteForPlacingAds/SubcategoriesForm/DeleteSubcategoriesForm.resx @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/WebsiteForPlacingAds/WebsiteForPlacingAds/SubcategoriesForm/ListSubcategoriesForm.Designer.cs b/WebsiteForPlacingAds/WebsiteForPlacingAds/SubcategoriesForm/ListSubcategoriesForm.Designer.cs new file mode 100644 index 0000000..cbd1b5f --- /dev/null +++ b/WebsiteForPlacingAds/WebsiteForPlacingAds/SubcategoriesForm/ListSubcategoriesForm.Designer.cs @@ -0,0 +1,75 @@ +namespace WebsiteForPlacingAds +{ + partial class ListSubcategoriesForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.labelListSubcategories = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.BackColor = System.Drawing.SystemColors.Control; + this.label1.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this.label1.Location = new System.Drawing.Point(10, 7); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(160, 20); + this.label1.TabIndex = 0; + this.label1.Text = "Список подкатегорий"; + // + // labelListSubcategories + // + this.labelListSubcategories.AutoSize = true; + this.labelListSubcategories.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this.labelListSubcategories.Location = new System.Drawing.Point(10, 35); + this.labelListSubcategories.Name = "labelListSubcategories"; + this.labelListSubcategories.Size = new System.Drawing.Size(0, 19); + this.labelListSubcategories.TabIndex = 1; + // + // ListSubcategoriesForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(700, 338); + this.Controls.Add(this.labelListSubcategories); + this.Controls.Add(this.label1); + this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.Name = "ListSubcategoriesForm"; + this.Text = "Список подкатегорий"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private Label label1; + private Label labelListSubcategories; + } +} \ No newline at end of file diff --git a/WebsiteForPlacingAds/WebsiteForPlacingAds/SubcategoriesForm/ListSubcategoriesForm.cs b/WebsiteForPlacingAds/WebsiteForPlacingAds/SubcategoriesForm/ListSubcategoriesForm.cs new file mode 100644 index 0000000..17df9a0 --- /dev/null +++ b/WebsiteForPlacingAds/WebsiteForPlacingAds/SubcategoriesForm/ListSubcategoriesForm.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using System.Windows.Forms.VisualStyles; + +namespace WebsiteForPlacingAds +{ + public partial class ListSubcategoriesForm : Form + { + IDatabaseLogic databaseLogic; + public ListSubcategoriesForm(IDatabaseLogic databaseLogic) + { + InitializeComponent(); + this.databaseLogic = databaseLogic; + LoadData(); + } + + private void LoadData() + { + DataTable result = databaseLogic.getAllEntry("Subcategories"); + string listSubcategories = ""; + for (int i = 0; i < result.Rows.Count; i++) + { + listSubcategories += databaseLogic.getRowTableById(result, "subcategories_id", i).ToString() + " | " + + databaseLogic.getRowTableById(result, "name", i).ToString() + "\n"; + } + labelListSubcategories.Text = listSubcategories; + } + } +} diff --git a/WebsiteForPlacingAds/WebsiteForPlacingAds/SubcategoriesForm/ListSubcategoriesForm.resx b/WebsiteForPlacingAds/WebsiteForPlacingAds/SubcategoriesForm/ListSubcategoriesForm.resx new file mode 100644 index 0000000..f298a7b --- /dev/null +++ b/WebsiteForPlacingAds/WebsiteForPlacingAds/SubcategoriesForm/ListSubcategoriesForm.resx @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/WebsiteForPlacingAds/WebsiteForPlacingAds/SubcategoriesForm/UpdateSubcategoriesForm.Designer.cs b/WebsiteForPlacingAds/WebsiteForPlacingAds/SubcategoriesForm/UpdateSubcategoriesForm.Designer.cs new file mode 100644 index 0000000..67ea25d --- /dev/null +++ b/WebsiteForPlacingAds/WebsiteForPlacingAds/SubcategoriesForm/UpdateSubcategoriesForm.Designer.cs @@ -0,0 +1,111 @@ +namespace WebsiteForPlacingAds +{ + partial class UpdateSubcategoriesForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.textBoxName = new System.Windows.Forms.TextBox(); + this.labelName = new System.Windows.Forms.Label(); + this.buttonUpdateSubcategory = new System.Windows.Forms.Button(); + this.comboBoxUpdateSubcategory = new System.Windows.Forms.ComboBox(); + this.label1 = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // textBoxName + // + this.textBoxName.Location = new System.Drawing.Point(80, 104); + this.textBoxName.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.textBoxName.Name = "textBoxName"; + this.textBoxName.Size = new System.Drawing.Size(239, 23); + this.textBoxName.TabIndex = 42; + // + // labelName + // + this.labelName.AutoSize = true; + this.labelName.Location = new System.Drawing.Point(80, 86); + this.labelName.Name = "labelName"; + this.labelName.Size = new System.Drawing.Size(59, 15); + this.labelName.TabIndex = 41; + this.labelName.Text = "Название"; + // + // buttonUpdateSubcategory + // + this.buttonUpdateSubcategory.Location = new System.Drawing.Point(80, 148); + this.buttonUpdateSubcategory.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.buttonUpdateSubcategory.Name = "buttonUpdateSubcategory"; + this.buttonUpdateSubcategory.Size = new System.Drawing.Size(239, 29); + this.buttonUpdateSubcategory.TabIndex = 40; + this.buttonUpdateSubcategory.Text = "Обновить категорию"; + this.buttonUpdateSubcategory.UseVisualStyleBackColor = true; + this.buttonUpdateSubcategory.Click += new System.EventHandler(this.buttonUpdateSubcategory_Click); + // + // comboBoxUpdateSubcategory + // + this.comboBoxUpdateSubcategory.FormattingEnabled = true; + this.comboBoxUpdateSubcategory.Location = new System.Drawing.Point(12, 47); + this.comboBoxUpdateSubcategory.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.comboBoxUpdateSubcategory.Name = "comboBoxUpdateSubcategory"; + this.comboBoxUpdateSubcategory.Size = new System.Drawing.Size(377, 23); + this.comboBoxUpdateSubcategory.TabIndex = 39; + this.comboBoxUpdateSubcategory.SelectedIndexChanged += new System.EventHandler(this.comboBoxUpdateSubcategory_SelectedIndexChanged_1); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(53, 23); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(291, 15); + this.label1.TabIndex = 38; + this.label1.Text = "Выберите подкатегорию, которую хотите обновить"; + // + // UpdateSubcategoriesForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(397, 195); + this.Controls.Add(this.textBoxName); + this.Controls.Add(this.labelName); + this.Controls.Add(this.buttonUpdateSubcategory); + this.Controls.Add(this.comboBoxUpdateSubcategory); + this.Controls.Add(this.label1); + this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.Name = "UpdateSubcategoriesForm"; + this.Text = "Обновить подкатегорию"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private TextBox textBoxName; + private Label labelName; + private Button buttonUpdateSubcategory; + private ComboBox comboBoxUpdateSubcategory; + private Label label1; + } +} \ No newline at end of file diff --git a/WebsiteForPlacingAds/WebsiteForPlacingAds/SubcategoriesForm/UpdateSubcategoriesForm.cs b/WebsiteForPlacingAds/WebsiteForPlacingAds/SubcategoriesForm/UpdateSubcategoriesForm.cs new file mode 100644 index 0000000..4c41d0f --- /dev/null +++ b/WebsiteForPlacingAds/WebsiteForPlacingAds/SubcategoriesForm/UpdateSubcategoriesForm.cs @@ -0,0 +1,82 @@ +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 UpdateSubcategoriesForm : Form + { + IDatabaseLogic databaseLogic; + public UpdateSubcategoriesForm(IDatabaseLogic databaseLogic) + { + InitializeComponent(); + this.databaseLogic = databaseLogic; + LoadData(); + } + public void LoadData() + { + comboBoxUpdateSubcategory.Items.Clear(); + DataTable result = databaseLogic.getAllEntry("Subcategories"); + string Subcategories = ""; + for (int i = 0; i < result.Rows.Count; i++) + { + Subcategories = result.Rows[i]["subcategories_id"].ToString() + " | " + + (string)result.Rows[i]["name"] + "\n"; + comboBoxUpdateSubcategory.Items.Add(Subcategories); + } + } + public void LoadDataSelectedItem(int subcategories_id) + { + DataTable result = databaseLogic.getEntryById("subcategories", subcategories_id); + textBoxName.Text = databaseLogic.getRowTableById(result, "name", 0).ToString(); + } + + + + private void buttonUpdateSubcategory_Click(object sender, EventArgs e) + { + string[] selectedSubcategory = comboBoxUpdateSubcategory.SelectedItem.ToString().Split("|"); + int subcategory_id = int.Parse(selectedSubcategory[0].Trim()); + + string query = $"UPDATE Subcategories SET "; + int len = query.Length; + + + string oldName = databaseLogic.getRowTableById("subcategories", "name", subcategory_id).ToString(); + + string newName = textBoxName.Text; + + + query = oldName == newName ? query : query + $"name = '{newName}', "; + if (len != query.Length) + { + query = query.TrimEnd(' '); + query = query.TrimEnd(','); + query += $" WHERE Subcategories_ID = {subcategory_id};"; + } + try + { + databaseLogic.ExecuteNonQuery(query); + MessageBox.Show("Данные успешно обновлены!"); + } + catch (Exception) + { + + MessageBox.Show("Данные не обновились"); + } + } + + private void comboBoxUpdateSubcategory_SelectedIndexChanged_1(object sender, EventArgs e) + { + string[] selectedItems = comboBoxUpdateSubcategory.SelectedItem.ToString().Split("|"); + int subcategory_id = int.Parse(selectedItems[0].Trim()); + LoadDataSelectedItem(subcategory_id); + } + } +} diff --git a/WebsiteForPlacingAds/WebsiteForPlacingAds/SubcategoriesForm/UpdateSubcategoriesForm.resx b/WebsiteForPlacingAds/WebsiteForPlacingAds/SubcategoriesForm/UpdateSubcategoriesForm.resx new file mode 100644 index 0000000..f298a7b --- /dev/null +++ b/WebsiteForPlacingAds/WebsiteForPlacingAds/SubcategoriesForm/UpdateSubcategoriesForm.resx @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/WebsiteForPlacingAds/WebsiteForPlacingAds/WebsiteForPlacingAds.csproj b/WebsiteForPlacingAds/WebsiteForPlacingAds/WebsiteForPlacingAds.csproj index 9acf6fb..c738f9e 100644 --- a/WebsiteForPlacingAds/WebsiteForPlacingAds/WebsiteForPlacingAds.csproj +++ b/WebsiteForPlacingAds/WebsiteForPlacingAds/WebsiteForPlacingAds.csproj @@ -12,4 +12,19 @@ + + + Form + + + Form + + + Form + + + Form + + + \ No newline at end of file