증명서 증명일 추가

This commit is contained in:
2023-10-13 22:18:47 +09:00
parent fad3de7397
commit f60b66e6b0
7 changed files with 36 additions and 26 deletions

View File

@@ -92,6 +92,7 @@
this.metroDateTime_End.Name = "metroDateTime_End"; this.metroDateTime_End.Name = "metroDateTime_End";
this.metroDateTime_End.Size = new System.Drawing.Size(200, 29); this.metroDateTime_End.Size = new System.Drawing.Size(200, 29);
this.metroDateTime_End.TabIndex = 6; this.metroDateTime_End.TabIndex = 6;
this.metroDateTime_End.ValueChanged += new System.EventHandler(this.metroDateTime_Start_ValueChanged);
// //
// Promotion // Promotion
// //

View File

@@ -8,17 +8,19 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomForm
{ {
public DateTime StartDate { get; set; } public DateTime StartDate { get; set; }
public DateTime EndDate { get; set; } public DateTime EndDate { get; set; }
public Promotion(string title) public Promotion(string title, string startName, string endName)
{ {
InitializeComponent(); InitializeComponent();
this.Text = title; this.Text = title;
metroLabel1.Text = startName;
metroLabel2.Text = endName;
} }
void metroButton_Promotion_Click(object sender, EventArgs e) void metroButton_Promotion_Click(object sender, EventArgs e)
{ {
StartDate = metroDateTime_Start.Value; StartDate = metroDateTime_Start.Value;
EndDate = metroDateTime_End.Value; EndDate = metroDateTime_End.Value;
DialogResult = DialogResult.OK; DialogResult = DialogResult.OK;
} }

View File

@@ -138,7 +138,7 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
private void metroButton_UpdateUser_Click(object sender, EventArgs e) private void metroButton_UpdateUser_Click(object sender, EventArgs e)
{ {
Promotion promotion = new Promotion("추첨자 이용기간"); Promotion promotion = new Promotion("추첨자 이용기간", "이용 시작일" , "이용 종료일");
DialogResult dialogResult = promotion.ShowDialog(); DialogResult dialogResult = promotion.ShowDialog();
if (dialogResult != DialogResult.OK) if (dialogResult != DialogResult.OK)
{ {

View File

@@ -495,7 +495,7 @@
this.Controls.Add(this.metroButton_Save); this.Controls.Add(this.metroButton_Save);
this.Name = "SettingControl"; this.Name = "SettingControl";
this.Size = new System.Drawing.Size(346, 505); this.Size = new System.Drawing.Size(346, 505);
this.Paint += new System.Windows.Forms.PaintEventHandler(this.Settings_Paint);
this.groupBox1.ResumeLayout(false); this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout(); this.groupBox1.PerformLayout();
this.groupBox2.ResumeLayout(false); this.groupBox2.ResumeLayout(false);

View File

@@ -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) private void metroButton_Save_Click(object sender, EventArgs e)
{ {
bool reStart = false; bool reStart = false;

View File

@@ -7,6 +7,7 @@ using System.Data;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using System.Windows.Media.Imaging;
namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl 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(); string no = dataGridView_List.SelectedRows[0].Cells[0].Value.ToString();
CertificateInformation certificateInformation = Database.GetUserCertificate(no); 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; certificateInformation.IssueDate = nowDateTime;
int lastNo = Database.GetLastCertificate(nowDateTime.Year); int lastNo = Database.GetLastCertificate(nowDateTime.Year);
@@ -414,27 +430,24 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
setCertificateInformation.No = certificateInformation.IssueNumber; setCertificateInformation.No = certificateInformation.IssueNumber;
setCertificateInformation.UserNo = no; setCertificateInformation.UserNo = no;
setCertificateInformation.IssueDate = certificateInformation.IssueDate; setCertificateInformation.IssueDate = certificateInformation.IssueDate;
setCertificateInformation.StartDate = certificateInformation.StartDate; setCertificateInformation.StartDate = promotion.StartDate;
setCertificateInformation.EndDate = certificateInformation.EndDate; setCertificateInformation.EndDate = promotion.EndDate;
setCertificateInformation.Amount = certificateInformation.Amount; 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 setProceedsInfo = new SetProceedsInfo();
setProceedsInfo.No = setCertificateInformation.UserNo; setProceedsInfo.No = setCertificateInformation.UserNo;
setProceedsInfo.Date = nowDateTime; setProceedsInfo.Date = nowDateTime;
setProceedsInfo.Type = EProceedsType.Certificate; 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); string amount = string.Format("{0:N0} 원", setProceedsInfo.Amount);
var dialogResult = MetroMessageBox.Show(this, $"증명서 발급요금이 {amount} 발생했습니다. 발급하시겠습니까?", "Question", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); var dialogResult = MetroMessageBox.Show(this, $"증명서 발급요금이 {amount} 발생했습니다. 발급하시겠습니까?", "Question", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
if (dialogResult == DialogResult.OK) if (dialogResult == DialogResult.OK)
@@ -507,7 +520,7 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
Database.DeleteUser(no); Database.DeleteUser(no);
MetroMessageBox.Show(this, "해당 사용자를 제거 완료했습니다.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); MetroMessageBox.Show(this, "해당 사용자를 제거 완료했습니다.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
DataChange(); DataChange();
} }
} }
} }

View File

@@ -144,7 +144,7 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
var count = dataGridView_List.Rows.Count; var count = dataGridView_List.Rows.Count;
if (count == 0) return; if (count == 0) return;
Promotion promotion = new Promotion("대기자 이용기간"); Promotion promotion = new Promotion("대기자 이용기간", "이용 시작일", "이용 종료일");
DialogResult dialogResult = promotion.ShowDialog(); DialogResult dialogResult = promotion.ShowDialog();
if (dialogResult != DialogResult.OK) if (dialogResult != DialogResult.OK)
{ {