/*
         * 保存当前填写信息到数据库
         */
        private void saveBtn_Click(object sender, EventArgs e)
        {
            NewCartonDetailManager newCartonDetailManager = new NewCartonDetailManager();
            if (checkIntegrity() == true)
            {
                if (operateFlag == 1)
                {
                    //将彩盒基本信息插入数据库
                    newCartonDetailManager.insertNewCarton(buildCartonInformationDict());
                    //将彩盒和供应商关系插入数据库
                    newCartonDetailManager.insertSupplierCarton(int.Parse(this.supplierInformation.Rows[this.supplier.SelectedIndex][0].ToString()), this.cartonNo.Text);
                }
                else if (operateFlag == 2)
                {
                    //将修改后的彩盒信息保存到数据库(未更新相应供应商信息)
                    newCartonDetailManager.updateCartonInformationByCartonNo(this.cartonNo.Text, buildCartonInformationDict2());
                }

                this.Close();
            }
        }
        /*
         * 根据彩盒编号获取供应商信息,填充各个TextBox
         */
        private void fillSupplierInforTextBox(String cartonNo)
        {
            NewCartonDetailManager newCartonDetailManager = new NewCartonDetailManager();
            supplierInforDict = newCartonDetailManager.querySupplierOfCartonByCartonNo(cartonNo);

            foreach (Control ctl in this.supplierPanel.Controls)
            {
                if (ctl.GetType().Name == "TextBox" && supplierInforDict.ContainsKey(ctl.Name))
                {
                    ((TextBox)ctl).Text = supplierInforDict[ctl.Name];
                }
                else if (ctl.GetType().Name == "ComboBox" && supplierInforDict.ContainsKey(ctl.Name))
                {
                    ((ComboBox)ctl).Items.Clear();
                    ((ComboBox)ctl).Items.Add(supplierInforDict[ctl.Name]);
                    ((ComboBox)ctl).SelectedIndex = 0;
                }
            }
        }
 /*
  * 生成最新可用的彩盒编号
  */
 private void fillCartonNo()
 {
     NewCartonDetailManager newCartonDetailManager = new NewCartonDetailManager();
     this.cartonNo.Text = newCartonDetailManager.queryBiggestCartonNo();
 }
        /*
         * 获取供应商相关信息
         */
        private void fillSupplier()
        {
            NewCartonDetailManager newCartonDetailManager = new NewCartonDetailManager();
            this.supplierInformation = newCartonDetailManager.querySupplierInformation();

            this.supplier.Items.Clear();
            foreach (DataRow row in this.supplierInformation.Rows)
            {
                this.supplier.Items.Add(row[1].ToString());
            }
        }
        /*
         * 根据彩盒编号获取彩盒信息,填充各个TextBox
         */
        private void fillCartonInforTextBox(String cartonNo)
        {
            NewCartonDetailManager newCartonDetailManager = new NewCartonDetailManager();
            cartonDict = newCartonDetailManager.queryCartonInformationByCartonNo(cartonNo);

            foreach (Control ctl in this.cartonPanel.Controls)
            {
                if (ctl.GetType().Name == "TextBox" && cartonDict.ContainsKey(((TextBox)ctl).Name))
                {
                    ((TextBox)ctl).Text = cartonDict[((TextBox)ctl).Name];
                }
            }
        }