private void HeaderView_InitNewRow(object sender, DevExpress.XtraGrid.Views.Grid.InitNewRowEventArgs e)
        {
            try
            {
                int bomCode = int.Parse(bom.GetCode().ToString());
                HeaderView.SetRowCellValue(e.RowHandle, HeaderView.Columns[0], "BOM" + bomCode);
                HeaderView.SetRowCellValue(e.RowHandle, HeaderView.Columns[4], false);

                bom.Add(new BOMHeader()
                {
                    BOMCode       = bomCode,
                    BOMLookUpCode = "BOM" + bomCode,
                    UserCode      = Usercode,
                    IsPosted      = false
                });
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void btnPost_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (HeaderView.FocusedRowHandle >= 0)
            {
                PostedTransactionsManager postLines = new PostedTransactionsManager();
                if (lines.GetAll().Where(l => l.transCode == TransCode).Count() > 0)
                {
                    foreach (TransactionLines item in lines.GetAll().Where(l => l.transCode == TransCode))
                    {
                        postLines.AddPostedTransactionDetails(TransCode, DateTime.Now, UserCode, item.accCode,
                                                              item.DebitAmount == null ? null : item.DebitAmount, item.CreditAmount == null ? null : item.CreditAmount);

                        postLines.AddPostedTransactionDetails((long)item.transCode, DateTime.Now, UserCode, item.offsetAccCode,
                                                              item.DebitAmount == null ? item.CreditAmount : null, item.CreditAmount == null ? item.DebitAmount : null);
                    }
                    TransactionHeaderManager headerManager = new TransactionHeaderManager();
                    TransactionHeader        header        = headerManager.Get(TransCode);
                    header.IsPosted = true;
                    headerManager.Update(header);
                    btnPost.Enabled = btnDelete.Enabled = false;
                    HeaderView.SetRowCellValue(HeaderView.FocusedRowHandle, HeaderView.Columns[4], true);
                }
            }
        }