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 LoadMasterData() { AssetMaster oAssetMaster = null; DataSet dsMaster = null; try { oAssetMaster = new AssetMaster(); dsMaster = oAssetMaster.GetAllMasterData(0); if (dsMaster != null && dsMaster.Tables.Count > 0) { cmbAssetTypeName.DataSource = dsMaster.Tables[0]; cmbAssetTypeName.DisplayMember = "sAssetType"; cmbAssetTypeName.ValueMember = "nAssetMainTypeID"; cmbAssetmaterialType.DataSource = dsMaster.Tables[1]; cmbAssetmaterialType.DisplayMember = "sAssetMaterialName"; cmbAssetmaterialType.ValueMember = "nAssetMaterialID"; cmbAssetType.DataSource = dsMaster.Tables[2]; cmbAssetType.DisplayMember = "sAssetTypeName"; cmbAssetType.ValueMember = "nAssetTypeID"; cmbAssetType1.DataSource = dsMaster.Tables[3]; cmbAssetType1.DisplayMember = "sAssetTypeOneName"; cmbAssetType1.ValueMember = "nAssetTypeOneID"; cmbAssetShelfLifeUnit.DataSource = dsMaster.Tables[4]; cmbAssetShelfLifeUnit.DisplayMember = "sAssetShelfLifeUnit"; cmbAssetShelfLifeUnit.ValueMember = "nAssetShelfLifeUnit"; } } catch (Exception) { throw; } finally { if (oAssetMaster != null) { oAssetMaster.Dispose(); oAssetMaster = null; } } }
private Int64 SaveAsset() { AssetMaster oAssetMaster = null; Int64 nAssetID = 0; try { oAssetMaster = new AssetMaster(); //oAssetMaster.nAssetID = 0; //oAssetMaster.sAssetName = txtAssetName.Text.Trim(); //oAssetMaster.sAssetDescription = txtAssetDescription.Text.Trim(); //oAssetMaster.sAssetShortDescription = txtAssetShortDescription.Text.Trim(); //oAssetMaster.nCompanyID = Convert.ToInt64(cmbCompanyList.SelectedValue); ////oAssetMaster.nBarcodeID = Convert.ToInt64(txtAssetBarcode.Text.Trim()); //oAssetMaster.nAssetMainTypeID = Convert.ToInt64(cmbAssetTypeName.SelectedValue); //oAssetMaster.sAssetSize = txtAssetSize.Text.Trim(); //oAssetMaster.sAssetCapacity = txtAssetCapacity.Text.Trim(); //oAssetMaster.sAssetDensity = txtAssetDensity.Text.Trim(); //oAssetMaster.sAssetQuality = txtAssetQuality.Text.Trim(); //oAssetMaster.nAssetMaterialID = Convert.ToInt64(cmbAssetmaterialType.SelectedValue); //oAssetMaster.sAssetMake = txtAssetMake.Text.Trim(); //oAssetMaster.nAssetTypeID = Convert.ToInt64(cmbAssetType.SelectedValue); //oAssetMaster.nAssetTypeOneID = Convert.ToInt64(cmbAssetType1.SelectedValue); //oAssetMaster.sAssetWeight = txtAssetWeight.Text.Trim(); //oAssetMaster.sAssetPackingDimention = txtAssetPackingDimention.Text.Trim(); //oAssetMaster.sAssetShelfLife = txtAssetShelfLife.Text.Trim(); //oAssetMaster.sAssetShelfLifeUnit = cmbAssetShelfLifeUnit.Text.Trim(); //oAssetMaster.sAssetHSN_SACCode = txtAssetHSNOrSACCode.Text.Trim(); //oAssetMaster.sAssetVendor = txtAssetVendor.Text.Trim(); //oAssetMaster.sAssetReorderTime = txtAssetReorderTime.Text.Trim(); //oAssetMaster.dtAssetDateOFIntroduction =Convert.ToDateTime(dtpIntroductionDate.Text.ToString()); //oAssetMaster.dtAssetDateOfRetirement = Convert.ToDateTime(dtpRetirementDate.Text.ToString()); //oAssetMaster.sAssetRate = txtAssetRate.Text.Trim(); //oAssetMaster.sAssetRentalRate = txtAssetRentalRate.Text.Trim(); //oAssetMaster.sAssetAbbrivation = GenerateAbbrivation(txtAssetName.Text.Trim()); //oAssetMaster.sAssetCode = GenerateCode(); //nAssetID= oAssetMaster.InsertUpdateAsset(); } catch (Exception ex) { throw; } return(nAssetID); }
private void FillAssetList() { AssetMaster oAssetMaster = null; DataTable dt = null; try { oAssetMaster = new AssetMaster(); dt = oAssetMaster.GetAssetList(0); if (dt != null) { gvAssetList.GridControl.DataSource = dt; gvAssetList.Columns[1].Visible = false; gvAssetList.Columns[8].Visible = false; } } catch (Exception ex) { MessageBox.Show("Error: " + ex.ToString(), clsGlobal._sMessageboxCaption, MessageBoxButtons.OK, MessageBoxIcon.Information); } }