/// <summary> /// Get events matching the subject. /// </summary> /// <returns> /// Array of relevant events or empty array. /// </returns> private ArrayList GetEventItems() { // Use a Jet Query to filter the details we need initially between the two specified dates string dateFilter = $"[Start] >= '{StartDate:g}' and [End] <= '{EndDate:g}'"; _Items calendarItems = s_mapiFolder.Items.Restrict(dateFilter); calendarItems.Sort("[Start]", Type.Missing); calendarItems.IncludeRecurrences = true; // Must use 'like' comparison for Find/FindNext string subjectFilter = !String.IsNullOrEmpty(Subject) ? $"@SQL=\"urn:schemas:httpmail:subject\" like '%{Subject.Replace("'", "''")}%'" : "@SQL=\"urn:schemas:httpmail:subject\" <> '!@#'"; // Use Find and FindNext methods to get all the items ArrayList resultArray = new ArrayList(); AppointmentItem eventItem = calendarItems.Find(subjectFilter) as AppointmentItem; while (eventItem != null) { resultArray.Add(eventItem); // Find the next event eventItem = calendarItems.FindNext() as AppointmentItem; } return(resultArray); }
/* * Default landing page * * @variables: tempArray, _Items[]- used to gather an ID for featured items from OsrsBox API * arrFeatItems, RootobjectOsrsGe[]- used to gather GE price of items from OSRS GE API * * * * @returns: RootobjectOsrsGe[] arrFeatItems, used to find GE price of items */ public ViewResult Index() { var url = string.Empty; List <string> featItems = new List <string>() { "Abyssal whip", "Elder maul", "Twisted bow", }; _Items[] tempArray = new _Items[featItems.Count()]; for (int i = 0; i < featItems.Count(); i++) { url = "https://api.osrsbox.com/items?where={ \"name\": \"" + featItems[i] + "\", \"duplicate\": false }"; tempArray[i] = DownloadedItem.Download_serialized_json_data(url); } RootobjectOsrsGe[] arrFeatItems = new RootobjectOsrsGe[featItems.Count()]; for (int i = 0; i < featItems.Count(); i++) { url = "https://secure.runescape.com/m=itemdb_oldschool/api/catalogue/detail.json?item=" + tempArray[i].id; arrFeatItems[i] = DownloadedItemOsrsGe.Download_serialized_json_data(url); } return(View(arrFeatItems)); }
/* * Pulls a users favorite items from the database * and displays a table for them to view the * items that they favorited * */ public ViewResult MyFavorites() { List <FavoriteModel> favorites = repository.Items.Where(i => i.Username == HttpContext.User.Identity.Name).Distinct().ToList(); var url = string.Empty; RootobjectOsrsGe[] favoritesArr = new RootobjectOsrsGe[favorites.Count()]; for (int i = 0; i < favorites.Count(); i++) { url = "https://secure.runescape.com/m=itemdb_oldschool/api/catalogue/detail.json?item=" + favorites[i].ItemID; favoritesArr[i] = DownloadedItemOsrsGe.Download_serialized_json_data(url); } _Items[] itemFavorites = new _Items[favorites.Count()]; for (int i = 0; i < favorites.Count(); i++) { url = "https://api.osrsbox.com/items?where={ \"name\": \"" + favoritesArr[i].item.name + "\", \"duplicate\": false }"; itemFavorites[i] = DownloadedItem.Download_serialized_json_data(url); itemFavorites[i].price = favoritesArr[i].item.current.price; } TempData["Username"] = HttpContext.User.Identity.Name; TempData["Favorite"] = "true"; return(View("MyFavorites", itemFavorites)); }
/* * Action that allows a user to save an item * to view later on the MyFavorites page * */ public IActionResult SaveItem(RootobjectOsrsGe items, string returnUrl) { var url = "https://api.osrsbox.com/items?where={ \"name\": \"" + items.item.name + "\", \"duplicate\": false }"; _Items nameToId = new _Items(); nameToId = DownloadedItem.Download_serialized_json_data(url); url = "https://secure.runescape.com/m=itemdb_oldschool/api/catalogue/detail.json?item=" + nameToId.id; RootobjectOsrsGe itemID = new RootobjectOsrsGe(); itemID = DownloadedItemOsrsGe.Download_serialized_json_data(url); FavoriteModel favorite = new FavoriteModel { ItemID = itemID.item.id.ToString(), Username = HttpContext.User.Identity.Name }; if (repository.SaveFavorite(favorite) == 1) { TempData["Result"] = "Item successfully added to favorites"; return(Redirect(returnUrl)); } else if (repository.SaveFavorite(favorite) == 0) { TempData["Result"] = "This item is already in your favorites"; return(Redirect(returnUrl)); } else { TempData["Result"] = "Something went wrong with adding this item"; return(Redirect(returnUrl)); } }
} //Constructor public Shortage(Shortage oShortage) { this.ID = oShortage.ID; this.CompanyID = oShortage.CompanyID; this.CustomerID = oShortage.CustomerID; this.OrderID = oShortage.OrderID; this.SchoolName = oShortage.SchoolName; this.ParentName = oShortage.ParentName; this.TeacherName = oShortage.Name; this.Name = oShortage.Name; this.Date = oShortage.Date; this.Detail = oShortage.Detail; this.DayPhone = oShortage.DayPhone; this.EvePhone = oShortage.EvePhone; this.QVNOption = oShortage.QVNOption; this.Address = oShortage.Address; this.Address_2 = oShortage.Address_2; this.Attention = oShortage.Attention; this.City = oShortage.City; this.State = oShortage.State; this.ZipCode = oShortage.ZipCode; this.eMail = oShortage.ZipCode; this.Type = oShortage.Type; this.StudentName = oShortage.StudentName; // this.oCustomer=oShortage.oCustomer; this.Items = new _Items(oShortage.Items); //this.TrakingNumber = oShortage.TrakingNumber; }
//Methods public Prize(String CompanyID) { this.CompanyID = CompanyID; this.Items = new _Items(); // this.IsCookieDough = false; this.PackID = ""; } //Constructor
/* * Removes an item from the favorites page */ public IActionResult RemoveItem(_Items item) { FavoriteModel model = new FavoriteModel(); model = (repository.Items.FirstOrDefault(i => i.ItemID == item.id && i.Username == HttpContext.User.Identity.Name)); repository.DeleteFavorite(model); return(RedirectToAction("MyFavorites")); }
public static IEnumerable <T> ToEnumerable <T>(this _Items items) { while (true) { var a = items.FindNext(); if (a == null) { break; } yield return((T)a); } }
/* * Populates an instance of the _Items[] class * with predefined items to be gathered from the api * gathered from the Categories class * * Every action in this controller uses the same logic * * * @returns: _Items[] Des Weapons, data gathered from API */ public ViewResult Weapons() { var url = string.Empty; _Items[] DesWeapons = new _Items[Categories.Weapons.Count]; for (int i = 0; i < Categories.Weapons.Count(); i++) { url = "https://api.osrsbox.com/items?where={ \"name\": \"" + Categories.Weapons[i] + "\", \"duplicate\": false }"; DesWeapons[i] = DownloadedItem.Download_serialized_json_data(url); } TempData["Category"] = "Weapons"; return(View("Categories", DesWeapons)); }
public Legend(Theme theme, IAestheticMapping aes) { Aes = aes; if (!string.IsNullOrEmpty(aes.Name)) { Title = new Dimension <string> { Value = aes.Name, Width = aes.Name.Width(theme.Legend.Title.Size), Height = aes.Name.Height(theme.Legend.Title.Size) }; } Items = new _Items(theme); }
public Legend(Theme theme, IAestheticMapping aes) { Aes = aes; if (!string.IsNullOrEmpty(aes.Name)) { var zone = aes.Name.Zone(theme.Legend.Title); Title = new Dimension <string> { Value = aes.Name, Width = zone.Width, Height = zone.Height }; } Items = new _Items(theme); }
public ViewResult Food() { var url = string.Empty; List <_Items> DesFood = new List <_Items>(); for (int i = 0; i < Categories.Food.Count(); i++) { url = "https://api.osrsbox.com/items?where={ \"name\": \"" + Categories.Food[i] + "\", \"duplicate\": false }"; DesFood.Add(DownloadedItem.Download_serialized_json_data(url)); } TempData["Category"] = "Food"; _Items[] food = new _Items[Categories.Potions.Count()]; food = DesFood.ToArray(); return(View("Categories", food)); }
protected override List <_AppointmentItem> PrepareItemsForExchange(_Items items) { List <_AppointmentItem> result = new List <_AppointmentItem>(); if (items == null) { return(result); } string filter = FormatInterval(Interval); _AppointmentItem olApt = items.Find(filter) as _AppointmentItem; while (olApt != null) { result.Add(olApt); olApt = items.FindNext() as _AppointmentItem; } return(result); }
public IActionResult NameFilter(int id) { var url = string.Empty; List <FavoriteModel> favorites = repository.Items.Where(i => i.Username == HttpContext.User.Identity.Name).Distinct().ToList(); RootobjectOsrsGe[] favoritesArr = new RootobjectOsrsGe[favorites.Count()]; for (int i = 0; i < favorites.Count; i++) { url = "https://secure.runescape.com/m=itemdb_oldschool/api/catalogue/detail.json?item=" + favorites[i].ItemID; favoritesArr[i] = (DownloadedItemOsrsGe.Download_serialized_json_data(url)); } _Items[] names = new _Items[favorites.Count()]; for (int i = 0; i < favorites.Count; i++) { url = "https://api.osrsbox.com/items?where={ \"name\": \"" + favoritesArr[i].item.name + "\", \"duplicate\": false }"; names[i] = (DownloadedItem.Download_serialized_json_data(url)); names[i].price = favoritesArr[i].item.current.price; } List <_Items> sortedList = names.OrderBy(p => p.name).ToList(); _Items[] sortedName = new _Items[favorites.Count()]; sortedName = sortedList.ToArray(); TempData["Username"] = HttpContext.User.Identity.Name; if (TempData["Sorted"] == null || TempData["Sorted"].Equals("high")) { sortedName = new _Items[favorites.Count()]; sortedName = sortedList.ToArray(); TempData["Sorted"] = "low"; return(View("MyFavorites", sortedName)); } else { sortedList.Reverse(); TempData["Sorted"] = "high"; sortedName = new _Items[Categories.Potions.Count()]; sortedName = sortedList.ToArray(); return(View("MyFavorites", sortedName)); } }
/* * Formats the search to input into OSRSBox Api * * @variables: searchedItems, _Items- used to gather the ID from the OSRSBox api to pass to 2nd API * specificItem, RootobjectOsrsGe- used to gather GE information from the OSRS GE API * */ public IActionResult SingleItem(Items item) { item.Name = item.Name.ToLower(); item.Name = char.ToUpper(item.Name[0]) + item.Name.Substring(1); ViewBag.ItemName = item.Name; RootobjectOsrsGe specificItem = new RootobjectOsrsGe(); var url = "https://api.osrsbox.com/items?where={ \"name\": \"" + item.Name + "\", \"duplicate\": false }&max_results=1"; _Items searchedItems = new _Items(); searchedItems = DownloadedItem.Download_serialized_json_data(url); if (searchedItems.id != null) { url = "https://secure.runescape.com/m=itemdb_oldschool/api/catalogue/detail.json?item=" + searchedItems.id; specificItem = DownloadedItemOsrsGe.Download_serialized_json_data(url); return(View(specificItem)); } else { TempData["Error"] = "Please enter a valid item name"; return(RedirectToAction("Stocks", "Home")); } }
public Receive(String CompanyID) { this.CompanyID = CompanyID; RItems = new _Items(); Items = new _Items(); } //Constructor
//Methods public Receive() { this.CompanyID = base.ID; RItems = new _Items(); Items = new _Items(); }
public static MailItem GetEmail(string subject, string recipientEmail, DateTime maxAgeTimeStamp, int waitSeconds) { const int checkIntervalSeconds = 15; const string prSmtpAddress = "http://schemas.microsoft.com/mapi/proptag/0x39FE001E"; if (Process.GetProcessesByName("outlook").Length == 0) { Process.Start("outlook.exe"); } var item = new MailItem(); NetOffice.OutlookApi.MailItem oItem = null; var match = false; try { Application app = new Application(); _NameSpace ns = app.GetNamespace("MAPI"); ns.Logon(null, null, false, false); MAPIFolder inboxFolder = ns.GetDefaultFolder(OlDefaultFolders.olFolderInbox); _Items oItems = inboxFolder.Items; oItems.Sort("[ReceivedTime]", false); Console.WriteLine("DBG: Started looking for email at {0}", DateTime.Now); for (int j = 0; j <= waitSeconds; j = j + checkIntervalSeconds) { Thread.Sleep(TimeSpan.FromSeconds(checkIntervalSeconds)); for (int i = oItems.Count; i > 1; i--) { oItem = (NetOffice.OutlookApi.MailItem)oItems[i]; Console.WriteLine("DBG: Checking mail at {0} => found mail with timestamp: { 1}", DateTime.Now.ToLongTimeString(), oItem.SentOn.ToLongTimeString()); if ((oItem.ReceivedTime - maxAgeTimeStamp).TotalSeconds < 0) { break; } if (oItem.Subject.IsRegExMatch(subject) && oItem.Recipients.Single().PropertyAccessor.GetProperty(prSmtpAddress).ToString().Equals(recipientEmail)) { match = true; break; } //Console.WriteLine("Subject: {0}", item.Subject); //Console.WriteLine("Sent: {0} {1}", item.SentOn.ToLongDateString(), item.SentOn.ToLongTimeString()); } if (match) { break; } } } catch (System.Runtime.InteropServices.COMException) { throw new Exception("ERROR: retrieving the email failed due to System.Runtime.InteropServices.COMException"); } if (match) { item.EntryId = oItem.EntryID; item.Subject = oItem.Subject; item.SentDate = oItem.SentOn.ToLongDateString(); item.SentTime = oItem.SentOn.ToLongTimeString(); item.ReceivedDate = oItem.ReceivedTime.ToLongDateString(); item.ReceivedTime = oItem.ReceivedTime.ToLongTimeString(); item.Body = oItem.Body; item.HtmlBody = oItem.HTMLBody; item.HasMessage = true; item.PrintInfo(); } else { Console.WriteLine("DBG: Couldn't find message with subject matching {0} and recipient {1}", subject, recipientEmail); } Console.WriteLine("DBG: Finished looking for email at {0}", DateTime.Now); return(item); }
public _Items(_Items oItems) { this.Detail = oItems.Detail; }
//Methods public Shortage() { this.CompanyID = base.ID; oCustomer = new Customer(); Items = new _Items(); } //Constructor
//Methods public GA_Giftco(String CompanyID) { Items = new _Items(); this.CompanyID = CompanyID; } //Constructor
} //Constructor public Rep(String CompanyID) : base(CompanyID) { this.ID = 0; this.CompanyID = CompanyID; this.Items = new _Items(this.CompanyID); } //Constructor
//Methods public Purchase(String CompanyID) : base(CompanyID) { this.CompanyID = CompanyID; Items = new _Items(CompanyID); } //Constructor
public ItemsEnumerator(_Items ar) { _ar = ar; _currIndex = -1; }
//Methods public ProductByRep(String CompanyID) : base(CompanyID) { this.CompanyID = CompanyID; Items = new _Items(); } //Constructor
/* * Gathers the predefined item list from the categories * class based on which category is being sorted * * Sorts the items displayed by high alch value * */ public ViewResult HAFilter(int id) { var category = TempData["Category"]; switch (category) { case "Potions": var url = string.Empty; List <_Items> DesPotions = new List <_Items>(); for (int i = 0; i < Categories.Potions.Count(); i++) { url = "https://api.osrsbox.com/items?where={ \"name\": \"" + Categories.Potions[i] + "\", \"duplicate\": false }"; DesPotions.Add(DownloadedItem.Download_serialized_json_data(url)); } TempData["Category"] = "Potions"; List <_Items> sortedList = DesPotions.OrderBy(n => n.highalch).ToList(); if (TempData["Sorted"] == null || TempData["Sorted"].Equals("high")) { _Items[] desPotionsSortedHA = new _Items[Categories.Potions.Count()]; desPotionsSortedHA = sortedList.ToArray(); TempData["Sorted"] = "low"; return(View("Categories", desPotionsSortedHA)); } else { sortedList.Reverse(); TempData["Sorted"] = "high"; _Items[] desPotionsSortedHA = new _Items[Categories.Potions.Count()]; desPotionsSortedHA = sortedList.ToArray(); return(View("Categories", desPotionsSortedHA)); } case "Weapons": url = string.Empty; List <_Items> DesWeapons = new List <_Items>(); for (int i = 0; i < Categories.Weapons.Count(); i++) { url = "https://api.osrsbox.com/items?where={ \"name\": \"" + Categories.Weapons[i] + "\", \"duplicate\": false }"; DesWeapons.Add(DownloadedItem.Download_serialized_json_data(url)); } TempData["Category"] = "Weapons"; sortedList = DesWeapons.OrderBy(p => p.highalch).ToList(); if (TempData["Sorted"] == null || TempData["Sorted"].Equals("high")) { _Items[] desWeaponsSortedHA = new _Items[Categories.Potions.Count()]; desWeaponsSortedHA = sortedList.ToArray(); TempData["Sorted"] = "low"; return(View("Categories", desWeaponsSortedHA)); } else { sortedList.Reverse(); TempData["Sorted"] = "high"; _Items[] desWeaponsSortedHA = new _Items[Categories.Potions.Count()]; desWeaponsSortedHA = sortedList.ToArray(); return(View("Categories", desWeaponsSortedHA)); } case "Food": url = string.Empty; List <_Items> DesFood = new List <_Items>(); for (int i = 0; i < Categories.Food.Count(); i++) { url = "https://api.osrsbox.com/items?where={ \"name\": \"" + Categories.Food[i] + "\", \"duplicate\": false }"; DesFood.Add(DownloadedItem.Download_serialized_json_data(url)); } TempData["Category"] = "Food"; sortedList = DesFood.OrderBy(p => p.highalch).ToList(); if (TempData["Sorted"] == null || TempData["Sorted"].Equals("high")) { _Items[] desFoodSortedHA = new _Items[Categories.Potions.Count()]; desFoodSortedHA = sortedList.ToArray(); TempData["Sorted"] = "low"; return(View("Categories", desFoodSortedHA)); } else { sortedList.Reverse(); TempData["Sorted"] = "high"; _Items[] desFoodSortedHA = new _Items[Categories.Potions.Count()]; desFoodSortedHA = sortedList.ToArray(); return(View("Categories", desFoodSortedHA)); } case "Armor": url = string.Empty; List <_Items> DesArmor = new List <_Items>(); for (int i = 0; i < Categories.Armor.Count(); i++) { url = "https://api.osrsbox.com/items?where={ \"name\": \"" + Categories.Armor[i] + "\", \"duplicate\": false }"; DesArmor.Add(DownloadedItem.Download_serialized_json_data(url)); } TempData["Category"] = "Armor"; sortedList = DesArmor.OrderBy(p => p.highalch).ToList(); if (TempData["Sorted"] == null || TempData["Sorted"].Equals("high")) { _Items[] desArmorSortedHA = new _Items[Categories.Potions.Count()]; desArmorSortedHA = sortedList.ToArray(); TempData["Sorted"] = "low"; return(View("Categories", desArmorSortedHA)); } else { sortedList.Reverse(); TempData["Sorted"] = "high"; _Items[] desArmorSortedHA = new _Items[Categories.Potions.Count()]; desArmorSortedHA = sortedList.ToArray(); return(View("Categories", desArmorSortedHA)); } case "Woodcutting": url = string.Empty; List <_Items> DesWoodcutting = new List <_Items>(); for (int i = 0; i < Categories.Woodcutting.Count(); i++) { url = "https://api.osrsbox.com/items?where={ \"name\": \"" + Categories.Woodcutting[i] + "\", \"duplicate\": false }"; DesWoodcutting.Add(DownloadedItem.Download_serialized_json_data(url)); } TempData["Category"] = "Woodcutting"; sortedList = DesWoodcutting.OrderBy(p => p.highalch).ToList(); if (TempData["Sorted"] == null || TempData["Sorted"].Equals("high")) { _Items[] desWoodcuttingSortedHA = new _Items[Categories.Potions.Count()]; desWoodcuttingSortedHA = sortedList.ToArray(); TempData["Sorted"] = "low"; return(View("Categories", desWoodcuttingSortedHA)); } else { sortedList.Reverse(); TempData["Sorted"] = "high"; _Items[] desWoodcuttingSortedHA = new _Items[Categories.Potions.Count()]; desWoodcuttingSortedHA = sortedList.ToArray(); return(View("Categories", desWoodcuttingSortedHA)); } case "Mining": url = string.Empty; List <_Items> DesMining = new List <_Items>(); for (int i = 0; i < Categories.Mining.Count(); i++) { url = "https://api.osrsbox.com/items?where={ \"name\": \"" + Categories.Mining[i] + "\", \"duplicate\": false }"; DesMining.Add(DownloadedItem.Download_serialized_json_data(url)); } TempData["Category"] = "Mining"; sortedList = DesMining.OrderBy(p => p.highalch).ToList(); if (TempData["Sorted"] == null || TempData["Sorted"].Equals("high")) { _Items[] desMiningSortedHA = new _Items[Categories.Potions.Count()]; desMiningSortedHA = sortedList.ToArray(); TempData["Sorted"] = "low"; return(View("Categories", desMiningSortedHA)); } else { sortedList.Reverse(); TempData["Sorted"] = "high"; _Items[] desMiningSortedHA = new _Items[Categories.Potions.Count()]; desMiningSortedHA = sortedList.ToArray(); return(View("Categories", desMiningSortedHA)); } } return(View()); }
//Methods public Brochure(String CompanyID) : base(CompanyID) { this.CompanyID = CompanyID; Items = new _Items(); } //Constructor
public Shortage(String CompanyID) : base(CompanyID) { this.CompanyID = CompanyID; oCustomer = new Customer(CompanyID); Items = new _Items(); } //Constructor
//Methods public Rep() : base() { this.CompanyID = base.ID; this.Items = new _Items(this.CompanyID); } //Constructor
if (SetProperty(ref _Items, value)) {