7(4/2). Stupid mistakes fixed, however ORDER form still needs corrections

This commit is contained in:
Inna Pruidze 2024-12-24 23:06:21 +04:00
parent ed1b146837
commit d1cb641edd
9 changed files with 30 additions and 37 deletions

View File

@ -44,9 +44,10 @@
PanelWithOperations.Controls.Add(AddBtn); PanelWithOperations.Controls.Add(AddBtn);
PanelWithOperations.Controls.Add(UpdBtn); PanelWithOperations.Controls.Add(UpdBtn);
PanelWithOperations.Dock = DockStyle.Right; PanelWithOperations.Dock = DockStyle.Right;
PanelWithOperations.Location = new Point(623, 0); PanelWithOperations.Location = new Point(1155, 0);
PanelWithOperations.Margin = new Padding(4, 4, 4, 4);
PanelWithOperations.Name = "PanelWithOperations"; PanelWithOperations.Name = "PanelWithOperations";
PanelWithOperations.Size = new Size(154, 396); PanelWithOperations.Size = new Size(200, 718);
PanelWithOperations.TabIndex = 0; PanelWithOperations.TabIndex = 0;
// //
// DelBtn // DelBtn
@ -55,9 +56,10 @@
DelBtn.BackgroundImage = Properties.Resources.DelImg; DelBtn.BackgroundImage = Properties.Resources.DelImg;
DelBtn.BackgroundImageLayout = ImageLayout.Stretch; DelBtn.BackgroundImageLayout = ImageLayout.Stretch;
DelBtn.ForeColor = Color.Transparent; DelBtn.ForeColor = Color.Transparent;
DelBtn.Location = new Point(23, 207); DelBtn.Location = new Point(40, 364);
DelBtn.Margin = new Padding(4, 4, 4, 4);
DelBtn.Name = "DelBtn"; DelBtn.Name = "DelBtn";
DelBtn.Size = new Size(78, 71); DelBtn.Size = new Size(101, 91);
DelBtn.TabIndex = 4; DelBtn.TabIndex = 4;
DelBtn.UseVisualStyleBackColor = false; DelBtn.UseVisualStyleBackColor = false;
DelBtn.Click += DelBtn_Click; DelBtn.Click += DelBtn_Click;
@ -68,9 +70,10 @@
AddBtn.BackgroundImage = Properties.Resources.AddImg; AddBtn.BackgroundImage = Properties.Resources.AddImg;
AddBtn.BackgroundImageLayout = ImageLayout.Stretch; AddBtn.BackgroundImageLayout = ImageLayout.Stretch;
AddBtn.ForeColor = Color.Transparent; AddBtn.ForeColor = Color.Transparent;
AddBtn.Location = new Point(23, 53); AddBtn.Location = new Point(40, 167);
AddBtn.Margin = new Padding(4, 4, 4, 4);
AddBtn.Name = "AddBtn"; AddBtn.Name = "AddBtn";
AddBtn.Size = new Size(78, 71); AddBtn.Size = new Size(101, 91);
AddBtn.TabIndex = 3; AddBtn.TabIndex = 3;
AddBtn.UseVisualStyleBackColor = false; AddBtn.UseVisualStyleBackColor = false;
AddBtn.Click += AddBtn_Click; AddBtn.Click += AddBtn_Click;
@ -81,9 +84,10 @@
UpdBtn.BackgroundImage = Properties.Resources.OperationImg; UpdBtn.BackgroundImage = Properties.Resources.OperationImg;
UpdBtn.BackgroundImageLayout = ImageLayout.Stretch; UpdBtn.BackgroundImageLayout = ImageLayout.Stretch;
UpdBtn.ForeColor = Color.Transparent; UpdBtn.ForeColor = Color.Transparent;
UpdBtn.Location = new Point(23, 130); UpdBtn.Location = new Point(40, 265);
UpdBtn.Margin = new Padding(4, 4, 4, 4);
UpdBtn.Name = "UpdBtn"; UpdBtn.Name = "UpdBtn";
UpdBtn.Size = new Size(78, 71); UpdBtn.Size = new Size(101, 91);
UpdBtn.TabIndex = 1; UpdBtn.TabIndex = 1;
UpdBtn.UseVisualStyleBackColor = false; UpdBtn.UseVisualStyleBackColor = false;
UpdBtn.Click += UpdBtn_Click; UpdBtn.Click += UpdBtn_Click;
@ -96,24 +100,26 @@
DataGV.BackgroundColor = Color.DarkSlateBlue; DataGV.BackgroundColor = Color.DarkSlateBlue;
DataGV.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; DataGV.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
DataGV.GridColor = Color.GreenYellow; DataGV.GridColor = Color.GreenYellow;
DataGV.Location = new Point(25, 101); DataGV.Location = new Point(39, 166);
DataGV.Margin = new Padding(4, 4, 4, 4);
DataGV.Name = "DataGV"; DataGV.Name = "DataGV";
DataGV.RowHeadersVisible = false; DataGV.RowHeadersVisible = false;
DataGV.RowHeadersWidth = 62; DataGV.RowHeadersWidth = 62;
DataGV.SelectionMode = DataGridViewSelectionMode.FullRowSelect; DataGV.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
DataGV.Size = new Size(583, 259); DataGV.Size = new Size(1090, 488);
DataGV.TabIndex = 1; DataGV.TabIndex = 1;
// //
// BookListF // BookListF
// //
AutoScaleDimensions = new SizeF(10F, 25F); AutoScaleDimensions = new SizeF(13F, 32F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
BackgroundImage = Properties.Resources.BookListFrameCover; BackgroundImage = Properties.Resources.BookListFrameCover;
BackgroundImageLayout = ImageLayout.Stretch; BackgroundImageLayout = ImageLayout.Stretch;
ClientSize = new Size(777, 396); ClientSize = new Size(1355, 718);
Controls.Add(DataGV); Controls.Add(DataGV);
Controls.Add(PanelWithOperations); Controls.Add(PanelWithOperations);
DoubleBuffered = true; DoubleBuffered = true;
Margin = new Padding(4, 4, 4, 4);
Name = "BookListF"; Name = "BookListF";
StartPosition = FormStartPosition.CenterParent; StartPosition = FormStartPosition.CenterParent;
Text = "BookListF"; Text = "BookListF";

View File

@ -67,6 +67,7 @@ public partial class CustomerListF : Form
{ {
DataGV.DataSource = _custR.GetCards(); DataGV.DataSource = _custR.GetCards();
DataGV.Columns["FIO"].Visible = false; DataGV.Columns["FIO"].Visible = false;
DataGV.Columns["CardID"].Visible = false;
} }
private bool GetIDFromRow(out int id) private bool GetIDFromRow(out int id)

View File

@ -86,7 +86,7 @@ public partial class EmployeesF : Form
private void ReloadList() private void ReloadList()
{ {
DataGV.DataSource = _libR.GetCards(); DataGV.DataSource = _libR.GetCards();
// DataGV.Columns["CardID"].Visible = false; DataGV.Columns["CardID"].Visible = false;
} }
private bool GetiDFromRow(out int id) private bool GetiDFromRow(out int id)

View File

@ -66,8 +66,7 @@ public partial class OrdersF : Form
private void ReloadList() private void ReloadList()
{ {
DataGV.DataSource = _regR.GetOrdersInfo(); DataGV.DataSource = _regR.GetOrdersInfo();
DataGV.Columns["OrderID"].Visible = false; // DataGV.Columns["BorrowDate"].DefaultCellStyle.Format = "dd MMMM yyyy hh:mm";
DataGV.Columns["BorrowDate"].DefaultCellStyle.Format = "dd MMMM yyyy hh:mm";
} }
private bool GetIDFromRow(out int id) private bool GetIDFromRow(out int id)

View File

@ -7,14 +7,14 @@ public class Book
{ {
public int BookID { get; private set; } public int BookID { get; private set; }
public string MainBookInfo => $"<<{Title}>>; {Author}";
[DisplayName("< title >")] [DisplayName("< title >")]
public string Title { get; private set; } public string Title { get; private set; }
[DisplayName("< author >")] [DisplayName("< author >")]
public string Author { get; private set; } public string Author { get; private set; }
[DisplayName("< year of print >")] [DisplayName("< year of print >")]
public string MainBookInfo => $"<<{Title}>>; {Author}";
public int PublishYear { get; private set; } public int PublishYear { get; private set; }
[DisplayName("< current position >")] [DisplayName("< current position >")]
public BookStat Status { get; private set; } public BookStat Status { get; private set; }

View File

@ -4,7 +4,6 @@ namespace LDBproject.Entities;
public class CustomerCard public class CustomerCard
{ {
[DisplayName("Reader's index")]
public int CardID { get; private set; } public int CardID { get; private set; }
[DisplayName("Reader's full name")] [DisplayName("Reader's full name")]

View File

@ -37,18 +37,6 @@ public class Order
}; };
} }
public static Order NewOrder(TemprOrderReg order, IEnumerable<Registration> regs)
{
return new Order
{
OrderID = order.OrderID,
CardID = order.CardID,
LibrarianID = order.LibrarianID,
Registrations = regs,
BorrowDate = order.BorrowDate
};
}
public void SetRegs(IEnumerable<Registration> regs) public void SetRegs(IEnumerable<Registration> regs)
{ {
if (regs != null && regs.Any()) if (regs != null && regs.Any())

View File

@ -140,15 +140,15 @@ public class OrderR : IOrderRep
var querySelectAll = @"SELECT var querySelectAll = @"SELECT
orders.*, orders.*,
lc.FIO as 'EmployeeName', lc.FIO as EmployeeName,
CONCAT(books.Title, ' ', books.Author) as BookInfo, CONCAT(books.Title, ' ', books.Author) as BookInfo,
CONCAT(cc.FIO, ' ', cc.AnimalNickName) as ReaderName, CONCAT(cc.CardID, ' ', cc.FIO) as ReaderName,
regs.BookID, regs.Note regs.BookID, regs.Note
FROM Orders orders FROM Orders orders
LEFT JOIN LibrarianCards lc ON lc.CardID = orders.LibrarianID LEFT JOIN LibrarianCards lc ON lc.CardID = orders.LibrarianID
LEFT JOIN CustomerCards cc ON cc.CardID = orders.CardID LEFT JOIN CustomerCards cc ON cc.CardID = orders.CardID
INNER JOIN Registrations regs ON regs.OrderID = orders.OrderID INNER JOIN Registrations regs ON regs.OrderID = orders.OrderID
LEFT JOIN Books books ON books.BookID = orders.BookID"; LEFT JOIN Books books ON books.BookID = regs.BookID";
var regsDict = new Dictionary<int, List<Registration>>(); var regsDict = new Dictionary<int, List<Registration>>();
var orders = connection.Query<Order, Registration, Order>(querySelectAll, (order, orders) => var orders = connection.Query<Order, Registration, Order>(querySelectAll, (order, orders) =>

View File

@ -79,11 +79,11 @@ public class UpdateR : IUpdateRep
var querySelectAll = @"SELECT var querySelectAll = @"SELECT
upd.*, upd.*,
lc.FIO as 'EmployeeName', lc.FIO as EmployeeName,
CONCAT(cc.CardID, ' ', cc.FIO) as ReaderName CONCAT(cc.CardID, ' ', cc.FIO) as ReaderName
FROM Updates upd FROM Updates upd
LEFT JOIN LibrarianCards lc ON lc.CardID = orders.LibrarianID LEFT JOIN LibrarianCards lc ON lc.CardID = upd.LibrarianID
LEFT JOIN CustomerCards cc ON cc.CardID = orders.CardID"; LEFT JOIN CustomerCards cc ON cc.CardID = upd.CardID";
var upds = connection.Query<UpdateC>(querySelectAll); var upds = connection.Query<UpdateC>(querySelectAll);
_logger.LogDebug("Aimed objects: {json}", JsonConvert.SerializeObject(upds)); _logger.LogDebug("Aimed objects: {json}", JsonConvert.SerializeObject(upds));