Example #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 = "";
        }
Example #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            StockMgntRef.StockMgntClient          client  = new StockMgntRef.StockMgntClient();
            TransactionMgnt.TransactionMgntClient client1 = new TransactionMgnt.TransactionMgntClient();
            int total = int.Parse(textBox1.Text) + soldQty;
            var msg   = client.SetStoves(comboBox1.Text, total);
            var msg1  = client1.AddStoveTx(comboBox1.Text, int.Parse(textBox1.Text));

            if (msg.Equals("OK") && msg1.Equals("OK"))
            {
                MessageBox.Show("Your new stock for product '" + comboBox1.Text + "' is " + total);
            }
            textBox1.Text            = "";
            stoves                   = client.GetStoves().ToList();
            comboBox1.DataSource     = stoves;
            dataGridView1.DataSource = stoves;
        }