using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace FCM0000.Mail
{
    public partial class fMailList : Form
    {
        string fn_fpcolsize = "";
        public fMailList()
        {
            InitializeComponent();
            this.FormClosed += fAutoSendSetting_FormClosed;
            fn_fpcolsize = System.IO.Path.Combine(FCOMMON.Util.CurrentPath, "formSetting", "fp_" + this.Name + ".ini");
        }

        void fAutoSendSetting_FormClosed(object sender, FormClosedEventArgs e)
        {
            FCOMMON.Util.FPColsizeSave(this.fpSpread1, fn_fpcolsize);
        }
        private void mailDataBindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            this.Validate();
            this.bs.EndEdit();
            this.tam.UpdateAll(this.dSMail);

        }
        private void __Load(object sender, EventArgs e)
        {
            //한달전으로 처리
            this.dtEd.Value = DateTime.Now;
            this.dtSd.Value = DateTime.Now.AddMonths(-1);
            refreshData();
        }

        private void fillToolStripButton_Click(object sender, EventArgs e)
        {
            

        }

        void refreshData()
        {
            try
            {
                this.ta.Fill(this.dSMail.MailData, FCOMMON.info.Login.gcode, dtSd.Value.ToShortDateString(), dtEd.Value.ToShortDateString(),"%");
            }
            catch (System.Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message);
            }
            FCOMMON.Util.FPColSizeLoad(ref this.fpSpread1, fn_fpcolsize);
        }
        private void btRefresh_Click(object sender, EventArgs e)
        {
            refreshData();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.Close();
        }

    }
}
