private void DisplayPeriodicals() { try { BindingList <DBPeriodical> filteredPeriodicals = DBControlHelper.GetFilteredItemsAndUpdateQuantity(this.periodicals, this.txtSearch.Text, new List <int>(), Cart.Invoice.Transactions); this.dgvItems.DataSource = filteredPeriodicals; this.cbxSelectedItem.DataSource = filteredPeriodicals; //Setup combobox this.cbxSelectedItem.DisplayMember = "ComboBoxDisplay"; this.cbxSelectedItem.ValueMember = "PeriodicalID"; //Setup datagridview this.dgvItems.Columns["PeriodicalID"].HeaderText = "Periodical ID"; this.dgvItems.Columns["ConditionType"].HeaderText = "Condition"; this.dgvItems.Columns["GenreName"].HeaderText = "Genre"; this.dgvItems.Columns["CompanyName"].HeaderText = "Company"; this.dgvItems.Columns["PublishDate"].HeaderText = "Publish Date"; this.dgvItems.Columns["ComboBoxDisplay"].Visible = false; this.dgvItems.Columns["ShowDiscount"].Visible = false; } catch (Exception ex) { (this.Parent.Parent as MasterForm).SetStatus("Failed to display periodicals: " + ex.Message); } }
/// <summary> /// Filters through a list of items and returns a new list with items that have a similar description /// to the passed value and updates the quantity of items to reflect transactions in the cart /// </summary> /// <typeparam name="T">The type of item to search. Either a book, periodical, or map</typeparam> /// <param name="items">The list of items to filter through</param> /// <param name="description">The description to look for</param> /// <param name="transactions">The transactions to update the item quantity based off</param> /// <returns></returns> public static BindingList <T> GetFilteredItems <T>(BindingList <T> items, string description, List <int> tagIds) where T : DBItem { return(DBControlHelper.GetFilteredItemsAndUpdateQuantity <T>(items, description, tagIds, new BindingList <DBTransaction>())); }