당첨 화면 추가 완료

This commit is contained in:
2023-10-04 11:06:29 +09:00
parent 1845f4aabb
commit 00ddead201
5 changed files with 169 additions and 48 deletions

View File

@@ -28,30 +28,11 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.metroLabel1 = new MetroFramework.Controls.MetroLabel();
this.metroButton_Close = new MetroFramework.Controls.MetroButton();
this.flowLayoutPanel_Lots = new System.Windows.Forms.FlowLayoutPanel(); this.flowLayoutPanel_Lots = new System.Windows.Forms.FlowLayoutPanel();
this.label_Page = new System.Windows.Forms.Label();
this.button_Close = new System.Windows.Forms.Button();
this.SuspendLayout(); this.SuspendLayout();
// //
// metroLabel1
//
this.metroLabel1.AutoSize = true;
this.metroLabel1.Location = new System.Drawing.Point(93, 12);
this.metroLabel1.Name = "metroLabel1";
this.metroLabel1.Size = new System.Drawing.Size(24, 19);
this.metroLabel1.TabIndex = 0;
this.metroLabel1.Text = "1/1";
//
// metroButton_Close
//
this.metroButton_Close.Location = new System.Drawing.Point(12, 12);
this.metroButton_Close.Name = "metroButton_Close";
this.metroButton_Close.Size = new System.Drawing.Size(75, 23);
this.metroButton_Close.TabIndex = 1;
this.metroButton_Close.Text = "닫기";
this.metroButton_Close.UseSelectable = true;
this.metroButton_Close.Click += new System.EventHandler(this.metroButton_Close_Click);
//
// flowLayoutPanel_Lots // flowLayoutPanel_Lots
// //
this.flowLayoutPanel_Lots.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.flowLayoutPanel_Lots.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
@@ -61,18 +42,44 @@
this.flowLayoutPanel_Lots.Location = new System.Drawing.Point(9, 54); this.flowLayoutPanel_Lots.Location = new System.Drawing.Point(9, 54);
this.flowLayoutPanel_Lots.Margin = new System.Windows.Forms.Padding(0); this.flowLayoutPanel_Lots.Margin = new System.Windows.Forms.Padding(0);
this.flowLayoutPanel_Lots.Name = "flowLayoutPanel_Lots"; this.flowLayoutPanel_Lots.Name = "flowLayoutPanel_Lots";
this.flowLayoutPanel_Lots.Padding = new System.Windows.Forms.Padding(5);
this.flowLayoutPanel_Lots.Size = new System.Drawing.Size(782, 437); this.flowLayoutPanel_Lots.Size = new System.Drawing.Size(782, 437);
this.flowLayoutPanel_Lots.TabIndex = 2; this.flowLayoutPanel_Lots.TabIndex = 2;
// //
// label_Page
//
this.label_Page.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.label_Page.AutoSize = true;
this.label_Page.BackColor = System.Drawing.Color.White;
this.label_Page.Font = new System.Drawing.Font("맑은 고딕", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
this.label_Page.Location = new System.Drawing.Point(733, 9);
this.label_Page.Name = "label_Page";
this.label_Page.Size = new System.Drawing.Size(58, 37);
this.label_Page.TabIndex = 3;
this.label_Page.Text = "1/1";
this.label_Page.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// button_Close
//
this.button_Close.Location = new System.Drawing.Point(9, 9);
this.button_Close.Name = "button_Close";
this.button_Close.Size = new System.Drawing.Size(110, 37);
this.button_Close.TabIndex = 4;
this.button_Close.Text = "닫기";
this.button_Close.UseVisualStyleBackColor = true;
this.button_Close.Click += new System.EventHandler(this.button_Close_Click);
//
// LotsScreen // LotsScreen
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.ActiveCaptionText; this.BackColor = System.Drawing.SystemColors.ActiveCaptionText;
this.ClientSize = new System.Drawing.Size(800, 500); this.ClientSize = new System.Drawing.Size(800, 500);
this.Controls.Add(this.button_Close);
this.Controls.Add(this.label_Page);
this.Controls.Add(this.flowLayoutPanel_Lots); this.Controls.Add(this.flowLayoutPanel_Lots);
this.Controls.Add(this.metroButton_Close);
this.Controls.Add(this.metroLabel1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "LotsScreen"; this.Name = "LotsScreen";
this.Text = "LotsScreen"; this.Text = "LotsScreen";
@@ -82,9 +89,8 @@
} }
#endregion #endregion
private MetroFramework.Controls.MetroLabel metroLabel1;
private MetroFramework.Controls.MetroButton metroButton_Close;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel_Lots; private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel_Lots;
private System.Windows.Forms.Label label_Page;
private System.Windows.Forms.Button button_Close;
} }
} }

