/// <summary>
        /// Gets the lead By Vendor.
        /// </summary>
        /// <param name="leadsByVendorParameters">The lead By Vendor parameters.</param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public async Task <APIResponse> GetLeadsByVendor(LeadsByVendorParameters leadsByVendorParameters)
        {
            try
            {
                var client = httpClientFactory.CreateClient(LeadServiceOperation.serviceName);

                UriBuilder url = new UriBuilder(servicesConfig.Lead + LeadServiceOperation.GetLeadsByVendor());

                url.Query = QueryStringHelper.ConvertToQueryString(leadsByVendorParameters);

                var response = await client.GetAsync(url.ToString());

                if (response.IsSuccessStatusCode)
                {
                    var leads = JsonConvert.DeserializeObject <List <LeadAssignDetailResponse> >(await response.Content.ReadAsStringAsync());

                    return(new APIResponse(leads, HttpStatusCode.OK));
                }

                return(new APIResponse(response.StatusCode));
            }
            catch (Exception ex)
            {
                logger.Error(ex, "Exception in method 'GetLeadsByVendor()'");
                var exMessage = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
                return(new APIResponse(exMessage, HttpStatusCode.InternalServerError));
            }
        }
Exemple #2
0
        public async Task <IActionResult> GetLeadsByVendor([FromQuery] LeadsByVendorParameters leadsByVendorParameters)
        {
            var getLeadByVendorQuery = new GetLeadsByVendorQuery(leadsByVendorParameters);

            var result = await mediator.Send(getLeadByVendorQuery);

            return(StatusCode((int)result.Code, result.Value));
        }
Exemple #3
0
        /// <summary>
        /// Gets the lead by Vendor.
        /// </summary>
        /// <param name="leadsByVendorParameters">The lead By Vendor Parameters.</param>
        /// <returns></returns>
        public async Task <List <Leads> > GetLeadsByVendor(LeadsByVendorParameters leadsByVendorParameters)
        {
            var getLeadsParams = new object[] {
                new MySqlParameter("@p_VendorId", leadsByVendorParameters.VendorId),
                new MySqlParameter("@p_IsForAssignedLead", leadsByVendorParameters.IsForAssignedLead),
                new MySqlParameter("@p_IsForQuotedLead", leadsByVendorParameters.IsForQuotedLead)
            };

            return(await FindAll("CALL SpSelectActiveLeadsByVendor(@p_VendorId, @p_IsForAssignedLead, @p_IsForQuotedLead)", getLeadsParams).ToListAsync());
        }
Exemple #4
0
        /// <summary>
        /// Gets the leads by vendor.
        /// </summary>
        /// <param name="leadsByVendorParameters">The leads by vendor parameters.</param>
        /// <returns></returns>
        public async Task <List <LeadAssignDetailResponse> > GetLeadsByVendor(LeadsByVendorParameters leadsByVendorParameters)
        {
            var leaddetails = await FindByCondition(leadassign => leadassign.VendorId.Equals(leadsByVendorParameters.VendorId) &&
                                                    leadassign.Active == Convert.ToInt16(true))
                              .Include(x => x.Lead)
                              .ProjectTo <LeadAssignDetailResponse>(mapper.ConfigurationProvider)
                              .ToListAsync();

            return(leaddetails);
        }
        public async Task <IActionResult> GetLeadsByVendor([FromQuery] LeadsByVendorParameters leadsByVendorParameters)
        {
            var result = await leadService.GetLeadsByVendor(leadsByVendorParameters);

            return(StatusCode((int)result.Code, result.Value));
        }