Beispiel #1
0
        public async Task <ActionResult> CreateUtilityCosts([Bind(Include = "idUtilityCosts,indicationCounter,amount,dateExpenses,expenseCategoryId")] UtilityCostsView utilityCostsView)
        {
            if (ModelState.IsValid)
            {
                UtilityCostsBll utilityCosts = Mapper.Map <UtilityCostsView, UtilityCostsBll>(utilityCostsView);
                await _utilityCosts.Insert(utilityCosts);

                return(RedirectToAction("ViewUtilityCosts"));
            }

            var expenseCategory = await _expenseCategory.GetTableAll();

            ViewBag.Category = new SelectList(expenseCategory.Where(x => (x.idExpenseCategory >= 10) && (x.idExpenseCategory <= 15)), "idExpenseCategory", "name");
            return(View(utilityCostsView));
        }
Beispiel #2
0
        public async Task SaveExpenses(AllExpensesBll allExpenses)
        {
            if (allExpenses.expenseCategoryId != 5)
            {
                await ExpensesInsert(allExpenses);
            }
            else if (allExpenses.expenseCategoryId == 5)
            {
                int idExpense = await ExpensesInsert(allExpenses);

                UtilityCostsBll utilityCosts = new UtilityCostsBll();

                utilityCosts.indicationCounter      = allExpenses.indicationCounter;
                utilityCosts.utilityCostsCategoryId = allExpenses.utilityCostsCategoryId;
                utilityCosts.expenseId = idExpense;

                await _utilityCosts.Insert(utilityCosts);
            }
        }
        public async Task SaveExpenses(AllExpensesBll allExpenses)
        {
            if (allExpenses.expenseCategoryId == 2 || allExpenses.expenseCategoryId == 3)
            {
                CostsCarWashAndDeteylingBll costsCarWash = new CostsCarWashAndDeteylingBll();

                costsCarWash.nameExpenses      = allExpenses.nameExpenses;
                costsCarWash.expenseCategoryId = allExpenses.expenseCategoryId;
                costsCarWash.dateExpenses      = allExpenses.dateExpenses;
                costsCarWash.amount            = allExpenses.amount;
                costsCarWash.typeServicesId    = allExpenses.typeServicesId;

                await _costsCarWashAndDeteyling.Insert(costsCarWash);
            }
            else if (allExpenses.expenseCategoryId == 5)
            {
                UtilityCostsBll utilityCosts = new UtilityCostsBll();

                utilityCosts.indicationCounter      = allExpenses.indicationCounter;
                utilityCosts.amount                 = allExpenses.amount;
                utilityCosts.dateExpenses           = allExpenses.dateExpenses;
                utilityCosts.expenseCategoryId      = allExpenses.expenseCategoryId;
                utilityCosts.utilityCostsCategoryId = allExpenses.utilityCostsCategoryId;

                await _utilityCosts.Insert(utilityCosts);
            }
            else if (allExpenses.expenseCategoryId == 6)
            {
                OtherExpensesBll otherExpenses = new OtherExpensesBll();

                otherExpenses.nameExpenses      = allExpenses.nameExpenses;
                otherExpenses.amount            = allExpenses.amount;
                otherExpenses.dateExpenses      = allExpenses.dateExpenses;
                otherExpenses.expenseCategoryId = allExpenses.expenseCategoryId;

                await _otherExpenses.Insert(otherExpenses);
            }
        }