예제 #1
0
        public string ProcessSurvey(string surveyData, ICrmService crmService)
        {
            var failedSurveys = string.Empty;

            if (string.IsNullOrWhiteSpace(surveyData))
            {
                throw new ArgumentNullException(Constants.Parameters.DataJson);
            }
            if (crmService == null)
            {
                throw new ArgumentNullException(Constants.Parameters.CrmService);
            }
            try
            {
                var response = crmService.ExecuteActionForSurveyCreate(surveyData);
                if (response == null)
                {
                    throw new InvalidOperationException(Constants.Messages.ResponseNull);
                }
                failedSurveys = ProcessResponse(response);
            }
            catch (Exception ex)
            {
                Trace.TraceError("Unexpected error occured at ProcessSurvey::Message:{0}||Trace:{1}", ex.Message, ex.StackTrace.ToString());
                return(Constants.General.Error);
            }
            return(failedSurveys);
        }