Example #1
0
        private void AddStoveandRegulator_Load(object sender, EventArgs e)
        {
            Location = new Point(-7, 50);
            int w = SystemInformation.VirtualScreen.Width + 14;
            int h = SystemInformation.VirtualScreen.Height - 43;

            Size = new Size(w, h);
            dataGridView1.DefaultCellStyle.Font = new Font("Microsoft Sans Serif", 10);
            using (StockMgntRef.StockMgntClient client = new StockMgntRef.StockMgntClient())
            {
                dataGridView1.DataSource = client.GetStoves();
                stoves = client.GetStoves().ToList();
                if (stoves.Count >= 10)
                {
                    textBox3.Enabled = false;
                    textBox4.Enabled = false;
                    textBox5.Enabled = false;
                    button3.Enabled  = false;
                }
                string[] stoveTypes = stoves.Where(x => x.Price != 0).Select(x => x.Product).ToArray();
                comboBox2.Items.AddRange(stoveTypes);
                comboBox1.Items.AddRange(stoveTypes);

                var reg = client.GetRegulators();
                roldQty = reg.Quentity;
                //textBox6.Text = roldQty.ToString();
                label16.Text = roldQty + " piece(s)";
            }
        }
Example #2
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 button2_Click(object sender, EventArgs e)
        {
            double imageWidth, sPrice = 0;

            if (double.TryParse(textBox2.Text, out imageWidth))
            {
                sPrice = imageWidth;
            }
            if (sPrice > 0)
            {
                StockMgntRef.StockMgntClient client = new StockMgntRef.StockMgntClient();
                var msg = client.SetStovePrice(selectedStove.Product, sPrice);
                if (msg.Equals("OK"))
                {
                    MessageBox.Show("Successfully Updated Price of Product '" + selectedStove.Product + "' . New price is " + sPrice + " Rs.");
                }
                stoves = client.GetStoves().ToList();
            }
            else
            {
                textBox2.Text = sPrice.ToString();
                MessageBox.Show("Invalid Price!!!");
            }
            textBox2.Text = "";
            comboBox2.Items.Clear();
            string[] stoveTypes = stoves.Where(x => x.Price != 0).Select(x => x.Product).ToArray();
            comboBox2.Items.AddRange(stoveTypes);
        }
        private void BillStoveRegulator_Load(object sender, EventArgs e)
        {
            Location = new Point(-7, 50);
            int w = SystemInformation.VirtualScreen.Width + 14;
            int h = SystemInformation.VirtualScreen.Height - 43;

            Size = new Size(w, h);
            dataGridView1.DefaultCellStyle.Font = new System.Drawing.Font("Microsoft Sans Serif", 10);
            dataGridView2.DefaultCellStyle.Font = new System.Drawing.Font("Microsoft Sans Serif", 10);
            dataGridView3.DefaultCellStyle.Font = new System.Drawing.Font("Microsoft Sans Serif", 10);
            using (StockMgntRef.StockMgntClient client = new StockMgntRef.StockMgntClient())
            {
                stoves = client.GetStoves().ToList();
                List <StockMgntRef.Stove> stoveTypes = stoves.Where(x => x.Price != 0).Select(x => x).ToList();
                dataGridView2.DataSource = stoveTypes;
            }
            using (CustomerMgntRef.CustomerMgntClient client1 = new CustomerMgntRef.CustomerMgntClient())
            {
                customersNames = client1.GetCustomersName();
                AutoCompleteStringCollection acsc = new AutoCompleteStringCollection();
                acsc.AddRange(customersNames);
                textBox1.AutoCompleteMode         = AutoCompleteMode.Suggest;
                textBox1.AutoCompleteSource       = AutoCompleteSource.CustomSource;
                textBox1.AutoCompleteCustomSource = acsc;
            }
        }
Example #5
0
        private void button4_Click(object sender, EventArgs e)
        {
            StockMgntRef.StockMgntClient client = new StockMgntRef.StockMgntClient();
            var msg = client.RemoveStove(comboBox2.Text);

            if (msg.Equals("OK"))
            {
                MessageBox.Show("Successfully removed 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);
        }
Example #6
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;
        }
        private void ViewStock_Load(object sender, EventArgs e)
        {
            Location = new Point(-7, 50);
            int w = SystemInformation.VirtualScreen.Width + 14;
            int h = SystemInformation.VirtualScreen.Height - 43;

            Size = new Size(w, h);

            dataGridView1.DefaultCellStyle.Font = new Font("Microsoft Sans Serif", 10);
            dataGridView2.DefaultCellStyle.Font = new Font("Microsoft Sans Serif", 10);
            using (StockMgntRef.StockMgntClient client = new StockMgntRef.StockMgntClient())
            {
                dataGridView1.DataSource = client.GetCylinders();
                dataGridView2.DataSource = client.GetStoves();
                var reg = client.GetRegulators();
                label3.Text += reg.Quentity + " piece(s)";
                label5.Text += reg.Price + " Rs.";
            }
        }
        private void SetPrice_Load(object sender, EventArgs e)
        {
            Location = new Point(-7, 50);
            int w = SystemInformation.VirtualScreen.Width + 14;
            int h = SystemInformation.VirtualScreen.Height - 43;

            Size = new Size(w, h);
            using (StockMgntRef.StockMgntClient client = new StockMgntRef.StockMgntClient())
            {
                cylinders = client.GetCylinders().ToList();
                string[] cyTypes = cylinders.Where(x => x.Price != 0).Select(x => x.CylinderType).ToArray();
                comboBox1.Items.AddRange(cyTypes);

                stoves = client.GetStoves().ToList();
                string[] stoveTypes = stoves.Where(x => x.Price != 0).Select(x => x.Product).ToArray();
                comboBox2.Items.AddRange(stoveTypes);

                var reg = client.GetRegulators();
                textBox3.Text = reg.Price.ToString();
            }
        }