예제 #1
0
        public ActionResult GetObjectName(long scId, string user, string objtype = "TABLE")
        {
            JsonResult ret = new JsonResult();

            try
            {
                List <string> objs = new List <string>();
                using (var dal = new DmDAL(GetSessionConnStr(scId)))
                {
                    objs.AddRange(dal.GetObjectName(user, "UTAB"));
                    objs.AddRange(dal.GetObjectName(user, "VIEW"));
                }
                ret.Data = JsonConvert.SerializeObject(new
                {
                    status = 0,
                    data   = objs
                });
            }
            catch (Exception ex)
            {
                ret.Data = JsonConvert.SerializeObject(new
                {
                    status  = 1,
                    message = ex.Message
                });
                RecordException(ex);
            }
            return(ret);
        }
예제 #2
0
        public ActionResult GetObjectName(long scId, string user, string objtype)
        {
            JsonResult ret = new JsonResult();

            try
            {
                List <string> objs = new List <string>();
                var           sc   = db.SessionConnection.Find(scId);
                if (sc.SCDBType == "ORACLE")
                {
                    using (OracleDAL dal = new OracleDAL(GetSessionConnStr(scId)))
                    {
                        objs = dal.GetObjectName(user, objtype).OrderBy(s => s).ToList();
                    }
                }
                else
                {
                    using (DmDAL dal = new DmDAL(GetSessionConnStr(scId)))
                    {
                        objs = dal.GetObjectName(user, objtype).OrderBy(s => s).ToList();
                    }
                }
                ret.Data = JsonConvert.SerializeObject(new
                {
                    status = 0,
                    data   = objs
                });
            }
            catch (Exception ex)
            {
                ret.Data = JsonConvert.SerializeObject(new
                {
                    status  = 1,
                    message = ex.Message
                });
                RecordException(ex);
            }
            return(ret);
        }