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()); }
public JsonResult AddSql(ViewModel model) { if (SysUser != null) { model.INPUTER = SysUser.UserCode; } else { return(FailResult("未登录状态")); } var verifymodel = ModelVerify.First(model); if (verifymodel != null) { return(FailResult(verifymodel.ErrorMessage)); } if (model.COMMAND_TEXT.Length > 2000) { return(FailResult("该SQL超出长度")); } if (!string.IsNullOrEmpty(model.VIEW_NAME)) { if (sqlManager.IsExists(model.VIEW_NAME)) { return(FailResult("标题已存在,不可用")); } } if (!sqlManager.IsCorrect(model.COMMAND_TEXT)) { return(FailResult(sqlManager.PromptInfo.Message)); } Tsql_View daView = new Tsql_View() { ViewName = model.VIEW_NAME, ClassifyId = model.CLASSIFY_ID, CommandText = model.COMMAND_TEXT, ViewTemplate = model.VIEW_TEMPLATE, CacheStatus = model.CACHE_STATUS, PageRow = model.PAGE_ROW, Status = 1, Inputer = model.INPUTER, Remarks = model.REMARKS, }; if (!daView.Insert()) { return(FailResult(daView.PromptInfo.Message)); } else { //添加删除缓存数据 ViewFacade viewfacade = new ViewFacade(); viewfacade.AddOrUpdateCache(daView.ViewId, Convert.ToInt32(daView.CacheStatus), Isparameter(daView.CommandText)); } return(SuccessResult()); }