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; }
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; }