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));
        }
示例#3
0
        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));
        }
示例#4
0
        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));
        }
示例#5
0
        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);
        }
示例#7
0
        /// <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));
        }
示例#8
0
 public FlowInstancesController()
 {
     _app = AutofacExt.GetFromFac <WFProcessInstanceService>();
 }
 public FormVariableServiceTests()
 {
     _formVariableService = AutofacExt.GetFromFac <FormVariableService>();
 }
 public CategoryManagerController()
 {
     _app = AutofacExt.GetFromFac <CategoryManagerApp>();
 }
示例#11
0
 public OrderCatchController()
 {
     _app = AutofacExt.GetFromFac <OrderCatchApp>();
 }
 public RelevanceManagerController()
 {
     _app = AutofacExt.GetFromFac <RevelanceManagerApp>();
 }
示例#13
0
 public FormControllerTests()
 {
     _controller = new FormController(AutofacExt.GetFromFac <FormService>(),
                                      AutofacExt.GetFromFac <FormStoreService>(), AutofacExt.GetFromFac <LabelService>());
 }
示例#14
0
        public ActionResult Index()
        {
            var user = AutofacExt.GetFromFac <LoginApp>().GetLoginUser();

            return(View(user.Modules));
        }
示例#15
0
 public ResourceManagerController()
 {
     _app = AutofacExt.GetFromFac <ResourceManagerApp>();
 }
示例#16
0
 public LabelServiceTests()
 {
     _labelService = AutofacExt.GetFromFac <LabelService>();
 }
示例#17
0
 public DictServiceTests()
 {
     _dictService = AutofacExt.GetFromFac <DictService>();
 }
示例#18
0
 public FormStoreServiceTests()
 {
     _formStoreService = AutofacExt.GetFromFac <FormStoreService>();
 }
示例#19
0
 public CheckController()
 {
     _app = AutofacExt.GetFromFac <AuthorizeApp>();
 }
示例#20
0
 public OrgManagerController()
 {
     _orgApp = AutofacExt.GetFromFac <OrgManagerApp>();
 }
示例#21
0
 public ModuleElementManagerController()
 {
     _app = AutofacExt.GetFromFac <ModuleElementManagerApp>();
 }
示例#22
0
 public Api_Init()
 {
     _apiService = AutofacExt.GetFromFac <ApiService>();
 }
示例#23
0
 public UserManagerController()
 {
     _app = AutofacExt.GetFromFac <UserManagerApp>();
 }
示例#24
0
        /// <summary>
        /// 直接加载所有的模块
        /// </summary>
        public string LoadForTree()
        {
            var orgs = AutofacExt.GetFromFac <LoginApp>().GetLoginUser().Modules;

            return(JsonHelper.Instance.Serialize(orgs));
        }
示例#25
0
 public OrderApproveController()
 {
     _app = AutofacExt.GetFromFac <CustomerApp>();
 }
示例#26
0
        public string LoadModuleWithRoot()
        {
            var orgs = AutofacExt.GetFromFac <LoginApp>().GetLoginUser().Modules.MapToList <ModuleView>();

            return(JsonHelper.Instance.Serialize(orgs));
        }
示例#27
0
 public HomeController()
 {
     _app = AutofacExt.GetFromFac <ModuleManagerApp>();
 }
示例#28
0
 public FormDesignController()
 {
     _wfFrmMainBll = AutofacExt.GetFromFac <WFFormService>();
 }
示例#29
0
 public StockManagerController()
 {
     _app = AutofacExt.GetFromFac <StockManagerApp>();
 }
示例#30
0
 public LoginController()
 {
     _app = AutofacExt.GetFromFac <LoginApp>();
 }