示例#1
0
        public void ReviewerRecorder(Guid id, string reviewer)
        {
            LoanRecord record = this.Records.FirstOrDefault(p => p.ID == id);

            if (record.IsInvalid)
            {
                throw new DomainException("作废凭证不能审核");
            }
            if (record.Reviewer != string.Empty && record.Reviewer != null)
            {
                throw new DomainException("凭证已审核");
            }
            record.Reviewer   = reviewer;
            record.ReviewTime = DateTimeOffset.Now;
        }
示例#2
0
        public LoanRecord SettleInterest(DateTimeOffset operateTime, string memo, string creater, IList <InterestRate> rates, int minDepositDays = 0)
        {
            if (this.IsInvalid)
            {
                throw new DomainException("已作废的条子无法结息");
            }
            if (!this.CanSettleInterest(minDepositDays))
            {
                throw new DomainException("无法结息");
            }
            var        interest = CalculateQuarterInterest(rates);
            LoanRecord record   = LoanRecord.Create(LoanRecordType.SettleInterest, operateTime, this.Amount, interest, memo, creater);

            this.Records.Add(record);
            record.Memo = this.InterestSettlementDate.ToString();
            this.InterestSettlementDate = GetSettlableDate();
            return(record);
        }
示例#3
0
        public LoanRecord Withdraw(DateTimeOffset operateTime, decimal amount, string memo, string creater, IList <InterestRate> rates, int minDepositDays = 0)
        {
            if (this.IsInvalid)
            {
                throw new DomainException("已作废的条子无法取款");
            }

            var interest = CalculateInterest(rates, operateTime, amount, 0);;

            if (DateTimeOffset.Now.Subtract(this.DepositTime).Days < minDepositDays)
            {
                interest = 0;
            }
            LoanRecord record = LoanRecord.Create(LoanRecordType.Withdraw, operateTime, amount, interest, memo, creater);

            this.Records.Add(record);
            this.Amount      = this.Amount - record.Amount;
            this.VoucherTime = DateTimeOffset.Now;
            return(record);
        }
示例#4
0
        public LoanRecord Deposit(DateTimeOffset operateTime, decimal amount, string memo, string creater)
        {
            foreach (var r in this.Records)
            {
                if (r.Type == LoanRecordType.Deposit)
                {
                    throw new DomainException("已经存在存款记录");
                }
            }
            LoanRecord record = LoanRecord.Create(LoanRecordType.Deposit, operateTime, amount, 0, memo, creater);

            this.Records.Add(record);
            this.DepositTime   = operateTime;
            this.Amount        = this.Amount + record.Amount;
            this.DepositAmount = record.Amount;
            this.VoucherTime   = DateTimeOffset.Now;

            this.InterestSettlementDate = (operateTime >= DateTimeOffset.Parse("2019/12/1 0:00:00 +08:00") ? operateTime : DateTimeOffset.Parse("2019/12/1 0:00:00 +08:00"));

            return(record);
        }