コード例 #1
0
ファイル: BillManage.cs プロジェクト: ljbbean/project
        public List <T> GetBillList <T>(DateTime startDate, string cookieStr)
        {
            JsonSerializer serializer  = JsonSerializer.CreateInstance();
            string         dateTimeStr = serializer.Serialize(startDate).Substring(9).TrimEnd(')');
            string         data        = "auctionType=0&close=0&pageNum={0}&pageSize={1}&queryMore=true&rxAuditFlag=0&rxHasSendFlag=0&rxOldFlag=0&rxSendFlag=0&rxSuccessflag=0&tradeTag=0&useCheckcode=false&useOrderInfo=false&errorCheckcode=false&action=itemlist%2FSoldQueryAction&dateBegin=";

            data += dateTimeStr + "&prePageNo={2}&buyerNick=&dateEnd=0&logisticsService=&orderStatus=&queryOrder=desc&rateStatus=&refund=&sellerNick=&tabCode=latest3Months";
            //string data = "auctionType=0&close=0&pageNum={0}&pageSize={1}&queryMore=false&rxAuditFlag=0&rxHasSendFlag=0&rxOldFlag=0&rxSendFlag=0&rxSuccessflag=0&tradeTag=0&useCheckcode=false&useOrderInfo=false&errorCheckcode=false&action=itemlist%2FSoldQueryAction&prePageNo={2}&buyerNick=&dateBegin=0&dateEnd=0&logisticsService=&orderStatus=&queryOrder=desc&rateStatus=&refund=&sellerNick=&tabCode=latest3Months";
            int             startIndex = 1;
            int             pageSize   = 15;
            string          sdata      = GetBillList(cookieStr, data, startIndex, pageSize);
            SearchOrderInfo rdata      = NetDataHandler.ListDataTransformation(sdata);

            List <T> list     = new List <T>();
            T        tempData = GetData <T>(sdata);

            list.Add(tempData);

            double max = Math.Ceiling((double)rdata.TotalNumber / pageSize);

            for (int i = startIndex + 1; i <= max; i++)
            {
                T temp = GetData <T>(GetBillList(cookieStr, data, i, pageSize).ToString());
                list.Add(temp);
            }
            return(list);
        }
コード例 #2
0
ファイル: BillManage.cs プロジェクト: ljbbean/project
        private T GetData <T>(string data)
        {
            Type t = typeof(T);

            if (t == typeof(string))
            {
                object obj = data;
                return((T)obj);
            }
            if (t == typeof(SearchOrderInfo))
            {
                object obj = NetDataHandler.ListDataTransformation(data);
                return((T)obj);
            }
            throw new Exception(string.Format("暂不支持这种类型{0}", t));
        }