Все работает \(^-^)/
This commit is contained in:
parent
8682baa376
commit
aa94208637
63
SushiBar/SushiBar/FormMain.Designer.cs
generated
63
SushiBar/SushiBar/FormMain.Designer.cs
generated
@ -40,6 +40,7 @@
|
|||||||
buttonCreateTask = new Button();
|
buttonCreateTask = new Button();
|
||||||
dataGridView = new DataGridView();
|
dataGridView = new DataGridView();
|
||||||
buttonTest = new Button();
|
buttonTest = new Button();
|
||||||
|
buttonPsqlToMongo = new Button();
|
||||||
menuStrip1.SuspendLayout();
|
menuStrip1.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
@ -49,8 +50,7 @@
|
|||||||
menuStrip1.Items.AddRange(new ToolStripItem[] { объектыToolStripMenuItem });
|
menuStrip1.Items.AddRange(new ToolStripItem[] { объектыToolStripMenuItem });
|
||||||
menuStrip1.Location = new Point(0, 0);
|
menuStrip1.Location = new Point(0, 0);
|
||||||
menuStrip1.Name = "menuStrip1";
|
menuStrip1.Name = "menuStrip1";
|
||||||
menuStrip1.Padding = new Padding(7, 3, 0, 3);
|
menuStrip1.Size = new Size(1214, 24);
|
||||||
menuStrip1.Size = new Size(1387, 30);
|
|
||||||
menuStrip1.TabIndex = 0;
|
menuStrip1.TabIndex = 0;
|
||||||
menuStrip1.Text = "menuStrip1";
|
menuStrip1.Text = "menuStrip1";
|
||||||
//
|
//
|
||||||
@ -58,43 +58,42 @@
|
|||||||
//
|
//
|
||||||
объектыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { buyerToolStripMenuItem, cookToolStripMenuItem, menuToolStripMenuItem, placeToolStripMenuItem });
|
объектыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { buyerToolStripMenuItem, cookToolStripMenuItem, menuToolStripMenuItem, placeToolStripMenuItem });
|
||||||
объектыToolStripMenuItem.Name = "объектыToolStripMenuItem";
|
объектыToolStripMenuItem.Name = "объектыToolStripMenuItem";
|
||||||
объектыToolStripMenuItem.Size = new Size(82, 24);
|
объектыToolStripMenuItem.Size = new Size(68, 20);
|
||||||
объектыToolStripMenuItem.Text = "Объекты";
|
объектыToolStripMenuItem.Text = "Объекты";
|
||||||
//
|
//
|
||||||
// buyerToolStripMenuItem
|
// buyerToolStripMenuItem
|
||||||
//
|
//
|
||||||
buyerToolStripMenuItem.Name = "buyerToolStripMenuItem";
|
buyerToolStripMenuItem.Name = "buyerToolStripMenuItem";
|
||||||
buyerToolStripMenuItem.Size = new Size(159, 24);
|
buyerToolStripMenuItem.Size = new Size(139, 22);
|
||||||
buyerToolStripMenuItem.Text = "Покупатель";
|
buyerToolStripMenuItem.Text = "Покупатель";
|
||||||
buyerToolStripMenuItem.Click += buyerToolStripMenuItem_Click;
|
buyerToolStripMenuItem.Click += buyerToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// cookToolStripMenuItem
|
// cookToolStripMenuItem
|
||||||
//
|
//
|
||||||
cookToolStripMenuItem.Name = "cookToolStripMenuItem";
|
cookToolStripMenuItem.Name = "cookToolStripMenuItem";
|
||||||
cookToolStripMenuItem.Size = new Size(159, 24);
|
cookToolStripMenuItem.Size = new Size(139, 22);
|
||||||
cookToolStripMenuItem.Text = "Повар";
|
cookToolStripMenuItem.Text = "Повар";
|
||||||
cookToolStripMenuItem.Click += cookToolStripMenuItem_Click;
|
cookToolStripMenuItem.Click += cookToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// menuToolStripMenuItem
|
// menuToolStripMenuItem
|
||||||
//
|
//
|
||||||
menuToolStripMenuItem.Name = "menuToolStripMenuItem";
|
menuToolStripMenuItem.Name = "menuToolStripMenuItem";
|
||||||
menuToolStripMenuItem.Size = new Size(159, 24);
|
menuToolStripMenuItem.Size = new Size(139, 22);
|
||||||
menuToolStripMenuItem.Text = "Меню";
|
menuToolStripMenuItem.Text = "Меню";
|
||||||
menuToolStripMenuItem.Click += menuToolStripMenuItem_Click;
|
menuToolStripMenuItem.Click += menuToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// placeToolStripMenuItem
|
// placeToolStripMenuItem
|
||||||
//
|
//
|
||||||
placeToolStripMenuItem.Name = "placeToolStripMenuItem";
|
placeToolStripMenuItem.Name = "placeToolStripMenuItem";
|
||||||
placeToolStripMenuItem.Size = new Size(159, 24);
|
placeToolStripMenuItem.Size = new Size(139, 22);
|
||||||
placeToolStripMenuItem.Text = "Столик";
|
placeToolStripMenuItem.Text = "Столик";
|
||||||
placeToolStripMenuItem.Click += placeToolStripMenuItem_Click;
|
placeToolStripMenuItem.Click += placeToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// buttonIssuedTask
|
// buttonIssuedTask
|
||||||
//
|
//
|
||||||
buttonIssuedTask.Location = new Point(1106, 275);
|
buttonIssuedTask.Location = new Point(968, 206);
|
||||||
buttonIssuedTask.Margin = new Padding(3, 4, 3, 4);
|
|
||||||
buttonIssuedTask.Name = "buttonIssuedTask";
|
buttonIssuedTask.Name = "buttonIssuedTask";
|
||||||
buttonIssuedTask.Size = new Size(226, 37);
|
buttonIssuedTask.Size = new Size(198, 28);
|
||||||
buttonIssuedTask.TabIndex = 11;
|
buttonIssuedTask.TabIndex = 11;
|
||||||
buttonIssuedTask.Text = "Заказ выдан";
|
buttonIssuedTask.Text = "Заказ выдан";
|
||||||
buttonIssuedTask.UseVisualStyleBackColor = true;
|
buttonIssuedTask.UseVisualStyleBackColor = true;
|
||||||
@ -102,10 +101,9 @@
|
|||||||
//
|
//
|
||||||
// buttonTaskReady
|
// buttonTaskReady
|
||||||
//
|
//
|
||||||
buttonTaskReady.Location = new Point(1106, 205);
|
buttonTaskReady.Location = new Point(968, 154);
|
||||||
buttonTaskReady.Margin = new Padding(3, 4, 3, 4);
|
|
||||||
buttonTaskReady.Name = "buttonTaskReady";
|
buttonTaskReady.Name = "buttonTaskReady";
|
||||||
buttonTaskReady.Size = new Size(226, 37);
|
buttonTaskReady.Size = new Size(198, 28);
|
||||||
buttonTaskReady.TabIndex = 10;
|
buttonTaskReady.TabIndex = 10;
|
||||||
buttonTaskReady.Text = "Заказ готов";
|
buttonTaskReady.Text = "Заказ готов";
|
||||||
buttonTaskReady.UseVisualStyleBackColor = true;
|
buttonTaskReady.UseVisualStyleBackColor = true;
|
||||||
@ -113,10 +111,9 @@
|
|||||||
//
|
//
|
||||||
// buttonTakeTaskInWork
|
// buttonTakeTaskInWork
|
||||||
//
|
//
|
||||||
buttonTakeTaskInWork.Location = new Point(1106, 133);
|
buttonTakeTaskInWork.Location = new Point(968, 100);
|
||||||
buttonTakeTaskInWork.Margin = new Padding(3, 4, 3, 4);
|
|
||||||
buttonTakeTaskInWork.Name = "buttonTakeTaskInWork";
|
buttonTakeTaskInWork.Name = "buttonTakeTaskInWork";
|
||||||
buttonTakeTaskInWork.Size = new Size(226, 37);
|
buttonTakeTaskInWork.Size = new Size(198, 28);
|
||||||
buttonTakeTaskInWork.TabIndex = 9;
|
buttonTakeTaskInWork.TabIndex = 9;
|
||||||
buttonTakeTaskInWork.Text = "Отдать на выполнение";
|
buttonTakeTaskInWork.Text = "Отдать на выполнение";
|
||||||
buttonTakeTaskInWork.UseVisualStyleBackColor = true;
|
buttonTakeTaskInWork.UseVisualStyleBackColor = true;
|
||||||
@ -124,10 +121,9 @@
|
|||||||
//
|
//
|
||||||
// buttonCreateTask
|
// buttonCreateTask
|
||||||
//
|
//
|
||||||
buttonCreateTask.Location = new Point(1106, 61);
|
buttonCreateTask.Location = new Point(968, 46);
|
||||||
buttonCreateTask.Margin = new Padding(3, 4, 3, 4);
|
|
||||||
buttonCreateTask.Name = "buttonCreateTask";
|
buttonCreateTask.Name = "buttonCreateTask";
|
||||||
buttonCreateTask.Size = new Size(226, 37);
|
buttonCreateTask.Size = new Size(198, 28);
|
||||||
buttonCreateTask.TabIndex = 8;
|
buttonCreateTask.TabIndex = 8;
|
||||||
buttonCreateTask.Text = "Создать заказ";
|
buttonCreateTask.Text = "Создать заказ";
|
||||||
buttonCreateTask.UseVisualStyleBackColor = true;
|
buttonCreateTask.UseVisualStyleBackColor = true;
|
||||||
@ -139,31 +135,40 @@
|
|||||||
dataGridView.BackgroundColor = Color.White;
|
dataGridView.BackgroundColor = Color.White;
|
||||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
dataGridView.Dock = DockStyle.Left;
|
dataGridView.Dock = DockStyle.Left;
|
||||||
dataGridView.Location = new Point(0, 30);
|
dataGridView.Location = new Point(0, 24);
|
||||||
dataGridView.Margin = new Padding(3, 4, 3, 4);
|
|
||||||
dataGridView.Name = "dataGridView";
|
dataGridView.Name = "dataGridView";
|
||||||
dataGridView.ReadOnly = true;
|
dataGridView.ReadOnly = true;
|
||||||
dataGridView.RowHeadersVisible = false;
|
dataGridView.RowHeadersVisible = false;
|
||||||
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||||
dataGridView.Size = new Size(1049, 570);
|
dataGridView.Size = new Size(918, 426);
|
||||||
dataGridView.TabIndex = 7;
|
dataGridView.TabIndex = 7;
|
||||||
//
|
//
|
||||||
// buttonTest
|
// buttonTest
|
||||||
//
|
//
|
||||||
buttonTest.Location = new Point(1106, 349);
|
buttonTest.Location = new Point(968, 262);
|
||||||
buttonTest.Margin = new Padding(3, 4, 3, 4);
|
|
||||||
buttonTest.Name = "buttonTest";
|
buttonTest.Name = "buttonTest";
|
||||||
buttonTest.Size = new Size(226, 37);
|
buttonTest.Size = new Size(198, 28);
|
||||||
buttonTest.TabIndex = 12;
|
buttonTest.TabIndex = 12;
|
||||||
buttonTest.Text = "ТЕСТ";
|
buttonTest.Text = "Удалить все данные";
|
||||||
buttonTest.UseVisualStyleBackColor = true;
|
buttonTest.UseVisualStyleBackColor = true;
|
||||||
buttonTest.Click += buttonTest_Click;
|
buttonTest.Click += buttonTest_Click;
|
||||||
//
|
//
|
||||||
|
// buttonPsqlToMongo
|
||||||
|
//
|
||||||
|
buttonPsqlToMongo.Location = new Point(968, 309);
|
||||||
|
buttonPsqlToMongo.Name = "buttonPsqlToMongo";
|
||||||
|
buttonPsqlToMongo.Size = new Size(198, 42);
|
||||||
|
buttonPsqlToMongo.TabIndex = 13;
|
||||||
|
buttonPsqlToMongo.Text = "Перенести все данные на MongoDB";
|
||||||
|
buttonPsqlToMongo.UseVisualStyleBackColor = true;
|
||||||
|
buttonPsqlToMongo.Click += buttonPsqlToMongo_Click;
|
||||||
|
//
|
||||||
// FormMain
|
// FormMain
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(1387, 600);
|
ClientSize = new Size(1214, 450);
|
||||||
|
Controls.Add(buttonPsqlToMongo);
|
||||||
Controls.Add(buttonTest);
|
Controls.Add(buttonTest);
|
||||||
Controls.Add(buttonIssuedTask);
|
Controls.Add(buttonIssuedTask);
|
||||||
Controls.Add(buttonTaskReady);
|
Controls.Add(buttonTaskReady);
|
||||||
@ -172,7 +177,6 @@
|
|||||||
Controls.Add(dataGridView);
|
Controls.Add(dataGridView);
|
||||||
Controls.Add(menuStrip1);
|
Controls.Add(menuStrip1);
|
||||||
MainMenuStrip = menuStrip1;
|
MainMenuStrip = menuStrip1;
|
||||||
Margin = new Padding(3, 4, 3, 4);
|
|
||||||
Name = "FormMain";
|
Name = "FormMain";
|
||||||
Text = "Главное окно";
|
Text = "Главное окно";
|
||||||
Load += FormMain_Load;
|
Load += FormMain_Load;
|
||||||
@ -197,5 +201,6 @@
|
|||||||
private Button buttonCreateTask;
|
private Button buttonCreateTask;
|
||||||
private DataGridView dataGridView;
|
private DataGridView dataGridView;
|
||||||
private Button buttonTest;
|
private Button buttonTest;
|
||||||
|
private Button buttonPsqlToMongo;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,6 +1,7 @@
|
|||||||
using SushiBar;
|
using SushiBar;
|
||||||
using SushiBarContracts.BindingModels;
|
using SushiBarContracts.BindingModels;
|
||||||
using SushiBarContracts.BusinessLogicContracts;
|
using SushiBarContracts.BusinessLogicContracts;
|
||||||
|
using SushiBarMongoDB;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
@ -16,14 +17,21 @@ namespace SushiBarView
|
|||||||
public partial class FormMain : Form
|
public partial class FormMain : Form
|
||||||
{
|
{
|
||||||
|
|
||||||
private readonly ITaskLogic _logic;
|
private readonly ITaskLogic _TaskLogic;
|
||||||
private readonly ICookLogic _CLogic;
|
private readonly ICookLogic _CookLogic;
|
||||||
|
private readonly IBuyerLogic _BuyerLogic;
|
||||||
|
private readonly IMenuLogic _MenuLogic;
|
||||||
|
private readonly IPlaceLogic _PlaceLogic;
|
||||||
|
|
||||||
public FormMain(ITaskLogic logic, ICookLogic cLogic)
|
|
||||||
|
public FormMain(ITaskLogic logic, ICookLogic cLogic, IBuyerLogic buyerLogic, IMenuLogic menuLogic, IPlaceLogic placeLogic)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_logic = logic;
|
_TaskLogic = logic;
|
||||||
_CLogic = cLogic;
|
_CookLogic = cLogic;
|
||||||
|
_BuyerLogic = buyerLogic;
|
||||||
|
_MenuLogic = menuLogic;
|
||||||
|
_PlaceLogic = placeLogic;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buyerToolStripMenuItem_Click(object sender, EventArgs e)
|
private void buyerToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
@ -69,7 +77,7 @@ namespace SushiBarView
|
|||||||
|
|
||||||
private void LoadData()
|
private void LoadData()
|
||||||
{
|
{
|
||||||
var _list = _logic.ReadList(null);
|
var _list = _TaskLogic.ReadList(null);
|
||||||
if (_list != null)
|
if (_list != null)
|
||||||
{
|
{
|
||||||
dataGridView.DataSource = _list;
|
dataGridView.DataSource = _list;
|
||||||
@ -97,7 +105,7 @@ namespace SushiBarView
|
|||||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var operationResult = _logic.TakeTaskInWork(new TaskBindingModel
|
var operationResult = _TaskLogic.TakeTaskInWork(new TaskBindingModel
|
||||||
{
|
{
|
||||||
Id = id,
|
Id = id,
|
||||||
Status = Enum.Parse<SushiBarDataModels.Enum.TaskStatus>(dataGridView.SelectedRows[0].Cells["Status"].Value.ToString()),
|
Status = Enum.Parse<SushiBarDataModels.Enum.TaskStatus>(dataGridView.SelectedRows[0].Cells["Status"].Value.ToString()),
|
||||||
@ -122,7 +130,7 @@ namespace SushiBarView
|
|||||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var operationResult = _logic.FinishTask(new TaskBindingModel
|
var operationResult = _TaskLogic.FinishTask(new TaskBindingModel
|
||||||
{
|
{
|
||||||
Id = id,
|
Id = id,
|
||||||
Status = Enum.Parse<SushiBarDataModels.Enum.TaskStatus>(dataGridView.SelectedRows[0].Cells["Status"].Value.ToString()),
|
Status = Enum.Parse<SushiBarDataModels.Enum.TaskStatus>(dataGridView.SelectedRows[0].Cells["Status"].Value.ToString()),
|
||||||
@ -147,7 +155,7 @@ namespace SushiBarView
|
|||||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var operationResult = _logic.DeliveryTask(new TaskBindingModel
|
var operationResult = _TaskLogic.DeliveryTask(new TaskBindingModel
|
||||||
{
|
{
|
||||||
Id = id,
|
Id = id,
|
||||||
Status = Enum.Parse<SushiBarDataModels.Enum.TaskStatus>(dataGridView.SelectedRows[0].Cells["Status"].Value.ToString()),
|
Status = Enum.Parse<SushiBarDataModels.Enum.TaskStatus>(dataGridView.SelectedRows[0].Cells["Status"].Value.ToString()),
|
||||||
@ -168,25 +176,21 @@ namespace SushiBarView
|
|||||||
private void buttonTest_Click(object sender, EventArgs e)
|
private void buttonTest_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
CookBindingModel model = new CookBindingModel()
|
try
|
||||||
{
|
{
|
||||||
Id = 2,
|
_BuyerLogic.ClearEntity();
|
||||||
CookName = "Иван",
|
_CookLogic.ClearEntity();
|
||||||
CookSurname = "dssfsdfs",
|
_MenuLogic.ClearEntity();
|
||||||
Experience = 2,
|
_PlaceLogic.ClearEntity();
|
||||||
PhoneNumber = "+79054324312",
|
_TaskLogic.ClearEntity();
|
||||||
Passport = "123124"
|
LoadData();
|
||||||
};
|
}
|
||||||
|
catch (Exception) { }
|
||||||
|
}
|
||||||
|
|
||||||
DateTime start = DateTime.Now;
|
private void buttonPsqlToMongo_Click(object sender, EventArgs e)
|
||||||
_CLogic.Delete(model);
|
{
|
||||||
DateTime stop = DateTime.Now;
|
PostgresToMongo.Convert();
|
||||||
MessageBox.Show((start - stop).ToString(), "Test", MessageBoxButtons.OK);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//public string CookSurname { get; set; } = string.Empty;
|
|
||||||
//public int Experience { get; set; }
|
|
||||||
//public string PhoneNumber { get; set; } = string.Empty;
|
|
||||||
//public string Passport { get; set; } = string.Empty;
|
|
||||||
|
@ -3,8 +3,8 @@ using Microsoft.Extensions.Logging;
|
|||||||
using SushiBarBusinessLogic.BusinessLogics;
|
using SushiBarBusinessLogic.BusinessLogics;
|
||||||
using SushiBarContracts.BusinessLogicContracts;
|
using SushiBarContracts.BusinessLogicContracts;
|
||||||
using SushiBarContracts.StoragesContracts;
|
using SushiBarContracts.StoragesContracts;
|
||||||
//using SushiBarDatabaseImplement.Implements;
|
using SushiBarDatabaseImplement.Implements;
|
||||||
using SushiBarMongoDB.Implements;
|
//using SushiBarMongoDB.Implements;
|
||||||
using SushiBarView;
|
using SushiBarView;
|
||||||
|
|
||||||
namespace SushiBar
|
namespace SushiBar
|
||||||
|
@ -90,5 +90,10 @@ namespace SushiBarBusinessLogic.BusinessLogics
|
|||||||
throw new ArgumentNullException("Нет названия", nameof(model.BuyerName));
|
throw new ArgumentNullException("Нет названия", nameof(model.BuyerName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ClearEntity()
|
||||||
|
{
|
||||||
|
_buyerStorage.ClearEntity();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -89,5 +89,10 @@ namespace SushiBarBusinessLogic.BusinessLogics
|
|||||||
throw new ArgumentNullException("Нет названия", nameof(model.CookName));
|
throw new ArgumentNullException("Нет названия", nameof(model.CookName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ClearEntity()
|
||||||
|
{
|
||||||
|
_cookStorage.ClearEntity();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -89,5 +89,10 @@ namespace SushiBarBusinessLogic.BusinessLogics
|
|||||||
throw new ArgumentNullException("Нет названия", nameof(model.FoodName));
|
throw new ArgumentNullException("Нет названия", nameof(model.FoodName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ClearEntity()
|
||||||
|
{
|
||||||
|
_menuStorage.ClearEntity();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -89,5 +89,10 @@ namespace SushiBarBusinessLogic.BusinessLogics
|
|||||||
throw new ArgumentNullException("Нет названия", nameof(model.PlaceNumber));
|
throw new ArgumentNullException("Нет названия", nameof(model.PlaceNumber));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ClearEntity()
|
||||||
|
{
|
||||||
|
_placeStorage.ClearEntity();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -116,5 +116,10 @@ namespace SushiBarBusinessLogic.BusinessLogics
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ClearEntity()
|
||||||
|
{
|
||||||
|
_taskStorage.ClearEntity();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,5 +17,6 @@ namespace SushiBarContracts.BusinessLogicContracts
|
|||||||
bool Create(BuyerBindingModel model);
|
bool Create(BuyerBindingModel model);
|
||||||
bool Update(BuyerBindingModel model);
|
bool Update(BuyerBindingModel model);
|
||||||
bool Delete(BuyerBindingModel model);
|
bool Delete(BuyerBindingModel model);
|
||||||
|
void ClearEntity();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,5 +17,6 @@ namespace SushiBarContracts.BusinessLogicContracts
|
|||||||
bool Create(CookBindingModel model);
|
bool Create(CookBindingModel model);
|
||||||
bool Update(CookBindingModel model);
|
bool Update(CookBindingModel model);
|
||||||
bool Delete(CookBindingModel model);
|
bool Delete(CookBindingModel model);
|
||||||
|
void ClearEntity();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,5 +17,6 @@ namespace SushiBarContracts.BusinessLogicContracts
|
|||||||
bool Create(MenuBindingModel model);
|
bool Create(MenuBindingModel model);
|
||||||
bool Update(MenuBindingModel model);
|
bool Update(MenuBindingModel model);
|
||||||
bool Delete(MenuBindingModel model);
|
bool Delete(MenuBindingModel model);
|
||||||
|
void ClearEntity();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,5 +17,6 @@ namespace SushiBarContracts.BusinessLogicContracts
|
|||||||
bool Create(PlaceBindingModel model);
|
bool Create(PlaceBindingModel model);
|
||||||
bool Update(PlaceBindingModel model);
|
bool Update(PlaceBindingModel model);
|
||||||
bool Delete(PlaceBindingModel model);
|
bool Delete(PlaceBindingModel model);
|
||||||
|
void ClearEntity();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,5 +20,6 @@ namespace SushiBarContracts.BusinessLogicContracts
|
|||||||
bool TakeTaskInWork(TaskBindingModel model);
|
bool TakeTaskInWork(TaskBindingModel model);
|
||||||
bool FinishTask(TaskBindingModel model);
|
bool FinishTask(TaskBindingModel model);
|
||||||
bool DeliveryTask(TaskBindingModel model);
|
bool DeliveryTask(TaskBindingModel model);
|
||||||
|
void ClearEntity();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,5 +18,6 @@ namespace SushiBarContracts.StoragesContracts
|
|||||||
BuyerViewModel? Insert(BuyerBindingModel model);
|
BuyerViewModel? Insert(BuyerBindingModel model);
|
||||||
BuyerViewModel? Update(BuyerBindingModel model);
|
BuyerViewModel? Update(BuyerBindingModel model);
|
||||||
BuyerViewModel? Delete(BuyerBindingModel model);
|
BuyerViewModel? Delete(BuyerBindingModel model);
|
||||||
|
void ClearEntity();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,5 +18,6 @@ namespace SushiBarContracts.StoragesContracts
|
|||||||
CookViewModel? Insert(CookBindingModel model);
|
CookViewModel? Insert(CookBindingModel model);
|
||||||
CookViewModel? Update(CookBindingModel model);
|
CookViewModel? Update(CookBindingModel model);
|
||||||
CookViewModel? Delete(CookBindingModel model);
|
CookViewModel? Delete(CookBindingModel model);
|
||||||
|
void ClearEntity();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,5 +18,6 @@ namespace SushiBarContracts.StoragesContracts
|
|||||||
MenuViewModel? Insert(MenuBindingModel model);
|
MenuViewModel? Insert(MenuBindingModel model);
|
||||||
MenuViewModel? Update(MenuBindingModel model);
|
MenuViewModel? Update(MenuBindingModel model);
|
||||||
MenuViewModel? Delete(MenuBindingModel model);
|
MenuViewModel? Delete(MenuBindingModel model);
|
||||||
|
void ClearEntity();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,5 +18,6 @@ namespace SushiBarContracts.StoragesContracts
|
|||||||
PlaceViewModel? Insert(PlaceBindingModel model);
|
PlaceViewModel? Insert(PlaceBindingModel model);
|
||||||
PlaceViewModel? Update(PlaceBindingModel model);
|
PlaceViewModel? Update(PlaceBindingModel model);
|
||||||
PlaceViewModel? Delete(PlaceBindingModel model);
|
PlaceViewModel? Delete(PlaceBindingModel model);
|
||||||
|
void ClearEntity();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,5 +18,6 @@ namespace SushiBarContracts.StoragesContracts
|
|||||||
TaskViewModel? Insert(TaskBindingModel model);
|
TaskViewModel? Insert(TaskBindingModel model);
|
||||||
TaskViewModel? Update(TaskBindingModel model);
|
TaskViewModel? Update(TaskBindingModel model);
|
||||||
TaskViewModel? Delete(TaskBindingModel model);
|
TaskViewModel? Delete(TaskBindingModel model);
|
||||||
|
void ClearEntity();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using SushiBarContracts.BindingModels;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using SushiBarContracts.BindingModels;
|
||||||
using SushiBarContracts.SearchModels;
|
using SushiBarContracts.SearchModels;
|
||||||
using SushiBarContracts.StoragesContracts;
|
using SushiBarContracts.StoragesContracts;
|
||||||
using SushiBarContracts.ViewModels;
|
using SushiBarContracts.ViewModels;
|
||||||
@ -74,5 +75,13 @@ namespace SushiBarDatabaseImplement.Implements
|
|||||||
context.SaveChanges();
|
context.SaveChanges();
|
||||||
return component.GetViewModel;
|
return component.GetViewModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ClearEntity()
|
||||||
|
{
|
||||||
|
using var context = new SushiBarDatabase();
|
||||||
|
|
||||||
|
string deleteAllQuery = "DELETE FROM \"Buyers\"";
|
||||||
|
context.Database.ExecuteSqlRaw(deleteAllQuery);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using SushiBarContracts.BindingModels;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using SushiBarContracts.BindingModels;
|
||||||
using SushiBarContracts.SearchModels;
|
using SushiBarContracts.SearchModels;
|
||||||
using SushiBarContracts.StoragesContracts;
|
using SushiBarContracts.StoragesContracts;
|
||||||
using SushiBarContracts.ViewModels;
|
using SushiBarContracts.ViewModels;
|
||||||
@ -14,6 +15,14 @@ namespace SushiBarDatabaseImplement.Implements
|
|||||||
{
|
{
|
||||||
public class CookStorage : ICookStorage
|
public class CookStorage : ICookStorage
|
||||||
{
|
{
|
||||||
|
public void ClearEntity()
|
||||||
|
{
|
||||||
|
using var context = new SushiBarDatabase();
|
||||||
|
|
||||||
|
string deleteAllQuery = "DELETE FROM \"Cooks\"";
|
||||||
|
context.Database.ExecuteSqlRaw(deleteAllQuery);
|
||||||
|
}
|
||||||
|
|
||||||
public CookViewModel? Delete(CookBindingModel model)
|
public CookViewModel? Delete(CookBindingModel model)
|
||||||
{
|
{
|
||||||
using var context = new SushiBarDatabase();
|
using var context = new SushiBarDatabase();
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using SushiBarContracts.BindingModels;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using SushiBarContracts.BindingModels;
|
||||||
using SushiBarContracts.SearchModels;
|
using SushiBarContracts.SearchModels;
|
||||||
using SushiBarContracts.StoragesContracts;
|
using SushiBarContracts.StoragesContracts;
|
||||||
using SushiBarContracts.ViewModels;
|
using SushiBarContracts.ViewModels;
|
||||||
@ -14,6 +15,14 @@ namespace SushiBarDatabaseImplement.Implements
|
|||||||
{
|
{
|
||||||
public class MenuStorage : IMenuStorage
|
public class MenuStorage : IMenuStorage
|
||||||
{
|
{
|
||||||
|
public void ClearEntity()
|
||||||
|
{
|
||||||
|
using var context = new SushiBarDatabase();
|
||||||
|
|
||||||
|
string deleteAllQuery = "DELETE FROM \"Menus\"";
|
||||||
|
context.Database.ExecuteSqlRaw(deleteAllQuery);
|
||||||
|
}
|
||||||
|
|
||||||
public MenuViewModel? Delete(MenuBindingModel model)
|
public MenuViewModel? Delete(MenuBindingModel model)
|
||||||
{
|
{
|
||||||
using var context = new SushiBarDatabase();
|
using var context = new SushiBarDatabase();
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using SushiBarContracts.BindingModels;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using SushiBarContracts.BindingModels;
|
||||||
using SushiBarContracts.SearchModels;
|
using SushiBarContracts.SearchModels;
|
||||||
using SushiBarContracts.StoragesContracts;
|
using SushiBarContracts.StoragesContracts;
|
||||||
using SushiBarContracts.ViewModels;
|
using SushiBarContracts.ViewModels;
|
||||||
@ -14,6 +15,14 @@ namespace SushiBarDatabaseImplement.Implements
|
|||||||
{
|
{
|
||||||
public class PlaceStorage : IPlaceStorage
|
public class PlaceStorage : IPlaceStorage
|
||||||
{
|
{
|
||||||
|
public void ClearEntity()
|
||||||
|
{
|
||||||
|
using var context = new SushiBarDatabase();
|
||||||
|
|
||||||
|
string deleteAllQuery = "DELETE FROM \"Places\"";
|
||||||
|
context.Database.ExecuteSqlRaw(deleteAllQuery);
|
||||||
|
}
|
||||||
|
|
||||||
public PlaceViewModel? Delete(PlaceBindingModel model)
|
public PlaceViewModel? Delete(PlaceBindingModel model)
|
||||||
{
|
{
|
||||||
using var context = new SushiBarDatabase();
|
using var context = new SushiBarDatabase();
|
||||||
|
@ -13,6 +13,14 @@ namespace SushiBarDatabaseImplement.Implements
|
|||||||
{
|
{
|
||||||
public class TaskStorage : ITaskStorage
|
public class TaskStorage : ITaskStorage
|
||||||
{
|
{
|
||||||
|
public void ClearEntity()
|
||||||
|
{
|
||||||
|
using var context = new SushiBarDatabase();
|
||||||
|
|
||||||
|
string deleteAllQuery = "DELETE FROM \"Tasks\"";
|
||||||
|
context.Database.ExecuteSqlRaw(deleteAllQuery);
|
||||||
|
}
|
||||||
|
|
||||||
public TaskViewModel? Delete(TaskBindingModel model)
|
public TaskViewModel? Delete(TaskBindingModel model)
|
||||||
{
|
{
|
||||||
using var context = new SushiBarDatabase();
|
using var context = new SushiBarDatabase();
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
using Microsoft.EntityFrameworkCore.Metadata;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||||
using SushiBarDatabaseImplement;
|
using SushiBarDatabaseImplement;
|
||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
@ -12,8 +12,8 @@ using SushiBarDatabaseImplement;
|
|||||||
namespace SushiBarDatabaseImplement.Migrations
|
namespace SushiBarDatabaseImplement.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(SushiBarDatabase))]
|
[DbContext(typeof(SushiBarDatabase))]
|
||||||
[Migration("20240326181255_InitialCreate")]
|
[Migration("20240507174252_InitMigration")]
|
||||||
partial class InitialCreate
|
partial class InitMigration
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
@ -21,24 +21,24 @@ namespace SushiBarDatabaseImplement.Migrations
|
|||||||
#pragma warning disable 612, 618
|
#pragma warning disable 612, 618
|
||||||
modelBuilder
|
modelBuilder
|
||||||
.HasAnnotation("ProductVersion", "8.0.3")
|
.HasAnnotation("ProductVersion", "8.0.3")
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||||
|
|
||||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||||
|
|
||||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Buyer", b =>
|
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Buyer", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("int");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
b.Property<DateTime?>("BuyerBirthDate")
|
b.Property<DateTime?>("BuyerBirthDate")
|
||||||
.HasColumnType("datetime2");
|
.HasColumnType("timestamp without time zone");
|
||||||
|
|
||||||
b.Property<string>("BuyerName")
|
b.Property<string>("BuyerName")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
@ -49,28 +49,28 @@ namespace SushiBarDatabaseImplement.Migrations
|
|||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("int");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
b.Property<string>("CookName")
|
b.Property<string>("CookName")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<string>("CookSurname")
|
b.Property<string>("CookSurname")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<int>("Experience")
|
b.Property<int>("Experience")
|
||||||
.HasColumnType("int");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
b.Property<string>("Passport")
|
b.Property<string>("Passport")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<string>("PhoneNumber")
|
b.Property<string>("PhoneNumber")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
@ -81,20 +81,20 @@ namespace SushiBarDatabaseImplement.Migrations
|
|||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("int");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
b.Property<string>("Description")
|
b.Property<string>("Description")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<string>("FoodName")
|
b.Property<string>("FoodName")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<double>("Price")
|
b.Property<double>("Price")
|
||||||
.HasColumnType("float");
|
.HasColumnType("double precision");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
@ -105,15 +105,15 @@ namespace SushiBarDatabaseImplement.Migrations
|
|||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("int");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
b.Property<int>("CountPlaces")
|
b.Property<int>("CountPlaces")
|
||||||
.HasColumnType("int");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
b.Property<int>("PlaceNumber")
|
b.Property<int>("PlaceNumber")
|
||||||
.HasColumnType("int");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
@ -124,27 +124,27 @@ namespace SushiBarDatabaseImplement.Migrations
|
|||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("int");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
b.Property<int>("BuyerId")
|
b.Property<int>("BuyerId")
|
||||||
.HasColumnType("int");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
b.Property<int>("CookId")
|
b.Property<int>("CookId")
|
||||||
.HasColumnType("int");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
b.Property<double>("FullPrice")
|
b.Property<double>("FullPrice")
|
||||||
.HasColumnType("float");
|
.HasColumnType("double precision");
|
||||||
|
|
||||||
b.Property<int>("PlaceId")
|
b.Property<int>("PlaceId")
|
||||||
.HasColumnType("int");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
b.Property<int>("Status")
|
b.Property<int>("Status")
|
||||||
.HasColumnType("int");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
b.Property<DateTime>("TaskDate")
|
b.Property<DateTime>("TaskDate")
|
||||||
.HasColumnType("datetime2");
|
.HasColumnType("timestamp without time zone");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
@ -155,18 +155,18 @@ namespace SushiBarDatabaseImplement.Migrations
|
|||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("int");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
b.Property<int>("Count")
|
b.Property<int>("Count")
|
||||||
.HasColumnType("int");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
b.Property<int>("MenuId")
|
b.Property<int>("MenuId")
|
||||||
.HasColumnType("int");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
b.Property<int>("TaskId")
|
b.Property<int>("TaskId")
|
||||||
.HasColumnType("int");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
@ -1,12 +1,13 @@
|
|||||||
using System;
|
using System;
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
namespace SushiBarDatabaseImplement.Migrations
|
namespace SushiBarDatabaseImplement.Migrations
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public partial class InitialCreate : Migration
|
public partial class InitMigration : Migration
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
@ -15,10 +16,10 @@ namespace SushiBarDatabaseImplement.Migrations
|
|||||||
name: "Buyers",
|
name: "Buyers",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
{
|
{
|
||||||
Id = table.Column<int>(type: "int", nullable: false)
|
Id = table.Column<int>(type: "integer", nullable: false)
|
||||||
.Annotation("SqlServer:Identity", "1, 1"),
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||||
BuyerName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
BuyerName = table.Column<string>(type: "text", nullable: false),
|
||||||
BuyerBirthDate = table.Column<DateTime>(type: "datetime2", nullable: true)
|
BuyerBirthDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: true)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
@ -29,13 +30,13 @@ namespace SushiBarDatabaseImplement.Migrations
|
|||||||
name: "Cooks",
|
name: "Cooks",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
{
|
{
|
||||||
Id = table.Column<int>(type: "int", nullable: false)
|
Id = table.Column<int>(type: "integer", nullable: false)
|
||||||
.Annotation("SqlServer:Identity", "1, 1"),
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||||
CookName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
CookName = table.Column<string>(type: "text", nullable: false),
|
||||||
CookSurname = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
CookSurname = table.Column<string>(type: "text", nullable: false),
|
||||||
Experience = table.Column<int>(type: "int", nullable: false),
|
Experience = table.Column<int>(type: "integer", nullable: false),
|
||||||
PhoneNumber = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
PhoneNumber = table.Column<string>(type: "text", nullable: false),
|
||||||
Passport = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
Passport = table.Column<string>(type: "text", nullable: false)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
@ -46,11 +47,11 @@ namespace SushiBarDatabaseImplement.Migrations
|
|||||||
name: "Menus",
|
name: "Menus",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
{
|
{
|
||||||
Id = table.Column<int>(type: "int", nullable: false)
|
Id = table.Column<int>(type: "integer", nullable: false)
|
||||||
.Annotation("SqlServer:Identity", "1, 1"),
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||||
FoodName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
FoodName = table.Column<string>(type: "text", nullable: false),
|
||||||
Description = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
Description = table.Column<string>(type: "text", nullable: false),
|
||||||
Price = table.Column<double>(type: "float", nullable: false)
|
Price = table.Column<double>(type: "double precision", nullable: false)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
@ -61,10 +62,10 @@ namespace SushiBarDatabaseImplement.Migrations
|
|||||||
name: "Places",
|
name: "Places",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
{
|
{
|
||||||
Id = table.Column<int>(type: "int", nullable: false)
|
Id = table.Column<int>(type: "integer", nullable: false)
|
||||||
.Annotation("SqlServer:Identity", "1, 1"),
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||||
PlaceNumber = table.Column<int>(type: "int", nullable: false),
|
PlaceNumber = table.Column<int>(type: "integer", nullable: false),
|
||||||
CountPlaces = table.Column<int>(type: "int", nullable: false)
|
CountPlaces = table.Column<int>(type: "integer", nullable: false)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
@ -75,14 +76,14 @@ namespace SushiBarDatabaseImplement.Migrations
|
|||||||
name: "Tasks",
|
name: "Tasks",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
{
|
{
|
||||||
Id = table.Column<int>(type: "int", nullable: false)
|
Id = table.Column<int>(type: "integer", nullable: false)
|
||||||
.Annotation("SqlServer:Identity", "1, 1"),
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||||
TaskDate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
TaskDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||||
Status = table.Column<int>(type: "int", nullable: false),
|
Status = table.Column<int>(type: "integer", nullable: false),
|
||||||
FullPrice = table.Column<double>(type: "float", nullable: false),
|
FullPrice = table.Column<double>(type: "double precision", nullable: false),
|
||||||
PlaceId = table.Column<int>(type: "int", nullable: false),
|
PlaceId = table.Column<int>(type: "integer", nullable: false),
|
||||||
CookId = table.Column<int>(type: "int", nullable: false),
|
CookId = table.Column<int>(type: "integer", nullable: false),
|
||||||
BuyerId = table.Column<int>(type: "int", nullable: false)
|
BuyerId = table.Column<int>(type: "integer", nullable: false)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
@ -93,11 +94,11 @@ namespace SushiBarDatabaseImplement.Migrations
|
|||||||
name: "TaskMenus",
|
name: "TaskMenus",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
{
|
{
|
||||||
Id = table.Column<int>(type: "int", nullable: false)
|
Id = table.Column<int>(type: "integer", nullable: false)
|
||||||
.Annotation("SqlServer:Identity", "1, 1"),
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||||
TaskId = table.Column<int>(type: "int", nullable: false),
|
TaskId = table.Column<int>(type: "integer", nullable: false),
|
||||||
MenuId = table.Column<int>(type: "int", nullable: false),
|
MenuId = table.Column<int>(type: "integer", nullable: false),
|
||||||
Count = table.Column<int>(type: "int", nullable: false)
|
Count = table.Column<int>(type: "integer", nullable: false)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
@ -2,8 +2,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
using Microsoft.EntityFrameworkCore.Metadata;
|
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||||
using SushiBarDatabaseImplement;
|
using SushiBarDatabaseImplement;
|
||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
@ -18,24 +18,24 @@ namespace SushiBarDatabaseImplement.Migrations
|
|||||||
#pragma warning disable 612, 618
|
#pragma warning disable 612, 618
|
||||||
modelBuilder
|
modelBuilder
|
||||||
.HasAnnotation("ProductVersion", "8.0.3")
|
.HasAnnotation("ProductVersion", "8.0.3")
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||||
|
|
||||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||||
|
|
||||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Buyer", b =>
|
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Buyer", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("int");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
b.Property<DateTime?>("BuyerBirthDate")
|
b.Property<DateTime?>("BuyerBirthDate")
|
||||||
.HasColumnType("datetime2");
|
.HasColumnType("timestamp without time zone");
|
||||||
|
|
||||||
b.Property<string>("BuyerName")
|
b.Property<string>("BuyerName")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
@ -46,28 +46,28 @@ namespace SushiBarDatabaseImplement.Migrations
|
|||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("int");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
b.Property<string>("CookName")
|
b.Property<string>("CookName")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<string>("CookSurname")
|
b.Property<string>("CookSurname")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<int>("Experience")
|
b.Property<int>("Experience")
|
||||||
.HasColumnType("int");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
b.Property<string>("Passport")
|
b.Property<string>("Passport")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<string>("PhoneNumber")
|
b.Property<string>("PhoneNumber")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
@ -78,20 +78,20 @@ namespace SushiBarDatabaseImplement.Migrations
|
|||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("int");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
b.Property<string>("Description")
|
b.Property<string>("Description")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<string>("FoodName")
|
b.Property<string>("FoodName")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<double>("Price")
|
b.Property<double>("Price")
|
||||||
.HasColumnType("float");
|
.HasColumnType("double precision");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
@ -102,15 +102,15 @@ namespace SushiBarDatabaseImplement.Migrations
|
|||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("int");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
b.Property<int>("CountPlaces")
|
b.Property<int>("CountPlaces")
|
||||||
.HasColumnType("int");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
b.Property<int>("PlaceNumber")
|
b.Property<int>("PlaceNumber")
|
||||||
.HasColumnType("int");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
@ -121,27 +121,27 @@ namespace SushiBarDatabaseImplement.Migrations
|
|||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("int");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
b.Property<int>("BuyerId")
|
b.Property<int>("BuyerId")
|
||||||
.HasColumnType("int");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
b.Property<int>("CookId")
|
b.Property<int>("CookId")
|
||||||
.HasColumnType("int");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
b.Property<double>("FullPrice")
|
b.Property<double>("FullPrice")
|
||||||
.HasColumnType("float");
|
.HasColumnType("double precision");
|
||||||
|
|
||||||
b.Property<int>("PlaceId")
|
b.Property<int>("PlaceId")
|
||||||
.HasColumnType("int");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
b.Property<int>("Status")
|
b.Property<int>("Status")
|
||||||
.HasColumnType("int");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
b.Property<DateTime>("TaskDate")
|
b.Property<DateTime>("TaskDate")
|
||||||
.HasColumnType("datetime2");
|
.HasColumnType("timestamp without time zone");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
@ -152,18 +152,18 @@ namespace SushiBarDatabaseImplement.Migrations
|
|||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("int");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
b.Property<int>("Count")
|
b.Property<int>("Count")
|
||||||
.HasColumnType("int");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
b.Property<int>("MenuId")
|
b.Property<int>("MenuId")
|
||||||
.HasColumnType("int");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
b.Property<int>("TaskId")
|
b.Property<int>("TaskId")
|
||||||
.HasColumnType("int");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
@ -15,11 +15,15 @@ namespace SushiBarDatabaseImplement
|
|||||||
{
|
{
|
||||||
if (optionsBuilder.IsConfigured == false)
|
if (optionsBuilder.IsConfigured == false)
|
||||||
{
|
{
|
||||||
optionsBuilder.UseSqlServer(@"Data Source=.\SQLEXPRESS;Initial Catalog=SushiBarDatabase;Integrated Security=True;MultipleActiveResultSets=True;TrustServerCertificate=True");
|
optionsBuilder.UseNpgsql(@"Host=localhost;Database=SUBDLab8;Username=postgres;Password=shotboll200412");
|
||||||
}
|
}
|
||||||
base.OnConfiguring(optionsBuilder);
|
base.OnConfiguring(optionsBuilder);
|
||||||
|
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
|
||||||
|
AppContext.SetSwitch("Npgsql.DisableDateTimeInfinityConversions", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//optionsBuilder.UseNpgsql(@"Host=localhost;Database=ComputersShop_db;Username=postgres;Password=postgres");
|
||||||
|
|
||||||
public virtual DbSet<Buyer> Buyers { get; set; }
|
public virtual DbSet<Buyer> Buyers { get; set; }
|
||||||
public virtual DbSet<Cook> Cooks { get; set; }
|
public virtual DbSet<Cook> Cooks { get; set; }
|
||||||
public virtual DbSet<Menu> Menus { get; set; }
|
public virtual DbSet<Menu> Menus { get; set; }
|
||||||
|
@ -15,6 +15,14 @@ namespace SushiBarMongoDB.Implements
|
|||||||
{
|
{
|
||||||
public class CookStorage : ICookStorage
|
public class CookStorage : ICookStorage
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public void ClearEntity()
|
||||||
|
{
|
||||||
|
using var context = new SushiBarMongoDB();
|
||||||
|
context.GetCollection<Cook>("Cooks")
|
||||||
|
.DeleteMany(Builders<Cook>.Filter.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
public List<CookViewModel> GetFullList()
|
public List<CookViewModel> GetFullList()
|
||||||
{
|
{
|
||||||
using var context = new SushiBarMongoDB();
|
using var context = new SushiBarMongoDB();
|
||||||
|
122
SushiBar/SushiBarMongoDB/PostgresToMongo.cs
Normal file
122
SushiBar/SushiBarMongoDB/PostgresToMongo.cs
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
using MongoDB.Bson;
|
||||||
|
using MongoDB.Driver;
|
||||||
|
using MongoDB.Driver.Core.Configuration;
|
||||||
|
using Npgsql;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SushiBarMongoDB
|
||||||
|
{
|
||||||
|
public static class PostgresToMongo
|
||||||
|
{
|
||||||
|
public static void Convert()
|
||||||
|
{
|
||||||
|
string postgresConnection = "Host=localhost;Username=postgres;Password=shotboll200412;Database=SUBDLab8";
|
||||||
|
using var psqlConn = new NpgsqlConnection(postgresConnection);
|
||||||
|
psqlConn.Open();
|
||||||
|
|
||||||
|
var client = new MongoClient("mongodb://localhost:27017");
|
||||||
|
var database = client.GetDatabase("lab8SUBD");
|
||||||
|
|
||||||
|
var buyers = database.GetCollection<BsonDocument>("Buyers");
|
||||||
|
var cooks = database.GetCollection<BsonDocument>("Cooks");
|
||||||
|
var menus = database.GetCollection<BsonDocument>("Menus");
|
||||||
|
var places = database.GetCollection<BsonDocument>("Places");
|
||||||
|
var tasks = database.GetCollection<BsonDocument>("Tasks");
|
||||||
|
|
||||||
|
//Конвертация покупателей
|
||||||
|
|
||||||
|
using var psqlBuyers = new NpgsqlCommand("SELECT * FROM \"Buyers\"", psqlConn);
|
||||||
|
using var readBuyers = psqlBuyers.ExecuteReader();
|
||||||
|
|
||||||
|
while(readBuyers.Read())
|
||||||
|
{
|
||||||
|
var document = new BsonDocument();
|
||||||
|
for(int i = 0;i<readBuyers.FieldCount;i++)
|
||||||
|
{
|
||||||
|
document.Add(readBuyers.GetName(i), BsonValue.Create(readBuyers.GetValue(i)));
|
||||||
|
}
|
||||||
|
buyers.InsertOne(document);
|
||||||
|
}
|
||||||
|
readBuyers.Close();
|
||||||
|
psqlBuyers.Cancel();
|
||||||
|
|
||||||
|
//Конвертация поваров
|
||||||
|
|
||||||
|
using var psqlCooks = new NpgsqlCommand("SELECT * FROM \"Cooks\"", psqlConn);
|
||||||
|
using var readCooks = psqlCooks.ExecuteReader();
|
||||||
|
|
||||||
|
while (readCooks.Read())
|
||||||
|
{
|
||||||
|
var document = new BsonDocument();
|
||||||
|
for (int i = 0; i < readCooks.FieldCount; i++)
|
||||||
|
{
|
||||||
|
document.Add(readCooks.GetName(i), BsonValue.Create(readCooks.GetValue(i)));
|
||||||
|
}
|
||||||
|
cooks.InsertOne(document);
|
||||||
|
}
|
||||||
|
readCooks.Close();
|
||||||
|
psqlCooks.Cancel();
|
||||||
|
|
||||||
|
//Конвертация меню
|
||||||
|
|
||||||
|
using var psqlMenus = new NpgsqlCommand("SELECT * FROM \"Menus\"", psqlConn);
|
||||||
|
using var readMenus = psqlMenus.ExecuteReader();
|
||||||
|
|
||||||
|
while (readMenus.Read())
|
||||||
|
{
|
||||||
|
var document = new BsonDocument();
|
||||||
|
for (int i = 0; i < readMenus.FieldCount; i++)
|
||||||
|
{
|
||||||
|
document.Add(readMenus.GetName(i), BsonValue.Create(readMenus.GetValue(i)));
|
||||||
|
}
|
||||||
|
menus.InsertOne(document);
|
||||||
|
}
|
||||||
|
readMenus.Close();
|
||||||
|
psqlMenus.Cancel();
|
||||||
|
|
||||||
|
//Конвертация столиков
|
||||||
|
|
||||||
|
using var psqlPlaces = new NpgsqlCommand("SELECT * FROM \"Places\"", psqlConn);
|
||||||
|
using var readPlaces = psqlPlaces.ExecuteReader();
|
||||||
|
|
||||||
|
while (readPlaces.Read())
|
||||||
|
{
|
||||||
|
var document = new BsonDocument();
|
||||||
|
for (int i = 0; i < readPlaces.FieldCount; i++)
|
||||||
|
{
|
||||||
|
document.Add(readPlaces.GetName(i), BsonValue.Create(readPlaces.GetValue(i)));
|
||||||
|
}
|
||||||
|
places.InsertOne(document);
|
||||||
|
}
|
||||||
|
readPlaces.Close();
|
||||||
|
psqlPlaces.Cancel();
|
||||||
|
|
||||||
|
//Конфертация заказов
|
||||||
|
|
||||||
|
using var psqlTasks = new NpgsqlCommand("SELECT * FROM \"Tasks\"", psqlConn);
|
||||||
|
using var readTasks = psqlTasks.ExecuteReader();
|
||||||
|
|
||||||
|
while (readTasks.Read())
|
||||||
|
{
|
||||||
|
var document = new BsonDocument();
|
||||||
|
for (int i = 0; i < readTasks.FieldCount; i++)
|
||||||
|
{
|
||||||
|
string fieldName = readTasks.GetName(i);
|
||||||
|
if (fieldName == "PlaceId") fieldName = "place_id";
|
||||||
|
if (fieldName == "CookId") fieldName = "cook_id";
|
||||||
|
if (fieldName == "BuyerId") fieldName = "buyer_id";
|
||||||
|
if (fieldName == "MenuIds") fieldName = "menu_ids";
|
||||||
|
document.Add(readTasks.GetName(i), BsonValue.Create(readTasks.GetValue(i)));
|
||||||
|
}
|
||||||
|
tasks.InsertOne(document);
|
||||||
|
}
|
||||||
|
readTasks.Close();
|
||||||
|
psqlTasks.Cancel();
|
||||||
|
psqlConn.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user