private void gvAssetConfigDetails_CellClick(object sender, DataGridViewCellEventArgs e) { objSQLdb = new SQLDB(); DataTable dt = new DataTable(); string strCmd = "SELECT COUNT(*) FROM FIXED_ASSETS_MOVEMENT_REG " + " WHERE FAMR_ASSET_SL_NO='" + txtAssetSLNo.Text.ToString() + "'"; dt = objSQLdb.ExecuteDataSet(strCmd).Tables[0]; if (dt.Rows.Count > 1) { dtMovementDetl = dt; } if (e.ColumnIndex == gvAssetConfigDetails.Columns["Edit"].Index) { if (Convert.ToBoolean(gvAssetConfigDetails.Rows[e.RowIndex].Cells["Edit"].Selected) == true) { isDetlUpdate = true; if (dtMovementDetl.Rows.Count == 1) { int SlNo = Convert.ToInt32(gvAssetConfigDetails.Rows[e.RowIndex].Cells[gvAssetConfigDetails.Columns["SlNo"].Index].Value); DataRow[] dr = dtConfigDetl.Select("SlNo=" + SlNo); AssetType = cbAssetType.SelectedValue.ToString(); AssetConfigurationDetl ConfigDetl = new AssetConfigurationDetl(AssetType, dr); ConfigDetl.objItInventory = this; ConfigDetl.Show(); } else { MessageBox.Show("This Data Can Not Be Manipulated", "SSERP", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } if (e.ColumnIndex == gvAssetConfigDetails.Columns["Delete"].Index) { DialogResult dlgResult = MessageBox.Show("Do you want delete this record?", "Confirm?", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dlgResult == DialogResult.Yes) { int SlNo = Convert.ToInt32(gvAssetConfigDetails.Rows[e.RowIndex].Cells[gvAssetConfigDetails.Columns["SlNo"].Index].Value); DataRow[] dr = dtConfigDetl.Select("SlNo=" + SlNo); dtConfigDetl.Rows.Remove(dr[0]); GetAssetConfigDetails(); MessageBox.Show("Selected Data Deleted Sucessfully", "SSERP", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
private void btnAddAssetConfigDetails_Click(object sender, EventArgs e) { if (cbAssetType.SelectedIndex > 0) { AssetType = cbAssetType.SelectedValue.ToString(); AssetConfigurationDetl ConfigDetl = new AssetConfigurationDetl(AssetType); ConfigDetl.objItInventory = this; ConfigDetl.Show(); } else { MessageBox.Show("Please Select Asset Type", "SSERP", MessageBoxButtons.OK, MessageBoxIcon.Information); } }