Exemple #1
0
        /// <summary>
        /// Load information from selected Item to Form
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonLoadPrice_Click(object sender, RoutedEventArgs e)
        {
            ListSoftware priceItem = MainWindow.DB.Softwares[comboBoxPrice.SelectedIndex];

            textBoxName.Text         = priceItem.NameItem;
            textBoxRegularPrice.Text = priceItem.RegularPrice.ToString();
            textBoxDiscount.Text     = priceItem.Discount.ToString();
            textBoxAction.Text       = priceItem.Action;
            textBoxActionPrice.Text  = priceItem.ActionPrice.ToString();
        }
Exemple #2
0
        /// <summary>
        /// Create new Item from fields  Form
        /// </summary>
        /// <returns></returns>
        private ListSoftware CreateItem()
        {
            string       name         = textBoxName.Text;
            double       regularPrice = Convert.ToDouble(textBoxRegularPrice.Text);
            int          discount     = Convert.ToInt32(textBoxDiscount.Text);
            string       action       = textBoxAction.Text;
            double       actionPrice  = Convert.ToDouble(textBoxActionPrice.Text);
            ListSoftware Item;

            if (action == "No action")
            {
                Item = new ListSoftware(name, regularPrice, discount);
            }
            else
            {
                Item = new ListSoftware(name, regularPrice, discount, action, actionPrice);
            }
            return(Item);
        }