private void QueryMain(HttpContext context) { IList <StoreDetail> list = new List <StoreDetail>(); var dt = DalStoreDetail.GetStoreDetail(); for (var i = 0; i < dt.Rows.Count; i++) { var storeItem = new StoreDetail(); storeItem.RowNumber = (i + 1).ToString(); storeItem.BarCode = dt.Rows[i]["cBarCode"].ToString(); storeItem.InvCode = dt.Rows[i]["cInvCode"].ToString(); storeItem.InvName = dt.Rows[i]["cInvName"].ToString(); storeItem.Qty = dt.Rows[i]["iQuantity"].ToString(); storeItem.FromId = dt.Rows[i]["cUser"].ToString(); storeItem.ScanTime = dt.Rows[i]["dScanTime"].ToString(); list.Add(storeItem); } context.Response.Write(list.ToJson()); context.Response.End(); }
private void QueryByDate(HttpContext context) { IList <StoreDetail> list = new List <StoreDetail>(); DateTime dStart, dEnd; var cStart = context.Request.Form["dStart"]; var cEnd = context.Request.Form["dEnd"]; if (!DateTime.TryParse(cStart, out dStart)) { return; } if (!DateTime.TryParse(cEnd, out dEnd)) { return; } var dt = DalStoreDetail.GetStoreDetailByDate(dStart, dEnd); for (var i = 0; i < dt.Rows.Count; i++) { var storeItem = new StoreDetail(); storeItem.RowNumber = (i + 1).ToString(); storeItem.BarCode = dt.Rows[i]["cBarCode"].ToString(); storeItem.InvCode = dt.Rows[i]["cInvCode"].ToString(); storeItem.InvName = dt.Rows[i]["cInvName"].ToString(); storeItem.Qty = dt.Rows[i]["iQuantity"].ToString(); storeItem.FromId = dt.Rows[i]["cUser"].ToString(); storeItem.ScanTime = dt.Rows[i]["dScanTime"].ToString(); list.Add(storeItem); } context.Response.Write(list.ToJson()); context.Response.End(); }