private void dgvAssets_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { var type = dgvAssets.CurrentRow.Cells["Type"].Value.ToString(); var assetIdstr = dgvAssets.CurrentRow.Cells["ID"].Value.ToString(); if (type.Equals("Động Sản")) { frmPersonalty personalty = new frmPersonalty(); personalty.ContractId = ContractId; personalty.AssetId = int.Parse(assetIdstr); DialogResult dr = personalty.ShowDialog(); if (dr == DialogResult.OK) { //bind data to dgvAssets BindDataAssetList(); } } if (type.Equals("Bất Động Sản")) { frmRealEstate realEstate = new frmRealEstate(); realEstate.ContractId = ContractId; realEstate.AssetId = int.Parse(assetIdstr); DialogResult dr = realEstate.ShowDialog(); if (dr == DialogResult.OK) { //bind data to dgvAssets BindDataAssetList(); } } }
private void btnThemBatDongSan_Click(object sender, EventArgs e) { try { bool isCreate = false; if (ContractId.HasValue) { isCreate = CreateContract(); } else { if (MessageBox.Show("Thông tin sẽ được lưu lại. Bạn có tiếp tục?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { isCreate = CreateContract(); } } if (isCreate) { frmRealEstate realEstate = new frmRealEstate(); realEstate.ContractId = ContractId; DialogResult dr = realEstate.ShowDialog(); if (dr == DialogResult.OK) { //bind data to dgvAssets BindDataAssetList(); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Lỗi", MessageBoxButtons.OK); } }