Esempio n. 1
0
        /// Method Name     : PutCustomerVerificationData
        /// Author          : Pratik Soni
        /// Creation Date   : 1 Dec 2017
        /// Purpose         : To update exisiting customer verification data for the given CustomerID
        /// Revision        :
        /// </summary>
        public ServiceResponse <Customer> PutCustomerVerificationData(string customerID, string jsonFormattedData)
        {
            Dictionary <string, string> crmPutResponse;
            string contactID;

            try
            {
                logger.Info("Put Customer Request encountered");

                contactID = GetSpecificAttributeFromResponse(GetCustomerGUID(customerID), resourceManager.GetString("crm_contact_customerId"));

                JObject requestContent = JObject.Parse(jsonFormattedData);

                if (Validations.IsValid(requestContent["VerificationCode"]))
                {
                    crmPutResponse = crmUtilities.ExecutePutRequest(contactEntityName, contactID, dtoToCRMMapper.MapCustomerDTOToCRM(requestContent.ToString()));
                }
                else
                {
                    requestContent["IsCustomerRegistered"] = "true";
                    crmPutResponse = crmUtilities.ExecutePutRequest(contactEntityName, contactID, dtoToCRMMapper.MapCustomerDTOToCRM(requestContent.ToString()));
                }
                return(crmUtilities.GetFormattedResponseToDTO <Customer>(crmPutResponse));
            }
            catch (Exception ex)
            {
                logger.Error(ex.InnerException.ToString());
                return(new ServiceResponse <Customer> {
                    Message = ex.ToString()
                });
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Method Name      : PutAlertDetails
        /// Author           : Ranjana Singh
        /// Creation Date    : 24 Feb 2018
        /// Purpose          : Update the given list of Alerts in "Alerts" table in CRM.
        /// Revision         :
        /// </summary>
        /// <param name="alertID"></param>
        /// <param name="jsonFormattedData"/>
        /// <returns></returns>
        public ServiceResponse <Alert> PutAlertDetails(string alertID, string jsonFormattedData)
        {
            Dictionary <string, string> putCRMResponse;
            var    requestContent = (JObject)JsonConvert.DeserializeObject(jsonFormattedData);
            string requestContentUsingCRMFields;

            try
            {
                if (!string.IsNullOrEmpty(requestContent.Property("StartDate").Name))
                {
                    requestContent.Property("StartDate").Remove();
                }
                if (!string.IsNullOrEmpty(requestContent.Property("EndDate").Name))
                {
                    requestContent.Property("EndDate").Remove();
                }
                requestContentUsingCRMFields = dtoToCRMMapper.MapAlertDTOToCRM(requestContent.ToString(Formatting.None));
                putCRMResponse = crmUtilities.ExecutePutRequest(activityEntityName, alertID, requestContentUsingCRMFields);

                return(GetFormattedResponse(putCRMResponse));
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message.ToString());
                return(null);
            }
        }
Esempio n. 3
0
        /// Method Name     : PutAmount
        /// Author          : Pratik Soni
        /// Creation Date   : 19 Feb 2018
        /// Purpose         : To retrive payment details from CRM for customer.
        /// Revision        :
        /// </summary>
        /// <returns> ServiceResponse with Paymeny DTO having only DeviceID value. </returns>
        public ServiceResponse <Payment> PutAmount(string jsonFormattedData)
        {
            Dictionary <string, string> crmResponse;
            string moveGUID;
            string requestContentUsingCRMFields;

            try
            {
                var requestContent = (JObject)JsonConvert.DeserializeObject(jsonFormattedData);
                moveGUID = General.GetSpecificAttributeFromCRMResponse(dalMoveDetails.GetMoveGUID(requestContent.Property("MoveID").Value.ToString()), "jkmoving_moveid");
                if (!Validations.IsValid(moveGUID))
                {
                    logger.Info(resourceManager.GetString("msgInvalidMove"));
                    return(new ServiceResponse <Payment> {
                        Information = resourceManager.GetString("msgInvalidMove")
                    });
                }
                requestContent.Property("MoveID").Remove(); // Deleting MoveID from requestContent as we are updating only TotalPaid amount.

                requestContentUsingCRMFields = dtoToCRMMapper.MapPaymentDTOToCRM(requestContent.ToString(Formatting.None));
                crmResponse = crmUtilities.ExecutePutRequest(moveEntityPluralName, moveGUID, requestContentUsingCRMFields);

                return(crmUtilities.GetFormattedResponseToDTO <Payment>(crmResponse));
            }
            catch (Exception ex)
            {
                logger.Error(resourceManager.GetString("msgServiceUnavailable"), ex);
                return(new ServiceResponse <Payment> {
                    Message = resourceManager.GetString("msgServiceUnavailable")
                });
            }
        }
Esempio n. 4
0
        /// Method Name     : PutMoveData
        /// Author          : Pratik Soni
        /// Creation Date   : 11 Jan 2018
        /// Purpose         : To update exisiting move data for the given MoveID
        /// Revision        :
        /// </summary>
        public DTO.ServiceResponse <DTO.Move> PutMoveData(string moveID, string jsonFormattedData)
        {
            Dictionary <string, string> crmResponse;
            string moveGUID;

            try
            {
                moveGUID = GetSpecificAttributeFromResponse(GetMoveGUID(moveID), "jkmoving_moveid");
                if (string.IsNullOrEmpty(moveGUID))
                {
                    logger.Info(resourceManager.GetString("msgInvalidMove"));
                    return(new ServiceResponse <Move> {
                        Information = resourceManager.GetString("msgInvalidMove")
                    });
                }

                crmResponse = objCrmUtilities.ExecutePutRequest(moveEntityName, moveGUID, objDTOToCRMMapper.MapMoveDTOToCRM(jsonFormattedData));
                return(GetFormattedResponse(crmResponse));
            }
            catch (Exception ex)
            {
                logger.Error(resourceManager.GetString("msgServiceUnavailableUnauthorized"), ex);
                return(new ServiceResponse <Move> {
                    Message = resourceManager.GetString("msgServiceUnavailableUnauthorized")
                });
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Method Name     : PutEstimateData
        /// Author          : Pratik Soni
        /// Creation Date   : 12 Jan 2018
        /// Purpose         : To update estimate details.
        /// Revision        :
        /// </summary>
        /// <param name="moveId"> </param>
        /// <param name="jsonFormattedData"> Contains the estimate details to be saved </param>
        /// <returns></returns>
        public ServiceResponse <Estimate> PutEstimateData(string moveId, string jsonFormattedData)
        {
            Dictionary <string, string> crmResponse;

            try
            {
                logger.Info("PutEstimateData encountered");
                string moveGUID = General.GetSpecificAttributeFromCRMResponse(crmMoveDetails.GetMoveGUID(moveId), "jkmoving_moveid");

                crmResponse = objCrmUtilities.ExecutePutRequest("jkmoving_moves", moveGUID, objDTOToCRMMapper.MapEstimateDTOToCRM(jsonFormattedData));

                return(GetCRMResponse(crmResponse));
            }
            catch (Exception ex)
            {
                logger.Error(resourceManager.GetString("msgServiceUnavailable"), ex);
                return(new ServiceResponse <Estimate> {
                    Message = resourceManager.GetString("msgServiceUnavailable")
                });
            }
        }