Пример #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]);
                    }
                }
            }
        }
Пример #2
0
        public string JsonDataForEasyUIdataGrid(string tablename, int pageindex, int pagesize, string filterJson, string sort = "keyid", 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(JSONhelper.FormatJSONForEasyuiDataGrid(recordCount, dt));
        }
Пример #3
0
 public DataTable GetPageWithSp(ProcCustomPage pcp, out int recordCount)
 {
     return(DbUtils.GetPageWithSp(pcp, out recordCount));
 }