Example #1
0
        public List <RoadFlow.Data.Model.MenuUser> GetAll(bool cache = true)
        {
            if (!cache)
            {
                Organize organize = new Organize();
                List <RoadFlow.Data.Model.MenuUser> all = dataMenuUser.GetAll();
                {
                    foreach (RoadFlow.Data.Model.MenuUser item in all)
                    {
                        item.Users = organize.GetAllUsersIdString(item.Organizes);
                    }
                    return(all);
                }
            }
            object obj = Opation.Get(cachekey);

            if (obj == null)
            {
                Organize organize2 = new Organize();
                List <RoadFlow.Data.Model.MenuUser> all2 = dataMenuUser.GetAll();
                foreach (RoadFlow.Data.Model.MenuUser item2 in all2)
                {
                    item2.Users = organize2.GetAllUsersIdString(item2.Organizes);
                }
                Opation.Set(cachekey, all2);
                return(all2);
            }
            return((List <RoadFlow.Data.Model.MenuUser>)obj);
        }
Example #2
0
        public List <RoadFlow.Data.Model.MenuUser> GetAll(bool cache = true)
        {
            if (!cache)
            {
                Organize organize = new Organize();
                List <RoadFlow.Data.Model.MenuUser> all = this.dataMenuUser.GetAll();
                foreach (RoadFlow.Data.Model.MenuUser menuUser in all)
                {
                    menuUser.Users = organize.GetAllUsersIdString(menuUser.Organizes);
                }
                return(all);
            }
            object obj = Opation.Get(MenuUser.cachekey);

            if (obj != null)
            {
                return((List <RoadFlow.Data.Model.MenuUser>)obj);
            }
            Organize organize1 = new Organize();
            List <RoadFlow.Data.Model.MenuUser> all1 = this.dataMenuUser.GetAll();

            foreach (RoadFlow.Data.Model.MenuUser menuUser in all1)
            {
                menuUser.Users = organize1.GetAllUsersIdString(menuUser.Organizes);
            }
            Opation.Set(MenuUser.cachekey, (object)all1);
            return(all1);
        }
Example #3
0
        public List <RoadFlow.Data.Model.HomeItems> GetAllByUserID(Guid userID)
        {
            object obj = Opation.Get(this.cacheKey);
            List <RoadFlow.Data.Model.HomeItems> homeItemsList1 = new List <RoadFlow.Data.Model.HomeItems>();
            List <RoadFlow.Data.Model.HomeItems> homeItemsList2;

            if (obj != null && obj is List <RoadFlow.Data.Model.HomeItems> )
            {
                homeItemsList2 = (List <RoadFlow.Data.Model.HomeItems>)obj;
            }
            else
            {
                Organize organize = new Organize();
                homeItemsList2 = this.GetAll();
                foreach (RoadFlow.Data.Model.HomeItems homeItems in homeItemsList2)
                {
                    homeItems.UseUsers = organize.GetAllUsersIdString(homeItems.UseOrganizes);
                }
                Opation.Set(this.cacheKey, (object)homeItemsList2);
            }
            return(homeItemsList2.FindAll((Predicate <RoadFlow.Data.Model.HomeItems>)(p => p.UseUsers.Contains(userID.ToString(), StringComparison.CurrentCultureIgnoreCase))).OrderBy <RoadFlow.Data.Model.HomeItems, int>((Func <RoadFlow.Data.Model.HomeItems, int>)(p => p.Type)).ThenBy <RoadFlow.Data.Model.HomeItems, int?>((Func <RoadFlow.Data.Model.HomeItems, int?>)(p => p.Sort)).ToList <RoadFlow.Data.Model.HomeItems>());
        }
Example #4
0
        public List <RoadFlow.Data.Model.HomeItems> GetAllByUserID(Guid userID)
        {
            object obj = Opation.Get(cacheKey);
            List <RoadFlow.Data.Model.HomeItems> list = new List <RoadFlow.Data.Model.HomeItems>();

            if (obj != null && obj is List <RoadFlow.Data.Model.HomeItems> )
            {
                list = (List <RoadFlow.Data.Model.HomeItems>)obj;
            }
            else
            {
                Organize organize = new Organize();
                list = GetAll();
                foreach (RoadFlow.Data.Model.HomeItems item in list)
                {
                    item.UseUsers = organize.GetAllUsersIdString(item.UseOrganizes);
                }
                Opation.Set(cacheKey, list);
            }
            return((from p in list.FindAll((RoadFlow.Data.Model.HomeItems p) => p.UseUsers.Contains(userID.ToString(), StringComparison.CurrentCultureIgnoreCase))
                    orderby p.Type, p.Sort
                    select p).ToList());
        }