View File

@@ -1,4 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
@@ -6,8 +7,13 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomForm
{ {
public partial class LotsScreen : Form public partial class LotsScreen : Form
{ {
public LotsScreen() List<ResultSetUserListInformation> _resultSetUserLists;
int pageMax = 0;
int nowPage = 0;
int totalPage = 1;
public LotsScreen(List<ResultSetUserListInformation> resultSetUserListInformation)
{ {
_resultSetUserLists = resultSetUserListInformation;
InitializeComponent(); InitializeComponent();
this.StartPosition = FormStartPosition.Manual; this.StartPosition = FormStartPosition.Manual;
var fullScrenn_bounds = Rectangle.Empty; var fullScrenn_bounds = Rectangle.Empty;
@@ -18,18 +24,115 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomForm
} }
this.ClientSize = new Size(fullScrenn_bounds.Width, fullScrenn_bounds.Height); this.ClientSize = new Size(fullScrenn_bounds.Width, fullScrenn_bounds.Height);
this.Location = new Point(fullScrenn_bounds.Left, fullScrenn_bounds.Top); this.Location = new Point(fullScrenn_bounds.Left, fullScrenn_bounds.Top);
this.TopMost = true; //this.TopMost = true;
int baseMargin = 5; // 내부 각테두리의 여백 사이즈
int controlWidth = 340 + 5; // Lot 컨트롤러 가로사이즈 + 여백
int controlHeight = 90 + 5; // Lot 컨트롤러 세로사이즈 + 여백
int tempSize = 0; // 임시 연상용 사이즈
int widthCount = 0; // 가로 최종 갯수
while(true)
{
widthCount++;
tempSize = baseMargin + (controlWidth * (widthCount));
if(tempSize > this.flowLayoutPanel_Lots.Size.Width)
{
widthCount--;
break;
}
}
int heightCount=0; // 세로 최종 갯수
while(true)
{
heightCount++;
tempSize = baseMargin + (controlHeight * (heightCount));
if (tempSize > this.flowLayoutPanel_Lots.Size.Height)
{
heightCount--;
break;
}
}
pageMax = widthCount * heightCount; // 한페이지에 표시가능한 총 갯수
if(pageMax < _resultSetUserLists.Count)
{
CustomUserControl.Lot a = new CustomUserControl.Lot("특대형-999", "2023-A1234"); totalPage = _resultSetUserLists.Count / pageMax;
CustomUserControl.Lot b = new CustomUserControl.Lot("특대형-998", "2023-A1232"); if(_resultSetUserLists.Count % pageMax != 0)
CustomUserControl.Lot c = new CustomUserControl.Lot("특대형-996", "2023-A1231"); {
flowLayoutPanel_Lots.Controls.Add(a); flowLayoutPanel_Lots.Controls.Add(b); flowLayoutPanel_Lots.Controls.Add(c); totalPage++;
}
Timer timer = new Timer();
timer.Interval = 5000; //5초
timer.Tick += Timer_Tick;
timer.Start();
}
ViewChange();
} }
private void metroButton_Close_Click(object sender, EventArgs e) private void Timer_Tick(object sender, EventArgs e)
{ {
this.Close();
ViewChange();
}
private void ViewChange()
{
nowPage++;
if (nowPage > totalPage)
{
nowPage = 1;
}
label_Page.Text = $"{nowPage}/{totalPage}";
if (totalPage ==1)
{
for (int i = 0; i < _resultSetUserLists.Count; i++)
{
List<CustomUserControl.Lot> lots = new List<CustomUserControl.Lot>();
CustomUserControl.Lot lot = new CustomUserControl.Lot(_resultSetUserLists[i].Area, _resultSetUserLists[i].ApplicantNo);
lots.Add(lot);
flowLayoutPanel_Lots.Controls.Add(lots[i]);
}
}
else
{
this.flowLayoutPanel_Lots.Controls.Clear();
int totalCount = _resultSetUserLists.Count;
int limit = nowPage * (pageMax);
if (limit > _resultSetUserLists.Count)
{
limit = _resultSetUserLists.Count;
}
int start = (nowPage - 1) * pageMax;
for (int i = start; i < limit; i++)
{
CustomUserControl.Lot lot = new CustomUserControl.Lot(_resultSetUserLists[i].Area, _resultSetUserLists[i].ApplicantNo);
flowLayoutPanel_Lots.Controls.Add(lot);
}
}
}
private void button_Close_Click(object sender, EventArgs e)
{
Close();
} }
} }
} }

