Пример #1
0
        private void FormBrowseRetailSaleConsignBill_Load(object sender, EventArgs e)
        {
            formRetailSaleConsignBill = (FormRetailSaleConsignBill)this.Owner;
            ControlBindDataSource cbds = new ControlBindDataSource();

            cbds.ComboBoxBindDataSource(cbxConsignCorpCode, "ConsignCorpCode", "ConsignCorpName", "Select * From ConsignCorp", "ConsignCorp");
            cbds.ComboBoxBindDataSource(cbxEmployeeCode4, "EmployeeCode", "EmployeeName", "Select * From Employee", "Employee");
            cbds.ComboBoxBindDataSource(cbxProvinceCode, "ProvinceCode", "ProvinceName", "Select * From Province", "Province");
            cbxConsignCorpCode.SelectedIndex = -1;
            cbxEmployeeCode4.SelectedIndex   = -1;
            cbxProvinceCode.SelectedIndex    = -1;
            dtpConsignDate.Value             = GlobalProperty.DBTime;
            dtpConsignDate.Checked           = false;
        }
        private void FormRetailSaleConsignBillInput_Load(object sender, EventArgs e)
        {
            formRetailSaleConsignBill = (FormRetailSaleConsignBill)this.Owner;
            ControlBindDataSource cbds = new ControlBindDataSource();

            //cbds.BindDataSource(gbOrder);
            //cbds.BindDataSource(gbTrade);
            //cbds.BindDataSource(gbConsign);
            cbds.BindDataSource(this);
            useful.InitFormContros(this, null);
            //useful.InitFormContros(gbOrder);
            //useful.InitFormContros(gbTrade);
            //useful.InitFormContros(gbConsign);
            if (this.Tag.ToString() == "Add")
            {
                this.Text     = "添加单据";
                btnCD.Enabled = false;
            }
            if (this.Tag.ToString() == "Edit")
            {
                this.Text              = "修改单据";
                m_SaleConsignBillId    = Convert.ToInt32(formRetailSaleConsignBill.dgvSaleConsignBill.CurrentRow.Cells["Id"].Value);
                btnCD.Enabled          = true;
                txtSaleBillNo.Text     = formRetailSaleConsignBill.dgvSaleConsignBill.CurrentRow.Cells["SaleBillNo"].Value.ToString();
                txtSaleBillNo.ReadOnly = true;
                btnBrowse.Enabled      = false;
                //检索并设置订货单信息
                RetrieveOrderBillInfo(txtSaleBillNo.Text.Trim());
                //检索并设置交易单信息
                RetrieveTradeBillInfo(txtSaleBillNo.Text.Trim());
                //设置发货单信息
                DataTable dt    = formRetailSaleConsignBill.bsSaleConsignBill.DataSource as DataTable;
                Int32     intId = Convert.ToInt32(formRetailSaleConsignBill.dgvSaleConsignBill.CurrentRow.Cells["Id"].Value);
                DataRow   dr    = dt.AsEnumerable().FirstOrDefault(itm => itm.Field <int>("Id") == intId);
                SetConsignBillInfo(dr);
            }
        }