Esempio n. 1
0
        /// <summary>
        /// Method Name     : GetDocumentList
        /// Author          : Ranjana Singh
        /// Creation Date   : 19 Dec 2017
        /// Purpose         : Gets the list of documents to be displayed in My Documents Page. If moveId is not provided, service will return common documents.
        /// Revision        :
        /// </summary>
        public ServiceResponse <List <Document> > GetDocumentList(string moveId)
        {
            Dictionary <string, string> documentListResponse;
            string        relativeURL;
            List <string> documentList;
            string        retrieveFiledString = "relativeurl,name";

            #warning Mocked move number (Remove it before publishing)
            moveId = "RM002970";
            string filterString = "contains(relativeurl,'" + moveId + "' " + ")";

            documentListResponse = objCrmUtilities.ExecuteGetRequest(documentEntityName, retrieveFiledString, filterString);
            if (objCrmUtilities.ContainsNullValue(documentListResponse))
            {
                logger.Info(resourceManager.GetString("msgNoDocumentFound"));
                return(new ServiceResponse <List <Document> > {
                    Message = resourceManager.GetString("msgNoDocumentFound")
                });
            }

            relativeURL = GetRelativeUrl(documentListResponse);
            if (!Validations.IsValid(relativeURL))
            {
                return(new ServiceResponse <List <Document> > {
                    Information = resourceManager.GetString("CRM_STATUS_204")
                });
            }

            documentList = GetSharepointDocument(relativeURL);
            return(GetDocumentListResponse(moveId, documentList, relativeURL));
        }
Esempio n. 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.Customer> ReturnServiceResponse(Dictionary <string, string> crmResponse)
        {
            if (crmUtilities.ContainsNullValue(crmResponse))
            {
                logger.Info(resourceManager.GetString("CRM_STATUS_204"));
                return(new ServiceResponse <Customer> {
                    Message = resourceManager.GetString("CRM_STATUS_204")
                });
            }
            var validatedResponse = crmTODTOMapper.ValidateResponse <Customer>(crmResponse);

            if (validatedResponse.Message != null)
            {
                logger.Error(resourceManager.GetString("msgServiceUnavailable"));
                return(new ServiceResponse <Customer> {
                    Message = resourceManager.GetString("msgServiceUnavailable")
                });
            }
            else if (validatedResponse.Information != null)
            {
                logger.Error(resourceManager.GetString("CRM_STATUS_204"));
                return(new ServiceResponse <Customer> {
                    Information = resourceManager.GetString("CRM_STATUS_204")
                });
            }
            return(crmTODTOMapper.MapCustomerResponseToDTO(crmResponse));
        }
Esempio n. 3
0
        /// <summary>
        /// Method Name     : GetEstimateList
        /// Author          : Pratik Soni
        /// Creation Date   : 11 Jan 2018
        /// Purpose         : Gets the list of estimate id for the Customer number.
        /// Revision        :
        /// </summary>
        /// <param name="customerId"></param>
        /// <returns></returns>
        public ServiceResponse <List <Estimate> > GetEstimateList(string customerId)
        {
            Dictionary <string, string> customerResponse, moveResponse;
            string        retrieveFieldList;
            StringBuilder filterString;

            filterString = new StringBuilder();

            customerResponse = objCrmUtilities.ExecuteGetRequest(contactEntityName, "contactid", "jkmoving_customernumber eq '" + customerId + "'");
            if (objCrmUtilities.ContainsNullValue(customerResponse))
            {
                logger.Info(resourceManager.GetString("msgUnregisteredCustomer"));
                return(new ServiceResponse <List <Estimate> > {
                    Message = resourceManager.GetString("msgUnregisteredCustomer")
                });
            }

            retrieveFieldList = "jkmoving_movenumber,_jkmoving_contactofmoveid_value,statecode";

            filterString.Append("_jkmoving_contactofmoveid_value eq " + General.GetSpecificAttributeFromCRMResponse(customerResponse, "contactid") + " and statecode eq 0");
            filterString.Append(" and statuscode eq " + " 676860000");

            moveResponse = objCrmUtilities.ExecuteGetRequest(moveEntityName, retrieveFieldList, filterString.ToString());
            return(objCRMToDTOMapper.MapEstimateIdResponseToDTO(moveResponse));
        }