Example #1
0
        public int AddExpense(ExpenseDTO dto)
        {
            int id = 0;

            try
            {
                log.Debug(ExpenseDTO.FormatExpenseDTO(dto));

                R_Expense t = ExpenseDTO.ConvertDTOtoEntity(dto);

                // add
                id            = Repository.AddExpense(t);
                dto.ExpenseId = id;

                log.Debug("result: 'success', id: " + id);
            }
            catch (System.Exception e)
            {
                // error
                log.Error(e.ToString());

                throw;
            }

            return(id);
        }
Example #2
0
        public void DeleteExpense(ExpenseDTO dto)
        {
            try
            {
                log.Debug(ExpenseDTO.FormatExpenseDTO(dto));

                R_Expense t = ExpenseDTO.ConvertDTOtoEntity(dto);

                // delete
                Repository.DeleteExpense(t);
                dto.IsDeleted = t.IsDeleted;

                log.Debug("result: 'success'");
            }
            catch (System.Exception e)
            {
                // error
                log.Error(e.ToString());

                throw;
            }
        }
Example #3
0
        public void UpdateExpense(ExpenseDTO dto)
        {
            try
            {
                //Requires.NotNull(t);
                //Requires.PropertyNotNegative(t, "ExpenseId");

                log.Debug(ExpenseDTO.FormatExpenseDTO(dto));

                R_Expense t = ExpenseDTO.ConvertDTOtoEntity(dto);

                // update
                Repository.UpdateExpense(t);

                log.Debug("result: 'success'");
            }
            catch (System.Exception e)
            {
                // error
                log.Error(e.ToString());

                throw;
            }
        }