public int GetPaymentSequence(string year) { try { int max_sequence = 0; using (BudgetContext db = new BudgetContext()) { var budget = db.Budgets.Where(b => b.Year == year.Trim()).FirstOrDefault(); if (budget == null) { throw new Exception("Invalid Year"); } var last_payment = db.Payments .Where(p => p.Year == year) .OrderByDescending(p => p.Sequence) .FirstOrDefault(); if (last_payment != null) { max_sequence = last_payment.Sequence; } return(max_sequence + 1); } } catch (Exception) { throw new Exception("ERROR: Can not get Payment Sequence."); } }
public StatementRepository(BudgetContext context) { this.context = context; }
public StatementRepository() { context = new BudgetContext(); }
public BudgetRepository(BudgetContext context) { this._db = context; InitInstance(); }
//private CostCenter _workingCostCenter; #region Constructor public BudgetRepository() { _db = new BudgetContext(); InitInstance(); }
public EmployeeRepository(BudgetContext context) { this.context = context; InitInstance(); }
public EmployeeRepository() { this.context = new BudgetContext(); InitInstance(); }
public CostCenterRepository(BudgetContext context) { this._db = context; }
public UserRepository() { context = new BudgetContext(); }
public CostCenterRepository() { _db = new BudgetContext(); }
public TransactionRepository(BudgetContext context) { this._db = context; }
public TransactionRepository() { _db = new BudgetContext(); }
public AccountRepository(BudgetContext context) { this.context = context; }
public AccountRepository() { context = new BudgetContext(); }