public void FindStandByOutWH() { DataSet ds = _bal.FindStandByOutWH(); if (ds != null && ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { if (ds.Tables[0].Rows[i]["STATUS"] != null && ds.Tables[0].Rows[i]["STATUS"].ToString() == "0") { ds.Tables[0].Rows[i]["STATUS"] = "创建"; } else if (ds.Tables[0].Rows[i]["STATUS"] != null && ds.Tables[0].Rows[i]["STATUS"].ToString() == "1") { ds.Tables[0].Rows[i]["STATUS"] = "运行"; } else if (ds.Tables[0].Rows[i]["STATUS"] != null && ds.Tables[0].Rows[i]["STATUS"].ToString() == "2") { ds.Tables[0].Rows[i]["STATUS"] = "暂停"; } else if (ds.Tables[0].Rows[i]["STATUS"] != null && ds.Tables[0].Rows[i]["STATUS"].ToString() == "3") { ds.Tables[0].Rows[i]["STATUS"] = "关闭"; } } } Dictionary <String, Object> map = new Dictionary <String, Object>(); map.Add("total", ds.Tables.Count); map.Add("rows", ds.Tables[0]); Context.Response.Write(JsonConvert.SerializeObject(map)); //StringBuilder sb = new StringBuilder(); //sb.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); //sb.Append("<rows>"); //if (ds != null && ds.Tables.Count > 0 && ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) //{ // for (int i = 0; i < ds.Tables[0].Rows.Count; i++) // { // sb.Append(string.Format("<row id='{0}'>", ds.Tables[0].Rows[i]["ORDER_NO"] + "," + ds.Tables[0].Rows[i]["PARTSDRAWING_CODE"])); // sb.Append(string.Format("<cell>{0}</cell>", ds.Tables[0].Rows[i]["ORDER_NO"])); // sb.Append(string.Format("<cell>{0}</cell>", ds.Tables[0].Rows[i]["WO"])); // sb.Append(string.Format("<cell>{0}</cell>", ds.Tables[0].Rows[i]["PARTSDRAWING_CODE"])); // sb.Append(string.Format("<cell>{0}</cell>", ds.Tables[0].Rows[i]["STATUS"])); // sb.Append(string.Format("<cell>{0}</cell>", ds.Tables[0].Rows[i]["PRODUCT_NAME"])); // sb.Append(string.Format("<cell>{0}</cell>", ds.Tables[0].Rows[i]["CREATED_DATE"])); // sb.Append(string.Format("<cell>{0}</cell>", ds.Tables[0].Rows[i]["UPDATED_DATE"])); // sb.Append(string.Format("<cell>{0}</cell>", ds.Tables[0].Rows[i]["BATCH_NUMBER"])); // sb.Append(string.Format("<cell>{0}</cell>", ds.Tables[0].Rows[i]["ORDER_QUANTITY"])); // sb.Append(string.Format("<cell>{0}</cell>", ds.Tables[0].Rows[i]["CHECK_TIME"])); // sb.Append(string.Format("<cell>{0}</cell>", ds.Tables[0].Rows[i]["IN_TIME"])); // //sb.Append(string.Format("<cell>View^javascript:MySite.Runner.showDetail({0})^_self</cell>", log.ID)); // sb.Append("</row>"); // } //} //sb.Append("</rows>"); //return sb.ToString(); }
public void QueryData() { int pageIndex = 0; int pageSize = 0; string where = ""; string orderField = null; string order = null; int totalRecord = 0; int TotalPage = 0; string orderStr = string.IsNullOrWhiteSpace(orderField) ? "d_id asc" : string.Format("{0} {1}", orderField, order); UserInfo ui = new UserInfo(); ui.SiteCode = "Mes"; ui.BUCode = "LF"; WareHouseBO wbo = new WareHouseBO(ui); DataSet ds = wbo.FindStandByOutWH();// MSCL.PagingHelper.QueryPagingMssql("TestTable", "*", orderStr, pageIndex, pageSize, where, out totalRecord, out TotalPage); DataTable dt = ds.Tables[0]; PageData data = new PageData(); data.total = totalRecord; List <JObject> list = new List <JObject>(); foreach (DataRow item in dt.Rows) { JObject obj = new JObject(); obj.Add("d_id", item["ORDER_NO"].ToString()); obj.Add("d_name", item["WO"].ToString()); obj.Add("d_password", item["PARTSDRAWING_CODE"].ToString()); obj.Add("d_else", item["STATUS"].ToString()); obj.Add("d_amount", item["PRODUCT_NAME"].ToString()); list.Add(obj); } data.rows = list; Context.Response.Write(JsonConvert.SerializeObject(data)); //return JsonConvert.SerializeObject(data); }