commit после сложного запроса

This commit is contained in:
dasha 2023-05-05 19:46:47 +04:00
parent 2d9db74bce
commit 594bfdaf5d
2 changed files with 51 additions and 21 deletions

View File

@ -55,7 +55,8 @@
this.comboBoxWhat.Items.AddRange(new object[] { this.comboBoxWhat.Items.AddRange(new object[] {
"Сотрудники", "Сотрудники",
"Клиенты", "Клиенты",
"Заказы"}); "Заказы",
"Сложный запрос"});
this.comboBoxWhat.Location = new System.Drawing.Point(68, 31); this.comboBoxWhat.Location = new System.Drawing.Point(68, 31);
this.comboBoxWhat.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.comboBoxWhat.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.comboBoxWhat.Name = "comboBoxWhat"; this.comboBoxWhat.Name = "comboBoxWhat";

View File

@ -2,6 +2,7 @@
using BeautySaloonContracts.BusinessLogicsContracts; using BeautySaloonContracts.BusinessLogicsContracts;
using BeautySaloonContracts.SearchModels; using BeautySaloonContracts.SearchModels;
using BeautySaloonContracts.ViewModels; using BeautySaloonContracts.ViewModels;
using BeautySaloonDatabaseImplement;
using BeautySaloonDataModels; using BeautySaloonDataModels;
using System.Diagnostics; using System.Diagnostics;
using System.Text; using System.Text;
@ -206,6 +207,34 @@ namespace BeautySaloonView
ts2.Milliseconds / 10); ts2.Milliseconds / 10);
label.Text = ("Время: " + elapsedTime2); label.Text = ("Время: " + elapsedTime2);
break; break;
case "Сложный запрос":
Stopwatch stopwatch3 = new Stopwatch();
stopwatch3.Start();
using (NewdbContext db = new NewdbContext())
{
var users = (from o in db.Orders
join c in db.Clients on o.ClientId equals c.Id
join em in db.Employees on o.EmployeeId equals em.Id
join p in db.Positions on em.PositionId equals p.Id
where p.Name == "Продавец"
orderby o.Date descending, o.Sum descending
select new
{
Id = o.Id,
Client = c.Name + ' ' + c.Surname + ' ' + c.Patronymic,
Seller = em.Name + ' ' + em.Surname + ' ' + em.Patronymic,
Position = p.Name,
Date = o.Date,
Sum = o.Sum
}).ToList();
}
stopwatch3.Stop();
TimeSpan ts3 = stopwatch3.Elapsed;
string elapsedTime3 = String.Format("{0:00}:{1:00}:{2:00}.{3:00}",
ts3.Hours, ts3.Minutes, ts3.Seconds,
ts3.Milliseconds / 10);
label.Text = ("Время: " + elapsedTime3);
break;
} }
break; break;
} }