コード例 #1
0
ファイル: RouteSetting.cs プロジェクト: zuhuizou/wojilu
        public Route getRouteWithDefaultValue()
        {
            Route route = new Route();

            route.setOwnerType(_default.getOwnerType());
            route.setOwner(_default.getOwner());
            route.setNs(_default.getNs());
            route.setController(_default.getController());
            route.setAction(_default.getAction());
            route.setQuery(_default.getQuery());
            route.setId(_default.getId());
            route.setAppId(_default.getAppId());
            route.setPage(_default.getPage());

            route.setItem("ownertype", route.ownerType);
            route.setItem("owner", route.owner);
            route.setItem("namespace", route.ns);
            route.setItem("controller", route.controller);
            route.setItem("action", route.action);
            route.setItem("query", route.query);
            route.setItem("id", route.id);
            route.setItem("appId", route.appId);
            route.setItem("page", route.page);

            return(route);
        }
コード例 #2
0
ファイル: RouteSetting.cs プロジェクト: jilumvc/Sajoo
        public Route getRouteWithDefaultValue()
        {
            Route route = new Route();

            route.setOwnerType ( _default.getOwnerType());
            route.setOwner ( _default.getOwner());
            route.setNs( _default.getNs() );
            route.setController ( _default.getController());
            route.setAction ( _default.getAction());
            route.setQuery ( _default.getQuery());
            route.setId( _default.getId() );
            route.setAppId( _default.getAppId() );
            route.setPage( _default.getPage() );

            route.setItem( "ownertype", route.ownerType );
            route.setItem( "owner", route.owner );
            route.setItem( "namespace", route.ns );
            route.setItem( "controller", route.controller );
            route.setItem( "action", route.action );
            route.setItem( "query", route.query );
            route.setItem( "id", route.id );
            route.setItem( "appId", route.appId );
            route.setItem( "page", route.page );

            return route;
        }
コード例 #3
0
ファイル: RouteTool.cs プロジェクト: zuhuizou/wojilu
        private static void setStrongTypeValue(Route result)
        {
            if (result.getItem("controller") != null)
            {
                result.setController(result.getItem("controller"));
            }
            if (result.getItem("action") != null)
            {
                result.setAction(result.getItem("action"));
            }
            if (result.getItem("query") != null)
            {
                result.setQuery(result.getItem("query"));
            }
            if (result.getItem("owner") != null)
            {
                result.setOwner(result.getItem("owner"));
            }
            if (result.getItem("ownertype") != null)
            {
                result.setOwnerType(result.getItem("ownertype"));
            }
            if (result.getItem("id") != null)
            {
                result.setId(cvt.ToLong(result.getItem("id")));
            }
            if (result.getItem("appid") != null)
            {
                result.setAppId(cvt.ToLong(result.getItem("appid")));
            }

            int page = 1;

            if (result.getItem("page") != null)
            {
                int routePage = Requirements.getPageNumber(result.getItem("page"));
                if (routePage > 1)
                {
                    page = routePage;
                }
            }

            result.setItem("page", page);
            result.setPage(page);
            CurrentRequest.setCurrentPage(page);
        }
コード例 #4
0
ファイル: LinkMap.cs プロジェクト: 2014AmethystCat/wojilu
        private static Route processController( Route route, String cleanUrl )
        {
            if (route == null || route.controller == null) return route;

            route.setCleanUrl( cleanUrl );

            if (route.owner == null) {

                route.setOwner( "site" );
                route.setOwnerType( "site" );
            }

            foreach (String aNamespace in MvcConfig.Instance.RootNamespace) {

                if (route.controller.StartsWith( aNamespace )) {

                    String cleanNs = strUtil.TrimStart( route.controller, aNamespace ).TrimStart( '.' );

                    String[] arrItem = cleanNs.Split( '.' );
                    String controller = arrItem[arrItem.Length - 1];
                    String ns = strUtil.TrimEnd( cleanNs, controller ).TrimEnd( '.' );

                    controller = strUtil.TrimEnd( controller, "Controller" );

                    route.setController( controller );
                    route.setNs( ns );
                    route.setRootNamespace( aNamespace );

                    return route;

                }

            }

            return route;
        }
コード例 #5
0
ファイル: LinkMap.cs プロジェクト: 2014AmethystCat/wojilu
        private static Route parseControllerAndAction( String[] arrPath, String mapController, Route x )
        {
            String action = arrPath[1];
            x.setController( mapController );
            x.setAction( action );

            return x;
        }
コード例 #6
0
ファイル: LinkMap.cs プロジェクト: 2014AmethystCat/wojilu
        private static Route parseCAndAId( String[] arrPath, String mapController, Route x )
        {
            String[] arrValue = mapController.Split( '.' );
            String action = arrValue[arrValue.Length - 1];
            String controller = strUtil.TrimEnd( mapController, action ).TrimEnd( '.' );
            x.setController( controller );
            x.setAction( action );
            x.setId( cvt.ToInt( arrPath[1] ) );

            return x;
        }
コード例 #7
0
ファイル: LinkMap.cs プロジェクト: 2014AmethystCat/wojilu
        private static Route parseActionId( String[] arrPath, String mapController, Route x )
        {
            String id = arrPath[2];
            if (cvt.IsInt( id ) == false) return null;

            String action = arrPath[1];
            x.setController( mapController );
            x.setAction( action );
            x.setId( cvt.ToInt( arrPath[2] ) );

            return x;
        }
コード例 #8
0
ファイル: LinkMap.cs プロジェクト: 2014AmethystCat/wojilu
 private static Route getEqualMap( KeyValuePair<String, String> kv, Route x )
 {
     String[] arr = kv.Value.Split( '.' );
     String action = arr[arr.Length - 1];
     String controller = strUtil.TrimEnd( kv.Value, action ).TrimEnd( '.' );
     x.setController( controller );
     x.setAction( action );
     return x;
 }
コード例 #9
0
ファイル: RouteTool.cs プロジェクト: 2014AmethystCat/wojilu
        private static void setStrongTypeValue( Route result ) {

            if (result.getItem( "controller" ) != null) result.setController( result.getItem( "controller" ) );
            if (result.getItem( "action" ) != null) result.setAction( result.getItem( "action" ) );
            if (result.getItem( "query" ) != null) result.setQuery( result.getItem( "query" ) );
            if (result.getItem( "owner" ) != null) result.setOwner( result.getItem( "owner" ) );
            if (result.getItem( "ownertype" ) != null) result.setOwnerType( result.getItem( "ownertype" ) );
            if (result.getItem( "id" ) != null) result.setId( cvt.ToLong( result.getItem( "id" ) ) );
            if (result.getItem( "appid" ) != null) result.setAppId( cvt.ToLong( result.getItem( "appid" ) ) );

            int page = 1;
            if (result.getItem( "page" ) != null) {
                int routePage = Requirements.getPageNumber( result.getItem( "page" ) );
                if (routePage > 1) page = routePage;
            }

            result.setItem( "page", page );
            result.setPage( page );
            CurrentRequest.setCurrentPage( page );
        }