Beispiel #1
0
        /// <summary>
        /// Creates a new user bill.
        /// </summary>
        /// <param name="userId">The user id</param>
        /// <param name="bill">The bill object</param>
        /// <param name="recModel">The recurrence model</param>
        /// <param name="recSchedule">The recurrence schedule</param>
        /// <returns></returns>
        public bool CreateNewUserBill(int userId, Bill bill, IRecurrenceModel recModel, RecurrenceSchedule recSchedule)
        {
            try
            {
                var newBill = _billRepository.CreateNewBill(bill);

                var newRecSchedule = _userBillRecurrenceScheduleRepository.CreateNewRecurrenceSchedule(recSchedule.RecurrenceTypeId, recSchedule.Schedule);

                _userBillRepository.CreateNewUserBill(userId, newBill, recModel, newRecSchedule);
            }
            catch (Exception e)
            {
                _logRepository.WriteLog(LogLevel.Error, "UserBillService.CreateNewUserBill", e.Message, e);
                return(false);
            }

            return(true);
        }