protected void UpdateAmount() { ExpenseList lines = Datos_Lineas.DataSource as ExpenseList; decimal asignado = lines.Sum(item => item.Asignado); if (_entity.Importe >= 0) { _entity.Importe = (_entity.Importe) > asignado ? _entity.Importe : asignado; } else { _entity.Importe = (_entity.Importe) < asignado ? _entity.Importe : asignado; } }
public ActionResult List(DateTime bDate, DateTime eDate, string code = "", int codeID = 0, string ReportType = "") { ViewBag.ReportType = ReportType; GetData(); IEnumerable <expense> ExpenseList; if (code == "BankAccountSearch") { ExpenseList = ExpenseRepository.GetExpenseByBankAccount(codeID, bDate, eDate); } else if (code == "CategorySearch") { ExpenseList = ExpenseRepository.GetExpenseByCategory(codeID, bDate, eDate); } else if (code == "DateRangeSearch") { ExpenseList = ExpenseRepository.GetExpenseByDateRange(bDate.Date, eDate.Date); } else if (code == "CurrentExpense") { ExpenseList = ExpenseRepository.GetExpenseByStatus("Unpaid"); } else { ExpenseList = ExpenseRepository.GetExpenseByDate(bDate); } ViewBag.RecordCount = ExpenseList.Count(); foreach (var i in ExpenseList) { i.subcategory = SubCategoryRepository.GetBySubCategoryID(i.subCategoryID); i.bankaccount = BankAccountRepository.GetBankAccountByID(i.bankAccountID); } ViewBag.TotalExpense = ExpenseList.Sum(e => e.Amount); return(PartialView(ExpenseList)); }