private void gvAssetList_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e) { try { if (e.Column.Caption == "Edit") { Int64 nAssetID = 0; var row = gvAssetList.GetFocusedDataRow(); nAssetID = Convert.ToInt64(row[1]); frmAddAsset frmAsset = new frmAddAsset(nAssetID); frmAsset.ShowDialog(); FillAssetList(); } if (e.Column.Caption == "Delete") { var row = gvAssetList.GetFocusedDataRow(); int n = Convert.ToString(gvAssetList.GetRowCellValue(e.RowHandle, "IsUsed")) == "" || Convert.ToString(gvAssetList.GetRowCellValue(e.RowHandle, "IsUsed")) == "0" ? 0 : 1; if (n == 1) { return; } if (MessageBox.Show("Do you want to delete?", clsGlobal._sMessageboxCaption, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } AssetMaster oAssetMaster = new AssetMaster(); oAssetMaster.nAssetID = Convert.ToInt64(row[1]); if (oAssetMaster.DeleteAsset() > 0) { MessageBox.Show("Asset details deleted successfully.", clsGlobal._sMessageboxCaption, MessageBoxButtons.OK, MessageBoxIcon.Information); } if (oAssetMaster != null) { oAssetMaster.Dispose(); oAssetMaster = null; } //clsMasters oclsMaster = new clsMasters(); //oclsMaster.nMasterID = Convert.ToInt64(row[1]); //oclsMaster.MasterType = this.MasterType; //oclsMaster.DeleteMaster(); FillAssetList(); } if (e.Column.Caption == "Show Asset") { Int64 nAssetID = 0; var row = gvAssetList.GetFocusedDataRow(); nAssetID = Convert.ToInt64(row[1]); frmMainAssetCodeList oFrmAssetCodeList = new frmMainAssetCodeList(nAssetID); oFrmAssetCodeList.ShowDialog(); FillAssetList(); } } catch (Exception ex) { MessageBox.Show("Error : " + ex, clsGlobal.MessageboxCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnAddAsset_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { frmAddAsset frmAsset = new frmAddAsset(); frmAsset.ShowDialog(); }