using AR;
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 Project.Dialog
{
	public partial class fSelectCustInfo : Form
	{
		public string CustCode, CustName;
		public fSelectCustInfo()
		{
			InitializeComponent();
		}

		private void fSelectCustInfo_Load(object sender, EventArgs e)
		{
			this.Show();
			Application.DoEvents();

			var ta = new DataSet1TableAdapters.K4EE_Component_Reel_CustInfoTableAdapter();
			var dt = ta.GetData();
			this.listView1.Items.Clear();
			foreach(DataSet1.K4EE_Component_Reel_CustInfoRow item in dt)
			{
				if (item.code.isEmpty()) continue;
				var lv = this.listView1.Items.Add(item.code);
				lv.SubItems.Add(item.name);
			}
		}

		private void btOK_Click(object sender, EventArgs e)
		{
			if (this.listView1.FocusedItem == null)
				return;

			this.CustCode = this.listView1.FocusedItem.SubItems[0].Text;
			this.CustName = this.listView1.FocusedItem.SubItems[1].Text;
			DialogResult = DialogResult.OK;
		}
	}
}
