Example #1
0
        public bool AccountDelete(Account account)
        {
            return(ExecuteFaultHandledOperation(() =>
            {
                var acct = _acct_es.Map(account);

                if (account.Addresses != null)
                {
                    Log.Info($"Account addresses to be deleted -> {account.Addresses.Count}");
                    foreach (Address address in account.Addresses)
                    {
                        try
                        {
                            bool ret_value = _address_be.AddressDelete(address);
                        }
                        catch (Exception ex)
                        {
                            Log.Error("Error deleting account address data from the database");
                            Log.Error($"{ex.Source}:{ex.Message}");
                            throw ex;
                        }
                    }
                }

                if (account.AccountAttributes != null)
                {
                    Log.Info($"Account attributes to be deleted -> {account.AccountAttributes.Count}");
                    foreach (EntityAttribute attribute in account.AccountAttributes)
                    {
                        try
                        {
                            bool ret_value = _entity_attribute_be.EntityAttributeDelete(attribute);
                        }
                        catch (Exception ex)
                        {
                            Log.Error("Error deleting account attribute data from the database");
                            Log.Error($"{ex.Source}:{ex.Message}");
                            throw ex;
                        }
                    }
                }

                if (account.FeeSchedules != null)
                {
                    Log.Info($"Account fee schedule to be deleted -> {account.FeeSchedules.Count}");
                    foreach (FeeSchedule fee_schedule in account.FeeSchedules)
                    {
                        try
                        {
                            bool ret_value = _fee_schedule_be.FeeScheduleDelete(fee_schedule);
                        }
                        catch (Exception ex)
                        {
                            Log.Error("Error deleting account fee schedule data from the database");
                            Log.Error($"{ex.Source}:{ex.Message}");
                            throw ex;
                        }
                    }
                }

                if (account.Employees != null)
                {
                    Log.Info($"Account employee(s) to be deleted -> {account.FeeSchedules.Count}");
                    foreach (AccountPerson employee in account.Employees)
                    {
                        try
                        {
                            bool ret_value = _account_employee_be.EmployeeDelete(account, employee);
                        }
                        catch (Exception ex)
                        {
                            Log.Error("Error deleting account employee data from the database");
                            Log.Error($"{ex.Source}:{ex.Message}");
                            throw ex;
                        }
                    }
                }

                if (account.Contacts != null)
                {
                    Log.Info($"Account contact(s) to be deleted -> {account.Contacts.Count}");
                    foreach (Contact contact in account.Contacts)
                    {
                        try
                        {
                            bool ret_value = _contact_be.ContactDelete(contact);
                        }
                        catch (Exception ex)
                        {
                            Log.Error("Error deleting account contact data from the database");
                            Log.Error($"{ex.Source}:{ex.Message}");
                            throw ex;
                        }
                    }
                }

                if (account.Comments != null)
                {
                    Log.Info($"Account comment(s) to be deleted -> {account.Comments.Count}");
                    foreach (var comment in account.Comments)
                    {
                        try
                        {
                            bool ret_value = _comment_be.CommentDelete(comment);
                        }
                        catch (Exception ex)
                        {
                            Log.Error("Error deleting account comment data from the database");
                            Log.Error($"{ex.Source}:{ex.Message}");
                            throw ex;
                        }
                    }
                }

                _acct_repo.Delete(acct);
                return true;
            }));
        }
Example #2
0
        public bool DeleteFeeSchedule(FeeSchedule fee_schedule)
        {
            IFeeScheduleBusinessEngine fee_schedule_be = _business_engine_factory.GetBusinessEngine <IFeeScheduleBusinessEngine>();

            return(fee_schedule_be.FeeScheduleDelete(fee_schedule));
        }