public string LoadOrg() { var orgs = AutofacExt.GetFromFac <LoginApp>().GetLoginUser().AccessedOrgs.MapToList <Org>(); //添加根节点 orgs.Add(new Org { Id = 0, ParentId = -1, Name = "根结点", CascadeId = "0" }); return(JsonHelper.Instance.Serialize(orgs)); }
public string LoadModuleWithRoot() { var orgs = AutofacExt.GetFromFac <LoginApp>().GetLoginUser().Modules.MapToList <ModuleView>(); //添加根节点 orgs.Add(new Module { Id = 0, ParentId = -1, Name = "根节点", CascadeId = "0" }); return(JsonHelper.Instance.Serialize(orgs)); }
public string IsCustomerNameExist(string custName) { CustomerApplication app = AutofacExt.GetFromFac <CustomerApplication>(); Infrastructure.Response result = new Infrastructure.Response(); try { result.Message = app.IsCustomerNameExist(custName).ToString(); } catch (Exception ex) { result.Status = false; result.Message = ex.Message; } return(JsonHelper.Instance.Serialize(result)); }
public string UserRegister(Customer view) { CustomerApplication app = AutofacExt.GetFromFac <CustomerApplication>(); Infrastructure.Response result = new Infrastructure.Response(); try { app.Add(view); } catch (Exception ex) { result.Status = false; result.Message = ex.Message; } return(JsonHelper.Instance.Serialize(result)); }
public override void OnActionExecuting(ActionExecutingContext filterContext) { base.OnActionExecuting(filterContext); var description = (Microsoft.AspNetCore.Mvc.Controllers.ControllerActionDescriptor)filterContext.ActionDescriptor; Controllername = description.ControllerName.ToLower(); Actionname = description.ActionName.ToLower(); var config = AutofacExt.GetFromFac <IOptions <AppSetting> >(); var version = config.Value.Version; if (version == "demo" && Request.Method == "POST") { filterContext.Result = new RedirectResult("/Error/Demo"); return; // throw new Exception("演示版本,不要乱动,当前模块:" + Controllername + "/" + Actionname); } if (!_authUtil.CheckLogin()) { return; } var function = ((TypeInfo)GetType()).DeclaredMethods.FirstOrDefault(u => u.Name.ToLower() == Actionname); if (function == null) { throw new Exception("未能找到Action"); } //权限验证标识 var authorize = function.GetCustomAttribute(typeof(AuthenticateAttribute)); if (authorize == null) { return; } var currentModule = _authUtil.GetCurrentUser().Modules.FirstOrDefault(u => u.Url.ToLower().Contains(Controllername)); //当前登录用户没有Action记录&&Action有authenticate标识 if (currentModule == null) { filterContext.Result = new RedirectResult("/Login/Index"); return; } }
protected override void OnActionExecuting(ActionExecutingContext filterContext) { var loginUser = AutofacExt.GetFromFac <LoginApp>().GetLoginUser(); if (!User.Identity.IsAuthenticated) { filterContext.Result = new RedirectResult("/Login/Index"); return; } var controllername = Request.RequestContext.RouteData.Values["controller"].ToString().ToLower(); var actionname = filterContext.ActionDescriptor.ActionName.ToLower(); var function = this.GetType().GetMethods().FirstOrDefault(u => u.Name.ToLower() == actionname); if (function == null) { throw new Exception("未能找到Action"); } var anonymous = function.GetCustomAttribute(typeof(AnonymousAttribute)); var module = loginUser.Modules.FirstOrDefault(u => u.Url.ToLower().Contains(controllername)); //当前登录用户没有Action记录&&Action没有anonymous标识 if (module == null && anonymous == null) { filterContext.Result = new RedirectResult("/Login/Index"); return; } else { ViewBag.Module = module; //为View显示服务,主要是为了显示按钮 } var version = ConfigurationManager.AppSettings["version"]; if (version == "demo") { HttpPostAttribute hobbyAttr = (HttpPostAttribute)Attribute.GetCustomAttribute(function, typeof(HttpPostAttribute)); if (actionname.Contains("del") || hobbyAttr != null) //客户端提交数据 { throw new HttpException(400, "演示版本,不能进行该操作,当前模块:" + controllername + "/" + actionname); } } base.OnActionExecuting(filterContext); }
/// <summary> /// 获取所有章节到本地 /// </summary> /// <param name="novelId"></param> /// <returns></returns> public string GetAllChapterToLocal(string novelId) { try { var novel = _novelManagerApp.GetNovel(novelId); var sqlStr = string.Format("Select * From [{0}] Where state <> 2 ", novelId); var listChapter = _app.Repository.ChapterQueryFromSql(sqlStr).ToList(); if (listChapter.Count() > 0) { ThreadPool.QueueUserWorkItem(x => { var _chapterManagerApp = AutofacExt.GetFromFac <ChapterManagerApp>(); foreach (var chapter in listChapter) { _chapterManagerApp.UpdateChapterState(novel.Id, chapter.Id, 1); var tmpChapterContent = _chapterManagerApp.GetWebChapterContent(chapter); _chapterManagerApp.SaveToLocal(_hostingEnvironment.ContentRootPath, novel, chapter, tmpChapterContent); _chapterManagerApp.UpdateChapterState(novel.Id, chapter.Id, 2); } if (_chapterManagerApp.IsAllChapterToLocal(novel.Id)) { novel.State = 2; var _novelManagerApp = AutofacExt.GetFromFac <NovelManagerApp>(); _novelManagerApp.Update(novel); } }); } else { Result.Code = 500; Result.Message = "未找到要获取的章节或者章节全部获取完成!"; } } catch (Exception ex) { Result.Code = 500; Result.Message = ex.ToString(); } return(JsonHelper.Instance.Serialize(Result)); }
public FlowInstancesController() { _app = AutofacExt.GetFromFac <WFProcessInstanceService>(); }
public FormVariableServiceTests() { _formVariableService = AutofacExt.GetFromFac <FormVariableService>(); }
public CategoryManagerController() { _app = AutofacExt.GetFromFac <CategoryManagerApp>(); }
public OrderCatchController() { _app = AutofacExt.GetFromFac <OrderCatchApp>(); }
public RelevanceManagerController() { _app = AutofacExt.GetFromFac <RevelanceManagerApp>(); }
public FormControllerTests() { _controller = new FormController(AutofacExt.GetFromFac <FormService>(), AutofacExt.GetFromFac <FormStoreService>(), AutofacExt.GetFromFac <LabelService>()); }
public ActionResult Index() { var user = AutofacExt.GetFromFac <LoginApp>().GetLoginUser(); return(View(user.Modules)); }
public ResourceManagerController() { _app = AutofacExt.GetFromFac <ResourceManagerApp>(); }
public LabelServiceTests() { _labelService = AutofacExt.GetFromFac <LabelService>(); }
public DictServiceTests() { _dictService = AutofacExt.GetFromFac <DictService>(); }
public FormStoreServiceTests() { _formStoreService = AutofacExt.GetFromFac <FormStoreService>(); }
public CheckController() { _app = AutofacExt.GetFromFac <AuthorizeApp>(); }
public OrgManagerController() { _orgApp = AutofacExt.GetFromFac <OrgManagerApp>(); }
public ModuleElementManagerController() { _app = AutofacExt.GetFromFac <ModuleElementManagerApp>(); }
public Api_Init() { _apiService = AutofacExt.GetFromFac <ApiService>(); }
public UserManagerController() { _app = AutofacExt.GetFromFac <UserManagerApp>(); }
/// <summary> /// 直接加载所有的模块 /// </summary> public string LoadForTree() { var orgs = AutofacExt.GetFromFac <LoginApp>().GetLoginUser().Modules; return(JsonHelper.Instance.Serialize(orgs)); }
public OrderApproveController() { _app = AutofacExt.GetFromFac <CustomerApp>(); }
public string LoadModuleWithRoot() { var orgs = AutofacExt.GetFromFac <LoginApp>().GetLoginUser().Modules.MapToList <ModuleView>(); return(JsonHelper.Instance.Serialize(orgs)); }
public HomeController() { _app = AutofacExt.GetFromFac <ModuleManagerApp>(); }
public FormDesignController() { _wfFrmMainBll = AutofacExt.GetFromFac <WFFormService>(); }
public StockManagerController() { _app = AutofacExt.GetFromFac <StockManagerApp>(); }
public LoginController() { _app = AutofacExt.GetFromFac <LoginApp>(); }