using FCOMMON;
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 FEQ0000
{
    public partial class EQfilterManager : fBase
    {
        string divtype = string.Empty;
        public EQfilterManager(string type_)
        {
            InitializeComponent();
            Properties.Settings.Default["gwcs"] = FCOMMON.info.CS;
            Properties.Settings.Default["EEEntities"] = FCOMMON.info.CS;
            divtype = type_;
            this.dsEQ.EquipmentFilter.TableNewRow += EquipmentFilter_TableNewRow;
        }

        void EquipmentFilter_TableNewRow(object sender, DataTableNewRowEventArgs e)
        {
            e.Row["type"] = this.divtype;
            e.Row["wuid"] = FCOMMON.info.Login.no;
            e.Row["wdate"] = DateTime.Now;
            e.Row["gcode"] = FCOMMON.info.Login.gcode;
        }
      
        private void EQfilter_Load(object sender, EventArgs e)
        {
            EnsureVisibleAndUsableSize();
            try
            {
                ta.Fill(this.dsEQ.EquipmentFilter, divtype, FCOMMON.info.Login.gcode);
            }
            catch (Exception ex)
            {
                FCOMMON.Util.MsgE(ex.Message);
            }
        }

        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            this.Invalidate();
            this.bs.EndEdit();
            try
            {
                var cnt = ta.Update(this.dsEQ.EquipmentFilter);
                FCOMMON.Util.MsgI("update : " + cnt.ToString());

            }
            catch (Exception ex)
            {
                FCOMMON.Util.MsgE(ex.Message);
            }
        }

        public string filter = string.Empty;
        public string apply = string.Empty;
        private void button1_Click(object sender, EventArgs e)
        {

        }

        private void toolStripButton2_Click(object sender, EventArgs e)
        {
            filter = textBox1.Text.Trim();
            apply = textBox2.Text.Trim();
            DialogResult = System.Windows.Forms.DialogResult.OK;
        }
    }
}
