Example #1
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));
        }
Example #2
0
        /// Method Name     : GetDeviceID
        /// Author          : Pratik Soni
        /// Creation Date   : 07 Feb 2018
        /// Purpose         : To Get device ID from CRM - for nodus payfabric
        /// Revision        :
        /// </summary>
        /// <returns> ServiceResponse with Paymeny DTO having only DeviceID value. </returns>
        public ServiceResponse <DTO.Payment> GetDeviceID()
        {
            string retriveField = resourceManager.GetString("crm_nodus_payfabricsecuritycode_deviceID");
            string filterString = "statecode eq 0";
            Dictionary <string, string> crmResponse = crmUtilities.ExecuteGetRequest(nodusPayFabricEntityNamePlural, retriveField, filterString);

            return(ReturnServiceResponse(crmResponse));
        }
Example #3
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));
        }
Example #4
0
        /// <summary>
        /// Method Name     : GetAlertList
        /// Author          : Vivek Bhavsar
        /// Creation Date   : 29 Dec 2017
        /// Purpose         : Method to get list of alerts from database
        /// Revision        :
        /// </summary>
        /// <param name="customerID"></param>
        /// <param name="startDate"></param>
        /// <returns>List of Alert DTO</returns>
        public ServiceResponse <List <DTO.Alert> > GetAlertList(string customerID, string startDate = null)
        {
            string        retriveFieldList, customerGUID;
            StringBuilder filterString = new StringBuilder();
            Dictionary <string, string> customerResponse, alertResponse;

            try
            {
                //Get customer GUID
                customerResponse = crmCustomerDetails.GetCustomerGUID(customerID);
                customerGUID     = crmUtilities.GetSpecificAttributeFromResponse(customerResponse, resourceManager.GetString("crm_contact_customerId"));

                retriveFieldList = resourceManager.GetString("activityGetAlertListFields");
                filterString.Append(resourceManager.GetString("crm_activity_regardingobjectidvalue") + " eq " + customerGUID);
                if (Validations.IsValid(startDate))
                {
                    DateTime.TryParse(startDate, new CultureInfo("en-US"), DateTimeStyles.None, out DateTime returnValue);
                    filterString.Append(" and " + resourceManager.GetString("crm_activity_actualstart") + " ge " + returnValue.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fff'Z'"));
                }

                alertResponse = crmUtilities.ExecuteGetRequest(activityEntityName, retriveFieldList, filterString.ToString());
                return(ValidateAndGenerateResponse(alertResponse));
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message.ToString());
                return(new ServiceResponse <List <DTO.Alert> > {
                    Message = resourceManager.GetString("msgServiceUnavailable")
                });
            }
        }
Example #5
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));
        }
Example #6
0
        /// Method Name     : GetCustomerGUID
        /// Author          : Pratik Soni
        /// Creation Date   : 15 Dec 2017
        /// Purpose         : To get Customer GUID from the CRM for given customerID
        /// Revision        :
        /// </summary>
        public Dictionary <string, string> GetCustomerGUID(string customerID)
        {
            string retrieveFieldList;
            string filterString;

            retrieveFieldList = resourceManager.GetString("crm_contact_customerId");
            filterString      = resourceManager.GetString("crm_contact_customerNumber") + " eq '" + customerID + "'";

            logger.Info("Get Request encountered");
            return(crmUtilities.ExecuteGetRequest(contactEntityName, retrieveFieldList, filterString));
        }