コード例 #1
0
        private void SeqeunceSelectionChnaged(object sender, SelectionChangedEventArgs e)
        {
            if (SelectedSeqeunce == null)
            {
                return;
            }

            _payment = _paymentRepository.Query
                       (
                pay => pay.PeriodSetting.Id == SelectedYear.Id
                &&
                pay.PaymentSequence.Id == SelectedSeqeunce.Id
                       ).Single();

            _paymentDetail =
                _detailRepository.Query
                (
                    det => det.FamilyMember.Code == _selectedMember.Code
                    &&
                    det.Payment.PaymentNo == _payment.PaymentNo
                ).Single();

            LoansHistory =
                _hisotryRepository.Query
                (
                    hist => hist.PaymentTransaction.TransNo == _paymentDetail.TransNo
                ).ToList();

            MemberLoans.Clear();

            foreach (LoanPayment lohis in LoansHistory)
            {
                var memLoan = new MemberLoan
                              (
                    lohis.Id, lohis.Loan.LoanNo, lohis.AmountPaid,
                    lohis.Loan.Description, lohis.Loan.Remarks
                              );
                MemberLoans.Add(memLoan);
            }

            MemberShares  = _paymentDetail.ShareNumbers;
            PaymentAmount = _payment.Amount;
            PaymentTotal  = (MemberShares * PaymentAmount);
            LoansTotal    = MemberLoans.Sum(x => x.LoanAmount);
            NetPayment    = _paymentDetail.NetPayments;
            if (_payment.PaymentStatus.Id != PaymentInReviewStatus.Id)
            {
                CanEdit = false;
            }
            SetState(ViewState.Saved);
        }
コード例 #2
0
        private void SeqeunceSelectionChnaged(PeriodYear paymentYear, PaymentSequence paymentSequence)
        {
            if (paymentSequence == null)
            {
                return;
            }

            _payment = _paymentRepository.Single
                       (
                pay => pay.PeriodYear.Year == paymentYear.Year
                &&
                pay.PaymentSequence.Id == paymentSequence.Id
                       );

            _paymentDetail =
                _detailRepository.Single
                (
                    det => det.FamilyMember.Code == _selectedMember.Code
                    &&
                    det.Payment.PaymentNo == _payment.PaymentNo
                );

            LoansHistory =
                _loanPaymentsRepository.Where
                (
                    hist => hist.PaymentTransaction.TransNo == _paymentDetail.TransNo
                ).ToList();

            MemberLoans.Clear();

            foreach (LoanPayment loanPayment in LoansHistory)
            {
                var memLoan = new MemberLoan
                              (
                    loanPayment.DocNo, loanPayment.Loan.LoanNo, loanPayment.AmountPaid,
                    loanPayment.Loan.Description, loanPayment.Loan.Remarks
                              );
                MemberLoans.Add(memLoan);
            }

            MemberShares  = _paymentDetail.ShareNumbers;
            PaymentAmount = _payment.Amount;
            PaymentTotal  = (MemberShares * PaymentAmount);
            LoansTotal    = MemberLoans.Sum(x => x.LoanAmount);
            NetPayment    = _paymentDetail.NetPayments;
            if (_payment.Posted)
            {
                CanEdit = false;
            }
            SetState(ViewState.Saved);
        }
コード例 #3
0
        private void SetState(ViewState state)
        {
            _viewState = state;
            switch (_viewState)
            {
            case ViewState.New:
                MemberLoans.Clear();
                MemberCode       = 0;
                MemberName       = string.Empty;
                _selectedMember  = null;
                Years            = null;
                PaymentSequences = null;
                PaymentTotal     = 0.0M;
                MemberShares     = 0;
                PaymentAmount    = 0.0M;
                LoansTotal       = 0.0M;
                NetPayment       = 0.0M;
                CanEdit          = true;
                ResetChangedFalg();
                break;

            case ViewState.Saved:
                ResetChangedFalg();
                break;

            case ViewState.Edited:
                SetChangedFlag();
                break;

            case ViewState.HasErrors:
                break;

            case ViewState.Deleted:
                ResetChangedFalg();
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            RaisePropertyChanged("");
        }