삭제 부활 기능 추가 및 수동배차 기능 개발시작
This commit is contained in:
@@ -28,7 +28,7 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.metroRadioButton_EndUser = new MetroFramework.Controls.MetroRadioButton();
|
||||
this.metroRadioButton_UseUser = new MetroFramework.Controls.MetroRadioButton();
|
||||
@@ -191,12 +191,12 @@
|
||||
// metroButton_DeleteStandBy
|
||||
//
|
||||
this.metroButton_DeleteStandBy.Anchor = System.Windows.Forms.AnchorStyles.Right;
|
||||
this.metroButton_DeleteStandBy.FontSize = MetroFramework.MetroButtonSize.Tall;
|
||||
this.metroButton_DeleteStandBy.FontSize = MetroFramework.MetroButtonSize.Medium;
|
||||
this.metroButton_DeleteStandBy.Location = new System.Drawing.Point(776, 279);
|
||||
this.metroButton_DeleteStandBy.Name = "metroButton_DeleteStandBy";
|
||||
this.metroButton_DeleteStandBy.Size = new System.Drawing.Size(121, 40);
|
||||
this.metroButton_DeleteStandBy.TabIndex = 15;
|
||||
this.metroButton_DeleteStandBy.Text = "결재대기 삭제";
|
||||
this.metroButton_DeleteStandBy.Text = "결재대기 \r\n삭제 or 복원";
|
||||
this.metroButton_DeleteStandBy.UseSelectable = true;
|
||||
this.metroButton_DeleteStandBy.Click += new System.EventHandler(this.metroButton_DeleteStandBy_Click);
|
||||
//
|
||||
@@ -372,14 +372,14 @@
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.dataGridView_List.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.AllCells;
|
||||
this.dataGridView_List.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.DisplayedCells;
|
||||
dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
|
||||
dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Control;
|
||||
dataGridViewCellStyle3.Font = new System.Drawing.Font("굴림", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
|
||||
dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.WindowText;
|
||||
dataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight;
|
||||
dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
|
||||
dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.dataGridView_List.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle3;
|
||||
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
|
||||
dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control;
|
||||
dataGridViewCellStyle2.Font = new System.Drawing.Font("굴림", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
|
||||
dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText;
|
||||
dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight;
|
||||
dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
|
||||
dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.dataGridView_List.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
|
||||
this.dataGridView_List.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dataGridView_List.Location = new System.Drawing.Point(20, 120);
|
||||
this.dataGridView_List.MultiSelect = false;
|
||||
|
@@ -1,5 +1,4 @@
|
||||
using HSUCO_Cargo_Garage_Operation_Program.CustomForm;
|
||||
using HSUCO_Cargo_Garage_Operation_Program.Properties;
|
||||
using MetroFramework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -7,7 +6,6 @@ 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
|
||||
{
|
||||
@@ -37,6 +35,7 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
|
||||
|
||||
return nowUserList;
|
||||
}
|
||||
|
||||
private List<UserInformation> PaymentType(List<UserInformation> beforUserInfromation)
|
||||
{
|
||||
List<UserInformation> userList = beforUserInfromation;
|
||||
@@ -54,10 +53,9 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
|
||||
userList = beforUserInfromation.Where(x => x.PaymentStatus == EPaymentStatus.Refund).ToList();
|
||||
}
|
||||
|
||||
|
||||
return userList;
|
||||
|
||||
}
|
||||
|
||||
private void DataChange()
|
||||
{
|
||||
var nowUserList = UserType();
|
||||
@@ -123,16 +121,18 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
|
||||
case EPaymentStatus.StandBy:
|
||||
payment = "결재 대기";
|
||||
break;
|
||||
|
||||
case EPaymentStatus.Use:
|
||||
payment = "결재 완료";
|
||||
break;
|
||||
|
||||
case EPaymentStatus.Refund:
|
||||
payment = "환불";
|
||||
break;
|
||||
|
||||
case EPaymentStatus.Delete:
|
||||
payment = "삭제";
|
||||
break;
|
||||
|
||||
}
|
||||
string owner = string.Empty;
|
||||
switch (nowUserList[i].Owner)
|
||||
@@ -144,11 +144,10 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
|
||||
case EOwner.IndividualIntoCorporation:
|
||||
owner = "지입";
|
||||
break;
|
||||
|
||||
case EOwner.Corporation:
|
||||
owner = "법인";
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
dataTable.Rows
|
||||
.Add(
|
||||
@@ -176,7 +175,6 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
|
||||
}
|
||||
dataGridView_List.DataSource = dataTable;
|
||||
dataGridView_List.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
|
||||
}
|
||||
|
||||
private void metroButton_Search_Click(object sender, EventArgs e)
|
||||
@@ -212,7 +210,6 @@ 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);
|
||||
@@ -228,6 +225,7 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
|
||||
case EPaymentStatus.Refund:
|
||||
errorMessage = "환불된 사용자입니다..";
|
||||
break;
|
||||
|
||||
case EPaymentStatus.Delete:
|
||||
errorMessage = "삭제된 사용자입니다.";
|
||||
break;
|
||||
@@ -243,7 +241,7 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
|
||||
return;
|
||||
}
|
||||
|
||||
// 연장 금액 가져오기
|
||||
// 연장 금액 가져오기
|
||||
EVehicleType eVehicleType = Database.GetVehicleType(no);
|
||||
int amount = eVehicleType == EVehicleType.Large ? Global.GlobalSettings.CargoLargeFee : Global.GlobalSettings.CargoOversizedFee;
|
||||
amount = amount * 12; // 한달치
|
||||
@@ -265,8 +263,6 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
|
||||
|
||||
DataChange();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void metroButton_Refund_Click(object sender, EventArgs e)
|
||||
@@ -285,7 +281,6 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
|
||||
if (refund.DialogResult != DialogResult.OK)
|
||||
{
|
||||
return;
|
||||
|
||||
}
|
||||
DateTime refundDateTime = refund.RefundDateTime;
|
||||
|
||||
@@ -311,7 +306,7 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
|
||||
}
|
||||
else if (getRefundInformation.ExtensionStatus)
|
||||
{
|
||||
//연장일 보다 환불일이 늦는경우(연장에 부분만 일자 계산후 정산)
|
||||
//연장일 보다 환불일이 늦는경우(연장에 부분만 일자 계산후 정산)
|
||||
if (getRefundInformation.ExtensionStart < refundDateTime)
|
||||
{
|
||||
// 연장 시작 부와 비교
|
||||
@@ -329,7 +324,6 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
|
||||
}
|
||||
totalAmount += leftAmount;
|
||||
// 연장부분만 계산
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -354,7 +348,6 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
// 연장안한경우
|
||||
ProgressDays progressDays = Extends.GetProgressDays(refundDateTime, getRefundInformation.DateEnd);
|
||||
int totalMonth = Extends.GetProgressMonth(getRefundInformation.DateStart.Year, getRefundInformation.DateStart.Month, getRefundInformation.DateEnd.Year, getRefundInformation.DateEnd.Month);
|
||||
@@ -386,7 +379,6 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
|
||||
MetroMessageBox.Show(this, "환불처리가 실패하였습니다.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void metroButton_Certificate_Click(object sender, EventArgs e)
|
||||
@@ -410,12 +402,12 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
|
||||
{
|
||||
return;
|
||||
}
|
||||
if( promotion.StartDate < certificateInformation.StartDate)
|
||||
if (promotion.StartDate < certificateInformation.StartDate)
|
||||
{
|
||||
MetroMessageBox.Show(this, "인증 시작일이 이용일 보다 먼저 일수 없습니다.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
if( promotion.EndDate > certificateInformation.EndDate)
|
||||
if (promotion.EndDate > certificateInformation.EndDate)
|
||||
{
|
||||
MetroMessageBox.Show(this, "인증 종료일이 이용일 보다 나중일수 없습니다.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
@@ -434,7 +426,6 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
|
||||
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;
|
||||
@@ -446,7 +437,6 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
|
||||
setProceedsInfo.Date = nowDateTime;
|
||||
setProceedsInfo.Type = EProceedsType.Certificate;
|
||||
setProceedsInfo.Amount = pay;
|
||||
|
||||
|
||||
string amount = string.Format("{0:N0} 원", setProceedsInfo.Amount);
|
||||
var dialogResult = MetroMessageBox.Show(this, $"증명서 발급요금이 {amount} 발생했습니다. 발급하시겠습니까?", "Question", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
|
||||
@@ -485,7 +475,6 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
|
||||
{
|
||||
MetroMessageBox.Show(this, "현재 사용자는 결재 완료로 전환할수 없는 사용자 입니다.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
|
||||
}
|
||||
GetPaymentBaseInformation getPaymentBaseInformation = Database.GetPaymentBase(no);
|
||||
int payBase = getPaymentBaseInformation.VehicleType == EVehicleType.Large ? Global.GlobalSettings.CargoLargeFee : Global.GlobalSettings.CargoOversizedFee;
|
||||
@@ -503,7 +492,6 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
|
||||
MetroMessageBox.Show(this, "완료되었습니다.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
DataChange();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void metroButton_DeleteStandBy_Click(object sender, EventArgs e)
|
||||
@@ -512,7 +500,27 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
|
||||
if (selectCount == 0) return;
|
||||
string no = dataGridView_List.SelectedRows[0].Cells[0].Value.ToString();
|
||||
var status = Database.CheckPaymentStatus(no);
|
||||
if (status != EPaymentStatus.StandBy)
|
||||
if (status == EPaymentStatus.Delete)
|
||||
{
|
||||
DialogResult dialogResult = MetroMessageBox.Show(this, "해당 사용자는 이미 삭제된 사용자입니다. 복구 하시겠습니까?", "Information", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
|
||||
if(dialogResult== DialogResult.No )
|
||||
{
|
||||
return;
|
||||
}
|
||||
bool result = Database.DeleteUserUndo(no);
|
||||
if(result)
|
||||
{
|
||||
MetroMessageBox.Show(this, "성공적으로 복구 하였습니다..", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
else
|
||||
{
|
||||
MetroMessageBox.Show(this, "이미 해당자리에 다른 사용자가 있습니다..", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
else if (status != EPaymentStatus.StandBy)
|
||||
{
|
||||
MetroMessageBox.Show(this, "현재 사용자는 삭제처리할수 없는 사용자 입니다.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
@@ -520,7 +528,6 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
|
||||
Database.DeleteUser(no);
|
||||
MetroMessageBox.Show(this, "해당 사용자를 제거 완료했습니다.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
DataChange();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@@ -31,6 +31,7 @@
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
this.metroPanel1 = new MetroFramework.Controls.MetroPanel();
|
||||
this.metroButton_UpdateUserData = new MetroFramework.Controls.MetroButton();
|
||||
this.metroButton_ExportExcel = new MetroFramework.Controls.MetroButton();
|
||||
this.metroButton_Delete = new MetroFramework.Controls.MetroButton();
|
||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
this.metroLabel2 = new MetroFramework.Controls.MetroLabel();
|
||||
@@ -41,7 +42,7 @@
|
||||
this.metroButton_UpdateUser = new MetroFramework.Controls.MetroButton();
|
||||
this.dataGridView_List = new System.Windows.Forms.DataGridView();
|
||||
this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog();
|
||||
this.metroButton_ExportExcel = new MetroFramework.Controls.MetroButton();
|
||||
this.metroButton_ManualPermission = new MetroFramework.Controls.MetroButton();
|
||||
this.metroPanel1.SuspendLayout();
|
||||
this.groupBox2.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView_List)).BeginInit();
|
||||
@@ -49,6 +50,7 @@
|
||||
//
|
||||
// metroPanel1
|
||||
//
|
||||
this.metroPanel1.Controls.Add(this.metroButton_ManualPermission);
|
||||
this.metroPanel1.Controls.Add(this.metroButton_UpdateUserData);
|
||||
this.metroPanel1.Controls.Add(this.metroButton_ExportExcel);
|
||||
this.metroPanel1.Controls.Add(this.metroButton_Delete);
|
||||
@@ -80,6 +82,19 @@
|
||||
this.metroButton_UpdateUserData.UseSelectable = true;
|
||||
this.metroButton_UpdateUserData.Click += new System.EventHandler(this.metroButton_UpdateUserData_Click);
|
||||
//
|
||||
// metroButton_ExportExcel
|
||||
//
|
||||
this.metroButton_ExportExcel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.metroButton_ExportExcel.BackgroundImage = global::HSUCO_Cargo_Garage_Operation_Program.Properties.Resources.file_type_excel_icon_130611;
|
||||
this.metroButton_ExportExcel.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||
this.metroButton_ExportExcel.FontSize = MetroFramework.MetroButtonSize.Tall;
|
||||
this.metroButton_ExportExcel.Location = new System.Drawing.Point(605, 66);
|
||||
this.metroButton_ExportExcel.Name = "metroButton_ExportExcel";
|
||||
this.metroButton_ExportExcel.Size = new System.Drawing.Size(40, 40);
|
||||
this.metroButton_ExportExcel.TabIndex = 11;
|
||||
this.metroButton_ExportExcel.UseSelectable = true;
|
||||
this.metroButton_ExportExcel.Click += new System.EventHandler(this.metroButton_ExportExcel_Click);
|
||||
//
|
||||
// metroButton_Delete
|
||||
//
|
||||
this.metroButton_Delete.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
@@ -221,18 +236,18 @@
|
||||
this.dataGridView_List.Size = new System.Drawing.Size(710, 330);
|
||||
this.dataGridView_List.TabIndex = 6;
|
||||
//
|
||||
// metroButton_ExportExcel
|
||||
// metroButton_ManualPermission
|
||||
//
|
||||
this.metroButton_ExportExcel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.metroButton_ExportExcel.BackgroundImage = global::HSUCO_Cargo_Garage_Operation_Program.Properties.Resources.file_type_excel_icon_130611;
|
||||
this.metroButton_ExportExcel.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||
this.metroButton_ExportExcel.FontSize = MetroFramework.MetroButtonSize.Tall;
|
||||
this.metroButton_ExportExcel.Location = new System.Drawing.Point(605, 66);
|
||||
this.metroButton_ExportExcel.Name = "metroButton_ExportExcel";
|
||||
this.metroButton_ExportExcel.Size = new System.Drawing.Size(40, 40);
|
||||
this.metroButton_ExportExcel.TabIndex = 11;
|
||||
this.metroButton_ExportExcel.UseSelectable = true;
|
||||
this.metroButton_ExportExcel.Click += new System.EventHandler(this.metroButton_ExportExcel_Click);
|
||||
this.metroButton_ManualPermission.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.metroButton_ManualPermission.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||
this.metroButton_ManualPermission.FontSize = MetroFramework.MetroButtonSize.Medium;
|
||||
this.metroButton_ManualPermission.Location = new System.Drawing.Point(665, 66);
|
||||
this.metroButton_ManualPermission.Name = "metroButton_ManualPermission";
|
||||
this.metroButton_ManualPermission.Size = new System.Drawing.Size(40, 40);
|
||||
this.metroButton_ManualPermission.TabIndex = 13;
|
||||
this.metroButton_ManualPermission.Text = "수동";
|
||||
this.metroButton_ManualPermission.UseSelectable = true;
|
||||
this.metroButton_ManualPermission.Click += new System.EventHandler(this.metroButton_ManualPermission_Click);
|
||||
//
|
||||
// WaitingList
|
||||
//
|
||||
@@ -264,5 +279,6 @@
|
||||
private System.Windows.Forms.FolderBrowserDialog folderBrowserDialog1;
|
||||
private MetroFramework.Controls.MetroButton metroButton_ExportExcel;
|
||||
private MetroFramework.Controls.MetroButton metroButton_UpdateUserData;
|
||||
private MetroFramework.Controls.MetroButton metroButton_ManualPermission;
|
||||
}
|
||||
}
|
||||
|
@@ -227,5 +227,14 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
|
||||
DataChange();
|
||||
}
|
||||
}
|
||||
|
||||
private void metroButton_ManualPermission_Click(object sender, EventArgs e)
|
||||
{
|
||||
var selectCount = dataGridView_List.SelectedRows.Count;
|
||||
if (selectCount == 0) return;
|
||||
string no = dataGridView_List.SelectedRows[0].Cells[1].Value.ToString();
|
||||
// 수동 배차
|
||||
// 일단
|
||||
}
|
||||
}
|
||||
}
|
@@ -4,6 +4,7 @@ using System.Data.SQLite;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace HSUCO_Cargo_Garage_Operation_Program
|
||||
{
|
||||
@@ -563,8 +564,20 @@ namespace HSUCO_Cargo_Garage_Operation_Program
|
||||
}
|
||||
public static void DeleteUser(string no)
|
||||
{
|
||||
DateTime endDate = new DateTime();
|
||||
var query = $"SELECT DateStart FROM UserList Where No='{no}'";
|
||||
string query = $"UPDATE UserList Set PaymentStatus={(int)EPaymentStatus.Delete} Where No='{no}'";
|
||||
using (var command = _sqLiteConnection.CreateCommand())
|
||||
{
|
||||
command.CommandText = query;
|
||||
command.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
public static bool DeleteUserUndo(string no)
|
||||
{
|
||||
bool result = false;
|
||||
string area = string.Empty;
|
||||
DateTime startDateTime = DateTime.Now;
|
||||
DateTime endDateTime = DateTime.Now;
|
||||
string query = $"SELECT Area, DateStart, DateEnd FROM UserList Where No='{no}'";
|
||||
using (var command = _sqLiteConnection.CreateCommand())
|
||||
{
|
||||
command.CommandText = query;
|
||||
@@ -572,18 +585,35 @@ namespace HSUCO_Cargo_Garage_Operation_Program
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
endDate = DateTime.Parse(reader["DateStart"].ToString());
|
||||
area = reader["Area"].ToString();
|
||||
startDateTime = Convert.ToDateTime(reader["DateStart"]);
|
||||
endDateTime = Convert.ToDateTime(reader["DateEnd"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
endDate = endDate.AddDays(-1);
|
||||
query = $"UPDATE UserList Set DateEnd='{endDate.EndDateTime()}', PaymentStatus={(int)EPaymentStatus.Delete} Where No='{no}'";
|
||||
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())
|
||||
{
|
||||
command.CommandText = query;
|
||||
using (var reader = command.ExecuteReader())
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
result = reader[0].ToString() == "0";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!result)
|
||||
return false;
|
||||
|
||||
query = $"UPDATE UserList Set PaymentStatus={(int)EPaymentStatus.StandBy} Where No='{no}'";
|
||||
using (var command = _sqLiteConnection.CreateCommand())
|
||||
{
|
||||
command.CommandText = query;
|
||||
command.ExecuteNonQuery();
|
||||
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
Reference in New Issue
Block a user