// retrieve open Adj Voucher public AdjustmentVoucher retrieveNewOrAvailableAdjustmentVoucherForClerk(int deliveredEmployeeId) { AdjustmentVoucher targetAdjustmentVoucher = (AdjustmentVoucher)adjustmentVoucherRepo.FindBy(x => x.EmployeeId == deliveredEmployeeId && x.Status == "Open").FirstOrDefault(); AdjustmentVoucher returnTargetAdjustmentVoucherId; if (targetAdjustmentVoucher == null) { AdjustmentVoucher newAdjustmentVoucher = new AdjustmentVoucher() { EmployeeId = deliveredEmployeeId, Status = "Open", Date = DateTime.Now }; newAdjustmentVoucher = adjustmentVoucherRepo.Create(newAdjustmentVoucher); returnTargetAdjustmentVoucherId = adjustmentVoucherRepo.FindOneBy(x => x.EmployeeId == deliveredEmployeeId && x.Status == "Open"); } else { returnTargetAdjustmentVoucherId = targetAdjustmentVoucher; } return(returnTargetAdjustmentVoucherId); }
public AdjustmentVoucher getOpenAdjustmentVoucherByClerk(int clerkId) { return(adjustmentVoucherRepo.FindOneBy(x => x.Status == "Open" && x.EmployeeId == clerkId)); }