private void btnDelete_ItemClick(object sender, ItemClickEventArgs e) { try { if (HeaderView.RowCount > 0 && HeaderView.FocusedRowHandle >= 0) { BOMHeader h = bom.Get(int.Parse(HeaderView.GetRowCellValue(HeaderView.FocusedRowHandle, HeaderView.Columns[0]).ToString().Substring(3))); if (IsPosted == false) { bom.Delete(h); HeaderView.DeleteRow(HeaderView.FocusedRowHandle); MessageBox.Show("Success"); } else { MessageBox.Show("You Can't Delete This Bom Journal", "Stop", MessageBoxButtons.OK, MessageBoxIcon.Stop); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void HeaderView_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e) { string bomCode = HeaderView.GetRowCellValue(e.RowHandle, HeaderView.Columns[0]).ToString(); BOMHeader h = bom.Get(int.Parse(bomCode.Substring(3))); if (e.RowHandle >= 0) { switch (e.Column.AbsoluteIndex) { case 1: h.BOMDate = DateTime.Parse(e.Value.ToString()).Date; break; case 2: h.JournalCode = int.Parse(e.Value.ToString()); break; case 3: h.Description = e.Value.ToString(); break; default: break; } bom.Update(h); } }
private void HeaderView_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e) { if (HeaderView.RowCount > 0) { BOMCode = int.Parse(HeaderView.GetRowCellValue(HeaderView.FocusedRowHandle, HeaderView.Columns[0]).ToString().Substring(3)); IsPosted = bool.Parse(HeaderView.GetRowCellValue(HeaderView.FocusedRowHandle, HeaderView.Columns[4]).ToString()); btnDelete.Enabled = btnPost.Enabled = btnValidate.Enabled = !IsPosted; HeaderView.OptionsBehavior.Editable = !IsPosted; } }
private void HeaderView_RowClick(object sender, RowClickEventArgs e) { try { if (e.RowHandle >= 0) { TransCode = long.Parse(HeaderView.GetRowCellValue(e.RowHandle, HeaderView.Columns[0]).ToString()); IsPost = bool.Parse(HeaderView.GetRowCellValue(e.RowHandle, HeaderView.Columns[4]).ToString()); btnDelete.Enabled = btnPost.Enabled = !IsPost; } } catch (Exception ex) { MessageBox.Show(ex.Message); } }