Esempio n. 1
0
    } // constructor

    public CraftingFilter(long filterID) 
    {
        CraftingFilter filter = FilterGateway.CraftingFilterGetByFilterID(filterID);
        if (filter == null)
        {
            ID = 0;
            Name = "n/a";
            Description = "n/a";
        }
        else
        {
            ID = filter.ID;
            Name = filter.Name;
            Description = filter.Description;
        }
    } // constructor
Esempio n. 2
0
    } // method GetFilterByItemID

    public static CraftingFilter CraftingFilterGetByFilterID(long objectID)
    {
        string cacheKey = "CraftingFilterByFilterID_" + objectID;
        CraftingFilter returnObject = HttpContext.Current.Cache[cacheKey] as CraftingFilter;
        if (returnObject == null)
        {
            using (RepopdataEntities myEntities = new RepopdataEntities())
            {
                var result = (from item in myEntities.Crafting_Filters
                                where item.filterID == objectID
                                select item).FirstOrDefault();
                if (result == null) { return null; }
                returnObject = new CraftingFilter(result);
                AppCaching.AddToCache(cacheKey, returnObject);
            } // using
        }// if
        return returnObject;
    } // method CraftingFilterGetByFilterID
    } // property IngredientFullName

    public CraftingRecipeFilter(long recipeID, long filterID, long ingCount, long slot)
    {
        parentRecipeID = recipeID;
        Slot = slot;
        Count = ingCount;

        // In this case, the filter is a Crafting Component
        if (filterID == 0 && ingCount == -1)
        {
            List<CraftingRecipeIngredient> ingredients = RecipeGateway.IngredientsGetByRecipeID(parentRecipeID);
            var ingredient = (from item in ingredients
                              where item.Slot == Slot
                              select item).FirstOrDefault();
            if (ingredient == null)
            {
                Ingredient = null;
            }
            else
            {
                Ingredient = ingredient.CraftingComponent;
                Count = ingredient.Count;
                _ingredientFullName = Ingredient.Name;
                return;
            } // if (ingredient == null)
        } // if (filterID == 0 && ingCount == -1)

        // If the ingredient count is 0, then there can't be anything in this slot
        if (ingCount == 0)
        {
            _ingredientFullName = "None";
            return;
        }

        // Use the actual filter information
        if (filterID > 0)
        {
            Ingredient = new CraftingFilter(filterID);
            _ingredientFullName = Ingredient.Name;
            return;
        } // if (ingredientCount == 0)

    } // constructor
Esempio n. 4
0
    } // method GetAllBlueprints

    public static CraftingFilter CraftingFilterGetByItemID(long objectID)
    {
        // Currently, there can only be 1 crafting filter per item
        string cacheKey = "CraftingFiltersByItemID_" + objectID;
        CraftingFilter returnObject = HttpContext.Current.Cache[cacheKey] as CraftingFilter;
        if (returnObject == null)
        {
            using (RepopdataEntities myEntities = new RepopdataEntities())
            {
                var result = (from item in myEntities.Crafting_Filters
                                join itemCraftingFilter in myEntities.Item_Crafting_Filters on item.filterID equals itemCraftingFilter.filterID
                                where itemCraftingFilter.itemID == objectID
                                select item).FirstOrDefault();
                if (result == null) { return null; }
                returnObject = new CraftingFilter(result);
                AppCaching.AddToCache(cacheKey, returnObject);
            } // using
        } // if (currentSkill == null)
        return returnObject;
    } // method GetFilterByItemID
Esempio n. 5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (String.IsNullOrEmpty(Request.QueryString.Get("FilterID"))) { Response.Redirect("~/Filters/Default.aspx"); }

        int itemID = Convert.ToInt32(Request.QueryString.Get("FilterID"));
        CurrentFilter = FilterGateway.CraftingFilterGetByFilterID(itemID);
        if (CurrentFilter == null || CurrentFilter.Name.Equals("n/a")) { Response.Redirect("~/Filters/Default.aspx"); }

        // Main information
        Title = CurrentFilter.Name;

        rpt_Items.DataSource = CurrentFilter.Items;
        rpt_Items.DataBind();
        grd_Recipes.DataSource = CurrentFilter.RecipesUsedAsIngredient;
        grd_Recipes.DataBind();

        ItemWrapper.Visible = rpt_Items.Items.Count > 0;
        RecipeWrapper.Visible = grd_Recipes.Rows.Count > 0;

    } // method Page_Load