private async static Task <StandardResponse> GetResponse(GoodsRequest goodsRequest) { await LongTaskSim.WaitFive(); var resp = new StandardResponse() { process_message = "Success" }; if (goodsRequest.op_type == "create") { resp.status = "inserted"; resp.reference = Guid.NewGuid().ToString().ToString().Replace("-", ""); } else if (goodsRequest.op_type == "update" || goodsRequest.op_type == "submit") { resp.status = "updated"; resp.reference = goodsRequest.goods_ref_number; } else if (goodsRequest.op_type == "delete") { resp.status = "deleted"; resp.reference = goodsRequest.goods_ref_number; } return(resp); }
public async Task <IActionResult> GoodsDeclaration(GoodsRequest goodsRequest) { if (goodsRequest == null) { return(BadRequest()); } return(Ok(await GetResponse(goodsRequest))); }
private void BindDgv() { GoodsRequest request = new GoodsRequest(); request.PageIndex = paginator.PageNo; request.PageSize = paginator.PageSize; //request.skuCode= "%"+tbName.Text.Trim()+"%"; if (!string.IsNullOrWhiteSpace(tbName.Text.Trim())) { request.goodsName = "%" + tbName.Text.Trim() + "%"; } request.partnerCode = UserInfo.PartnerCode; request.isPreprocess = 1; GoodsResponse response = client.Execute(request); if (!response.IsError) { if (response.result == null) { this.dataGridView1.DataSource = null; } else { int recordCount = response.pageUtil.totalRow; int totalPage; if (recordCount % paginator.PageSize == 0) { totalPage = recordCount / paginator.PageSize; } else { totalPage = recordCount / paginator.PageSize + 1; } IPagedList <Goods> pageList = new PagedList <Goods>(response.result, recordCount, totalPage); sortList = new SortableBindingList <Goods>(pageList.ContentList); goodsList = response.result; this.dataGridView1.DataSource = sortList; pageSplit1.Description = "共查询到" + pageList.RecordCount + "条记录"; pageSplit1.PageCount = pageList.PageCount; pageSplit1.PageNo = paginator.PageNo; pageSplit1.DataBind(); } } }