예제 #1
0
        public IList<string> GetUserRights()
        {
            IList<string> rights = new List<string>();

            using (Entities dbContext = new Entities())
            {
                rights = dbContext.Users.Find(this.UserId).UserLevel.UserRights.Select(r => r.Name).ToList();
            }

            return rights;
        }
예제 #2
0
파일: Util.cs 프로젝트: jayrulez/skydance
        public static string GetDbSetting(string key, bool fallback = true)
        {
            Entities dbContext = new Entities();

            var setting = dbContext.Settings.FirstOrDefault(s => s.Name == key);

            if (setting != null)
            {
                return setting.Value;
            }
            else
            {
                if(fallback)
                {
                    return Util.GetAppSetting(key);
                }
            }

            return null;
        }
예제 #3
0
파일: Util.cs 프로젝트: jayrulez/skydance
        public static User GetUserById(int userId)
        {
            try
            {
                Entities dbContext = new Entities();

                User user = dbContext.Users.Find(userId);
                return user;
            }
            catch (EntityException ex)
            {
                throw ex;
            }
        }
예제 #4
0
파일: Util.cs 프로젝트: jayrulez/skydance
        public static User GetLoggedInUser()
        {
            try
            {
                string username = System.Web.HttpContext.Current.User.Identity.Name;

                Entities dbContext = new Entities();

                var user = dbContext.Users.FirstOrDefault(u => u.Username == username);

                return user;
            }
            catch(Exception ex)
            {
                throw ex;
            }
        }