예제 #1
0
        public ActionResult CreateSql(string sql, string code)
        {
            var res  = false;
            var msg  = "";
            var mng  = new SqlCrudManager();
            var item = mng.GetSqlGet(code);

            try
            {
                if (item != null)
                {
                    msg = "Sql с таким кодом уже существует в системе";
                }
                else
                {
                    var users = Membership.GetUser().UserName;
                    item = new as_sqlGet {
                        id = 0, code = code, sql = sql, users = users
                    };
                    mng.SaveSql(item);
                    res = true;
                }
            }
            catch (Exception ex)
            {
                RDL.Debug.LogError(ex);
            }
            return(Json(new
            {
                result = res,
                msg = msg,
                rightID = item.id
            }, JsonRequestBehavior.AllowGet));
        }
예제 #2
0
 public void SaveSql(as_sqlGet item)
 {
     try
     {
         db.SaveSql(item);
     }
     catch (Exception ex)
     {
         RDL.Debug.LogError(ex);
     }
 }
예제 #3
0
 public void DeleteSqlCrud(as_sqlGet item)
 {
     try
     {
         RDL.CacheManager.PurgeCacheItems("as_sqlGet_id__" + item.code);
         db.DeleteSqlCrud(item.id);
     }
     catch (Exception ex)
     {
         RDL.Debug.LogError(ex);
     }
 }
예제 #4
0
        public as_sqlGet GetSqlGet(string code)
        {
            var res = new as_sqlGet();
            var key = "as_sqlGet_code_" + code;

            if (CacheManager.EnableCaching && CacheManager.Cache[key] != null && false)
            {
                res = (as_sqlGet)CacheManager.Cache[key];
            }
            else
            {
                try
                {
                    res = db.GetSql(code);
                    CacheManager.CacheData(key, res);
                }
                catch (Exception ex)
                {
                    Debug.LogError(ex);
                }
            }
            return(res);
        }
예제 #5
0
        public as_sqlGet GetSqlCrud(int id)
        {
            var res = new as_sqlGet();
            var key = "as_sqlCrud_id_" + id;

            if (CacheManager.EnableCaching && CacheManager.Cache[key] != null && false)
            {
                res = (as_sqlGet)CacheManager.Cache[key];
            }
            else
            {
                try
                {
                    res = db.GetSqlGet(id);
                    CacheManager.CacheData(key, res);
                }
                catch (Exception ex)
                {
                    Debug.LogError(ex);
                }
            }
            return(res);
        }