From 0d657d919f64a211bc3083bbfa8d67be1c649f6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=BA=D1=81=D0=B8=D0=BC=20=D0=AF=D0=BA=D0=BE?= =?UTF-8?q?=D0=B2=D0=BB=D0=B5=D0=B2?= Date: Tue, 7 May 2024 16:17:47 +0400 Subject: [PATCH] =?UTF-8?q?=D0=BF=D1=80=D0=B0=D0=B2=D0=BE=D1=87=D0=BA?= =?UTF-8?q?=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SushiBar/SushiBar/FormCreateTask.cs | 5 +++++ SushiBar/SushiBar/FormMain.cs | 19 ++++++++++--------- .../BusinessLogics/CookLogic.cs | 1 - 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/SushiBar/SushiBar/FormCreateTask.cs b/SushiBar/SushiBar/FormCreateTask.cs index 9db435f..7be33c8 100644 --- a/SushiBar/SushiBar/FormCreateTask.cs +++ b/SushiBar/SushiBar/FormCreateTask.cs @@ -108,6 +108,7 @@ namespace SushiBarView { if (form.ShowDialog() == DialogResult.OK) { + if (form.MenuModel == null) { return; @@ -187,11 +188,15 @@ namespace SushiBarView PlaceId = comboBoxPlace.SelectedIndex + 1, TaskMenus = _taskMenu }; + DateTime start = DateTime.Now; + var operationResult = _id.HasValue ? _logicT.Update(model) : _logicT.Create(model); if (!operationResult) { throw new Exception("Ошибка при сохранении. Доп информация в логах"); } + DateTime stop = DateTime.Now; + MessageBox.Show((stop - start).ToString(), "Test", MessageBoxButtons.OK); MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information); DialogResult = DialogResult.OK; Close(); diff --git a/SushiBar/SushiBar/FormMain.cs b/SushiBar/SushiBar/FormMain.cs index 90a0cae..13d893a 100644 --- a/SushiBar/SushiBar/FormMain.cs +++ b/SushiBar/SushiBar/FormMain.cs @@ -69,7 +69,12 @@ namespace SushiBarView private void LoadData() { + DateTime start = DateTime.Now; + + var _list = _logic.ReadList(null); + DateTime stop = DateTime.Now; + MessageBox.Show((stop - start).ToString(), "Test", MessageBoxButtons.OK); if (_list != null) { dataGridView.DataSource = _list; @@ -168,20 +173,16 @@ namespace SushiBarView private void buttonTest_Click(object sender, EventArgs e) { - CookBindingModel model = new CookBindingModel() + TaskBindingModel model = new TaskBindingModel() { - Id = 2, - CookName = "Иван", - CookSurname = "dssfsdfs", - Experience = 2, - PhoneNumber = "+79054324312", - Passport = "123124" + Id = 1 }; DateTime start = DateTime.Now; - _CLogic.Delete(model); + _logic.Delete(model); + DateTime stop = DateTime.Now; - MessageBox.Show((start - stop).ToString(), "Test", MessageBoxButtons.OK); + MessageBox.Show((stop - start).ToString(), "Test", MessageBoxButtons.OK); } } } diff --git a/SushiBar/SushiBarBusinessLogic/BusinessLogics/CookLogic.cs b/SushiBar/SushiBarBusinessLogic/BusinessLogics/CookLogic.cs index 7bfa486..4bfc022 100644 --- a/SushiBar/SushiBarBusinessLogic/BusinessLogics/CookLogic.cs +++ b/SushiBar/SushiBarBusinessLogic/BusinessLogics/CookLogic.cs @@ -56,7 +56,6 @@ namespace SushiBarBusinessLogic.BusinessLogics public bool Delete(CookBindingModel model) { - CheckModel(model, false); if (_cookStorage.Delete(model) == null) { return false;