private void BindEditData() { currentProductInfoEntity = new ProductInfoManager(dbProvider).GetEntity(this.EntityId); if (currentProductInfoEntity == null || string.IsNullOrEmpty(currentProductInfoEntity.ProductName)) { return; } //新方法,一句话就搞定了 FormBinding.BindObjectToControls(currentProductInfoEntity, this); /* * //General Information 常规信息 * this.ProductCode.Text = currentProductInfoEntity.ProductCode; * this.ProductName.Text = currentProductInfoEntity.ProductName; * this.ProductCategory.SelectedValue = currentProductInfoEntity.ProductCategory; * this.ProductModel.Text = currentProductInfoEntity.ProductModel; * this.ProductStandard.Text = currentProductInfoEntity.ProductStandard; * this.ProductUnit.Text = currentProductInfoEntity.ProductUnit; * this.ProductDescription.Text = currentProductInfoEntity.ProductDescription; * * //价格信息 * this.MiddleRate.Text = currentProductInfoEntity.MiddleRate.ToString(); * this.ReferenceCoefficient.Text = currentProductInfoEntity.ReferenceCoefficient.ToString(); * this.ProductPrice.Text = currentProductInfoEntity.ProductPrice.ToString(); * this.WholesalePrice.Text = currentProductInfoEntity.WholesalePrice.ToString(); * this.PromotionPrice.Text = currentProductInfoEntity.PromotionPrice.ToString(); * this.InternalPrice.Text = currentProductInfoEntity.InternalPrice.ToString(); * this.SpecialPrice.Text = currentProductInfoEntity.SpecialPrice.ToString(); * * //功能描述 * this.Description.Text = currentProductInfoEntity.Description; * this.Enabled.Checked = BusinessLogic.ConvertIntToBoolean(currentProductInfoEntity.Enabled); */ }
private void btnEntityToControl_Click(object sender, EventArgs e) { FormBinding.BindObjectToControls(TestEntity, this); }
public override void FormOnLoad() { base.FormOnLoad(); BindCategory(); FormBinding.BindObjectToControls(TestEntity, this); }