Пример #1
0
        public List <AdminTypeRoutesModel> Modal_admin_Type(int id)
        {
            var res = new List <AdminTypeRoutesModel>();

            PDBC db = new PDBC("PandaMarketCMS", true);

            db.Connect();

            DataTable dt = db.Select("SELECT [CatId],[R_CatName] FROM [tbl_ADMIN_ruleRoutes_Category]");

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                DataTable dt2   = db.Select("SELECT A.[rulerouteID],[ruleRouteURL],[ruleRouteName] FROM [tbl_ADMIN_ruleRoutes_Main] as A inner join [tbl_ADMIN_types_ruleRoute_Connection] as B on A.rulerouteID=B.rulerouteID where ruleRouteCatId=" + dt.Rows[i]["CatId"] + " and B.HasAccess=1 and B.ad_typeID=" + id);
                var       MList = new List <RouteModel>();
                for (int j = 0; j < dt2.Rows.Count; j++)
                {
                    var model = new RouteModel()
                    {
                        RouteId   = Convert.ToInt32(dt2.Rows[j]["rulerouteID"]),
                        RouteName = dt2.Rows[j]["ruleRouteName"].ToString(),
                        RouteUrl  = dt2.Rows[j]["ruleRouteURL"].ToString()
                    };
                    MList.Add(model);
                }

                var modelRes = new AdminTypeRoutesModel()
                {
                    CatId     = Convert.ToInt32(dt.Rows[i]["CatId"]),
                    CatName   = dt.Rows[i]["R_CatName"].ToString(),
                    RouteList = MList
                };
                if (MList.Count != 0)
                {
                    res.Add(modelRes);
                }
            }

            return(res);
        }
Пример #2
0
        public List <AdminTypeRoutesModel> AdminTypeFiller()
        {
            var  result = new List <AdminTypeRoutesModel>();
            PDBC db     = new PDBC("PandaMarketCMS", true);

            db.Connect();

            DataTable dt = db.Select("SELECT [CatId],[R_CatName] FROM [tbl_ADMIN_ruleRoutes_Category]");

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                DataTable dt2   = db.Select("SELECT [rulerouteID],[ruleRouteURL],[ruleRouteName] FROM [tbl_ADMIN_ruleRoutes_Main] where ruleRouteCatId=" + dt.Rows[i]["CatId"]);
                var       MList = new List <RouteModel>();
                for (int j = 0; j < dt2.Rows.Count; j++)
                {
                    var model = new RouteModel()
                    {
                        RouteId   = Convert.ToInt32(dt2.Rows[j]["rulerouteID"]),
                        RouteName = dt2.Rows[j]["ruleRouteName"].ToString(),
                        RouteUrl  = dt2.Rows[j]["ruleRouteURL"].ToString()
                    };
                    MList.Add(model);
                }

                var modelRes = new AdminTypeRoutesModel()
                {
                    CatId     = Convert.ToInt32(dt.Rows[i]["CatId"]),
                    CatName   = dt.Rows[i]["R_CatName"].ToString(),
                    RouteList = MList
                };

                result.Add(modelRes);
            }


            return(result);
        }