From 7956da56f4e0205189f9b63433e260d4a1387236 Mon Sep 17 00:00:00 2001 From: Crudelis Date: Wed, 11 Oct 2023 16:53:51 +0900 Subject: [PATCH] =?UTF-8?q?=EB=B2=84=EA=B7=B8=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CustomUserControl/ApplicantControl.cs | 7 +++- .../CustomUserControl/ApplicantList.cs | 2 - .../CustomUserControl/UserList.cs | 37 ++++++++++++++++++- .../Database.cs | 14 +++---- .../Master.cs | 1 + .../Properties/AssemblyInfo.cs | 4 +- 6 files changed, 51 insertions(+), 14 deletions(-) diff --git a/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/ApplicantControl.cs b/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/ApplicantControl.cs index db9429f..0894e3b 100644 --- a/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/ApplicantControl.cs +++ b/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/ApplicantControl.cs @@ -8,12 +8,17 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl { public partial class ApplicantControl : UserControl { + public ApplicantControl() { InitializeComponent(); - label1.Text = $"현 프로그램의 차고지는 {Global.GlobalSettings.GarageName}입니다.\r\n입력시 필히 확인 바랍니다."; + } + public void GarageName(string name) + { + label1.Text = $"현 프로그램의 차고지는 {Global.GlobalSettings.GarageName}입니다.\r\n입력시 필히 확인 바랍니다."; + } void metroButton_Register_Click(object sender, EventArgs e) { diff --git a/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/ApplicantList.cs b/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/ApplicantList.cs index 7c1cd12..2b93738 100644 --- a/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/ApplicantList.cs +++ b/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/ApplicantList.cs @@ -137,8 +137,6 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl private void metroButton_UpdateUser_Click(object sender, EventArgs e) { - var count = dataGridView_List.Rows.Count - 1; - if (count == 0) return; Promotion promotion = new Promotion("추첨자 이용기간"); DialogResult dialogResult = promotion.ShowDialog(); diff --git a/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/UserList.cs b/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/UserList.cs index 002f18f..69acdb9 100644 --- a/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/UserList.cs +++ b/HSUCO_Cargo_Garage_Operation_Program/CustomUserControl/UserList.cs @@ -211,8 +211,30 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl var selectCount = dataGridView_List.SelectedRows.Count; if (selectCount == 0) return; - // 연장 했는가? + string no = dataGridView_List.SelectedRows[0].Cells[0].Value.ToString(); + + var status = Database.CheckPaymentStatus(no); + if (status != EPaymentStatus.Use) + { + string errorMessage = string.Empty; + switch (status) + { + case EPaymentStatus.StandBy: + errorMessage = "아직 이용대기 중인 사용자입니다."; + break; + + case EPaymentStatus.Refund: + errorMessage = "환불된 사용자입니다.."; + break; + case EPaymentStatus.Delete: + errorMessage = "삭제된 사용자입니다."; + break; + } + MetroMessageBox.Show(this, errorMessage, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + bool result = Database.CheckExtensionStatus(no); if (result) { @@ -229,7 +251,16 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl if (MetroMessageBox.Show(this, message, "1년 연장", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK) { - Database.UpdateExtended(no, amount); + bool updtaeResult = Database.UpdateExtended(no, amount); + if (updtaeResult) + { + MetroMessageBox.Show(this, "연장처리 완료하였습니다.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + else + { + MetroMessageBox.Show(this, "연장에 실패하였습니다.", "Error", MessageBoxButtons.OKCancel, MessageBoxIcon.Error); + } + DataChange(); } @@ -469,6 +500,8 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl if (result == DialogResult.Yes) { Database.AcceptUser(no, pay); + MetroMessageBox.Show(this, "완료되었습니다.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); + DataChange(); } } diff --git a/HSUCO_Cargo_Garage_Operation_Program/Database.cs b/HSUCO_Cargo_Garage_Operation_Program/Database.cs index 3512666..b8d8181 100644 --- a/HSUCO_Cargo_Garage_Operation_Program/Database.cs +++ b/HSUCO_Cargo_Garage_Operation_Program/Database.cs @@ -531,7 +531,7 @@ namespace HSUCO_Cargo_Garage_Operation_Program } public static void AcceptUser(string no, int pay) { - var query = $"UPDATE PaymentStatus{(int)EPaymentStatus.Use} FROM UserList Where No='{no}'"; + var query = $"UPDATE UserList Set PaymentStatus={(int)EPaymentStatus.Use} Where No='{no}'"; using (var command = _sqLiteConnection.CreateCommand()) { command.CommandText = query; @@ -595,7 +595,7 @@ namespace HSUCO_Cargo_Garage_Operation_Program return result; } - public static void UpdateExtended(string no, int amount) + public static bool UpdateExtended(string no, int amount) { var query = $"SELECT DateEnd From UserList Where No='{no}'"; DateTime endDateTime = DateTime.Now; @@ -620,7 +620,7 @@ namespace HSUCO_Cargo_Garage_Operation_Program int result = command.ExecuteNonQuery(); if (result < 1) { - return; + return false; } } @@ -631,7 +631,7 @@ namespace HSUCO_Cargo_Garage_Operation_Program int result = command.ExecuteNonQuery(); if (result < 1) { - return; + return false; } } query = $"UPDATE UserList Set DateEnd='{endDateTime.EndDateTime()}', ExtensionStatus={true.BoolToInt()}, ExtensionStart='{extensionStart.StartDateTime()}' Where No='{no}'"; @@ -641,10 +641,10 @@ namespace HSUCO_Cargo_Garage_Operation_Program int result = command.ExecuteNonQuery(); if (result < 1) { - return; + return false; } } - return; + return true; } public static GetRefundInformation GetRefundData(string no) @@ -1092,7 +1092,7 @@ namespace HSUCO_Cargo_Garage_Operation_Program public static EVehicleType GetVehicleType(string no) { - var query = $"SELECT VehicleType From UserList Where No='{no}'"; + var query = $"SELECT VehicleType From ViewUserList Where No='{no}'"; int type = 0; using (var command = _sqLiteConnection.CreateCommand()) { diff --git a/HSUCO_Cargo_Garage_Operation_Program/Master.cs b/HSUCO_Cargo_Garage_Operation_Program/Master.cs index 2de7190..5ca2a6f 100644 --- a/HSUCO_Cargo_Garage_Operation_Program/Master.cs +++ b/HSUCO_Cargo_Garage_Operation_Program/Master.cs @@ -15,6 +15,7 @@ namespace HSUCO_Cargo_Garage_Operation_Program Global.GlobalSettings = Database.LoadSettings(); settings1.SettingReset(); this.Text = $"{Global.GlobalSettings.GarageName} 화물 차고지 운영프로그램 v{System.Reflection.Assembly.GetExecutingAssembly().GetName().Version}"; + applicant1.GarageName(Global.GlobalSettings.GarageName); } diff --git a/HSUCO_Cargo_Garage_Operation_Program/Properties/AssemblyInfo.cs b/HSUCO_Cargo_Garage_Operation_Program/Properties/AssemblyInfo.cs index 29532f7..b78d211 100644 --- a/HSUCO_Cargo_Garage_Operation_Program/Properties/AssemblyInfo.cs +++ b/HSUCO_Cargo_Garage_Operation_Program/Properties/AssemblyInfo.cs @@ -31,5 +31,5 @@ using System.Runtime.InteropServices; // 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호를 // 기본값으로 할 수 있습니다. // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.2.*")] -[assembly: AssemblyFileVersion("0.2.*")] +[assembly: AssemblyVersion("0.3.*")] +[assembly: AssemblyFileVersion("0.3.*")]