Exemplo n.º 1
0
        /// <summary>
        /// Method Name      : PostAlertList
        /// Author           : Pratik Soni
        /// Creation Date    : 29 Dec2017
        /// Purpose          : Insert the given list of Alerts in "Alerts" table in SQL.
        /// Revision         :
        /// </summary>
        /// <param name="customerID"></param>
        /// <param name="jsonFormattedData"/>
        /// <returns></returns>
        public ServiceResponse <Alert> PostAlertDetails(string customerID, string jsonFormattedData)
        {
            Dictionary <string, string> postCRMResponse;
            var    requestContent = (JObject)JsonConvert.DeserializeObject(jsonFormattedData);
            string requestContentUsingCRMFields;

            try
            {
                if (!string.IsNullOrEmpty(requestContent.Property("AlertID").Name))
                {
                    requestContent.Property("AlertID").Remove();
                }
                requestContentUsingCRMFields = dtoToCRMMapper.MapAlertDTOToCRM(requestContent.ToString(Formatting.None));
                postCRMResponse = crmUtilities.ExecutePostRequest(activityEntityName, requestContentUsingCRMFields);

                return(crmUtilities.GetFormattedResponseToDTO <Alert>(postCRMResponse));
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message.ToString());
                return(null);
            }
        }