private void CbxSelectedItem_SelectedValueChanged(object sender, EventArgs e) { if (this.cbxSelectedItem.SelectedItem is DBItem) { if (this.cbxSelectedItem.SelectedItem is DBBook) { this.lblItemSearchPrompt.Text = "Search by Title:"; //this.txtSearch.Text = (this.cbxSelectedItem.SelectedItem as DBBook).Title; } else if (this.cbxSelectedItem.SelectedItem is DBMap) { this.lblItemSearchPrompt.Text = "Search by Location:"; //this.txtSearch.Text = (this.cbxSelectedItem.SelectedItem as DBMap).Location; } else if (this.cbxSelectedItem.SelectedItem is DBPeriodical) { this.lblItemSearchPrompt.Text = "Search by Title:"; //this.txtSearch.Text = (this.cbxSelectedItem.SelectedItem as DBPeriodical).Title; } DBItem tempItem = (this.cbxSelectedItem.SelectedItem as DBItem); this.lblCondition.Text = tempItem.GetConditionType(); this.UpdateTotalPrice(); this.UpdateStock(); } }
/// <summary> /// Used to instantiate a new transaction /// </summary> /// <param name="invoiceID">The invoice the transaction belongs to</param> /// <param name="item">The item being sold</param> /// <param name="quantity">How many of the item is being sold</param> public DBTransaction(int invoiceID, DBItem item, int quantity) { this.invoiceID = invoiceID; this.ItemID = item.GetItemID(); this.Desc = item.GetDescription(); this.ItemType = item.GetItemType(); this.Edition = item.GetEdition(); this.Condition = item.GetConditionType(); this.conditionID = item.GetConditionID(); this.Price = item.GetPrice(); this.Quantity = quantity; this.itemStock = item.GetQuantity(); }