public void queryOrderRecords(object temp) { OrderRecordsReq req = (OrderRecordsReq)temp; string resp = BgWork.HttpPost(Host + QueryOrderRecordsURL, String.Format("begin_time={0}&end_time={1}&page=1&page_row=10", this.dateTimePicker1.Text, this.dateTimePicker2.Text)); JavaScriptObject jsonObj = JavaScriptConvert.DeserializeObject <JavaScriptObject>(resp); if (jsonObj.ContainsKey("code") && (Int64)jsonObj["code"] == 0 && jsonObj.ContainsKey("datas")) { JavaScriptArray jList = (JavaScriptArray)jsonObj["datas"]; if (jList.Count == 0) { MessageBox.Show("没有记录!"); return; } List <OrderRecord> orderRecords = new List <OrderRecord>(); for (int i = 0; i < jList.Count; i++) { JavaScriptObject item = (JavaScriptObject)jList[i]; OrderRecord tt = new OrderRecord { order_id = (string)item["order_id"], createtime = (string)item["createtime"], total = (string)item["total"], total_fact = (string)item["total_fact"], status = (string)item["status"], remark = (string)item["remark"], create_user_id = (string)item["create_user_id"] }; orderRecords.Add(tt); } req.form.BeginInvoke(new UpdateInvoke(updateSoldRecords), orderRecords); } else { MessageBox.Show("错误!", "查询失败!"); } }
private void querySoldRecords(object sender, EventArgs e) { Thread thread = new Thread(queryOrderRecords); OrderRecordsReq req = new OrderRecordsReq(); req.form = this; req.beginTime = this.dateTimePicker1.Text; req.endTime = this.dateTimePicker2.Text; thread.Start(req); }