public JsonpResult GetData(int pageSize, int currentPage, string clientid, string tbid)
        {
            System.Data.DataTable dt = new System.Data.DataTable();
            ClientServer          c  = new ClientServer(clientid);

            Tz.Net.DataManager dataManager = new Net.DataManager(tbid, c.GetServer().ServerID, clientid);
            dt = dataManager.GetData(currentPage, pageSize);
            int trecord = dataManager.GetDataCount();

            string dtr = DataResult.Create(dt, pageSize, currentPage, trecord);

            return(new JsonpResult(dtr));
        }
Exemple #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="tb"></param>
        /// <param name="currentPage"></param>
        /// <param name="PageSize"></param>
        /// <returns></returns>
        public JsonResult GetData(string clientid, string tb, int currentPage, int PageSize)
        {
            ClientServer c = new ClientServer(clientid);

            System.Data.DataTable dt = new DataTable();
            Data.DBDatabase       db = Data.DBDatabase.Create(c.GetServer().Connection(), "MySql.Data.MySqlClient");
            // Data.DBDatabase db = Data.DBDatabase.Create("Server=52.163.241.42; Uid=admin;Pwd=smrtalentoz3106;Initial Catalog=jumbo_talentoz; ", "MySql.Data.MySqlClient");
            //Data.Schema.DBSchemaProvider provider = db.GetSchemaProvider();
            //DBSchemaTable tables = provider.GetTable(tb);
            string  dbname      = c.GetServer().DBName;
            DBQuery totalRecord = DBQuery.SelectCount().From(dbname, tb);
            int     trecord     = Convert.ToInt32(db.ExecuteScalar(totalRecord));
            DBQuery record      = DBQuery.SelectAll().From(dbname, tb).TopRange(currentPage * PageSize, PageSize);
            var     dtRecord    = db.GetDatatable(record);
            string  dtr         = DataResult.Create(dtRecord, PageSize, currentPage, trecord);

            //tables.Columns

            return(Json(dtr, JsonRequestBehavior.AllowGet));
        }