private void btnNewSupplier_Click(object sender, EventArgs e)
        {
            var frmSupplierDetail = new frmSupplierDetail(_DataContext, 0, _buildingId);
            var dialogResult      = frmSupplierDetail.ShowDialog();

            if (dialogResult == DialogResult.OK)
            {
                btnSearch.PerformClick();
            }
        }
        private void dgSuppliers_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            var senderGrid = (DataGridView)sender;

            int editColumnIndex   = -1;
            int selectColumnIndex = -1;

            if (_IsSelectDialog)
            {
                editColumnIndex   = senderGrid.Columns.Count - 1;
                selectColumnIndex = senderGrid.Columns.Count - 2;
            }
            else
            {
                editColumnIndex = senderGrid.Columns.Count - 1;
            }

            if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0)
            {
                _SelectedSupplier = senderGrid.Rows[e.RowIndex].DataBoundItem as SupplierResult;

                if (_SelectedSupplier != null)
                {
                    if (e.ColumnIndex == selectColumnIndex)
                    {
                        var supplier = _DataContext.SupplierSet.Single(a => a.id == _SelectedSupplier.SupplierId);
                        SupplierSelected(supplier);
                    }
                    else if (e.ColumnIndex == editColumnIndex)
                    {
                        var frmSupplierDetail = new frmSupplierDetail(_DataContext, _SelectedSupplier.SupplierId, _buildingId);
                        var dialogResult      = frmSupplierDetail.ShowDialog();

                        if (dialogResult == DialogResult.OK)
                        {
                            btnSearch.PerformClick();
                        }
                    }
                }
            }
        }