public static GetProductListResponse Unmarshall(UnmarshallerContext context) { GetProductListResponse getProductListResponse = new GetProductListResponse(); getProductListResponse.HttpResponse = context.HttpResponse; getProductListResponse.RequestId = context.StringValue("GetProductList.RequestId"); getProductListResponse.Message = context.StringValue("GetProductList.Message"); getProductListResponse.Code = context.StringValue("GetProductList.Code"); getProductListResponse.Data = context.StringValue("GetProductList.Data"); return(getProductListResponse); }
public async override Task <GetProductListResponse> GetProductList(GetProductListRequest request, ServerCallContext context) { var result = (await _mediator.Send(new GetAllRequest())).ToList(); var listProduct = await GetProductResponses(result).ToListAsync(); var response = new GetProductListResponse { StatusCode = 0, Message = string.Empty, ResponseData = new GetProductListResponse.Types.ResponseData { ListProduct = { listProduct } } }; return(response); }
public void UrunlistesiniGetir() { //Authentication authentication = new Authentication(); authentication.appKey = strAppKey; authentication.appSecret = strAppSecret; RequestPagingData requestPagingData = new RequestPagingData(); requestPagingData.currentPage = currentPageValue; requestPagingData.pageSize = pageSizeValue; GetProductListRequest getProductListRequest = new GetProductListRequest(); getProductListRequest.auth = authentication; getProductListRequest.pagingData = requestPagingData; n11ProductService.ProductServicePortService port = new n11ProductService.ProductServicePortService(); GetProductListResponse response = port.GetProductList(getProductListRequest); if (productList == null) { this.productList = response.products.ToList(); } else { productList.AddRange(response.products); } //productList[0].stockItems.stockItem. if (response.pagingData.currentPage != response.pagingData.pageCount - 1) //son sayfaya kadar gidiyoruz { currentPageValue = (int)response.pagingData.currentPage + 1; UrunlistesiniGetir(); } //return productList; }
/// <summary> /// Get all profiles related to product /// </summary> /// <returns></returns> public ActionResponse GetProductsAction() { try { // Find Records var products = productsRepository.GetProducts(); if (products.Count <= 0) { return(utilities.Response((int)CodeStatusEnum.NO_CONTENT, "No se han encontrado registros", null)); } List <Product> lst = new List <Product>(); foreach (var product in products) { Product p = new Product { idProduct = product.IdProduct, description = product.Description, token = product.Token, tagName = product.TagName }; lst.Add(p); } GetProductListResponse response = new GetProductListResponse(); response.totalItems = lst.Count; response.items = lst; return(utilities.Response((int)CodeStatusEnum.OK, "OK", response)); } catch (Exception e) { return(utilities.Response((int)CodeStatusEnum.INTERNAL_ERROR, "Error desconocido en el sistema: " + e.Message, null)); } }
public ProductBasic[] GetProductList() { com.n11Product.api.Authentication authentication = new com.n11Product.api.Authentication { appKey = apiKey, appSecret = apiSecret }; com.n11Product.api.RequestPagingData requestPagingData = new com.n11Product.api.RequestPagingData(); requestPagingData.currentPage = 0; requestPagingData.pageSize = 10; GetProductListRequest getProductListRequest = new GetProductListRequest(); getProductListRequest.auth = authentication; getProductListRequest.pagingData = requestPagingData; ProductServicePortService port = new ProductServicePortService(); GetProductListResponse getProductListResponse = port.GetProductList(getProductListRequest); ProductBasic[] productBasics = getProductListResponse.products; return(productBasics); }
private static ProductBasic[] getProds() { apiAnahtari1 = "dbd6f8d0-52c1-4675-ab4d-3efc2badb56c"; apiSifresi1 = "iDg6PakWEtkcLrea"; var authentication1 = new n11Api.com.n11.api.Authentication(); authentication1.appKey = apiAnahtari1; //api anahtarınız authentication1.appSecret = apiSifresi1; //api şifeniz GetProductListRequest ProductListRequest = new GetProductListRequest(); ProductListRequest.auth = authentication1; ProductServicePortService port = new ProductServicePortService(); GetProductListResponse response = port.GetProductList(ProductListRequest); var products = response.products; return(products); }
public NegotiatedContentResult <GetProductListResponse> PostGetProductList([FromBody] GetProductListRequest request) { GetProductListResponse resp = _productServices.GetProductList(request); return(Content(HttpStatusCode.OK, resp)); }
public static void CopyFromEntity(GetProductListResponse dto, Reminder reminder) { dto.reminder_description = reminder == null ? string.Empty : reminder.Description; dto.reminder_id = reminder == null ? 0 : reminder.RmdrID; dto.reminder_image = reminder == null ? string.Empty : ImagePathService.reminderImagePath + reminder.ReminderImage; }
public GetProductListResponse GetProductList(GetProductListRequest request) { GetProductListResponse response = new GetProductListResponse(); try { if (request.is_admin) { if (!AgentAdminServices.CheckAdmin(request.user_id, request.auth_token, response)) { //_userServices.MakeNouserResponse(response); return(response); } } else { if (!_userServices.CheckAuthUser(request.user_id, request.auth_token)) { _userServices.MakeNouserResponse(response); return(response); } } using (ProductDao dao = new ProductDao()) { List <Product> pList = dao.GetProducts(request.page_number, request.row_per_page); int totalCount = dao.GetTotalCount(); response.product_details = new ProductPagenationDetailsDto(); response.product_details.total_num_products = totalCount; ProductDto[] prodDtos = new ProductDto[pList.Count()]; for (int i = 0; i < pList.Count; i++) { ProductDto dto = new ProductDto(); ProductHelper.CopyFromEntity(dto, pList[i]); prodDtos[i] = dto; response.products = prodDtos; //response.has_exchange = (pList[i].ProductExchanges.Count > 0 ? 1 : 0); //if (response.has_exchange == 1) //{ // if (response.exchange == null) // response.exchange = new List<ExchangeDto>(); // foreach (var item in pList[i].ProductExchanges.ToList()) // { // ExchangeDto exDto = new ExchangeDto(); // ProductHelper.CopyFromEntity(exDto, item); // response.exchange.Add(exDto); // } //} } var reminder = dao.GetRemindersForProducts(); response.has_reminder = (reminder == null ? 0 : 1); ProductHelper.CopyFromEntity(response, reminder); response.has_resource = 1; response.code = 0; response.message = MessagesSource.GetMessage("has.products"); } } catch (Exception ex) { response.MakeExceptionResponse(ex); } return(response); }
public Task <GetProductListResponse> GetListAsync(GetProductList dto) { return(Task.Run(() => { string sqlWhere = ""; switch (dto.type) { case Community.Contact.Enum.HotEnum.All: break; case Community.Contact.Enum.HotEnum.Hot: sqlWhere += string.Format(SELECT_PRODUCT_WHERE_HOT, 1); break; case Community.Contact.Enum.HotEnum.UnHot: sqlWhere += string.Format(SELECT_PRODUCT_WHERE_HOT, 0); break; default: break; } switch (dto.off_line) { case Community.Contact.Enum.OffLineEnum.All: break; case Community.Contact.Enum.OffLineEnum.OffLine: if (sqlWhere.Length < 1) { sqlWhere += string.Format(SELECT_PRODUCT_WHERE_OFFLINE, 1); } else { sqlWhere += " and "; sqlWhere += string.Format(SELECT_PRODUCT_WHERE_OFFLINE, 1); } break; case Community.Contact.Enum.OffLineEnum.UnOffLine: if (sqlWhere.Length < 1) { sqlWhere += string.Format(SELECT_PRODUCT_WHERE_OFFLINE, 0); } else { sqlWhere += " and "; sqlWhere += string.Format(SELECT_PRODUCT_WHERE_OFFLINE, 0); } break; default: break; } if (sqlWhere.Length > 1) { sqlWhere = " where " + sqlWhere; } if (!string.IsNullOrEmpty(dto.q)) { sqlWhere = sqlWhere + " and " + string.Format(SELECT_PRODUCT_WHERE_USER, dto.q); } List <SearchProductInfoModel> data = new List <SearchProductInfoModel>(); int count = 0; string sqlData = ""; string sqlCount = ""; if (string.IsNullOrEmpty(dto.category_id)) { sqlData = string.Format(SELECT_PRODUCT_FROM, SELECT_PRODUCT_SELECT, sqlWhere, string.Format("LIMIT {0},{1}", dto.start, dto.length)); sqlCount = string.Format(SELECT_PRODUCT_FROM, SELECT_PRODUCT_COUNT, sqlWhere, ""); } else { string[] typeidList = dto.category_id.Split(','); var builder = new StringBuilder(); for (int i = 0; i < typeidList.Length; i++) { builder.Append("category_id= " + typeidList[i]); if (i != typeidList.Length - 1) { builder.Append("||"); } } if (sqlWhere.Length > 0) { sqlWhere = sqlWhere + " and " + string.Format(SELECT_PRODUCT_WHERE_CAT, builder.ToString(), typeidList.Count() - 1); } else { sqlWhere = " where " + string.Format(SELECT_PRODUCT_WHERE_CAT, builder.ToString(), typeidList.Count() - 1); } sqlData = string.Format(SELECT_PRODUCT_FROM, SELECT_PRODUCT_SELECT, sqlWhere, string.Format("LIMIT {0},{1}", dto.start, dto.length)); sqlCount = string.Format(SELECT_PRODUCT_FROM, SELECT_PRODUCT_COUNT, sqlWhere, ""); } data = _dapperRepository.Query <SearchProductInfoModel>(sqlData).ToList(); if (data != null && data.Count() > 0) { count = _dapperRepository.QuerySingleOrDefault <int>(sqlCount); } GetProductListResponse resp = new GetProductListResponse(); resp.data = Mapper.Map <List <ProductInfo> >(data); resp.total = count; return resp; })); }