private void llAddContact_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { if (DaSupplierBindingSource.Current == null) { MessageBox.Show("请选择供应商"); return; } using (供应商联系人编辑 mForm = new 供应商联系人编辑()) { mForm.DaSupplierID = ((DaSupplier)DaSupplierBindingSource.Current).IntID; if (mForm.ShowDialog() == DialogResult.OK) { InitDaSupplierContact(); } } }
private void dgvDaSuppContact_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0) { return; } if (e.ColumnIndex == dsc删除.Index) { //删除 DaSupplierContact mDaSupplierContact = (DaSupplierContact)DaSuppContactBindingSource[e.RowIndex]; if (MessageBox.Show("是否确认删除" + mDaSupplierContact.VcName, "警告", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) != DialogResult.OK) { return; } myEntity.DaSupplierContacts.Remove(mDaSupplierContact); int ret = myEntity.SaveChanges(); if (ret > 0) { InitDaSupplierContact(); MessageBox.Show("删除成功"); } else { MessageBox.Show("删除失败"); } } if (e.ColumnIndex == dsc修改.Index) { //修改 using (供应商联系人编辑 mForm = new 供应商联系人编辑()) { mForm.DaContactID = ((DaSupplierContact)DaSuppContactBindingSource[e.RowIndex]).IntID; if (mForm.ShowDialog() == DialogResult.OK) { InitDaSupplierContact(); } } } }
private void llAddContact_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { if (DaSupplierBindingSource.Current == null) { MessageBox.Show("请选择供应商"); return; } using (供应商联系人编辑 mForm = new 供应商联系人编辑()) { mForm.DaSupplierID = ((DaSupplier)DaSupplierBindingSource.Current).IntID; //mForm.myEntity = myEntity; if (mForm.ShowDialog() == DialogResult.OK) { //((System.Data.Entity.Infrastructure.IObjectContextAdapter)myEntity).ObjectContext.Refresh(System.Data.Objects.RefreshMode.StoreWins, myEntity.DaSupplierContacts); //((System.Data.Entity.Infrastructure.IObjectContextAdapter)myEntity).ObjectContext.AcceptAllChanges(); InitDaSupplierContact(); } } }