コード例 #1
0
        private void grvEntries_ShowingEditor(object sender, CancelEventArgs e)
        {
            try
            {
                // The ledger account has been selected
                BulkEntry FocusedRow = grvEntries.GetFocusedRow() as BulkEntry;

                if (((DevExpress.XtraGrid.Views.Grid.GridView)sender).FocusedValue == null || FocusedRow.AccountId == null)
                {
                    return;
                }

                if ((sender as DevExpress.XtraGrid.Views.Grid.GridView).FocusedColumn == colAgingId)
                {
                    if (!(((DevExpress.Data.Async.Helpers.ReadonlyThreadSafeProxyForObjectFromAnotherThread)(ddlAccount.Properties.View.GetFocusedRow())).OriginalRow as DB.VW_Account).AgingAccount)
                    {
                        e.Cancel = true;
                        SendKeys.Send("{Tab}");
                    }
                }
            }
            catch (Exception ex)
            {
                if (CDS.Shared.Exception.UserInterfaceExceptionHandler.HandleException(ref ex))
                {
                    throw ex;
                }
            }
        }
コード例 #2
0
 private void grvEntries_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
 {
     try
     {
         BulkEntry row = (BulkEntry)grvEntries.GetRow(e.RowHandle);
         if (row.TaxId == null)
         {
             row.Inclusive = Math.Round((row.Exclusive ?? 0) * (1.0m), 2, MidpointRounding.AwayFromZero);
         }
         else if (e.Column == colTax)
         {
             // Tax type changed recalc exclusive based on inclusive
             row.Exclusive = Math.Round((row.Inclusive ?? 0) * 1.0m / (1.0m + taxes.FirstOrDefault(n => n.Id == row.TaxId).Percentage), 2, MidpointRounding.AwayFromZero);
         }
         else if (e.Column == colExclusive)
         {
             // Exclusive changed - recalc inclusive
             row.Inclusive = Math.Round((row.Exclusive ?? 0) * (1.0m + taxes.FirstOrDefault(n => n.Id == row.TaxId).Percentage), 2, MidpointRounding.AwayFromZero);
         }
         else if (e.Column == colInclusive)
         {
             // Inclusive changed - recalc exclusive
             row.Exclusive = Math.Round((row.Inclusive ?? 0) * 1.0m / (1.0m + taxes.FirstOrDefault(n => n.Id == row.TaxId).Percentage), 2, MidpointRounding.AwayFromZero);
         }
         txtTotal.EditValue = bulkentries.Sum(n => - n.Inclusive.Value);
     }
     catch (Exception ex)
     {
         if (CDS.Shared.Exception.UserInterfaceExceptionHandler.HandleException(ref ex))
         {
             throw ex;
         }
     }
 }