Beispiel #1
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public JsonResult GetEntity(string clientid)
        {
            System.Data.DataTable dt = new DataTable();
            ClientServer          c  = new ClientServer(clientid);

            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");
            //Server=52.163.241.42; Uid=admin;Pwd=smrtalentoz3106;Initial Catalog=jumbo_talentoz;
            Data.Schema.DBSchemaProvider provider             = db.GetSchemaProvider();
            IEnumerable <Data.Schema.DBSchemaItemRef> tables  = provider.GetAllTables();
            IEnumerable <Data.Schema.DBSchemaItemRef> tables1 = provider.GetAllViews();

            tables = tables.Concat(tables1);
            return(Json(Newtonsoft.Json.JsonConvert.SerializeObject(tables), JsonRequestBehavior.AllowGet));
        }
Beispiel #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="tb"></param>
        /// <returns></returns>
        public JsonResult GetFields(string clientid, string tb)
        {
            System.Data.DataTable dt = new DataTable();
            ClientServer          c  = new ClientServer(clientid);

            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);

            if (tables == null)
            {
                DBSchemaView view = provider.GetView(tb);
                return(Json(Newtonsoft.Json.JsonConvert.SerializeObject(view), JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(Newtonsoft.Json.JsonConvert.SerializeObject(tables), JsonRequestBehavior.AllowGet));
            }
        }