private void FormAddCP_Load(object sender, EventArgs e)
 {
     parent = (FormOrderInfo)this.Owner;
     try
     {
         ClassDB.bindCombobox("产品类别", "产品类别", CPLB);   // 绑定订货单位
         ClassDB.bindCombobox("产品单位", "产品单位", CPDW);   // 绑定产品单位
         CPLB_SelectedIndexChanged(sender, e);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
        private void FormOrderInfo_Load(object sender, EventArgs e)
        {
            parent = (FormOrderMana)this.Owner;
            try
            {
                ClassDB.bindCombobox("订货单位", "订货单位", DHDW); // 绑定订货单位
                ClassDB.bindCombobox("订货渠道", "订货渠道", DHQD); // 绑定订货单位
                ClassDB.bindCombobox("经办人", "经办人", JBR);    // 绑定订货单位
                ClassDB.bindCombobox("提货方式", "提货方式", THFS); // 绑定订货单位
                dt = new DataTable();
                dt.Columns.Add("产品类别", Type.GetType("System.String"));
                dt.Columns.Add("产品名称", Type.GetType("System.String"));
                dt.Columns.Add("数量", Type.GetType("System.String"));
                dt.Columns.Add("产品单位", Type.GetType("System.String"));

                //DDBH.Text = string.Format("{0:yyyyMMddHHmmss}", DateTime.Now);
                if (this.Text == "修改订单" || this.Text == "查看订单")
                {
                    DDBH.ReadOnly = true;  // 修改订单 单号不能改变
                    //修改订单\
                    DDBH.Text = orderid;
                    string  sql = "select * from 订单表 where 订单编号='" + orderid + "'";
                    DataSet ds  = ClassDB.getDataSet(sql);
                    if (ds.Tables[0].Rows.Count < 1)
                    {
                        MessageBox.Show("打开订单失败,请重试");
                        this.Close();
                    }
                    DHDW.Text  = ds.Tables[0].Rows[0]["订货单位"].ToString();
                    SHR.Text   = ds.Tables[0].Rows[0]["收货人"].ToString();
                    LXFS.Text  = ds.Tables[0].Rows[0]["联系方式"].ToString();
                    SHDZ.Text  = ds.Tables[0].Rows[0]["送货地址"].ToString();
                    DHQD.Text  = ds.Tables[0].Rows[0]["订货渠道"].ToString();
                    THFS.Text  = ds.Tables[0].Rows[0]["提货方式"].ToString();
                    JBR.Text   = ds.Tables[0].Rows[0]["经办人"].ToString();
                    BZ.Text    = ds.Tables[0].Rows[0]["备注"].ToString();
                    DHSJ.Value = DateTime.Parse(ds.Tables[0].Rows[0]["订货时间"].ToString());
                    sql        = "select 产品类别,产品名称,数量,产品单位 from 订单详单表 where 订单编号='" + orderid + "'";
                    ds         = ClassDB.getDataSet(sql);
                    dt         = ds.Tables[0];
                }
                dataGridView1.DataSource = dt;
                if (this.Text == "查看订单")
                {
                    button1.Visible  = false;
                    button2.Visible  = false;
                    buttonOK.Visible = false;

                    buttonCancel.Text      = "关闭";
                    dataGridView1.ReadOnly = true;
                    DHDW.Enabled           = false;
                    SHR.Enabled            = false;
                    LXFS.Enabled           = false;
                    SHDZ.Enabled           = false;
                    DHQD.Enabled           = false;
                    DHSJ.Enabled           = false;
                    THFS.Enabled           = false;
                    JBR.Enabled            = false;
                    BZ.Enabled             = false;
                    DDBH.Enabled           = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }