using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using Core.Mes.ClientFrameWork;
using Core.Mes.IBaseInterface;
using System.Data;
using System.Runtime.InteropServices;
using Core.XgMes.Client.JGKC.TurnoffSendManager;

namespace Core.XgMes.Client.JGKC.MaterialManager
{
    public partial class FrmDepotDialogNew : Mes.ClientFrameWork.FrmBase
    {
        public FrmDepotDialogNew()
        {
            InitializeComponent();
        }


        public void Init()
        {
            string err = "";
            string sql = "SELECT DEPOTID,DEPOTNAME,DEPOT_LB "

                + "FROM KCJ_DEPOTMAGAGER1 WHERE 1=1 "
                ;

            DataSet ds = (DataSet)ClientCommon._RemotingHelp.ExecuteMethod("BJZWStuff", "Core.XgMes.Server.JGKC.SteelPlateManager.Common", "GetDataSet", new object[] { sql }, out err);
            if (err == "")
            {
                ultraGrid1.DataSource = ds;
            }
        }

        public string strckdm = "";
        public string stckmc = "";
        public string strcklb = "";
        private void btrqr_Click(object sender, EventArgs e)
        {
            Infragistics.Win.UltraWinGrid.UltraGridRow row = ultraGrid1.ActiveRow;
            if (row.Selected) return;
            strckdm = row.Cells["DEPOTID"].Value.ToString();
            stckmc = row.Cells["DEPOTNAME"].Value.ToString();
            strcklb = row.Cells["DEPOT_LB"].Value.ToString();
            this.Close();
       
        }

        private void FrmDepotDialog_Load(object sender, EventArgs e)
        {
            Init();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string strWhere = "";
            string sql = "";
            string err = "";
            if (Chk_WZDM.Checked && txt_wzdm.Text.Trim().Length > 0)
            {
                strWhere += " AND DEPOTID LIKE '%" + txt_wzdm.Text.Trim().ToString() + "%' ";
            }
            if (chk_wz.Checked && txt_wz.Text.Trim().Length > 0)
            {
                strWhere += " AND DEPOTNAME LIKE '%" + txt_wz.Text.Trim().ToString() + "%' ";
            }
            if (Chk_CKLB.Checked && Cmb_LB.Text.Trim().Length > 0)
            {
                strWhere += " AND DEPOT_LB LIKE '%" + txt_wz.Text.Trim().ToString() + "%' ";
            }
            sql = "SELECT DEPOTID,DEPOTNAME,DEPOT_LB "

                + "FROM KCJ_DEPOTMAGAGER1 WHERE 1=1 " + strWhere
                ;
            DataSet ds = (DataSet)ClientCommon._RemotingHelp.ExecuteMethod("BJZWStuff", "Core.XgMes.Server.JGKC.SteelPlateManager.Common", "GetDataSet", new object[] { sql }, out err);
            if (err == "")
            {
                ultraGrid1.DataSource = ds;
            }
        }

        private void Chk_WZDM_CheckedChanged(object sender, EventArgs e)
        {
            txt_wzdm.Enabled = Chk_WZDM.Checked;
        }

        private void chk_wz_CheckedChanged(object sender, EventArgs e)
        {
            txt_wz.Enabled = chk_wz.Checked;
        }

        private void Chk_CKLB_CheckedChanged(object sender, EventArgs e)
        {
            Cmb_LB.Enabled = Chk_CKLB.Checked;
        }

      

    }
}