View File

@@ -139,7 +139,7 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
} }
List<ResultSetUserListInformation> result = Database.SetUserListForApplicant(leftAreaInformation, promotion.EndDate); List<ResultSetUserListInformation> result = Database.SetUserListForApplicant(leftAreaInformation, promotion.EndDate);
//TODO: 당첨 화면 출력 필요함 //TODO: 당첨 화면 출력 필요함
LotsScreen lotsScreen = new LotsScreen(); LotsScreen lotsScreen = new LotsScreen(result);
lotsScreen.ShowDialog(); lotsScreen.ShowDialog();
InsertResult insertResult = new InsertResult(result); InsertResult insertResult = new InsertResult(result);

View File

@@ -30,13 +30,14 @@
{ {
this.metroPanel1 = new MetroFramework.Controls.MetroPanel(); this.metroPanel1 = new MetroFramework.Controls.MetroPanel();
this.label_No = new System.Windows.Forms.Label(); this.label_No = new System.Windows.Forms.Label();
this.label_Area = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label();
this.label_Area = new System.Windows.Forms.Label();
this.metroPanel1.SuspendLayout(); this.metroPanel1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// metroPanel1 // metroPanel1
// //
this.metroPanel1.BackColor = System.Drawing.Color.White;
this.metroPanel1.Controls.Add(this.label_No); this.metroPanel1.Controls.Add(this.label_No);
this.metroPanel1.Controls.Add(this.label2); this.metroPanel1.Controls.Add(this.label2);
this.metroPanel1.Controls.Add(this.label_Area); this.metroPanel1.Controls.Add(this.label_Area);
@@ -62,16 +63,6 @@
this.label_No.TabIndex = 5; this.label_No.TabIndex = 5;
this.label_No.Text = "2023-L9999"; this.label_No.Text = "2023-L9999";
// //
// label_Area
//
this.label_Area.AutoSize = true;
this.label_Area.Font = new System.Drawing.Font("맑은 고딕", 30F, System.Drawing.FontStyle.Bold);
this.label_Area.Location = new System.Drawing.Point(3, 0);
this.label_Area.Name = "label_Area";
this.label_Area.Size = new System.Drawing.Size(229, 54);
this.label_Area.TabIndex = 2;
this.label_Area.Text = "특대형-999";
//
// label2 // label2
// //
this.label2.AutoSize = true; this.label2.AutoSize = true;
@@ -82,12 +73,24 @@
this.label2.TabIndex = 3; this.label2.TabIndex = 3;
this.label2.Text = "접수번호 :"; this.label2.Text = "접수번호 :";
// //
// label_Area
//
this.label_Area.AutoSize = true;
this.label_Area.Font = new System.Drawing.Font("맑은 고딕", 30F, System.Drawing.FontStyle.Bold);
this.label_Area.Location = new System.Drawing.Point(3, 0);
this.label_Area.Name = "label_Area";
this.label_Area.Size = new System.Drawing.Size(229, 54);
this.label_Area.TabIndex = 2;
this.label_Area.Text = "특대형-999";
//
// Lot // Lot
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.Transparent; this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(189)))), ((int)(((byte)(204)))), ((int)(((byte)(222)))));
this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
this.Controls.Add(this.metroPanel1); this.Controls.Add(this.metroPanel1);
this.Margin = new System.Windows.Forms.Padding(5);
this.Name = "Lot"; this.Name = "Lot";
this.Size = new System.Drawing.Size(340, 90); this.Size = new System.Drawing.Size(340, 90);
this.metroPanel1.ResumeLayout(false); this.metroPanel1.ResumeLayout(false);

View File

@@ -1,5 +1,6 @@
using HSUCO_Cargo_Garage_Operation_Program.CustomForm; using HSUCO_Cargo_Garage_Operation_Program.CustomForm;
using System; using System;
using System.Collections.Generic;
using System.Windows.Forms; using System.Windows.Forms;
namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
@@ -64,7 +65,15 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
private void metroButton_Test_Click(object sender, EventArgs e) private void metroButton_Test_Click(object sender, EventArgs e)
{ {
LotsScreen lotsScreen = new LotsScreen(); List<ResultSetUserListInformation> test = new List<ResultSetUserListInformation>();
for (int i = 0; i < 120; i++)
{
ResultSetUserListInformation r = new ResultSetUserListInformation();
r.Area = $"대형-{i}";
r.ApplicantNo = $"2023-T{i}";
test.Add(r);
}
LotsScreen lotsScreen = new LotsScreen(test);
lotsScreen.Show(); lotsScreen.Show();
} }
} }