示例#1
0
        private void button3_Click(object sender, EventArgs e)
        {
            StockMgntRef.Stove stove = new StockMgntRef.Stove();
            stove.Product  = textBox3.Text;
            stove.Price    = double.Parse(textBox5.Text);
            stove.Quentity = int.Parse(textBox4.Text);
            StockMgntRef.StockMgntClient          client  = new StockMgntRef.StockMgntClient();
            TransactionMgnt.TransactionMgntClient client1 = new TransactionMgnt.TransactionMgntClient();
            var msg  = client.AddStove(stove);
            var msg1 = client1.AddStoveTx(textBox3.Text, int.Parse(textBox4.Text));

            if (msg.Equals("OK") && msg1.Equals("OK"))
            {
                MessageBox.Show("Successfully added new product.");
            }
            dataGridView1.DataSource = client.GetStoves();
            stoves = client.GetStoves().ToList();
            string[] stoveTypes = stoves.Where(x => x.Price != 0).Select(x => x.Product).ToArray();
            comboBox1.Items.Clear();
            comboBox2.Items.Clear();
            comboBox2.Items.AddRange(stoveTypes);
            comboBox1.Items.AddRange(stoveTypes);
            textBox4.Text = "";
            textBox5.Text = "";
        }
 private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
 {
     selectedStove = stoves.Where(x => x.Product == comboBox2.Text).FirstOrDefault();
     if (selectedStove != null)
     {
         textBox2.Text = selectedStove.Price.ToString();
     }
 }
示例#3
0
 private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
 {
     selectedStove = stoves.Where(x => x.Product == comboBox1.Text).FirstOrDefault();
     if (selectedStove != null)
     {
         soldQty = selectedStove.Quentity;
     }
 }