Пример #1
0
        //Gets all Client's order (ID and price)
        //Returns a list of ViewModel ClientsOrder
        public static List <ClientsOrder> GetAllClientsOrder()
        {
            List <ClientsOrder> OrderList = new List <ClientsOrder>();

            using (SQLiteConnection connect = new SQLiteConnection(pathdb))
            {
                connect.Open();

                using (SQLiteCommand fmd = connect.CreateCommand())
                {
                    fmd.CommandText = @"SELECT *
                                        FROM Orders";

                    SQLiteDataReader q = fmd.ExecuteReader();

                    while (q.Read())
                    {
                        string       ID          = Convert.ToString(q["ID_Order"]);
                        int          price_order = Convert.ToInt32(q["Price"]);
                        ClientsOrder newOrder    = new ClientsOrder(ID, price_order);
                        OrderList.Add(newOrder);
                    }
                }

                using (SQLiteCommand fmd = connect.CreateCommand())
                {
                    Guid a = Guid.NewGuid();
                    fmd.CommandText = @"INSERT INTO Orders (ID_Order, Price) VALUES('" + a + "', 333333)";
                    fmd.ExecuteNonQuery();
                }


                return(OrderList);
            }
        }
Пример #2
0
        //ON COMBOBOX CHANGED : Updates the price depend on the Client's order selected
        private void orderid_SelectedIndexChanged(object sender, EventArgs e)
        {
            ClientsOrder order = (ClientsOrder)orderid.SelectedItem;

            price.Text = ((double)order.Price / 10000).ToString("0.##€");
        }