示例#1
0
        private void xDG_CellUpdated(object Sender, CellUpdatedEventArgs E)
        {
            var row           = E.Record;
            var stawkaVat     = row.Cells[DictionaryMain.KolumnaStawkaVat];
            var ilosc         = row.Cells[DictionaryMain.KolumnaIlosc];
            var wartoscNetto  = row.Cells[DictionaryMain.KolumnaWartoscNetto];
            var cenaNetto     = row.Cells[DictionaryMain.KolumnaCenaNetto];
            var kwotaVat      = row.Cells[DictionaryMain.KolumnaKwotaVat];
            var wartoscBrutto = row.Cells[DictionaryMain.KolumnaWartoscBrutto];

            if (ilosc.Value != DBNull.Value && ilosc.Value != null &&
                cenaNetto.Value != DBNull.Value &&
                (wartoscNetto.Value == DBNull.Value ||
                 Convert.ToDecimal(wartoscNetto.Value) != GetValueIloraz(ilosc, cenaNetto)))
            {
                wartoscNetto.Value = GetValueIloraz(ilosc, cenaNetto);
            }

            if (!string.IsNullOrEmpty(stawkaVat.Value.ToString()) &&
                wartoscNetto.Value != DBNull.Value && wartoscNetto.Value != null &&
                (wartoscBrutto.Value == DBNull.Value ||
                 (decimal)wartoscBrutto.Value != GetValueIloraz(wartoscNetto, stawkaVat)))
            {
                wartoscBrutto.Value = GetValueIloraz(wartoscNetto, stawkaVat);
            }

            if (wartoscBrutto.Value != DBNull.Value && wartoscBrutto.Value != null &&
                wartoscNetto.Value != null &&
                (kwotaVat.Value == DBNull.Value || (decimal)kwotaVat.Value !=
                 (decimal)wartoscBrutto.Value - (decimal)wartoscNetto.Value))
            {
                kwotaVat.Value = (decimal)wartoscBrutto.Value - (decimal)wartoscNetto.Value;
            }
        }
示例#2
0
 private void _gDataView_CellUpdated(object sender, CellUpdatedEventArgs e)
 {
     try
     {
         if (e.Cell.Field.Name != "IsNewRecord")
         {
             CellValuePresenter.FromCell(e.Record.Cells[e.Cell.Field]).FontWeight = FontWeights.Bold;
             this._IsDirty = true;
         }
     }
     catch (Exception ex)
     {
         HandleExceptions(ex);
     }
 }