/// Method Name : PostTransactionHistory /// Author : Ranjana Singh /// Creation Date : 23 Jan 2018 /// Purpose : Creates new records for transaction history based on given customer ID. /// Revision : By Pratik Soni on 27 Jan 2018: Modified to send proper request body for CRM POST method and return validated serviceResponse /// </summary> public DTO.ServiceResponse <DTO.Payment> PostTransactionHistory(DTO.Payment dtoPayment) { Dictionary <string, string> crmResponse; string jsonFormattedData; string moveGUID, customerGUID; try { moveGUID = General.GetSpecificAttributeFromCRMResponse(dalMoveDetails.GetMoveGUID(dtoPayment.MoveID), "jkmoving_moveid"); customerGUID = General.GetSpecificAttributeFromCRMResponse(dalCustomerDetails.GetCustomerGUID(dtoPayment.CustomerID), "contactid"); dtoPayment.MoveID = moveGUID; dtoPayment.CustomerID = customerGUID; jsonFormattedData = General.ConvertToJson <Payment>(dtoPayment); crmResponse = crmUtilities.ExecutePostRequest(transactionEntityNamePlural, dtoToCRMMapper.MapPaymentDTOToCRM(jsonFormattedData)); return(crmUtilities.GetFormattedResponseToDTO <Payment>(crmResponse)); } catch (Exception ex) { logger.Error(resourceManager.GetString("msgServiceUnavailable"), ex); return(new ServiceResponse <Payment> { Message = resourceManager.GetString("msgServiceUnavailable") }); } }
/// <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); } }