Example #1
0
        public List<Role> GetUserRoles(string username)
        {
            var result = new List<Role>();

            var existingUser = this.userRepository.GetSingleByUsername(username);

            if (existingUser != null)
            {
                result = this.GetUserRoles(existingUser);
            }

            return result.Distinct().ToList();
        }
Example #2
0
        /// <summary>
        /// Process all the images for the given list of images
        /// retrieved from the sites HTML - this processes all images
        /// in a given list of xml nodes for the sitemap.
        /// </summary>
        /// <param name="xmlNodeList"></param>
        /// <param name="siteMapUrl"></param>
        /// <param name="squishedCssImages"></param>
        /// <returns></returns>
        public IEnumerable<string> ProcessImagesForXmlList(XmlNodeList xmlNodeList, string siteMapUrl, ref List<SquishedImage> squishedCssImages)
        {
            List<SquishedImage> images = new List<SquishedImage>();
            List<string> imageList = new List<string>();
            List<string> alreadyProcessed = new List<string>();

            foreach (XmlNode node in xmlNodeList)
            {
                string imageUrl = node.InnerText;

                if (!_commonUtils.IsValidFileExtension(imageUrl))
                {
                    break;
                }

                WebClient client = new WebClient();
                string downloadString = client.DownloadString(imageUrl);

                imageList.AddRange(_commonUtils.GetImagesInHtmlString(downloadString));

                // Process images in CSS file.
                squishedCssImages.AddRange(ProcessCss(downloadString, imageUrl, ref alreadyProcessed));
            }

            return imageList.Distinct();
        }
Example #3
0
        public List<Role> GetUserRoles(User existingUser)
        {
            var result = new List<Role>();

            if (existingUser != null)
            {
                foreach (var userRole in existingUser.UserRoles)
                {
                    result.Add(userRole.Role);
                }
            }

            return result.Distinct().ToList();
        }
        private IEnumerable<Entity> RetrieveAllEntities(DTProject project)
        {
            List<Entity> projectEntities = new List<Entity>();
            projectEntities.Add(project);
            var subEntities = GetSubEntities(project, projectEntities);
            if (subEntities.Count() > 0)
                projectEntities.AddRange(subEntities);

            return projectEntities.Distinct();
        }