Ejemplo n.º 1
0
        /// <summary>
        /// 文章列表
        /// </summary>
        /// <returns></returns>
        public string GetList()
        {
            ArticleBLL            articleBLL = new ArticleBLL();
            List <SqlDbParameter> parms      = new List <SqlDbParameter>();
            SqlDbParameter        parm       = null;

            if (!string.IsNullOrEmpty(Request.Form["JournalId"]))
            {
                parm                = new SqlDbParameter();
                parm.ColumnName     = "JournalId";
                parm.ParameterName  = "JournalId";
                parm.ParameterValue = Request.Form["JournalId"];
                parm.ColumnType     = DbType.Int32;
                parms.Add(parm);
            }
            if (!string.IsNullOrEmpty(Request.Form["CategoryId"]) && Request.Form["CategoryId"] != "0")
            {
                parm                = new SqlDbParameter();
                parm.ColumnName     = "CategoryId";
                parm.ParameterName  = "CategoryId";
                parm.ParameterValue = Request.Form["CategoryId"];
                parm.ColumnType     = DbType.Int32;
                parms.Add(parm);
            }

            //默认条件IsDelete!=1,软删标准
            //parm = new SqlDbParameter();
            //parm.ColumnName = "IsDelete";
            //parm.ParameterName = "IsDelete";
            //parm.QualificationType = SqlDbParameter.QualificationSymbol.IsNull;
            //parm.ColumnType = DbType.Int32;
            //parms.Add(parm);

            int         recordCount;
            int         draw      = Convert.ToInt32(Request["draw"]);
            int         start     = Convert.ToInt32(Request["start"]);
            int         length    = Convert.ToInt32(Request["length"]);
            int         page      = start / length; //start 初始值0
            DataTable   dataTable = articleBLL.GetArticleDataTablePage(parms, "NoOfJournal DESC", length, page, out recordCount);
            IDictionary info      = new Hashtable();

            info.Add("draw", draw);
            info.Add("recordsTotal", recordCount);
            info.Add("recordsFiltered", recordCount);
            info.Add("data", dataTable);
            return(JsonConvert.SerializeObject(info));
        }