protected void Page_Load(object sender, EventArgs e) { db = new MooglenomicsDatabaseDataContext(); string searchName = Request.QueryString["name"]; if (searchName != null) { Search_Data(searchName); } }
protected void Page_Load(object sender, EventArgs e) { db = new MooglenomicsDatabaseDataContext(); string itemID = Request.QueryString["item"]; if (itemID != null) { LoadPage_ByItemID(itemID); } }
protected void Page_Load(object sender, EventArgs e) { db = new MooglenomicsDatabaseDataContext(); //itemsList = db.Items.Where(p => p.isUntradeable == false).OrderBy(p => p.ItemSubCategory.ItemCategory.ItemCategoryID).ThenBy(p => p.ItemSubCategory.ItemSubCat_ID).ToList(); HttpCookie hc = MoogleCookieHelper.GetCookie(Request); if (hc != null) { currentUser = db.Users.SingleOrDefault(i => i.UserID.ToString().Equals(hc["userID"])); } if (currentUser == null) { Response.Redirect("Login.aspx"); } if (!IsPostBack) { string catID = Request.QueryString["cat"]; string subcatID = Request.QueryString["subcat"]; string itemID = Request.QueryString["item"]; if (itemID != null) { Load_Item(itemID); } Subcategory_DropDownList.Items.Clear(); Category_DropDownList.Items.Clear(); Subcategory_DropDownList.Items.Add("All"); Category_DropDownList.Items.Add("All"); int iCat = 0; List<ItemCategory> icList = db.ItemCategories.ToList(); foreach (ItemCategory ic in icList) { iCat++; Category_DropDownList.Items.Add(ic.CategoryName); if (catID != null && ic.ItemCategoryID.ToString().Equals(catID)) { Category_DropDownList.SelectedIndex = iCat; itemCategory = ic; List<ItemSubCategory> iscList = ic.ItemSubCategories.ToList(); foreach (ItemSubCategory isc in iscList) { Subcategory_DropDownList.Items.Add(isc.Name); if (subcatID != null && isc.ItemSubCat_ID.ToString().Equals(subcatID)) { itemSubcategory = isc; } } } } ItemList_Filter(); } }
protected void Page_Load(object sender, EventArgs e) { db = new MooglenomicsDatabaseDataContext(); HttpCookie hc = MoogleCookieHelper.GetCookie(Request); if (hc != null) { currentUser = db.Users.SingleOrDefault(i => i.UserID.ToString().Equals(hc["userID"])); } if (currentUser == null) { LoginUL.Visible = true; SignedInUL.Visible = false; } else { LoginUL.Visible = false; SignedInUL.Visible = true; UserNameLabel.Text = @"<a href=""~/Account"">" + currentUser.InGameName + @"</a>"; } }
public static Best_Cost_Result Calculate_Item_CraftCost(Item i, MooglenomicsDatabaseDataContext db) { List<Recipe> recipes = i.Recipes.ToList(); List<Best_Cost_Result> ListofCosts = new List<Best_Cost_Result>(); foreach (Recipe r in recipes) { int reciptCost = 0; Best_Cost_Result recipeCost_result = new Best_Cost_Result(); List<Ingredient> ingredients = r.Ingredients.ToList(); foreach (Ingredient ing in ingredients) { Best_Cost_Result ing_Best_Result = new Best_Cost_Result(); int cheapestCost = int.MaxValue; Best_Cost_Result.Source cheapestSource = Best_Cost_Result.Source.NA; Best_Cost_Result ingCraft_result = new Best_Cost_Result(); int ingCraftCost = int.MaxValue; int vendorBought = int.MaxValue; int marketBought = int.MaxValue; int ingGatherCost = int.MaxValue; Item mat = ing.Item; if ((bool)mat.canCraft) { ingCraft_result = Calculate_Item_CraftCost(mat, db); ingCraftCost = ingCraft_result.value; } if (cheapestCost > ingCraftCost) { cheapestCost = ingCraftCost; cheapestSource = Best_Cost_Result.Source.Craft; } if ((bool)mat.isVendorBought && mat.buyFromVendor != null) { vendorBought = (int)mat.buyFromVendor; } if (cheapestCost > vendorBought) { cheapestCost = vendorBought; cheapestSource = Best_Cost_Result.Source.Vendor; } LastMarket_value_View lmv = db.LastMarket_value_Views.SingleOrDefault(p => p.Item_ID_FK == mat.id); if (lmv != null) { if (lmv.nqPrice == 0 && lmv.hqPrice == 0) { marketBought = int.MaxValue; } else if (lmv.nqPrice == 0 || lmv.nqPrice == null) { marketBought = (int)lmv.hqPrice; } else if (lmv.hqPrice == 0 || lmv.hqPrice == null) { marketBought = (int)lmv.nqPrice; } else { marketBought = (lmv.nqPrice < lmv.hqPrice) ? (int)lmv.nqPrice : (int)lmv.hqPrice; } } if (cheapestCost > marketBought) { cheapestCost = marketBought; cheapestSource = Best_Cost_Result.Source.Market; } //TODO: GatheringCost formula once it been complete; if((bool)i.canGather) { } if (cheapestCost > ingGatherCost) { cheapestCost = ingGatherCost; cheapestSource = Best_Cost_Result.Source.Gather; } ing_Best_Result.value = cheapestCost; ing_Best_Result.source = cheapestSource; ing_Best_Result.item = mat; if(cheapestSource == Best_Cost_Result.Source.Craft) { ing_Best_Result.Mats_Best_Source.Add(ingCraft_result); } recipeCost_result.Mats_Best_Source.Add(ing_Best_Result); if(cheapestCost != int.MaxValue) { reciptCost += cheapestCost*(int)ing.quantity; } } reciptCost = reciptCost / (int)r.yeild; recipeCost_result.item = i; recipeCost_result.source = Best_Cost_Result.Source.Craft; recipeCost_result.value = reciptCost; ListofCosts.Add(recipeCost_result); } Best_Cost_Result toReturn = new Best_Cost_Result(); foreach (Best_Cost_Result bcr in ListofCosts) { if(toReturn.value > bcr.value) { toReturn = bcr; } } return toReturn; }
protected void Page_Load(object sender, EventArgs e) { db = new MooglenomicsDatabaseDataContext(); }