Ejemplo n.º 1
0
        private void MakeOrderButton_Click(object sender, EventArgs e)
        {
            try {
                var      result = Microsoft.VisualBasic.Interaction.InputBox("F&&V", "Enter the quantity", "1", -1, -1);
                string[] values = new string[8];
                //
                values[4] = DateTime.Today.ToShortDateString();
                values[1] = servConn.GetCurrentUser();
                values[0] = servConn.FindIdByName(goodsName).ToString();
                values[6] = result;
                Random rand = new Random();
                values[2] = "1";
                values[3] = rand.Next(10, 100).ToString();
                values[5] = "1";
                values[7] = "";


                List <string> attributes = new List <string>();
                attributes = servConn.GetAttributesTable("FV_Order").ToList();
                attributes.RemoveAt(0);

                servConn.InsertInto("FV_Order", values, attributes.ToArray());
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Ejemplo n.º 2
0
        private void CartButton_Click(object sender, EventArgs e)
        {
            if (serverConn != null)
            {
                var reader = serverConn.FindOrderByUsername(serverConn.GetCurrentUser());
                int total  = 0;

                while (reader.Read())
                {
                    total += Convert.ToInt32(serverConn.OrderCost(reader.GetValue(4).ToString()));
                }
                MessageBox.Show("Price for all products " + total.ToString());
            }
            else
            {
                MessageBox.Show("You are not logged in!");
            }
        }