Example #1
0
        /// <summary>
        /// Modify business tax status
        /// </summary>
        /// <param name="businessTaxStatus">BusinessTaxStatus object to use for update</param>
        /// <returns>true if modify business tax status was successful</returns>
        public bool ModifyBusinessTaxStatus(BusinessTaxStatus businessTaxStatus)
        {
            bool result = false;
            using (BusinessTransaction businessTransaction = new BusinessTransaction())
            {
                result = businessDao.ModifyBusinessTaxStatus(businessTaxStatus);

                businessEventDao.Create(new BusinessEvent
                {
                    BusinessId = businessTaxStatus.BusinessId,
                    EventTypeCode = BusinessEventTypesEnum.EditBusinessTaxStatus.GetCode(),
                    EventType = new EnumEntity { Code = BusinessEventTypesEnum.EditBusinessTaxStatus.GetCode() }
                });

                businessTransaction.Commit();
            }
            return result;
        }
Example #2
0
        /// <summary>
        /// Modify business settings
        /// </summary>
        /// <param name="businessTaxStatus">BusinessTaxStatus object to use for update</param>
        /// <returns>true if modify business settings was successful</returns>
        public bool ModifyBusinessTaxStatus(BusinessTaxStatus businessTaxStatus)
        {
            const string SQL_UPDATE_BUSINESS_TAX_STATUS = @"UPDATE Business.Business
                                                            SET BusinessRegistrationNumber = @BusinessRegistrationNumber,
                                                                IsTaxRegistered = @IsTaxRegistered,
                                                                TaxRegistrationNumber = @TaxRegistrationNumber,
                                                                DefaultTaxRate = @DefaultTaxRate
                                                            WHERE Id = @BusinessId";

            var parameters = new List<SqlParameter>
            {
                DbHelper.CreateParameter(BusinessMapper.Parameters.BusinessRegistrationNumber, businessTaxStatus.BusinessRegistrationNumber),
                DbHelper.CreateParameter(BusinessMapper.Parameters.TaxRegistrationNumber, businessTaxStatus.TaxRegistrationNumber),
                DbHelper.CreateParameter(BusinessMapper.Parameters.IsTaxRegistered, businessTaxStatus.IsTaxRegistered),
                DbHelper.CreateParameter(BusinessMapper.Parameters.DefaultTaxRate, businessTaxStatus.DefaultTaxRate),
                DbHelper.CreateParameter(BusinessMapper.Parameters.BusinessId, businessTaxStatus.BusinessId)
            };

            AuditFieldsHelper.PopulateAuditFields(parameters);
            return DbHelper.ExecuteNonQueryCommand(SQL_UPDATE_BUSINESS_TAX_STATUS, parameters: parameters) > 0;
        }