AreaSetting 연동 버그 수정

This commit is contained in:
2023-10-26 19:09:00 +09:00
parent 045f57bbc0
commit c1d61cc742
7 changed files with 20 additions and 36 deletions

View File

@@ -7,17 +7,15 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomForm
{ {
public partial class ManualPermission : MetroForm public partial class ManualPermission : MetroForm
{ {
private string _prifix = string.Empty; public int selectArea { get; set; }
public int selectArea;
public ManualPermission(string prifix, List<int> areas) public ManualPermission(List<int> areas)
{ {
InitializeComponent(); InitializeComponent();
_prifix = prifix;
metroComboBox_Area.Items.Clear(); metroComboBox_Area.Items.Clear();
foreach (int i in areas) foreach (int i in areas)
{ {
metroComboBox_Area.Items.Add($"{prifix}-{i}"); metroComboBox_Area.Items.Add($"{i}");
} }
} }
@@ -30,7 +28,6 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomForm
else else
{ {
string text = metroComboBox_Area.Items[metroComboBox_Area.SelectedIndex].ToString(); string text = metroComboBox_Area.Items[metroComboBox_Area.SelectedIndex].ToString();
text = text.Replace($"{_prifix}-", "");
selectArea = Convert.ToInt32(text); selectArea = Convert.ToInt32(text);
DialogResult = DialogResult.OK; DialogResult = DialogResult.OK;
} }

View File

@@ -126,7 +126,7 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomForm
var result = Database.UpdateUserData(_updateUserInformation); var result = Database.UpdateUserData(_updateUserInformation);
if (result) if (result)
{ {
MetroMessageBox.Show(this, "변경이 완료되었습니다..", "이용자 정보 수정", MessageBoxButtons.OK, MessageBoxIcon.Information); MetroMessageBox.Show(this, "변경이 완료되었습니다.", "이용자 정보 수정", MessageBoxButtons.OK, MessageBoxIcon.Information);
} }
DialogResult = DialogResult.OK; DialogResult = DialogResult.OK;

View File

@@ -113,15 +113,6 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
dataGridView_List.DataSource = dataTable; dataGridView_List.DataSource = dataTable;
dataGridView_List.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; dataGridView_List.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
/*
dataGridView_List.Columns[0].MinimumWidth = 100;
dataGridView_List.Columns[0].FillWeight = 100;
dataGridView_List.Columns[1].MinimumWidth = 100;
dataGridView_List.Columns[1].FillWeight = 100;
dataGridView_List.Columns[2].MinimumWidth = 60;
dataGridView_List.Columns[2].FillWeight = 60;
*/
} }
private void metroButton_Search_Click(object sender, EventArgs e) => DataChange(); private void metroButton_Search_Click(object sender, EventArgs e) => DataChange();
@@ -178,14 +169,14 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
{ {
stringBuilder = new StringBuilder(); stringBuilder = new StringBuilder();
stringBuilder.AppendLine("현재 당첨 가능한 사람/자리 가 없습니다."); stringBuilder.AppendLine("현재 당첨 가능한 사람/자리 가 없습니다.");
stringBuilder.AppendLine($"대 형 대기인원/남은자리 : {leftUserInformation.Large}/{leftAreaInformation.Large.Count}"); stringBuilder.AppendLine($"대\u3000형 대기인원/남은자리 : {leftUserInformation.Large}/{leftAreaInformation.Large.Count}");
stringBuilder.Append($"특대형 대기인원/남은자리 : {leftUserInformation.OverSized}/{leftAreaInformation.OverSized.Count}"); stringBuilder.Append($"특대형 대기인원/남은자리 : {leftUserInformation.OverSized}/{leftAreaInformation.OverSized.Count}");
MetroMessageBox.Show(this, stringBuilder.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); MetroMessageBox.Show(this, stringBuilder.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return; return;
} }
stringBuilder = new StringBuilder(); stringBuilder = new StringBuilder();
stringBuilder.AppendLine("다음 사항을 추첨하시겠습니까?"); stringBuilder.AppendLine("다음 사항을 추첨하시겠습니까?");
stringBuilder.AppendLine($"대 형 대기인원/남은자리 : {leftUserInformation.Large}/{leftAreaInformation.Large.Count}"); stringBuilder.AppendLine($"대\u3000형 대기인원/남은자리 : {leftUserInformation.Large}/{leftAreaInformation.Large.Count}");
stringBuilder.Append($"특대형 대기인원/남은자리 : {leftUserInformation.OverSized}/{leftAreaInformation.OverSized.Count}"); stringBuilder.Append($"특대형 대기인원/남은자리 : {leftUserInformation.OverSized}/{leftAreaInformation.OverSized.Count}");
dialogResult = MetroMessageBox.Show(this, stringBuilder.ToString(), "Error", MessageBoxButtons.YesNo, MessageBoxIcon.Information); dialogResult = MetroMessageBox.Show(this, stringBuilder.ToString(), "Error", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
if (dialogResult == DialogResult.Yes) if (dialogResult == DialogResult.Yes)

View File

@@ -100,7 +100,7 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
return; return;
} }
int no = Convert.ToInt32(metroListView_Area.SelectedItems[0].Text); int no = Convert.ToInt32(metroListView_Area.SelectedItems[0].Text);
AreaSetting areaSetting = mAreaSettings.Where(x => x.No == no).Single(); AreaSetting areaSetting = mAreaSettings.Single(x => x.No == no);
if(areaName == areaSetting.AreaName) if(areaName == areaSetting.AreaName)
{ {
MetroMessageBox.Show(this, "이름이 변경되지 않았습니다..", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); MetroMessageBox.Show(this, "이름이 변경되지 않았습니다..", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
@@ -134,7 +134,7 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
} }
EAreaType eAreaType = (EAreaType)changeType; EAreaType eAreaType = (EAreaType)changeType;
int no = Convert.ToInt32(metroListView_Area.SelectedItems[0].Text); int no = Convert.ToInt32(metroListView_Area.SelectedItems[0].Text);
AreaSetting areaSetting = mAreaSettings.Where(x => x.No == no).Single(); AreaSetting areaSetting = mAreaSettings.Single(x => x.No == no);
if(areaSetting.AreaType == eAreaType) if(areaSetting.AreaType == eAreaType)
{ {
MetroMessageBox.Show(this, "구역 타입이 변경되지 않았습니다.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); MetroMessageBox.Show(this, "구역 타입이 변경되지 않았습니다.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

View File

@@ -186,7 +186,7 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
{ {
stringBuilder = new StringBuilder(); stringBuilder = new StringBuilder();
stringBuilder.AppendLine("현재 당첨 가능한 사람/자리 가 없습니다."); stringBuilder.AppendLine("현재 당첨 가능한 사람/자리 가 없습니다.");
stringBuilder.AppendLine($"대 형 대기인원/남은자리 : {leftUserInformation.Large}/{leftAreaInformation.Large.Count}"); stringBuilder.AppendLine($"대\u3000형 대기인원/남은자리 : {leftUserInformation.Large}/{leftAreaInformation.Large.Count}");
stringBuilder.Append($"특대형 대기인원/남은자리 : {leftUserInformation.OverSized}/{leftAreaInformation.OverSized.Count}"); stringBuilder.Append($"특대형 대기인원/남은자리 : {leftUserInformation.OverSized}/{leftAreaInformation.OverSized.Count}");
MetroMessageBox.Show(this, stringBuilder.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); MetroMessageBox.Show(this, stringBuilder.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return; return;
@@ -194,7 +194,7 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
} }
stringBuilder = new StringBuilder(); stringBuilder = new StringBuilder();
stringBuilder.AppendLine("다음 사항을 추첨하시겠습니까?"); stringBuilder.AppendLine("다음 사항을 추첨하시겠습니까?");
stringBuilder.AppendLine($"대 형 대기인원/남은자리 : {leftUserInformation.Large}/{leftAreaInformation.Large.Count}"); stringBuilder.AppendLine($"대\u3000형 대기인원/남은자리 : {leftUserInformation.Large}/{leftAreaInformation.Large.Count}");
stringBuilder.Append($"특대형 대기인원/남은자리 : {leftUserInformation.OverSized}/{leftAreaInformation.OverSized.Count}"); stringBuilder.Append($"특대형 대기인원/남은자리 : {leftUserInformation.OverSized}/{leftAreaInformation.OverSized.Count}");
dialogResult = MetroMessageBox.Show(this, stringBuilder.ToString(), "Error", MessageBoxButtons.YesNo, MessageBoxIcon.Information); dialogResult = MetroMessageBox.Show(this, stringBuilder.ToString(), "Error", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
if (dialogResult == DialogResult.Yes) if (dialogResult == DialogResult.Yes)
@@ -265,7 +265,7 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
return; return;
} }
ManualPermission manualPermission = new ManualPermission(eVehicleType == EVehicleType.Large_Down || eVehicleType == EVehicleType.Large_Up ? "대형" : "특대형", leftArea); ManualPermission manualPermission = new ManualPermission(leftArea);
DialogResult result = manualPermission.ShowDialog(); DialogResult result = manualPermission.ShowDialog();
if (result == DialogResult.OK) if (result == DialogResult.OK)
{ {

View File

@@ -162,7 +162,7 @@ namespace HSUCO_Cargo_Garage_Operation_Program
public struct SetUserListInformation public struct SetUserListInformation
{ {
public string No { get; set; } public string No { get; set; }
public string Area { get; set; } public int Area { get; set; }
public string ApplicantNo { get; set; } public string ApplicantNo { get; set; }
public int UID { get; set; } public int UID { get; set; }
public string CargoVehicleNumber { get; set; } public string CargoVehicleNumber { get; set; }

View File

@@ -609,7 +609,7 @@ namespace HSUCO_Cargo_Garage_Operation_Program
} }
} }
} }
query = $"SELECT COUNT(*) FROM UserList Where Area='{area}' AND ('{startDateTime.DateOnly()}' < DateEnd OR '{endDateTime.DateOnly()}' > DateStart) And (PaymentStatus={(int)EPaymentStatus.StandBy} OR PaymentStatus={(int)EPaymentStatus.Use})"; query = $"SELECT COUNT(*) FROM UserList Where Area={area} AND ('{startDateTime.DateOnly()}' < DateEnd OR '{endDateTime.DateOnly()}' > DateStart) And (PaymentStatus={(int)EPaymentStatus.StandBy} OR PaymentStatus={(int)EPaymentStatus.Use})";
using (var command = _sqLiteConnection.CreateCommand()) using (var command = _sqLiteConnection.CreateCommand())
{ {
command.CommandText = query; command.CommandText = query;
@@ -852,20 +852,16 @@ namespace HSUCO_Cargo_Garage_Operation_Program
} }
List<SetUserListInformation> setUserListInformationFinal = new List<SetUserListInformation>(); List<SetUserListInformation> setUserListInformationFinal = new List<SetUserListInformation>();
string test = "";
for (int i = 0; i < setUserListInformationLarge.Count; i++) for (int i = 0; i < setUserListInformationLarge.Count; i++)
{ {
var mm = setUserListInformationLarge.Where(x => x.UID == setUserListInformationLarge[i].UID);
test += mm.Count();
SetUserListInformation setUserListInformation = setUserListInformationLarge[i]; SetUserListInformation setUserListInformation = setUserListInformationLarge[i];
setUserListInformation.Area = "대형-" + leftAreaInformation.Large[i]; setUserListInformation.Area = leftAreaInformation.Large[i];
setUserListInformationFinal.Add(setUserListInformation); setUserListInformationFinal.Add(setUserListInformation);
} }
for (int i = 0; i < setUserListInformationOversized.Count; i++) for (int i = 0; i < setUserListInformationOversized.Count; i++)
{ {
SetUserListInformation setUserListInformation = setUserListInformationOversized[i]; SetUserListInformation setUserListInformation = setUserListInformationOversized[i];
setUserListInformation.Area = "특대형-" + leftAreaInformation.OverSized[i]; setUserListInformation.Area = leftAreaInformation.OverSized[i];
setUserListInformationFinal.Add(setUserListInformation); setUserListInformationFinal.Add(setUserListInformation);
} }
var result = SetUserList(setUserListInformationFinal, leftAreaInformation.StartDateTime, endDate); var result = SetUserList(setUserListInformationFinal, leftAreaInformation.StartDateTime, endDate);
@@ -923,7 +919,7 @@ namespace HSUCO_Cargo_Garage_Operation_Program
} }
} }
} }
setUserListInformation.Area = setUserListInformation.VehicleType == EVehicleType.Large_Down || setUserListInformation.VehicleType == EVehicleType.Large_Up ? $"대형-{area}" : $"특대형-{area}"; setUserListInformation.Area = area;
var result = SetUserList(new List<SetUserListInformation>() { setUserListInformation }, startDate, endDate); var result = SetUserList(new List<SetUserListInformation>() { setUserListInformation }, startDate, endDate);
return result.Count != 0; return result.Count != 0;
} }
@@ -973,13 +969,13 @@ namespace HSUCO_Cargo_Garage_Operation_Program
for (int i = 0; i < setUserListInformationLarge.Count; i++) for (int i = 0; i < setUserListInformationLarge.Count; i++)
{ {
SetUserListInformation setUserListInformation = setUserListInformationLarge[i]; SetUserListInformation setUserListInformation = setUserListInformationLarge[i];
setUserListInformation.Area = "대형-" + leftAreaInformation.Large[i]; setUserListInformation.Area = leftAreaInformation.Large[i];
setUserListInformationFinal.Add(setUserListInformation); setUserListInformationFinal.Add(setUserListInformation);
} }
for (int i = 0; i < setUserListInformationOversized.Count; i++) for (int i = 0; i < setUserListInformationOversized.Count; i++)
{ {
SetUserListInformation setUserListInformation = setUserListInformationOversized[i]; SetUserListInformation setUserListInformation = setUserListInformationOversized[i];
setUserListInformation.Area = "특대형-" + leftAreaInformation.OverSized[i]; setUserListInformation.Area = leftAreaInformation.OverSized[i];
setUserListInformationFinal.Add(setUserListInformation); setUserListInformationFinal.Add(setUserListInformation);
} }
var result = SetUserList(setUserListInformationFinal, leftAreaInformation.StartDateTime, endDate); var result = SetUserList(setUserListInformationFinal, leftAreaInformation.StartDateTime, endDate);
@@ -995,7 +991,7 @@ namespace HSUCO_Cargo_Garage_Operation_Program
for (int i = 0; i < setUserListInformation.Count; i++) for (int i = 0; i < setUserListInformation.Count; i++)
{ {
string query = $"INSERT INTO UserList(No, Area, ApplicantNo, ApplicantDate, UID, Date, DateStart, DateEnd, ExtensionStatus, PaymentStatus) " + string query = $"INSERT INTO UserList(No, Area, ApplicantNo, ApplicantDate, UID, Date, DateStart, DateEnd, ExtensionStatus, PaymentStatus) " +
$"VALUES('{noPrefix + lastNo}','{setUserListInformation[i].Area}','{setUserListInformation[i].ApplicantNo}','{setUserListInformation[i].Date.DateTimeDatabase()}',{setUserListInformation[i].UID},'{DateTime.Now.DateTimeDatabase()}','{startDate.DateOnly()}','{endDate.DateOnly()}',0,{(int)EPaymentStatus.StandBy})"; $"VALUES('{noPrefix + lastNo}',{setUserListInformation[i].Area},'{setUserListInformation[i].ApplicantNo}','{setUserListInformation[i].Date.DateTimeDatabase()}',{setUserListInformation[i].UID},'{DateTime.Now.DateTimeDatabase()}','{startDate.DateOnly()}','{endDate.DateOnly()}',0,{(int)EPaymentStatus.StandBy})";
using (var command = _sqLiteConnection.CreateCommand()) using (var command = _sqLiteConnection.CreateCommand())
{ {
@@ -1009,7 +1005,7 @@ namespace HSUCO_Cargo_Garage_Operation_Program
command.ExecuteNonQuery(); command.ExecuteNonQuery();
} }
ResultSetUserListInformation ResultSetUserListInformation = new ResultSetUserListInformation(); ResultSetUserListInformation ResultSetUserListInformation = new ResultSetUserListInformation();
ResultSetUserListInformation.Area = setUserListInformation[i].Area; ResultSetUserListInformation.Area = GetAreaName(setUserListInformation[i].Area);
ResultSetUserListInformation.No = noPrefix + lastNo; ResultSetUserListInformation.No = noPrefix + lastNo;
ResultSetUserListInformation.ApplicantNo = setUserListInformation[i].ApplicantNo; ResultSetUserListInformation.ApplicantNo = setUserListInformation[i].ApplicantNo;
ResultSetUserListInformation.CargoVehicleNumber = setUserListInformation[i].CargoVehicleNumber; ResultSetUserListInformation.CargoVehicleNumber = setUserListInformation[i].CargoVehicleNumber;