Exemple #1
0
        /// <summary>
        /// Method Name     : GetMoveId
        /// Author          : Ranjana Singh
        /// Creation Date   : 27 Dec 2017
        /// Purpose         : Gets move Id from customerID.
        /// Revision        :
        /// </summary>
        /// <param name="moveID"></param>
        /// <returns></returns>
        public DTO.ServiceResponse <DTO.Move> GetMoveId(string customerID)
        {
            Dictionary <string, string> customerResponse, moveResponse;
            string        retrieveFieldList;
            StringBuilder filterString;

            filterString = new StringBuilder();

            logger.Info("GetMoveId encountered");
            customerResponse = objCrmUtilities.ExecuteGetRequest(contactEntityName, "contactid", "jkmoving_customernumber eq '" + customerID + "'");

            retrieveFieldList = "jkmoving_movenumber,_jkmoving_contactofmoveid_value,statecode";
            filterString.Append("_jkmoving_contactofmoveid_value eq " + Utility.General.GetSpecificAttributeFromCRMResponse(customerResponse, "contactid"));
            filterString.Append(" and statecode eq 0");
            filterString.Append(" and statuscode ne " + resourceManager.GetString("Move_StatusReasonCode_Estimated"));

            moveResponse = objCrmUtilities.ExecuteGetRequest(moveEntityName, retrieveFieldList, filterString.ToString());
            var validatedResponse = objCRMToDTOMapper.ValidateResponse <Move>(moveResponse);

            if (!string.IsNullOrEmpty(validatedResponse.Message) || !string.IsNullOrEmpty(validatedResponse.Information))
            {
                return(validatedResponse);
            }
            return(ReturnServiceResponse(moveResponse));
        }
Exemple #2
0
        /// Method Name     : ReturnServiceResponse
        /// Author          : Pratik Soni
        /// Creation Date   : 07 Feb 2018
        /// Purpose         : To return service response from CRM's dictionary response
        /// Revision        :
        /// </summary>
        private ServiceResponse <DTO.Payment> ReturnServiceResponse(Dictionary <string, string> crmResponse)
        {
            if (crmUtilities.ContainsNullValue(crmResponse))
            {
                logger.Info(resourceManager.GetString("CRM_STATUS_204"));
                return(new ServiceResponse <Payment> {
                    Message = resourceManager.GetString("CRM_STATUS_204")
                });
            }
            var validatedResponse = crmToDTOMapper.ValidateResponse <Payment>(crmResponse);

            if (validatedResponse.Message != null)
            {
                logger.Error(resourceManager.GetString("msgServiceUnavailable"));
                return(new ServiceResponse <Payment> {
                    Message = resourceManager.GetString("msgServiceUnavailable")
                });
            }
            else if (validatedResponse.Information != null)
            {
                logger.Error(resourceManager.GetString("CRM_STATUS_204"));
                return(new ServiceResponse <Payment> {
                    Information = resourceManager.GetString("CRM_STATUS_204")
                });
            }
            return(crmToDTOMapper.MapPaymentResponseToDTO(crmResponse));
        }
Exemple #3
0
        /// Method Name     : GetCustomerID
        /// Author          : Pratik Soni
        /// Creation Date   : 1 Dec 2017
        /// Purpose         : To get CustomerID from the given emailID
        /// Revision        :
        /// </summary>
        public DTO.ServiceResponse <DTO.Customer> GetCustomerIDAsync(string emailID)
        {
            StringBuilder retrieveFieldList = new StringBuilder();
            string        filterString;

            retrieveFieldList.Append(resourceManager.GetString("crm_contact_customerNumber"));
            retrieveFieldList.Append("," + resourceManager.GetString("crm_contact_customerFullName"));
            retrieveFieldList.Append("," + resourceManager.GetString("crm_contact_iscustomerregistered"));

            filterString = resourceManager.GetString("crm_contact_customerPrimaryEmail") + " eq '" + emailID + "'";

            logger.Info("Get CustomerID async Request encountered");
            var crmResponse       = crmUtilities.ExecuteGetRequest(contactEntityName, retrieveFieldList.ToString(), filterString);
            var validatedResponse = crmTODTOMapper.ValidateResponse <Customer>(crmResponse);

            if (!string.IsNullOrEmpty(validatedResponse.Message) || !string.IsNullOrEmpty(validatedResponse.Information))
            {
                return(validatedResponse);
            }
            return(ReturnServiceResponse(crmResponse));
        }
Exemple #4
0
        /// <summary>
        /// Method Name     : ValidateAndGenerateResponse
        /// Author          : Pratik Soni
        /// Creation Date   : 02 Feb 2018
        /// Purpose         : To validate and generate proper response based on details received from CRM
        /// Revision        :
        /// </summary>
        /// <param name="alertResponse"></param>
        private ServiceResponse <List <Alert> > ValidateAndGenerateResponse(Dictionary <string, string> alertResponse)
        {
            ServiceResponse <List <Alert> > validatedResponse;

            validatedResponse = crmTODTOMapper.ValidateResponse <List <DTO.Alert> >(alertResponse);

            if (validatedResponse.Message != null)
            {
                return(new ServiceResponse <List <Alert> > {
                    Message = resourceManager.GetString("msgServiceUnavailable")
                });
            }
            else if (validatedResponse.Information != null)
            {
                logger.Error(resourceManager.GetString("msgInvalidCustomer"));
                return(new ServiceResponse <List <Alert> > {
                    Information = resourceManager.GetString("msgInvalidCustomer")
                });
            }
            return(crmTODTOMapper.MapAlertResponseToDTO(alertResponse));
        }