Пример #1
0
        private void initPrivate( MvcContext ctx )
        {
            IAppContext context = new AppContext();

            long appId = ctx.route.appId;
            context.Id = appId; // ID

            Type appType = ctx.controller.utils.getAppType();
            if (appType == null) {
                ctx.utils.setAppContext( context );
                return;
            }

            if (appId <= 0) {

                context.setAppType( appType );
                ctx.utils.setAppContext( context );
                return;
            }

            IApp app = getAppById( appType, appId, ctx.owner.obj );
            if (app == null) {

                if (appId == 1) {

                    context.setAppType( appType );
                    ctx.utils.setAppContext( context );
                    return;

                }
                else {

                    ctx.utils.setAppContext( context );
                    ctx.utils.endMsg( lang.get( "exAppNotFound" ) + ": appType=" + appType, HttpStatus.NotFound_404 );
                }
            }
            else {

                context.obj = app; // objApp
                context.setAppType( app.GetType() ); // type
                ctx.utils.setAppContext( context );

                IAppStats stats = app as IAppStats;
                if (stats != null) {
                    refreshStats( stats );
                }

            }
        }