} // property RecipesUsedAsIngredient

    public CraftingComponent(long componentID)
    {
        ID = componentID;
        Crafting_Components component = ComponentGateway.CraftingComponentGetByComponentID(ID);
        if (component == null)
        {
            Name = "n/a";
            Description = "n/a";
        }
        else
        {
            Name = component.displayName;
            Description = component.displayDescription;
        }
    } // constructor
Exemple #2
0
    } // method GetAllBlueprintsCreatedByTradeskillID

    public static ItemGroupEnum DetermineItemGroupByItemID(long objectID)
    {
        string cacheKey = "ItemGroupByItemID_" + objectID;
        ItemGroupEnum returnObject;
        if (HttpContext.Current.Cache[cacheKey] == null)
        {
            returnObject = ItemGroupEnum.Unknown;
        }
        else
        {
            returnObject = (ItemGroupEnum)HttpContext.Current.Cache[cacheKey];
        }
        
        if (returnObject == ItemGroupEnum.Unknown)
            using (RepopdataEntities myEntities = new RepopdataEntities())
            {
                // There's no easy way to determine the item "group" (recipe book, crafting component, etc.)
                // This method definitely needs refactoring
               
                var recipeResult = RecipeGateway.RecipesGrantedByRecipeBookID(objectID);
                if (recipeResult.Count > 0)
                {
                    returnObject = ItemGroupEnum.RecipeBook;
                    AppCaching.AddToCache(cacheKey, returnObject);
                    return returnObject;
                }
                var rawMatResult = SpeciesGateway.AllSpeciesInfoForItem(objectID);
                if (rawMatResult.Count > 0)
                {
                    returnObject = ItemGroupEnum.RawMaterial;
                    AppCaching.AddToCache(cacheKey, returnObject);
                    return returnObject;
                }
                var componentResult = ComponentGateway.ComponentsGetByItemID(objectID);
                if (componentResult.Count > 0)
                    {
                    returnObject = ItemGroupEnum.CraftingComponent;
                    AppCaching.AddToCache(cacheKey, returnObject);
                    return returnObject;
                }
            } // using
        return returnObject;
    } // DetermineItemGroupByItemID