using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Printing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using static System.ComponentModel.Design.ObjectSelectorEditor;

namespace WinForms
{
    public partial class Default : Form
    {
        public Default()
        {
            InitializeComponent();
        }

        private void button10_Click(object sender, EventArgs e)
        {
            SelectWork selectWork = new SelectWork();
            DialogResult result = selectWork.ShowDialog();
            if (result == DialogResult.OK)
            {
                string workId = selectWork.selectValue;

                //基本信息
                Jpsoft.BLL.Work bllWork = new Jpsoft.BLL.Work();
                Jpsoft.Model.Work modelWork = bllWork.GetModel(workId);

                Jpsoft.BLL.Customer bllCustomer = new Jpsoft.BLL.Customer();
                Jpsoft.Model.Customer modelCustomer = bllCustomer.GetModel(modelWork.customer_id);

                this.labCustomer.Text = "客户：" + modelCustomer.name_;
                this.labName.Text = "品种及规格：" + modelWork.name_;
                this.labWidth.Text = "幅宽：" + modelWork.width_.ToString();
                this.labNumber.Text = "编号：" + modelWork.number_;
                this.labColour.Text = "色泽：" + modelWork.colour_;
                this.labTagFactorSave.Text = "加码：" + modelWork.tag_factor_save.ToString();

                //库存信息
                Jpsoft.BLL.Stock bllStock = new Jpsoft.BLL.Stock();
                List<Jpsoft.Model.Stock> listStock = bllStock.GetModelList(String.Format("del_flag=0 and work_id='{0}'", workId));
                this.dataGridView1.AutoGenerateColumns = false;
                this.dataGridView1.DataSource = listStock;
            }
        }

        private void button11_Click(object sender, EventArgs e)
        {
            WorkNumber workNumber = new WorkNumber();
            DialogResult result = workNumber.ShowDialog();
            if (result == DialogResult.OK)
            {

            }
        }

        private void btnSetting_Click(object sender, EventArgs e)
        {
            Configure configureForm = new Configure();
            configureForm.ShowDialog();
        }
    }
}
