static public string queryAllOutflow(int storeID, ref int outflowTotalPage, ref int outflowCurrentPage, out string msg, out decimal money) { money = 0m; List <Dictionary <string, string> > list = OutflowDAL.QueryAllByStoreID(storeID, out msg); if (list == null) { outflowTotalPage = 0; outflowCurrentPage = -1; return(null); } msg = null; foreach (Dictionary <string, string> d in list) { money += decimal.Parse(d["price"]) * decimal.Parse(d["quantity"]); } outflowTotalPage = (int)System.Math.Floor((decimal)(list.Count / 10)); if (list.Count != 0 && list.Count % 10 == 0) { --outflowTotalPage; } if (outflowCurrentPage < outflowTotalPage) { ++outflowCurrentPage; } try { return(JsonConvert.SerializeObject(list.GetRange(outflowCurrentPage * 10, 10))); } catch { return(JsonConvert.SerializeObject(list.GetRange(outflowCurrentPage * 10, list.Count - outflowCurrentPage * 10))); } }
static public string ExportOutflow(int storeID, out string msg, out decimal money) { money = 0m; List <Dictionary <string, string> > list = OutflowDAL.QueryAllByStoreID(storeID, out msg); if (list == null) { msg = "没有需要导出的记录"; return(null); } msg = null; foreach (Dictionary <string, string> d in list) { money += decimal.Parse(d["price"]) * decimal.Parse(d["quantity"]); } return(JsonConvert.SerializeObject(list)); }