Exemplo n.º 1
0
        public void AddUserIncomeAbility(Int64 userId, bool isIncome, string shortName, string expenseName, int month, int year, decimal value, int type)
        {
            try
            {
                CRUDOperation         cRUDOperation     = new CRUDOperation();
                tbl_UserIncomeAbility userIncomeAbility = null;
                if (isIncome)
                {
                    userIncomeAbility = new tbl_UserIncomeAbility()
                    {
                        UserID             = userId,
                        Month              = month,
                        Year               = year,
                        IsExpense          = 0,
                        RealExpense        = 0,
                        Expense            = 0,
                        ApproximateExpense = 0,
                        Income             = value,
                        IncomeAbility      = value * 1,
                        Type               = type
                    };
                }
                else
                {
                    ExpenseDTO expenseDTO = GetExpenseChannelInfo(shortName, expenseName, value);
                    userIncomeAbility = new tbl_UserIncomeAbility()
                    {
                        UserID             = userId,
                        Month              = month,
                        Year               = year,
                        IsExpense          = 1,
                        RealExpense        = value,
                        Expense            = expenseDTO.Expense,
                        ApproximateExpense = expenseDTO.ApproximateExpense,
                        Income             = expenseDTO.ApproximateExpense,
                        IncomeAbility      = expenseDTO.ApproximateExpense * 1,
                        Type               = type
                    };
                }


                cRUDOperation.AddUserIncomeAbility(userIncomeAbility);
            }
            catch (Exception ex)
            {
            }
        }