환불처리 작업 완료
This commit is contained in:
147
HSUCO_Cargo_Garage_Operation_Program/CustomForm/Refund.Designer.cs
generated
Normal file
147
HSUCO_Cargo_Garage_Operation_Program/CustomForm/Refund.Designer.cs
generated
Normal file
@@ -0,0 +1,147 @@
|
||||
namespace HSUCO_Cargo_Garage_Operation_Program.CustomForm
|
||||
{
|
||||
partial class Refund
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.metroLabel1 = new MetroFramework.Controls.MetroLabel();
|
||||
this.metroDateTime_Refund = new MetroFramework.Controls.MetroDateTime();
|
||||
this.metroButton_Refund = new MetroFramework.Controls.MetroButton();
|
||||
this.metroButton_Cancel = new MetroFramework.Controls.MetroButton();
|
||||
this.metroLabel_DateStart = new MetroFramework.Controls.MetroLabel();
|
||||
this.metroLabel_DateEnd = new MetroFramework.Controls.MetroLabel();
|
||||
this.metroLabel4 = new MetroFramework.Controls.MetroLabel();
|
||||
this.metroLabel5 = new MetroFramework.Controls.MetroLabel();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// metroLabel1
|
||||
//
|
||||
this.metroLabel1.AutoSize = true;
|
||||
this.metroLabel1.Location = new System.Drawing.Point(58, 146);
|
||||
this.metroLabel1.Name = "metroLabel1";
|
||||
this.metroLabel1.Size = new System.Drawing.Size(83, 19);
|
||||
this.metroLabel1.TabIndex = 0;
|
||||
this.metroLabel1.Text = "환불 시작일";
|
||||
//
|
||||
// metroDateTime_Refund
|
||||
//
|
||||
this.metroDateTime_Refund.Location = new System.Drawing.Point(183, 159);
|
||||
this.metroDateTime_Refund.MinimumSize = new System.Drawing.Size(0, 29);
|
||||
this.metroDateTime_Refund.Name = "metroDateTime_Refund";
|
||||
this.metroDateTime_Refund.Size = new System.Drawing.Size(200, 29);
|
||||
this.metroDateTime_Refund.TabIndex = 1;
|
||||
//
|
||||
// metroButton_Refund
|
||||
//
|
||||
this.metroButton_Refund.FontSize = MetroFramework.MetroButtonSize.Tall;
|
||||
this.metroButton_Refund.Location = new System.Drawing.Point(44, 212);
|
||||
this.metroButton_Refund.Name = "metroButton_Refund";
|
||||
this.metroButton_Refund.Size = new System.Drawing.Size(170, 50);
|
||||
this.metroButton_Refund.TabIndex = 37;
|
||||
this.metroButton_Refund.Text = "환 불";
|
||||
this.metroButton_Refund.UseSelectable = true;
|
||||
this.metroButton_Refund.Click += new System.EventHandler(this.metroButton_Refund_Click);
|
||||
//
|
||||
// metroButton_Cancel
|
||||
//
|
||||
this.metroButton_Cancel.FontSize = MetroFramework.MetroButtonSize.Tall;
|
||||
this.metroButton_Cancel.Location = new System.Drawing.Point(258, 221);
|
||||
this.metroButton_Cancel.Name = "metroButton_Cancel";
|
||||
this.metroButton_Cancel.Size = new System.Drawing.Size(170, 50);
|
||||
this.metroButton_Cancel.TabIndex = 38;
|
||||
this.metroButton_Cancel.Text = "취 소";
|
||||
this.metroButton_Cancel.UseSelectable = true;
|
||||
this.metroButton_Cancel.Click += new System.EventHandler(this.metroButton_Cancel_Click);
|
||||
//
|
||||
// metroLabel_DateStart
|
||||
//
|
||||
this.metroLabel_DateStart.AutoSize = true;
|
||||
this.metroLabel_DateStart.Location = new System.Drawing.Point(197, 74);
|
||||
this.metroLabel_DateStart.Name = "metroLabel_DateStart";
|
||||
this.metroLabel_DateStart.Size = new System.Drawing.Size(83, 19);
|
||||
this.metroLabel_DateStart.TabIndex = 39;
|
||||
this.metroLabel_DateStart.Text = "환불 시작일";
|
||||
//
|
||||
// metroLabel_DateEnd
|
||||
//
|
||||
this.metroLabel_DateEnd.AutoSize = true;
|
||||
this.metroLabel_DateEnd.Location = new System.Drawing.Point(197, 93);
|
||||
this.metroLabel_DateEnd.Name = "metroLabel_DateEnd";
|
||||
this.metroLabel_DateEnd.Size = new System.Drawing.Size(83, 19);
|
||||
this.metroLabel_DateEnd.TabIndex = 40;
|
||||
this.metroLabel_DateEnd.Text = "환불 시작일";
|
||||
//
|
||||
// metroLabel4
|
||||
//
|
||||
this.metroLabel4.AutoSize = true;
|
||||
this.metroLabel4.Location = new System.Drawing.Point(50, 74);
|
||||
this.metroLabel4.Name = "metroLabel4";
|
||||
this.metroLabel4.Size = new System.Drawing.Size(83, 19);
|
||||
this.metroLabel4.TabIndex = 41;
|
||||
this.metroLabel4.Text = "환불 시작일";
|
||||
//
|
||||
// metroLabel5
|
||||
//
|
||||
this.metroLabel5.AutoSize = true;
|
||||
this.metroLabel5.Location = new System.Drawing.Point(50, 93);
|
||||
this.metroLabel5.Name = "metroLabel5";
|
||||
this.metroLabel5.Size = new System.Drawing.Size(83, 19);
|
||||
this.metroLabel5.TabIndex = 42;
|
||||
this.metroLabel5.Text = "환불 시작일";
|
||||
//
|
||||
// Refund
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Controls.Add(this.metroLabel5);
|
||||
this.Controls.Add(this.metroLabel4);
|
||||
this.Controls.Add(this.metroLabel_DateEnd);
|
||||
this.Controls.Add(this.metroLabel_DateStart);
|
||||
this.Controls.Add(this.metroButton_Cancel);
|
||||
this.Controls.Add(this.metroButton_Refund);
|
||||
this.Controls.Add(this.metroDateTime_Refund);
|
||||
this.Controls.Add(this.metroLabel1);
|
||||
this.Name = "Refund";
|
||||
this.Text = "Refund";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private MetroFramework.Controls.MetroLabel metroLabel1;
|
||||
private MetroFramework.Controls.MetroDateTime metroDateTime_Refund;
|
||||
private MetroFramework.Controls.MetroButton metroButton_Refund;
|
||||
private MetroFramework.Controls.MetroButton metroButton_Cancel;
|
||||
private MetroFramework.Controls.MetroLabel metroLabel_DateStart;
|
||||
private MetroFramework.Controls.MetroLabel metroLabel_DateEnd;
|
||||
private MetroFramework.Controls.MetroLabel metroLabel4;
|
||||
private MetroFramework.Controls.MetroLabel metroLabel5;
|
||||
}
|
||||
}
|
50
HSUCO_Cargo_Garage_Operation_Program/CustomForm/Refund.cs
Normal file
50
HSUCO_Cargo_Garage_Operation_Program/CustomForm/Refund.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using MetroFramework;
|
||||
using MetroFramework.Forms;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace HSUCO_Cargo_Garage_Operation_Program.CustomForm
|
||||
{
|
||||
public partial class Refund : MetroForm
|
||||
{
|
||||
public DateTime RefundDateTime { get; set; }
|
||||
private GetRefundInformation _getRefundInformation;
|
||||
public Refund(GetRefundInformation getRefundInformation)
|
||||
{
|
||||
InitializeComponent();
|
||||
_getRefundInformation = getRefundInformation;
|
||||
metroLabel_DateStart.Text = _getRefundInformation.DateStart.ToString("yyyy-MM- dd");
|
||||
metroLabel_DateEnd.Text = _getRefundInformation.DateEnd.ToString("yyyy-MM- dd");
|
||||
}
|
||||
|
||||
private void metroButton_Refund_Click(object sender, EventArgs e)
|
||||
{
|
||||
if(metroDateTime_Refund.Value > _getRefundInformation.DateEnd)
|
||||
{
|
||||
MetroMessageBox.Show(this, "환불일이 종료일 보다 큽니다.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
metroDateTime_Refund.Focus();
|
||||
return;
|
||||
}
|
||||
if(metroDateTime_Refund.Value < DateTime.Now.Date)
|
||||
{
|
||||
MetroMessageBox.Show(this, "환불일이 현재시간보다 이릅니다.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
metroDateTime_Refund.Focus();
|
||||
return;
|
||||
}
|
||||
RefundDateTime = metroDateTime_Refund.Value.Date;
|
||||
DialogResult = DialogResult.OK;
|
||||
}
|
||||
|
||||
private void metroButton_Cancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
}
|
||||
}
|
||||
}
|
120
HSUCO_Cargo_Garage_Operation_Program/CustomForm/Refund.resx
Normal file
120
HSUCO_Cargo_Garage_Operation_Program/CustomForm/Refund.resx
Normal file
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
@@ -187,14 +187,97 @@ namespace HSUCO_Cargo_Garage_Operation_Program.CustomUserControl
|
||||
|
||||
private void metroButton_Refund_Click(object sender, EventArgs e)
|
||||
{
|
||||
var allCount = dataGridView_List.SelectedRows.Count;
|
||||
if (allCount == 0) return;
|
||||
var count = dataGridView_List.SelectedRows.Count;
|
||||
if (count == 0) return;
|
||||
string no = dataGridView_List.SelectedRows[0].Cells[0].Value.ToString();
|
||||
GetRefundInformation getRefundInformation = Database.GetRefundData(no);
|
||||
if (getRefundInformation.RefundStatus)
|
||||
{
|
||||
MetroMessageBox.Show(this, "이미 환불된 사용자 입니다.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
Refund refund = new Refund(getRefundInformation);
|
||||
refund.ShowDialog();
|
||||
if(refund.DialogResult != DialogResult.OK)
|
||||
{
|
||||
return;
|
||||
|
||||
}
|
||||
DateTime refundDateTime = refund.RefundDateTime;
|
||||
|
||||
int totalAmount = 0;
|
||||
|
||||
// 연장여부
|
||||
// 이용 전 이면
|
||||
if(getRefundInformation.DateStart > refundDateTime)
|
||||
{
|
||||
refundDateTime = getRefundInformation.DateStart;
|
||||
|
||||
totalAmount += getRefundInformation.BaseFee;
|
||||
if(getRefundInformation.ExtensionStatus)
|
||||
{
|
||||
totalAmount += getRefundInformation.ExtensionFee;
|
||||
}
|
||||
}
|
||||
else if(getRefundInformation.ExtensionStatus)
|
||||
{
|
||||
//연장일 보다 환불일이 늦는경우(연장에 부분만 일자 계산후 정산)
|
||||
if (getRefundInformation.ExtensionStart < refundDateTime)
|
||||
{
|
||||
// 연장 시작 부와 비교
|
||||
var leftDays = (getRefundInformation.DateEnd - refundDateTime).TotalDays + 1;
|
||||
int leftAmount = (getRefundInformation.ExtensionFee / 365) * (int)leftDays;
|
||||
if (leftAmount > 0)
|
||||
{
|
||||
leftAmount = leftAmount / 10 * 10;
|
||||
}
|
||||
totalAmount += leftAmount;
|
||||
// 연장부분만 계산
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// 최초 이용일에서 남은 이용일 게산
|
||||
var leftDays = (getRefundInformation.ExtensionStart.AddDays(-1) - refundDateTime).TotalDays + 1;
|
||||
int leftAmount = (getRefundInformation.BaseFee / 365) * (int)leftDays;
|
||||
if(leftAmount > 0)
|
||||
{
|
||||
leftAmount = leftAmount / 10 * 10;
|
||||
}
|
||||
totalAmount += leftAmount;
|
||||
totalAmount += getRefundInformation.ExtensionFee;
|
||||
}
|
||||
// 연장한 경우
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
// 연장안한경우
|
||||
var leftDays = (getRefundInformation.DateEnd - refundDateTime).TotalDays + 1;
|
||||
int leftAmount = (getRefundInformation.ExtensionFee / 365) * (int)leftDays;
|
||||
if (leftAmount > 0)
|
||||
{
|
||||
leftAmount = leftAmount / 10 * 10;
|
||||
}
|
||||
totalAmount += leftAmount;
|
||||
}
|
||||
|
||||
DialogResult dialogResult = MetroMessageBox.Show(this, $"환불 처리 하시겟습니까?\r\n 환불 금액 : {String.Format("{0:n0}", totalAmount)}원", "환불", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
|
||||
|
||||
if(dialogResult == DialogResult.OK)
|
||||
{
|
||||
bool result = Database.SetRefund(no, refundDateTime, totalAmount);
|
||||
if(result)
|
||||
{
|
||||
MetroMessageBox.Show(this, "환불처리가 완료되었습니다.", "환불", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
DataChange();
|
||||
}
|
||||
else
|
||||
{
|
||||
MetroMessageBox.Show(this, "환불처리가 실패하였습니다.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
// 연장 Y N
|
||||
// 연장일을 사용중인가 Y N - 사용중이면 일반 금액은 계산하지 않음,
|
||||
//
|
||||
// TODO: 환불시 금액은 남은 이용일 일활 계산
|
||||
// 이 사람의 결제 금액 가져오기 -> 남은 일수 만큼 나누고 원단위 올림처리 연장 되었을경우 까지 처리
|
||||
}
|
||||
|
||||
private void metroButton_Certificate_Click(object sender, EventArgs e)
|
||||
|
@@ -123,6 +123,19 @@ namespace HSUCO_Cargo_Garage_Operation_Program
|
||||
public string Phone { get; set; } // 연락처
|
||||
public string Address { get; set; } // 주소
|
||||
}
|
||||
public struct GetRefundInformation
|
||||
{
|
||||
|
||||
public bool RefundStatus { get; set; }
|
||||
public DateTime DateStart { get; set; }
|
||||
public DateTime DateEnd { get; set; }
|
||||
public bool ExtensionStatus { get; set; }
|
||||
public DateTime ExtensionStart { get; set; }
|
||||
public int BaseFee { get; set; }
|
||||
public int ExtensionFee { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public struct Settings
|
||||
{
|
||||
public string GarageName { get; set; }
|
||||
|
@@ -189,7 +189,7 @@ namespace HSUCO_Cargo_Garage_Operation_Program
|
||||
string no = $"{year}-{suffix}{lastNo}";
|
||||
|
||||
var query =
|
||||
$"INSERT INTO ApplicantList VALUES('{no}, {applicant.ApplicantType.BoolToInt()}','{applicant.CargoVehicleNumber}','{applicant.CargoVehicleName}','{applicant.PassengerVehicleNumber}','{applicant.PassengerVehicleName}','{(int)applicant.VehicleType}','{applicant.Name}','{applicant.PersonalNumber}','{applicant.Phone}','{applicant.Address}','{applicant.DateOfApplication.DateTimeDatabase()}',0) ";
|
||||
$"INSERT INTO ApplicantList VALUES('{no}', '{applicant.ApplicantType.BoolToInt()}','{applicant.CargoVehicleNumber}','{applicant.CargoVehicleName}','{applicant.PassengerVehicleNumber}','{applicant.PassengerVehicleName}','{(int)applicant.VehicleType}','{applicant.Name}','{applicant.PersonalNumber}','{applicant.Phone}','{applicant.Address}','{applicant.DateOfApplication.DateTimeDatabase()}', 0)";
|
||||
|
||||
int insertResult;
|
||||
using (var command = _sqLiteConnection.CreateCommand())
|
||||
@@ -440,11 +440,7 @@ namespace HSUCO_Cargo_Garage_Operation_Program
|
||||
|
||||
public static void UpdateExtended(string no, int amount)
|
||||
{
|
||||
// Userlist ExtensionStatus, ExtensionStart
|
||||
// UserListHistor "UserNo" TEXT NOT NULL, "HistoryCode" INTEGER NOT NULL, "HistoryDate" TEXT NOT NULL, "HistoryAmount" INTEGER NOT NULL,
|
||||
//CREATE TABLE "LedgerProceeds" ( "UserNo" TEXT NOT NULL, "Type" INTEGER NOT NULL, "Amount" INTEGER NOT NULL, "Date" TEXT NOT NULL,
|
||||
|
||||
// 일단 EndDate
|
||||
var query = $"SELECT DateEnd From UserList Where No='{no}'";
|
||||
DateTime endDateTime = DateTime.Now;
|
||||
using (var command = _sqLiteConnection.CreateCommand())
|
||||
@@ -496,7 +492,89 @@ namespace HSUCO_Cargo_Garage_Operation_Program
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static GetRefundInformation GetRefundData(string no)
|
||||
{
|
||||
GetRefundInformation getRefundInformation = new GetRefundInformation();
|
||||
// RefundStatus DateStart DateEnd ExtensionStatus ExtensionStart BaseFee ExtensionFee
|
||||
var query = $"SELECT RefundStatus, DateStart, DateEnd, ExtensionStatus, ExtensionStart From UserList Where No='{no}'";
|
||||
using (var command = _sqLiteConnection.CreateCommand())
|
||||
{
|
||||
command.CommandText = query;
|
||||
using (var reader = command.ExecuteReader())
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
getRefundInformation.RefundStatus = reader["RefundStatus"].ToString() == "1";
|
||||
getRefundInformation.DateStart = DateTime.Parse(reader["DateStart"].ToString());
|
||||
getRefundInformation.DateEnd = DateTime.Parse(reader["DateEnd"].ToString());
|
||||
getRefundInformation.ExtensionStatus = reader["ExtensionStatus"].ToString() == "1";
|
||||
if (getRefundInformation.ExtensionStatus)
|
||||
{
|
||||
getRefundInformation.ExtensionStart = DateTime.Parse(reader["ExtensionStart"].ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
query = $"SELECT Type, Amount From LedgerProceeds Where UserNo='{no}'";
|
||||
using (var command = _sqLiteConnection.CreateCommand())
|
||||
{
|
||||
command.CommandText = query;
|
||||
using (var reader = command.ExecuteReader())
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
EProceedsType eProceedsType = (EProceedsType)int.Parse(reader["Type"].ToString());
|
||||
int amount = int.Parse(reader["Amount"].ToString());
|
||||
if (eProceedsType == EProceedsType.Fees)
|
||||
{
|
||||
getRefundInformation.BaseFee = amount;
|
||||
}
|
||||
if (eProceedsType == EProceedsType.ExtensionFees)
|
||||
{
|
||||
getRefundInformation.ExtensionFee = amount;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return getRefundInformation;
|
||||
}
|
||||
public static bool SetRefund(string no, DateTime refundDate, int amount)
|
||||
{
|
||||
var query = $"UPDATE UserList Set DateEnd='{refundDate.AddDays(-1).EndDateTime()}', RefundStatus={true.BoolToInt()} Where No='{no}'";
|
||||
using (var command = _sqLiteConnection.CreateCommand())
|
||||
{
|
||||
command.CommandText = query;
|
||||
int result = command.ExecuteNonQuery();
|
||||
if (result < 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
query = $"INSERT INTO UserListHistory(UserNo, HistoryCode, HistoryDate, HistoryAmount) VALUES('{no}',{(int)EHistoryCode.Refund},'{DateTime.Now.DateTimeDatabase()}',{-amount})";
|
||||
using (var command = _sqLiteConnection.CreateCommand())
|
||||
{
|
||||
command.CommandText = query;
|
||||
int result = command.ExecuteNonQuery();
|
||||
if (result < 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
query = $"INSERT INTO LedgerProceeds(UserNo, Type, Amount, Date) Values('{no}',{(int)EProceedsType.Refunds},{-amount},'{DateTime.Now}')";
|
||||
using (var command = _sqLiteConnection.CreateCommand())
|
||||
{
|
||||
command.CommandText = query;
|
||||
int result = command.ExecuteNonQuery();
|
||||
if (result < 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
public static List<ApplicantInformation> GetApplicantList(List<string> CargoVehicleNumber)
|
||||
{
|
||||
var applicants = new List<ApplicantInformation>();
|
||||
|
@@ -4,30 +4,55 @@ namespace HSUCO_Cargo_Garage_Operation_Program
|
||||
{
|
||||
public static class Extends
|
||||
{
|
||||
/// <summary>
|
||||
/// Database 저장용 Date와 Time 존재
|
||||
/// </summary>
|
||||
/// <param name="dateTime"></param>
|
||||
/// <returns></returns>
|
||||
public static string DateTimeDatabase(this DateTime dateTime)
|
||||
{
|
||||
return dateTime.ToString("yyyy-MM-dd hh:mm:ss");
|
||||
}
|
||||
/// <summary>
|
||||
/// 시간이 00:00:00 으로 된 버전
|
||||
/// </summary>
|
||||
/// <param name="date"></param>
|
||||
/// <returns></returns>
|
||||
public static string DateOnly(this DateTime date)
|
||||
{
|
||||
return date.ToString("yyyy-MM-dd 00:00:00");
|
||||
}
|
||||
/// <summary>
|
||||
/// 시간이 00:00:00 으로 변경하여 출력
|
||||
/// </summary>
|
||||
/// <param name="date"></param>
|
||||
/// <returns></returns>
|
||||
public static string StartDateTime(this DateTime date)
|
||||
{
|
||||
return $"{date.Year:D4}-{date.Month:D2}-{date.Day:D2} 00:00:00";
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 시간이 23:59:59 으로 변경하여 출력
|
||||
/// </summary>
|
||||
/// <param name="date"></param>
|
||||
/// <returns></returns>
|
||||
public static string EndDateTime(this DateTime date)
|
||||
{
|
||||
return $"{date.Year:D4}-{date.Month:D2}-{date.Day:D2} 23:59:59";
|
||||
|
||||
}
|
||||
|
||||
public static int BoolToInt(this bool value)
|
||||
{
|
||||
return value ? 1 : 0;
|
||||
}
|
||||
|
||||
public static int LeftArea(int count, DateTime dateTime)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -92,6 +92,12 @@
|
||||
<Compile Include="CustomForm\Promotion.Designer.cs">
|
||||
<DependentUpon>Promotion.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="CustomForm\Refund.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="CustomForm\Refund.Designer.cs">
|
||||
<DependentUpon>Refund.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="CustomForm\UpdateUserData.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@@ -164,6 +170,9 @@
|
||||
<EmbeddedResource Include="CustomForm\Promotion.resx">
|
||||
<DependentUpon>Promotion.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="CustomForm\Refund.resx">
|
||||
<DependentUpon>Refund.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="CustomForm\UpdateUserData.resx">
|
||||
<DependentUpon>UpdateUserData.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
Reference in New Issue
Block a user