Exemplo n.º 1
0
        public string GetPartialPath(Category category, DisplayImage.ImageCategory imgCategory)
        {
            if (imgCategory == ImageCategory.Clothing)
            {
                string basePath = AppImageRoot + GetCategoryDir();
                string genderDir = "Neutral/";

                if (category.HasGender)
                {
                    bool? isMale = category.IsMale;
                    if (!isMale.HasValue)
                        throw new ArgumentNullException("Invalid Gender");
                    else
                    {
                        if ((bool)category.IsMale)
                            genderDir = "Male";
                        else
                            genderDir = "Female";
                    }
                }

                string path = basePath;
                path += genderDir + "/";
                path += category.AgeGroup.Name + "/";
                path += category.CategoryName.Name + "/";
                return path;
            }
            else
                throw new NotImplementedException("Image Category Not Supported");
        }
Exemplo n.º 2
0
 public bool ImageExists(string fileName, Category category, DisplayImage.ImageCategory imgCategory,
     out String partialPath)
 {
     bool returnVal = false;
     string baseDirectory = System.AppDomain.CurrentDomain.BaseDirectory;
     partialPath = GetPartialPath(category, imgCategory);
     string pathSys = partialPath.Replace("/", "\\");
     string fileSys = System.IO.Path.Combine(baseDirectory, pathSys, fileName);
     if (System.IO.File.Exists(fileSys))
         returnVal = true;
     return returnVal;
 }
 public static string GetPersonType(Category category, bool possessive)
 {
     string personType;
     if (category.HasGender)
     {
         bool? isMaleEntry = category.IsMale;
         if (!isMaleEntry.HasValue)
         {
             throw new ArgumentNullException("Invalid Category Object. It has gender but none is listed.");
         }
         else
         {
             if (category.AgeGroup.Name == "Adult")
             {
                 if ((bool)category.IsMale)
                 {
                     if (possessive)
                         personType = "Men's";
                     else
                         personType = "Men";
                 }
                 else
                 {
                     if (possessive)
                         personType = "Women's";
                     else
                         personType = "Women";
                 }
             }
             else if (category.AgeGroup.Name == "Child")
             {
                 if ((bool)category.IsMale)
                 {
                     if (possessive)
                         personType = "Boys'";
                     else
                         personType = "Boy";
                 }
                 else
                 {
                     if (possessive)
                         personType = "Girls'";
                     else
                         personType = "Girl";
                 }
             }
             else
                 throw new ArgumentNullException("Invalid Category Object. Has gender but not Adult or Child");
         }
     }
     else
     {
         if (category.AgeGroup.Name == "Infant")
         {
             if (possessive)
                 personType = "Infants'";
             else
                 personType = "Infant";
         }
         else
             throw new ArgumentNullException("Invalid Category Object. Has no gender but not Infant");
     }
     return personType;
 }