Exemplo n.º 1
0
        private List <HashMap> GetBillList(JsonSerializer serializer, string str, DateTime date, string user)
        {
            string[] keys  = { "mainOrders" };
            HashMap  hash  = (HashMap)serializer.DeserializeObject(str);
            HashMap  vhash = hash.GetHashValue(keys)[0];

            List <object> list = new List <object>();

            list.AddRange(vhash["mainOrders"] as object[]);

            List <HashMap> rtlist = new List <HashMap>();

            foreach (HashMap row in list)
            {
                var     id      = row["id"].ToString();
                string  content = serializer.Serialize(row);
                string  status  = ((HashMap)row["statusInfo"])["text"].ToString();
                HashMap rtData  = new HashMap();
                rtData.Add("bid", id);
                rtData.Add("content", serializer.Serialize(row));
                rtData.Add("cdate", date);
                rtData.Add("status", status);
                rtData.Add("user", user);
                rtlist.Add(rtData);
            }

            return(rtlist);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 列表数据转换
        /// </summary>
        /// <param name="rdata">网络数据</param>
        public static SearchOrderInfo ListDataTransformation(string rdata)
        {
            SearchOrderInfo info = new SearchOrderInfo();

            if (string.IsNullOrEmpty(rdata))
            {
                info.ErrorMsg = "网络数据为空";
                return(info);
            }
            JsonSerializer serializer = JsonSerializer.CreateInstance();
            HashMap        hash       = null;

            try
            {
                hash = (HashMap)serializer.DeserializeObject(rdata);
            }
            catch (Exception e)
            {
                info.ErrorMsg = string.Format("网络数据转换错误,ErrorMessage:{0}, data:{1}", e.Message, rdata);
                return(info);
            }
            string[] keys = { "mainOrders/buyer/nick",
                              "mainOrders/orderInfo/createTime",
                              "mainOrders/orderInfo/id",
                              "mainOrders/payInfo/actualFee",
                              "mainOrders/payInfo/icons",
                              "mainOrders/statusInfo/text",
                              "mainOrders/statusInfo/operations",
                              "mainOrders/subOrders/itemInfo/skuText",
                              "mainOrders/subOrders/itemInfo/title",
                              "mainOrders/subOrders/quantity",
                              "page/currentPage",
                              "page/totalNumber",
                              "page/totalPage" };

            HashMap vhash = hash.GetHashValue(keys)[0];

            info.MainOrders  = (IList <object>)vhash["mainOrders"];
            info.CurrentPage = hash.GetHashValue(keys)[1].Get <int>("currentPage");
            info.TotalNumber = hash.GetHashValue(keys)[2].Get <int>("totalNumber");
            info.TotalPage   = hash.GetHashValue(keys)[3].Get <int>("totalPage");
            return(info);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 明细数据获取
        /// </summary>
        /// <param name="rdata">明细数据</param>
        public static object DetailDataTransformation(string rdata)
        {
            JsonSerializer serializer = JsonSerializer.CreateInstance();
            string         tempJson   = GetDetailDataFromHtml(rdata);
            HashMap        data       = (HashMap)serializer.DeserializeObject(tempJson);

            string[] keys = { "tabs/content/alingPhone",
                              "tabs/content/logisticsName",
                              "tabs/content/address",
                              "tabs/content/logisticsNum" };

            return(data.GetHashValue(keys));
        }