Beispiel #1
0
        public IActionResult PlatAdmin()
        {
            base.SetGlobalViewBag();
            List <CPSystem> sysCol = CPSystemHelper.Instance().GetSystems();

            ViewBag.SystemCol  = sysCol;
            ViewBag.DefaultUrl = CPAppContext.CPWebRootPath() + "/Plat/Tab/TabView?TabCode=Tab0002&SysId=2";
            return(View());
        }
Beispiel #2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        //注册服务
        public void ConfigureServices(IServiceCollection services)
        {
            // Add framework services.
            //不加这句的话,发布到IIS里会运行不起来
            services.AddApplicationInsightsTelemetry(Configuration);
            //注册编辑器
            services.AddUEditorService();
            services.AddMvc(o => o.Conventions.Add(new FeatureConvention()))
            .AddJsonOptions(t => t.SerializerSettings.ContractResolver = new DefaultContractResolver())
            .AddRazorOptions(options =>
            {
                // {0} - Action Name
                // {1} - Controller Name
                // {2} - Area Name
                // {3} - Feature Name
                // replace normal view location entirely
                //    options.ViewLocationFormats.Clear();
                options.ViewLocationFormats.Add("/Plat/{3}/{1}/{0}.cshtml");
                options.ViewLocationFormats.Add("/Plat/{3}/{0}.cshtml");
                options.ViewLocationFormats.Add("/Plat/Shared/{0}.cshtml");


                options.ViewLocationExpanders.Add(new FeatureViewLocationExpander());
            }).AddSessionStateTempDataProvider();

            //.AddApplicationPart(typeof(GridEngineController).Assembly).AddControllersAsServices(); ;
            //services.AddMvc()
            // .AddApplicationPart(typeof(GridEngineController).Assembly).AddControllersAsServices();
            //services.AddMvc().AddApplicationPart(Assembly.Load(new AssemblyName("CPFrameWork.UIInterface")));
            //使用session
            services.AddSession();
            Services = services;
            //设置文件大小
            services.Configure <FormOptions>(options =>
            {
                //1个G
                options.MultipartBodyLengthLimit = 1024 * 1024 * 1024;
            });
            //自己加的
            CPLogHelper.StartupInit(services, Configuration);
            CPSystemHelper.StartupInit(services, Configuration);
            CPAutoNumHelper.StartupInit(services, Configuration);
            COOrgans.StartupInit(services, Configuration);
            CPFormEngine.StartupInit(services, Configuration);
            CPFormTemplate.StartupInit(services, Configuration);
            CPGridEngine.StartupInit(services, Configuration);
            CPTabEngine.StartupInit(services, Configuration);
            CPTreeEngine.StartupInit(services, Configuration);
            CPModuleEngine.StartupInit(services, Configuration);
            CPFlowTemplate.StartupInit(services, Configuration);
            CPFlowEngine.StartupInit(services, Configuration);
            CPMsgs.StartupInit(services, Configuration);
        }
Beispiel #3
0
        private void AddUserSession(COUserIdentity userIden, COUser user)
        {
            CPAppContext.GetHttpContext().Session.SetString("UserId", userIden.UserId.ToString());
            CPAppContext.GetHttpContext().Session.SetString("UserKey", userIden.UserKey.ToString());
            CPAppContext.GetHttpContext().Session.SetString("UserName", user.UserName);
            CPAppContext.GetHttpContext().Session.SetString("UserLoginName", user.LoginName.ToString());
            if (string.IsNullOrEmpty(user.UserPhotoPath))
            {
                CPAppContext.GetHttpContext().Session.SetString("UserPhotoPath", "");
            }
            else
            {
                CPAppContext.GetHttpContext().Session.SetString("UserPhotoPath", user.UserPhotoPath.ToString());
            }
            //获取用户所在的角色
            List <CORole> userRole  = this.GetUserStaticRoles(user.Id);
            string        RoleIds   = "";
            string        RoleNames = "";

            userRole.ForEach(t => {
                if (string.IsNullOrEmpty(RoleIds))
                {
                    RoleIds   = t.Id.ToString();
                    RoleNames = t.RoleName;
                }
                else
                {
                    RoleIds   += "," + t.Id.ToString();
                    RoleNames += "," + t.RoleName;
                }
            });
            CPAppContext.GetHttpContext().Session.SetString("RoleIds", RoleIds.ToString());
            CPAppContext.GetHttpContext().Session.SetString("RoleNames", RoleNames.ToString());
            //获取部门
            List <CODep> depCol   = this.GetDepByUser(user.Id);
            string       DepIds   = "";
            string       DepNames = "";

            depCol.ForEach(t => {
                if (string.IsNullOrEmpty(DepIds))
                {
                    DepIds   = t.Id.ToString();
                    DepNames = t.DepName;
                }
                else
                {
                    DepIds   += "," + t.Id.ToString();
                    DepNames += "," + t.DepName;
                }
            });
            CPAppContext.GetHttpContext().Session.SetString("DepIds", DepIds.ToString());
            CPAppContext.GetHttpContext().Session.SetString("DepNames", DepNames.ToString());
            //获取当前用户拥有管理员权限的子系统
            List <CPSystem> sysCol = CPSystemHelper.Instance().GetSystems();
            string          sysIds = "";

            sysCol.ForEach(t => {
                if (string.IsNullOrEmpty(t.AdminUserIds))
                {
                    return;
                }
                if (t.AdminUserIds.Split(',').Contains(user.Id.ToString()))
                {
                    if (string.IsNullOrEmpty(sysIds))
                    {
                        sysIds = t.Id.ToString();
                    }
                    else
                    {
                        sysIds += "," + t.Id.ToString();
                    }
                }
            });
            CPAppContext.GetHttpContext().Session.SetString("UserAdminSysIds", sysIds.ToString());
        }