private void dgvDaGoods_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;
            }
            if (e.ColumnIndex == dg删除.Index)
            {
                //删除
                int     daGoodsId = ((DaGoods)DaGoodsBindingSource[e.RowIndex]).IntID;
                DaGoods mDaGoods  = myEntity.DaGoods1.SingleOrDefault(a => a.IntID == daGoodsId);
                if (mDaGoods.DaContractGoods.Count > 0)
                {
                    MessageBox.Show("该物品已有采购订单,不能删除");
                    return;
                }
                if (MessageBox.Show("是否确认删除" + mDaGoods.VcName, "警告", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) != DialogResult.OK)
                {
                    return;
                }
                //myEntity.DaGoods1.Attach(mDaGoods);
                mDaGoods.DaGoodsSuppliers.Clear();

                myEntity.DaGoods1.Remove(mDaGoods);

                int ret = myEntity.SaveChanges();

                if (ret > 0)
                {
                    InitDaGoods();
                    MessageBox.Show("删除成功");
                }
                else
                {
                    MessageBox.Show("删除失败");
                }
            }
            if (e.ColumnIndex == dg修改.Index)
            {
                //修改
                using (采购物品编辑 mForm = new 采购物品编辑())
                {
                    mForm.mDaGoodsID = ((DaGoods)DaGoodsBindingSource[e.RowIndex]).IntID;

                    if (mForm.ShowDialog() == DialogResult.OK)
                    {
                        InitDaGoods();
                    }
                }
            }
        }
        private void llAddGoods_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (tvDaGoodsType.SelectedNode == null)
            {
                return;
            }
            if (tvDaGoodsType.SelectedNode.Name.Replace("tvGoodsType", "") == "1")
            {
                return;
            }
            using (采购物品编辑 mForm = new 采购物品编辑())
            {
                //mForm.myEntity = myEntity;
                mForm.mDaGoodsTypeID = Convert.ToInt32(tvDaGoodsType.SelectedNode.Name.Replace("tvGoodsType", ""));
                //mForm.mDaGoodsTypeName = tvDaGoodsType.SelectedNode.Text;
                if (mForm.ShowDialog() == DialogResult.OK)
                {
                    //((System.Data.Entity.Infrastructure.IObjectContextAdapter)myEntity).ObjectContext.Refresh(System.Data.Objects.RefreshMode.StoreWins, myEntity.DaGoods1);
                    //((System.Data.Entity.Infrastructure.IObjectContextAdapter)myEntity).ObjectContext.AcceptAllChanges();

                    InitDaGoods();
                }
            }
        }