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;
        }
    }
}
