Exemple #1
0
            public static decimal CorrectPayment(Model.Payment currentPayment, decimal newCorrection)
            {
                decimal returnValue;

                if (currentPayment.OldValue == 0)
                {
                    currentPayment.OldValue = currentPayment.Value;
                }

                if (currentPayment.Correction == 0)
                {
                    returnValue                  = newCorrection;
                    currentPayment.Value         = currentPayment.OldValue + newCorrection;
                    currentPayment.Parent.Total += newCorrection;

                    Model.GlobalParameters.saldo += newCorrection;
                }
                else
                {
                    Model.GlobalParameters.saldo -= (currentPayment.Correction - newCorrection);

                    returnValue                  = newCorrection;
                    currentPayment.Value         = currentPayment.OldValue + newCorrection;
                    currentPayment.Parent.Total -= (currentPayment.Correction - newCorrection);
                }
                return(returnValue);
            }
        private void CheckBox_Unchecked(object sender, RoutedEventArgs e)
        {
            Model.Payment currentPayment = ((CheckBox)sender).DataContext as Model.Payment;


            currentPayment.Correction = 0;
            currentPayment.Value      = currentPayment.OldValue;
            currentPayment.Parent.HowManyRecordsChecked -= 1;
        }
        private void CheckBox_Checked_1(object sender, RoutedEventArgs e) // Галочка "Исключить"
        {
            Model.Payment currentPayment = ((CheckBox)sender).DataContext as Model.Payment;
            if (currentPayment.OldValue == 0)
            {
                currentPayment.OldValue = currentPayment.Value;
            }


            currentPayment.Correction = -currentPayment.OldValue;
            currentPayment.Parent.HowManyRecordsChecked += 1;
        }