コード例 #1
0
 public static DisbursementVcrStatu ChangeStatus(LoanDisbursementVcr loanDisbursementVoucher, DisbursementVcrStatusType statusType, DateTime today)
 {
     DisbursementVcrStatu disbursementStatus = GetActive(loanDisbursementVoucher);
     if (CanChangeStatus(disbursementStatus.DisbursementVcrStatusType, statusType, today))
         return CreateOrUpdateCurrent(loanDisbursementVoucher, statusType, today);
     return disbursementStatus;
 }
コード例 #2
0
 public static bool CanChangeStatus(DisbursementVcrStatusType statusFrom, DisbursementVcrStatusType statusTo, DateTime today)
 {
     //check if change status is allowed through the DisbursementVcrStatusTypeAssoc
     var checkStatus = Context.DisbursementVcrStatTypeAssocs.SingleOrDefault(entity =>
         entity.FromStatusTypeId == statusFrom.Id && entity.ToStatusTypeId == statusTo.Id &&
         entity.EndDate == null);
     if (checkStatus != null)
         return true;
     else
         return false;
 }
コード例 #3
0
        public static DisbursementVcrStatu Create(LoanDisbursementVcr loanDisbursementVoucher, DisbursementVcrStatusType statusType, DateTime today)
        {
            DisbursementVcrStatu status = new DisbursementVcrStatu();
            status.DisbursementVoucherStatTypId = statusType.Id;
            status.LoanDisbursementVcr = loanDisbursementVoucher;
            status.Remarks = null;
            status.TransitionDateTime = today;
            status.IsActive = true;

            Context.DisbursementVcrStatus.AddObject(status);
            return status;
        }
コード例 #4
0
        public static DisbursementVcrStatu CreateOrUpdateCurrent(LoanDisbursementVcr loanDisbursementVoucher, DisbursementVcrStatusType statusType, DateTime today)
        {
            DisbursementVcrStatu disbursementStatus = GetActive(loanDisbursementVoucher);
            if (disbursementStatus != null && disbursementStatus.DisbursementVcrStatusType.Id != statusType.Id)
                disbursementStatus.IsActive = false;

            if (disbursementStatus == null || disbursementStatus.DisbursementVcrStatusType.Id != statusType.Id)
            {
                DisbursementVcrStatu newDisbursementStatus = new DisbursementVcrStatu();
                newDisbursementStatus.DisbursementVoucherStatTypId = statusType.Id;
                newDisbursementStatus.LoanDisbursementVcr = loanDisbursementVoucher;
                newDisbursementStatus.Remarks = null;
                newDisbursementStatus.TransitionDateTime = today;
                newDisbursementStatus.IsActive = true;

                Context.DisbursementVcrStatus.AddObject(newDisbursementStatus);

                return newDisbursementStatus;
            }
            return disbursementStatus;
        }
コード例 #5
0
 public static DisbursementVcrStatu RetrieveStatus(LoanDisbursementVcr loanDisbursementVoucher, DisbursementVcrStatusType statusType)
 {
     return Context.DisbursementVcrStatus.SingleOrDefault(entity => entity.LoanDisbursementVoucherId == loanDisbursementVoucher.Id
         && entity.TransitionDateTime == GetActive(loanDisbursementVoucher).TransitionDateTime && entity.DisbursementVoucherStatTypId == statusType.Id);
 }
コード例 #6
0
        private DisbursementVcrStatu CreateVoucherStatusWithType(LoanDisbursementVcr voucher, DateTime today, DisbursementVcrStatusType type)
        {
            DisbursementVcrStatu voucherStatus = new DisbursementVcrStatu();
            voucherStatus.DisbursementVcrStatusType = type;
            voucherStatus.IsActive = true;
            voucherStatus.LoanDisbursementVcr = voucher;
            voucherStatus.TransitionDateTime = today;

            Context.DisbursementVcrStatus.AddObject(voucherStatus);
            return voucherStatus;
        }