From f60b66e6b067df894081f9e83e87cea3e8980d74 Mon Sep 17 00:00:00 2001 From: Crudelis Date: Fri, 13 Oct 2023 22:18:47 +0900 Subject: [PATCH] =?UTF-8?q?=EC=A6=9D=EB=AA=85=EC=84=9C=20=EC=A6=9D?= =?UTF-8?q?=EB=AA=85=EC=9D=BC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CustomForm/Promotion.Designer.cs | 1 + .../CustomForm/Promotion.cs | 6 ++- .../CustomUserControl/ApplicantList.cs | 2 +- .../SettingControl.Designer.cs | 2 +- .../CustomUserControl/SettingControl.cs | 6 --- .../CustomUserControl/UserList.cs | 43 ++++++++++++------- .../CustomUserControl/WaitingList.cs | 2 +- 7 files changed, 36 insertions(+), 26 deletions(-) diff --git a/HSUCO_Cargo_Garage_Operation_Program/CustomForm/Promotion.Designer.cs b/HSUCO_Cargo_Garage_Operation_Program/CustomForm/Promotion.Designer.cs index 94776f6..4853efc 100644 --- a/HSUCO_Cargo_Garage_Operation_Program/CustomForm/Promotion.Designer.cs +++ b/HSUCO_Cargo_Garage_Operation_Program/CustomForm/Promotion.Designer.cs @@ -92,6 +92,7 @@ this.metroDateTime_End.Name = "metroDateTime_End"; this.metroDateTime_End.Size = new System.Drawing.Size(200, 29); this.metroDateTime_End.TabIndex = 6; + this.metroDateTime_End.ValueChanged += new System.EventHandler(this.metroDateTime_Start_ValueChanged); // // Promotion // diff --git a/HSUCO_Cargo_Garage_Operation_Program/CustomForm/Promotion.cs b/HSUCO_Cargo_Garage_Operation_Program/CustomForm/Promotion.cs index 40e7317..2300959 100644 --- a/HSUCO_Cargo_Garage_Operation_Program/CustomForm/Promotion.cs +++ b/HSUCO_Cargo_Garage_Operation_Program/CustomForm/Promotion.cs @@ -8,17 +8,19 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomForm { public DateTime StartDate { get; set; } public DateTime EndDate { get; set; } - public Promotion(string title) + public Promotion(string title, string startName, string endName) { InitializeComponent(); this.Text = title; + metroLabel1.Text = startName; + metroLabel2.Text = endName; } void metroButton_Promotion_Click(object sender, EventArgs e) { StartDate = metroDateTime_Start.Value; EndDate = metroDateTime_End.Value; - + DialogResult = DialogResult.OK; } diff --git a/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/ApplicantList.cs b/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/ApplicantList.cs index 6c09918..19bf4e1 100644 --- a/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/ApplicantList.cs +++ b/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/ApplicantList.cs @@ -138,7 +138,7 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl private void metroButton_UpdateUser_Click(object sender, EventArgs e) { - Promotion promotion = new Promotion("추첨자 이용기간"); + Promotion promotion = new Promotion("추첨자 이용기간", "이용 시작일" , "이용 종료일"); DialogResult dialogResult = promotion.ShowDialog(); if (dialogResult != DialogResult.OK) { diff --git a/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/SettingControl.Designer.cs b/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/SettingControl.Designer.cs index ef888ca..b93afbb 100644 --- a/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/SettingControl.Designer.cs +++ b/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/SettingControl.Designer.cs @@ -495,7 +495,7 @@ this.Controls.Add(this.metroButton_Save); this.Name = "SettingControl"; this.Size = new System.Drawing.Size(346, 505); - this.Paint += new System.Windows.Forms.PaintEventHandler(this.Settings_Paint); + this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); this.groupBox2.ResumeLayout(false); diff --git a/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/SettingControl.cs b/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/SettingControl.cs index 4be3063..7e873d1 100644 --- a/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/SettingControl.cs +++ b/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/SettingControl.cs @@ -28,12 +28,6 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl } - private void Settings_Paint(object sender, PaintEventArgs e) - { - SettingReset(); - - } - private void metroButton_Save_Click(object sender, EventArgs e) { bool reStart = false; diff --git a/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/UserList.cs b/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/UserList.cs index 5981267..23e75fb 100644 --- a/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/UserList.cs +++ b/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/UserList.cs @@ -7,6 +7,7 @@ using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; +using System.Windows.Media.Imaging; namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl { @@ -403,7 +404,22 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl string no = dataGridView_List.SelectedRows[0].Cells[0].Value.ToString(); CertificateInformation certificateInformation = Database.GetUserCertificate(no); - + Promotion promotion = new Promotion("증명서 인증 기간", "증명 시작일", "증명 종료일"); + DialogResult promotionDialogResult = promotion.ShowDialog(); + if (promotionDialogResult != DialogResult.OK) + { + return; + } + if( promotion.StartDate < certificateInformation.StartDate) + { + MetroMessageBox.Show(this, "인증 시작일이 이용일 보다 먼저 일수 없습니다.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + if( promotion.EndDate > certificateInformation.EndDate) + { + MetroMessageBox.Show(this, "인증 종료일이 이용일 보다 나중일수 없습니다.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } certificateInformation.IssueDate = nowDateTime; int lastNo = Database.GetLastCertificate(nowDateTime.Year); @@ -414,27 +430,24 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl setCertificateInformation.No = certificateInformation.IssueNumber; setCertificateInformation.UserNo = no; setCertificateInformation.IssueDate = certificateInformation.IssueDate; - setCertificateInformation.StartDate = certificateInformation.StartDate; - setCertificateInformation.EndDate = certificateInformation.EndDate; + setCertificateInformation.StartDate = promotion.StartDate; + setCertificateInformation.EndDate = promotion.EndDate; setCertificateInformation.Amount = certificateInformation.Amount; + // 증명서 발급 요금 계산 + EVehicleType eVehicleType = Database.GetVehicleType(setCertificateInformation.UserNo); + int payBase = eVehicleType == EVehicleType.Large ? Global.GlobalSettings.CargoLargeCertificateFee : Global.GlobalSettings.CargoOversizedCertificateFee; + int month = Extends.GetProgressDays(promotion.StartDate, promotion.EndDate).Month; + int pay = month * payBase; + SetProceedsInfo setProceedsInfo = new SetProceedsInfo(); setProceedsInfo.No = setCertificateInformation.UserNo; setProceedsInfo.Date = nowDateTime; setProceedsInfo.Type = EProceedsType.Certificate; + setProceedsInfo.Amount = pay; + - EVehicleType eVehicleType = Database.GetVehicleType(setCertificateInformation.UserNo); - switch (eVehicleType) - { - case EVehicleType.Large: - setProceedsInfo.Amount = Global.GlobalSettings.CargoLargeCertificateFee; - break; - - case EVehicleType.Oversized: - setProceedsInfo.Amount = Global.GlobalSettings.CargoOversizedFee; - break; - } string amount = string.Format("{0:N0} 원", setProceedsInfo.Amount); var dialogResult = MetroMessageBox.Show(this, $"증명서 발급요금이 {amount} 발생했습니다. 발급하시겠습니까?", "Question", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (dialogResult == DialogResult.OK) @@ -507,7 +520,7 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl Database.DeleteUser(no); MetroMessageBox.Show(this, "해당 사용자를 제거 완료했습니다.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); DataChange(); - + } } } \ No newline at end of file diff --git a/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/WaitingList.cs b/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/WaitingList.cs index c041d94..d8d114c 100644 --- a/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/WaitingList.cs +++ b/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/WaitingList.cs @@ -144,7 +144,7 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl var count = dataGridView_List.Rows.Count; if (count == 0) return; - Promotion promotion = new Promotion("대기자 이용기간"); + Promotion promotion = new Promotion("대기자 이용기간", "이용 시작일", "이용 종료일"); DialogResult dialogResult = promotion.ShowDialog(); if (dialogResult != DialogResult.OK) {