예제 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (Results.SelectedIndex == -1)
            {
                MessageBox.Show("Nothing selected!");
                return;
            }
            var product = new Product();
            var results = Results.SelectedItem.ToString().Split('/');

            foreach (var item in results)
            {
                var data = item.Split(':');
                if (data.Length < 2)
                {
                    continue;
                }
                if (data[0] == "ID")
                {
                    product.ID = int.Parse(data[1]);
                }
                if (data[0] == "Name")
                {
                    product.Name = data[1];
                }
                if (data[0] == "Quantity")
                {
                    product.Quantity = int.Parse(data[1]);
                }
                if (data[0] == "Price")
                {
                    product.Price = int.Parse(data[1]);
                }
            }
            this.Hide();
            var cus = new ProductsFrm(product);

            cus.ShowDialog();
        }
예제 #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            var cus = new ProductsFrm();

            cus.ShowDialog();
        }