public JsonResult GetSQLInfo(int SQLId) { if (SQLId < 1) { return(FailResult("SQLId不合法")); } VViewModel vModel = new VViewModel(); //获取分类列表 Tsql_ClassifyCollection daclassifyColl = new Tsql_ClassifyCollection(); daclassifyColl.SelectClassify(); Tsql_View daview = new Tsql_View(); daview.SelectSQLBySqlId(SQLId); vModel = MapProvider.Map <VViewModel>(daview.DataRow); List <Classify> list = new List <Classify>(); list = MapProvider.Map <Classify>(daclassifyColl.DataTable); vModel.classifylist = new List <Classify>(); foreach (var item in list) { vModel.classifylist.Add(item); } return(SuccessResult(vModel)); }
public JsonResult UpdateSql(VViewModel vModel) { if (SysUser == null) { FailResult("未登录状态"); } if (!sqlManager.IsCorrect(vModel.COMMAND_TEXT)) { return(FailResult(sqlManager.PromptInfo.Message)); } Tsql_View daview = new Tsql_View(); daview.SelectByPK(vModel.VIEW_ID); daview.ViewName = vModel.VIEW_NAME; daview.ClassifyId = vModel.CLASSIFY_ID; daview.CommandText = vModel.COMMAND_TEXT; daview.ViewTemplate = vModel.VIEW_TEMPLATE; daview.CacheStatus = vModel.CACHE_STATUS; daview.PageRow = vModel.PAGE_ROW; daview.Status = 1; daview.Remarks = vModel.REMARKS; if (!daview.Update()) { return(FailResult(daview.PromptInfo.Message)); } else { ViewFacade viewfacade = new ViewFacade(); viewfacade.AddOrUpdateCache(daview.ViewId, Convert.ToInt32(daview.CacheStatus), Isparameter(daview.CommandText)); } return(SuccessResult()); }
// GET: UseSQL public ActionResult Index(int?SQLId) { if (SQLId > 0) { ViewBag.SQLID = SQLId; } else { ViewBag.SQLID = 0; } Tsql_ClassifyCollection daclassifyColl = new Tsql_ClassifyCollection(); VViewModel vModel = new VViewModel(); vModel.classifylist = new List <Classify>(); daclassifyColl.SelectClassify(); List <Classify> list = MapProvider.Map <Classify>(daclassifyColl.DataTable); foreach (var item in list) { vModel.classifylist.Add(item); } return(View(vModel)); }