public IList <Vgoodssourceinformation> DescendOrderPaginationFindByUsername(VgoodssourceinformationPagination obj)
        {
            String stmtId = "VgoodssourceinformationPagination.DescendOrderFindByUsername";
            IList <Vgoodssourceinformation> result = this.sqlMapper.QueryForList <Vgoodssourceinformation>(stmtId, obj);

            return(result);
        }
        public IList <Vgoodssourceinformation> PaginationFindByNeedtrunkvolume(VgoodssourceinformationPagination obj)
        {
            String stmtId = "VgoodssourceinformationPagination.FindByNeedtrunkvolume";
            IList <Vgoodssourceinformation> result = this.sqlMapper.QueryForList <Vgoodssourceinformation>(stmtId, obj);

            return(result);
        }
        public IList <Vgoodssourceinformation> PaginationFindByTitlecolor(VgoodssourceinformationPagination obj)
        {
            String stmtId = "VgoodssourceinformationPagination.FindByTitlecolor";
            IList <Vgoodssourceinformation> result = this.sqlMapper.QueryForList <Vgoodssourceinformation>(stmtId, obj);

            return(result);
        }
        public int DynamicCount(VgoodssourceinformationPagination obj)
        {
            String stmtId = "Vgoodssourceinformation.DynamicCount";
            int    result = this.sqlMapper.QueryForObject <int>(stmtId, obj);

            return(result);
        }
        public IList <Vgoodssourceinformation> DynamicQuery(VgoodssourceinformationPagination obj)
        {
            String stmtId = "Vgoodssourceinformation.DynamicQuery";
            IList <Vgoodssourceinformation> result = this.sqlMapper.QueryForList <Vgoodssourceinformation>(stmtId, obj);

            return(result);
        }
        public string generateTableHtml(string pageNumber, string pageSize, string bitParams)
        {
            VgoodssourceinformationPagination goodsInfoPoco = this.bitMapParser(bitParams);

            goodsInfoPoco.Limit  = int.Parse(pageSize);
            goodsInfoPoco.Offset = (int.Parse(pageNumber) - 1) * goodsInfoPoco.Limit;
            logger.Info("Got offset:" + goodsInfoPoco.Offset.ToString());
            IList <Vgoodssourceinformation> goodsInfoPocoList = this.vGoodsInfoDao.DynamicQuery(goodsInfoPoco);

            logger.Info("Good goods information items:" + goodsInfoPocoList.Count.ToString());
            StringBuilder htmlBuilder = new StringBuilder();

            htmlBuilder.Append("<table class=\"table table-hover goodsList\">");
            htmlBuilder.Append("<caption>");
            htmlBuilder.Append("<div id=\"tableCaption\" style=\"padding-top:3px;\"><img src=\"../imgs/pack-2.png\">货源信息</div>");
            htmlBuilder.Append("</caption>");
            htmlBuilder.Append("<thead>");
            htmlBuilder.Append("<tr class=\"headTr\">");
            htmlBuilder.Append("<th>信息内容</th>");
            htmlBuilder.Append("<th>发布时间</th>");
            htmlBuilder.Append("<th>所在地</th>");
            htmlBuilder.Append("<th>立即查看</th>");
            htmlBuilder.Append("</tr>");
            htmlBuilder.Append("</thead>");
            htmlBuilder.Append(this.getTableBodyHtml(goodsInfoPocoList));
            htmlBuilder.Append("</table>");
            string tableHtml = htmlBuilder.ToString();

            logger.Info("Html code :" + tableHtml);
            return(tableHtml);
        }
 public void ProcessRequest(HttpContext context)
 {
     if (context.Request.RequestType == "POST")
     {// POST for getting total items count.
         logger.Info("Request type is POST.");
         StreamReader streamReader = new StreamReader(context.Request.InputStream);
         string       parameters   = streamReader.ReadToEnd();
         logger.Info("Got special line type parameter:" + parameters);
         VgoodssourceinformationPagination poco = new VgoodssourceinformationPagination();
         Hashtable data = (Hashtable)JsonConvert.DeserializeObject <Hashtable>(parameters);
         if (data == null || data.Count < 1)
         {
             data = new Hashtable();
             int count = this.vGoodsInfoDao.GetCount();
             data.Add("item_count", count.ToString());
             logger.Info("got item count:" + count.ToString());
             data.Add("params", "0-0-0-0");
         }
         else
         {
             string bitMap = this.hashtable2BitMap(data);
             poco.Goodstypeid     = data["typeId"] == null ? 0 : long.Parse(data["typeId"].ToString());
             poco.Dstcitycode     = data["dstCityId"] == null ? null : data["dstCityId"].ToString();
             poco.Srccitycode     = data["srcCityId"] == null ? null : data["srcCityId"].ToString();
             poco.Needtrunkweight = data["weight"] == null ? 0 : long.Parse(data["weight"].ToString());
             Hashtable weightMap = this.weightMap(poco.Needtrunkweight.ToString());
             poco.Weighthigh = int.Parse(weightMap["weighthigh"].ToString());
             poco.Weightlow  = int.Parse(weightMap["weightlow"].ToString());
             int count = this.vGoodsInfoDao.DynamicCount(poco);
             logger.Info("Got items count:" + count.ToString());
             data = new Hashtable();
             data.Add("item_count", count.ToString());
             data.Add("params", bitMap);
             logger.Info("Post back bitMap:" + bitMap);
         }
         context.Response.ContentType = "text/plain";
         context.Response.Write(JsonConvert.SerializeObject(data));
     }
     else
     {
         string pageNumber = context.Request.QueryString["pageNumber"].ToString();
         logger.Info("Got page number:" + pageNumber);
         string pageSize = context.Request.QueryString["pageSize"].ToString();
         logger.Info("Got page size:" + pageSize);
         string bitParams = context.Request.QueryString["bitparams"].ToString();//null
         logger.Info("Got bitmap params:" + bitParams);
         context.Response.ContentType = "text/plain";
         context.Response.Write(this.generateTableHtml(pageNumber, pageSize, bitParams));
     }
 }
        /// <summary>
        /// srcCityId-dstCityId-weight-typeId
        /// </summary>
        /// <param name="bitMap"></param>
        /// <returns></returns>
        private VgoodssourceinformationPagination bitMapParser(string bitMap)
        {
            VgoodssourceinformationPagination poco = new VgoodssourceinformationPagination();

            string[] paramArray = bitMap.Split('-');
            if (paramArray.Length != 4)
            {
                return(null);
            }
            poco.Srccitycode     = paramArray[0] == "0" ? null : paramArray[0];
            poco.Dstcitycode     = paramArray[1] == "0" ? null : paramArray[1];
            poco.Needtrunkweight = long.Parse(paramArray[2]);
            Hashtable weightMap = this.weightMap(paramArray[2]);

            poco.Weighthigh  = int.Parse(weightMap["weighthigh"].ToString());
            poco.Weightlow   = int.Parse(weightMap["weightlow"].ToString());
            poco.Goodstypeid = int.Parse(paramArray[3]);
            return(poco);
        }