Example #1
0
        public static DataTable GetPageWithSp(ProcCustomPage pcp, out int recordCount)
        {
            using (var conn = new SqlConnection(cs))
            {
                using (var cmd = conn.CreateCommand())
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = pcp.Sp_PagerName;
                    cmd.InjectFrom(new SetParamsValues().IgnoreFields("sp_pagername"), pcp);

                    SqlParameter outputPara = new SqlParameter("@RecordCount", SqlDbType.Int);
                    outputPara.Direction = ParameterDirection.Output;
                    cmd.Parameters.Add(outputPara);

                    conn.Open();

                    using (var da = new SqlDataAdapter(cmd))
                    {
                        DataSet ds = new DataSet();
                        da.Fill(ds);
                        cmd.Parameters.Clear();
                        recordCount = PublicMethod.GetInt(outputPara.Value);
                        conn.Close();
                        return(ds.Tables[0]);
                    }
                }
            }
        }
Example #2
0
        public DataTable JsonDataForDataTable(string tablename, int pageindex, int pagesize, string filterJson, string sort = "FID", string order = "asc")
        {
            string sortorder = sort + " " + order;
            var    pcp       = new ProcCustomPage(tablename)
            {
                PageIndex   = pageindex,
                PageSize    = pagesize,
                OrderFields = sortorder,
                WhereString = FilterTranslator.ToSql(filterJson)
            };
            int       recordCount;
            DataTable dt = GetPageWithSp(pcp, out recordCount);

            return(dt);
        }
Example #3
0
        public string JsonDataForEasyUIdataGrid(string tablename, int pageindex, int pagesize, string filterJson, string hqlString, string sort = "FID", string order = "asc")
        {
            string sortorder = sort + " " + order;

            var pcp = new ProcCustomPage(tablename)
            {
                PageIndex   = pageindex,
                PageSize    = pagesize,
                OrderFields = sortorder,
                WhereString = FilterTranslator.ToSql(filterJson, hqlString)
            };
            int       recordCount;
            DataTable dt = GetPageWithSp(pcp, out recordCount);

            return(JsonHelper.FormatJSONForEasyuiDataGrid(recordCount, dt));
        }
Example #4
0
        public IEnumerable <T> JsonDataForEasyUIdataGrid(ref int recordCount, string tablename, int pageindex, int pagesize, string filterJson, string sort = "FID", string order = "asc")
        {
            string sortorder = sort + " " + order;

            var pcp = new ProcCustomPage(tablename)
            {
                PageIndex   = pageindex,
                PageSize    = pagesize,
                OrderFields = sortorder,
                WhereString = FilterTranslator.ToSql(filterJson)
            };
            //DataTable dt = GetPageWithSp(pcp, out recordCount);
            IEnumerable <T> list = GetList <T>(GetPageWithSp(pcp, out recordCount));

            return(list);
        }
Example #5
0
 public virtual DataTable GetPageWithSp(ProcCustomPage pcp, out int recordCount)
 {
     return(DbUtils.GetPageWithSp(pcp, out recordCount));
 }