Esempio n. 1
0
        static public string ExportConbinationInflow(int storeID, string keyWords, out string msg, out decimal money)
        {
            money = 0m;
            JObject keys = (JObject)JsonConvert.DeserializeObject(keyWords);
            List <Dictionary <string, string> > list = StockDAL.CombinationQuery(keys, storeID, out msg);

            if (list == null || list.Count == 0)
            {
                msg = "没有需要导出的记录";
                return(null);
            }
            for (int i = 0; i < list.Count; i++)
            {
                if (list[i]["quantity"].Equals("0"))
                {
                    list.Remove(list[i]);
                    i = 0;
                }
            }
            if (list.Count == 0)
            {
                msg = "没有需要导出的记录";
                return(null);
            }
            msg = null;
            foreach (Dictionary <string, string> dictionary in list)
            {
                money += decimal.Parse(dictionary["money"]);
            }
            return(JsonConvert.SerializeObject(list));
        }
Esempio n. 2
0
        static public string CombinationQuery(int storeID, string keyWords, out string msg, ref int totalPage, ref int currentPage, out decimal money)
        {
            money = 0m;
            JObject keys = (JObject)JsonConvert.DeserializeObject(keyWords);
            List <Dictionary <string, string> > list = StockDAL.CombinationQuery(keys, storeID, out msg);

            if (list == null || list.Count == 0)
            {
                msg         = "搜索结果为空";
                totalPage   = 0;
                currentPage = -1;
                return(null);
            }
            for (int i = 0; i < list.Count; i++)
            {
                if (list[i]["quantity"].Equals("0"))
                {
                    list.Remove(list[i]);
                    i = 0;
                }
            }
            if (list.Count == 0)
            {
                totalPage   = 0;
                currentPage = -1;
                msg         = "未查询到库存记录";
                return(null);
            }
            foreach (Dictionary <string, string> dictionary in list)
            {
                money += decimal.Parse(dictionary["money"]);
            }
            totalPage = (int)System.Math.Floor((decimal)(list.Count / 10));
            if (list.Count != 0 && list.Count % 10 == 0)
            {
                --totalPage;
            }
            if (currentPage < totalPage)
            {
                ++currentPage;
            }
            try
            {
                return(JsonConvert.SerializeObject(list.GetRange(currentPage * 10, 10)));
            }
            catch
            {
                return(JsonConvert.SerializeObject(list.GetRange(currentPage * 10, list.Count - currentPage * 10)));
            }
        }