ИСЭбд-21 Мосевнин А.М. LabWork_4 #4
@ -9,10 +9,9 @@ namespace ProjectLibrary.Entites
|
||||
{
|
||||
public class Book_Orders
|
||||
{
|
||||
[Browsable(false)]
|
||||
public int BookID { get; private set; }
|
||||
|
||||
[Browsable(false)]
|
||||
|
||||
public int OrderID { get; private set; }
|
||||
|
||||
[DisplayName("Количество")]
|
||||
|
@ -4,10 +4,8 @@ namespace ProjectLibrary.Entites
|
||||
{
|
||||
public class Book_Library
|
||||
{
|
||||
[Browsable(false)]
|
||||
public int BookID { get; private set; }
|
||||
|
||||
[Browsable(false)]
|
||||
public int LibraryID { get; private set; }
|
||||
[DisplayName("Количество")]
|
||||
public int Count { get; private set; }
|
||||
|
27
ProjectLibrary/Forms/FBooks.Designer.cs
generated
27
ProjectLibrary/Forms/FBooks.Designer.cs
generated
@ -40,57 +40,52 @@
|
||||
dataGridViewBooks.AllowUserToAddRows = false;
|
||||
dataGridViewBooks.AllowUserToDeleteRows = false;
|
||||
dataGridViewBooks.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridViewBooks.Location = new Point(10, 9);
|
||||
dataGridViewBooks.Margin = new Padding(3, 2, 3, 2);
|
||||
dataGridViewBooks.Location = new Point(11, 12);
|
||||
dataGridViewBooks.Name = "dataGridViewBooks";
|
||||
dataGridViewBooks.ReadOnly = true;
|
||||
dataGridViewBooks.RowHeadersWidth = 51;
|
||||
dataGridViewBooks.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridViewBooks.Size = new Size(602, 254);
|
||||
dataGridViewBooks.Size = new Size(688, 339);
|
||||
dataGridViewBooks.TabIndex = 8;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.Location = new Point(27, 267);
|
||||
buttonAdd.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonAdd.Location = new Point(31, 356);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(161, 37);
|
||||
buttonAdd.Size = new Size(184, 49);
|
||||
buttonAdd.TabIndex = 9;
|
||||
buttonAdd.Text = "Добавить";
|
||||
buttonAdd.Click += buttonAdd_Click;
|
||||
//
|
||||
// buttonUpdate
|
||||
//
|
||||
buttonUpdate.Location = new Point(247, 267);
|
||||
buttonUpdate.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonUpdate.Location = new Point(282, 356);
|
||||
buttonUpdate.Name = "buttonUpdate";
|
||||
buttonUpdate.Size = new Size(161, 37);
|
||||
buttonUpdate.Size = new Size(184, 49);
|
||||
buttonUpdate.TabIndex = 10;
|
||||
buttonUpdate.Text = "Изменить";
|
||||
buttonUpdate.Click += buttonUpdate_Click;
|
||||
//
|
||||
// buttonRemove
|
||||
//
|
||||
buttonRemove.Location = new Point(452, 267);
|
||||
buttonRemove.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonRemove.Location = new Point(517, 356);
|
||||
buttonRemove.Name = "buttonRemove";
|
||||
buttonRemove.Size = new Size(161, 37);
|
||||
buttonRemove.Size = new Size(184, 49);
|
||||
buttonRemove.TabIndex = 11;
|
||||
buttonRemove.Text = "Удалить";
|
||||
buttonRemove.Click += buttonRemove_Click;
|
||||
//
|
||||
// FBooks
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(700, 338);
|
||||
ClientSize = new Size(800, 451);
|
||||
Controls.Add(dataGridViewBooks);
|
||||
Controls.Add(buttonAdd);
|
||||
Controls.Add(buttonUpdate);
|
||||
Controls.Add(buttonRemove);
|
||||
Margin = new Padding(3, 2, 3, 2);
|
||||
Name = "FBooks";
|
||||
Text = "FBooks";
|
||||
Text = "Книги";
|
||||
Load += FBooks_Load;
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewBooks).EndInit();
|
||||
ResumeLayout(false);
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
@ -48,7 +48,7 @@
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
|
27
ProjectLibrary/Forms/FLibraries.Designer.cs
generated
27
ProjectLibrary/Forms/FLibraries.Designer.cs
generated
@ -40,56 +40,53 @@
|
||||
dataGridViewOrders.AllowUserToAddRows = false;
|
||||
dataGridViewOrders.AllowUserToDeleteRows = false;
|
||||
dataGridViewOrders.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridViewOrders.Location = new Point(12, 11);
|
||||
dataGridViewOrders.Margin = new Padding(3, 2, 3, 2);
|
||||
dataGridViewOrders.Location = new Point(14, 15);
|
||||
dataGridViewOrders.Name = "dataGridViewOrders";
|
||||
dataGridViewOrders.ReadOnly = true;
|
||||
dataGridViewOrders.RowHeadersWidth = 51;
|
||||
dataGridViewOrders.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridViewOrders.Size = new Size(525, 225);
|
||||
dataGridViewOrders.Size = new Size(600, 300);
|
||||
dataGridViewOrders.TabIndex = 8;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.Location = new Point(12, 251);
|
||||
buttonAdd.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonAdd.Location = new Point(14, 335);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(88, 22);
|
||||
buttonAdd.Size = new Size(101, 29);
|
||||
buttonAdd.TabIndex = 9;
|
||||
buttonAdd.Text = "Добавить";
|
||||
buttonAdd.Click += buttonAdd_Click;
|
||||
//
|
||||
// buttonUpdate
|
||||
//
|
||||
buttonUpdate.Location = new Point(227, 251);
|
||||
buttonUpdate.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonUpdate.Location = new Point(259, 335);
|
||||
buttonUpdate.Name = "buttonUpdate";
|
||||
buttonUpdate.Size = new Size(88, 22);
|
||||
buttonUpdate.Size = new Size(101, 29);
|
||||
buttonUpdate.TabIndex = 10;
|
||||
buttonUpdate.Text = "Изменить";
|
||||
buttonUpdate.Click += buttonUpdate_Click;
|
||||
//
|
||||
// buttonRemove
|
||||
//
|
||||
buttonRemove.Location = new Point(450, 251);
|
||||
buttonRemove.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonRemove.Location = new Point(514, 335);
|
||||
buttonRemove.Name = "buttonRemove";
|
||||
buttonRemove.Size = new Size(88, 22);
|
||||
buttonRemove.Size = new Size(101, 29);
|
||||
buttonRemove.TabIndex = 11;
|
||||
buttonRemove.Text = "Удалить";
|
||||
buttonRemove.Click += buttonRemove_Click;
|
||||
//
|
||||
// FLibraries
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(562, 283);
|
||||
ClientSize = new Size(642, 377);
|
||||
Controls.Add(dataGridViewOrders);
|
||||
Controls.Add(buttonAdd);
|
||||
Controls.Add(buttonUpdate);
|
||||
Controls.Add(buttonRemove);
|
||||
Margin = new Padding(3, 4, 3, 4);
|
||||
Name = "FLibraries";
|
||||
Text = "FLibraries";
|
||||
Text = "Библиотеки";
|
||||
Load += FLibraries_Load;
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewOrders).EndInit();
|
||||
ResumeLayout(false);
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
@ -48,7 +48,7 @@
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
|
@ -82,7 +82,7 @@
|
||||
buttonCreate.UseVisualStyleBackColor = false;
|
||||
buttonCreate.Click += ButtonCreate_Click;
|
||||
//
|
||||
// FormOrderDistributionReport
|
||||
// FOrderDistributionReport
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
@ -92,8 +92,8 @@
|
||||
Controls.Add(label1);
|
||||
Controls.Add(labelFileName);
|
||||
Controls.Add(buttonSelectFileName);
|
||||
Name = "FormOrderDistributionReport";
|
||||
Text = "FormInvoiceDistributionReport";
|
||||
Name = "FOrderDistributionReport";
|
||||
Text = "Количество книг в библиотеках";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
2
ProjectLibrary/Forms/FOrders.Designer.cs
generated
2
ProjectLibrary/Forms/FOrders.Designer.cs
generated
@ -74,7 +74,7 @@
|
||||
Controls.Add(buttonAdd);
|
||||
Controls.Add(buttonRemove);
|
||||
Name = "FOrders";
|
||||
Text = "FOrders";
|
||||
Text = "Заказы";
|
||||
Load += FOrders_Load;
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewOrders).EndInit();
|
||||
ResumeLayout(false);
|
||||
|
22
ProjectLibrary/Forms/FTiclet_Extensions.Designer.cs
generated
22
ProjectLibrary/Forms/FTiclet_Extensions.Designer.cs
generated
@ -39,45 +39,43 @@
|
||||
dataGridView.AllowUserToAddRows = false;
|
||||
dataGridView.AllowUserToDeleteRows = false;
|
||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView.Location = new Point(12, 11);
|
||||
dataGridView.Margin = new Padding(3, 2, 3, 2);
|
||||
dataGridView.Location = new Point(14, 15);
|
||||
dataGridView.Name = "dataGridView";
|
||||
dataGridView.ReadOnly = true;
|
||||
dataGridView.RowHeadersWidth = 51;
|
||||
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridView.Size = new Size(525, 225);
|
||||
dataGridView.Size = new Size(600, 300);
|
||||
dataGridView.TabIndex = 8;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.Location = new Point(12, 251);
|
||||
buttonAdd.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonAdd.Location = new Point(14, 335);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(88, 22);
|
||||
buttonAdd.Size = new Size(101, 29);
|
||||
buttonAdd.TabIndex = 9;
|
||||
buttonAdd.Text = "Добавить";
|
||||
buttonAdd.Click += buttonAdd_Click;
|
||||
//
|
||||
// buttonUpdate
|
||||
//
|
||||
buttonUpdate.Location = new Point(227, 251);
|
||||
buttonUpdate.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonUpdate.Location = new Point(259, 335);
|
||||
buttonUpdate.Name = "buttonUpdate";
|
||||
buttonUpdate.Size = new Size(88, 22);
|
||||
buttonUpdate.Size = new Size(101, 29);
|
||||
buttonUpdate.TabIndex = 10;
|
||||
buttonUpdate.Text = "Изменить";
|
||||
buttonUpdate.Click += buttonUpdate_Click;
|
||||
//
|
||||
// FTiclet_Extensions
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(569, 293);
|
||||
ClientSize = new Size(650, 391);
|
||||
Controls.Add(dataGridView);
|
||||
Controls.Add(buttonAdd);
|
||||
Controls.Add(buttonUpdate);
|
||||
Margin = new Padding(3, 4, 3, 4);
|
||||
Name = "FTiclet_Extensions";
|
||||
Text = "FTiclet_Extensions";
|
||||
Text = "Продления билетов";
|
||||
Load += FTiclet_Extensions_Load;
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||
ResumeLayout(false);
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
@ -48,7 +48,7 @@
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
|
@ -39,8 +39,8 @@ public class ChartReport
|
||||
{
|
||||
return _orderRepository
|
||||
.ReadOrders()
|
||||
.GroupBy(x => x.BookOrders.First(y => y.OrderID == x.Id).BookID , (key, group) => new { ID = key, Count = group.Sum(y => y.BookOrders.First(z => z.OrderID == y.Id).Count) })
|
||||
.Select(x => (x.ID.ToString(), (double)x.Count))
|
||||
.GroupBy(x => x.BookOrders.First(y => y.OrderID == x.Id).BookName , (key, group) => new { Name = key, Count = group.Sum(y => y.BookOrders.First(z => z.OrderID == y.Id).Count) })
|
||||
.Select(x => (x.Name, (double)x.Count))
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
@ -42,9 +42,6 @@ public class TableReport
|
||||
|
||||
private List<string[]> GetData(DateTime? startDate = null, DateTime? endDate = null)
|
||||
{
|
||||
var s = _orderRepository
|
||||
.ReadOrders(StartDate: startDate, EndDate: endDate);
|
||||
|
||||
var data = _orderRepository
|
||||
.ReadOrders(StartDate: startDate, EndDate: endDate)
|
||||
.Select(x => new
|
||||
@ -52,7 +49,7 @@ public class TableReport
|
||||
x.Id,
|
||||
DateOrder = x.OrderDate,
|
||||
DateReturn = x.ReturnDate,
|
||||
Book = x.BookOrders.FirstOrDefault(y => y.OrderID == x.Id)?.BookID,//вот эти данные не вставляются в эксель
|
||||
Book = x.BookOrders.FirstOrDefault(y => y.OrderID == x.Id)?.BookName,
|
||||
Count = x.BookOrders.FirstOrDefault(y => y.OrderID == x.Id)?.Count
|
||||
})
|
||||
.OrderBy(x => x.Id);
|
||||
@ -61,7 +58,7 @@ public class TableReport
|
||||
.Union(
|
||||
data
|
||||
.Select(x => new string[] { x.Id.ToString(), x.DateOrder.ToString("dd.MM.yyyy"), x.DateReturn.ToString("dd.MM.yyyy"),
|
||||
x.Book?.ToString("N0") ?? string.Empty, x.Count?.ToString("N0") ?? string.Empty}))
|
||||
x.Book?.ToString() ?? string.Empty, x.Count?.ToString("N0") ?? string.Empty}))
|
||||
.Union([["Всего", "", "", "", data.Sum(x => x.Count ?? 0).ToString("N0")]])
|
||||
.ToList();
|
||||
//return null;
|
||||
|
@ -123,9 +123,9 @@ namespace ProjectLibrary.Repositories.Implementations
|
||||
{
|
||||
builder.AddCollerction("ord.ReturnDate < @EndDate");
|
||||
}*/
|
||||
var querySelect = $@"SELECT ord.*,
|
||||
bk.Name as BookName,
|
||||
Obo.bookid as bookid
|
||||
var querySelect = $@"SELECT ord.*, bk.Name as BookName,
|
||||
Obo.bookid as bookid,
|
||||
Obo.Orderid, obo.count
|
||||
FROM Orders ord
|
||||
INNER JOIN Book_Orders Obo ON Obo.orderId = ord.Id
|
||||
Inner join book bk on bk.ID = obo.Bookid
|
||||
@ -140,6 +140,7 @@ namespace ProjectLibrary.Repositories.Implementations
|
||||
Book_Orders = [];
|
||||
OrderBookDict.Add(orders.Id, Book_Orders);
|
||||
}
|
||||
books_orders.BookName = orders.BookName;
|
||||
Book_Orders.Add(books_orders);
|
||||
return orders;
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user