private void initForm(ShopInfo shop) { if (shop != null) { DBModelBase.Clone<ShopInfo>(shop, ref newShopInfo); shopInfo = shop; } this.Text += IsNew ? "-添加" : "-修改"; this.Btn_OK.Click += Btn_OK_Click; txtAddress.DataBindings.Add("Text", newShopInfo, "Address");//newShopInfo.Address txtName.DataBindings.Add("Text", newShopInfo, "Name");//newShopInfo.Name txtPhone.DataBindings.Add("Text", newShopInfo, "Phone");//newShopInfo.Phone txtDesc.DataBindings.Add("Text", newShopInfo, "Desc"); //newShopInfo.Desc; cbRegion.Properties.Items.AddRange(GlobalCaches.Instance.RegionInfos); cbRegion.SelectedItem = GlobalCaches.Instance.RegionInfos.FirstOrDefault(e => e.Id == newShopInfo.RegionId); }
public FmShopInfo(ShopInfo shop = null) { InitializeComponent(); initForm(shop); }