private static void GetOrderItemComponentComponents(ref OrderItemComponent component)
        {
            SqliteConnection connection2 = new SqliteConnection();
            connection2.ConnectionString = "Data Source = " + System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal) + "/" + fileName + ";Version=3;";

            connection2.Open();

            SqliteCommand command = new SqliteCommand();
            command.Connection = connection2;
            command.CommandType = CommandType.Text;
            command.CommandText = "select OrderItemComponentComponents.OrderItemComponentsId, Components.Id, Components.Name, Components.DisplayName, OrderItemComponentComponents.Portions from OrderItemComponentComponents inner join Components on Components.Id = OrderItemComponentComponents.ComponentId where OrderItemComponentComponents.OrderItemComponentsId = " + component.Id.ToString();

            SqliteDataReader reader = command.ExecuteReader();

            while (reader.Read())
            {
                int parentId = reader.GetInt32(0);
                int componentId = reader.GetInt32(1);
                string name = reader.GetString(2);
                string displayName = reader.GetString(3);
                int portions = reader.GetInt32(4);

                OrderItemComponentComponent newComponent = new OrderItemComponentComponent(parentId, componentId, name, displayName, portions);
                component.AddComponent(newComponent);
            }

            reader.Close();
            connection2.Close();
        }
 public OrderItemComponentComponentModel(OrderItemComponentComponent component)
 {
     parentId    = component.ParentId;
     componentId = component.ComponentId;
     name        = component.Name;
     displayName = component.DisplayName;
     portions    = component.Portions;
 }
Beispiel #3
0
 public OrderItemComponentComponentModel(OrderItemComponentComponent component)
 {
     //id = component.Id;
     parentId    = component.ParentId;
     componentId = component.ComponentId;
     name        = component.Name;
     displayName = component.DisplayName;
     cost        = component.Cost;
     price       = component.Price;
     portions    = component.Portions;
 }