Пример #1
0
        public void Delete(int id)
        {
            var objSurveyItem = _SurveyRepository.GetSurveyItem(id);

            Models.SurveyItem SurveyItem = ConvertToSurveyItem(objSurveyItem);

            if (SurveyItem != null && SurveyItem.Id == _entityId)
            {
                bool boolResult = _SurveyRepository.DeleteSurveyItem(id);
                if (boolResult)
                {
                    _logger.Log(LogLevel.Information, this, LogFunction.Delete, "SurveyItem Deleted {Id}", id);
                }
                else
                {
                    _logger.Log(LogLevel.Information, this, LogFunction.Delete, "Error: SurveyItem *NOT* Deleted {Id}", id);
                }
            }
        }
Пример #2
0
        public void Delete(int id)
        {
            var objSurvey = _SurveyRepository.GetSurvey(id);

            Models.Survey Survey = ConvertToSurvey(objSurvey);

            if (Survey != null && Survey.ModuleId == _entityId)
            {
                // Delete all Survey Items
                if (Survey.SurveyItem != null)
                {
                    foreach (var item in Survey.SurveyItem)
                    {
                        bool boolDeleteSurveyItemResult = _SurveyRepository.DeleteSurveyItem(item.Id);

                        if (boolDeleteSurveyItemResult)
                        {
                            _logger.Log(LogLevel.Information, this, LogFunction.Delete, "Survey Item Deleted {item.Id}", item.Id);
                        }
                        else
                        {
                            _logger.Log(LogLevel.Information, this, LogFunction.Delete, "Error: Survey Item *NOT* Deleted {item.Id}", item.Id);
                        }
                    }
                }

                bool boolResult = _SurveyRepository.DeleteSurvey(id);

                if (boolResult)
                {
                    _logger.Log(LogLevel.Information, this, LogFunction.Delete, "Survey Deleted {id}", id);
                }
                else
                {
                    _logger.Log(LogLevel.Information, this, LogFunction.Delete, "Error: Survey *NOT* Deleted {id}", id);
                }
            }
        }