Ejemplo n.º 1
0
        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();
        }
Ejemplo n.º 2
0
 public OrderItemComponentModel(OrderItemComponent component)
 {
     this.id          = component.Id;
     this.name        = component.Name;
     this.displayName = component.DisplayName;
     this.orderItemId = component.ParentId;
     this.componentId = component.ComponentId;
     this.portions    = component.Portions;
     this.position    = component.Position;
 }
 public OrderItemComponentModel(OrderItemComponent component)
 {
     this.id          = component.Id;
     this.orderItemId = component.OrderItemId;
     this.componentId = component.ComponentId;
     this.name        = component.Name;
     this.displayName = component.DisplayName;
     this.cost        = component.Cost;
     this.price       = component.Price;
     this.portions    = component.Portions;
     this.position    = component.Position;
     //foreach (OrderItemComponentComponent subComponent in component.Components)
     //    components.Add(subComponent.Id, new OrderItemComponentComponentModel(subComponent));
 }
Ejemplo n.º 4
0
        private void CreateContainerContentItems(List <ContainerItem> containerItems, ContainerItemWithGroupNode container, bool isRare)
        {
            int num = 0;

            if (isRare)
            {
                num = 100;
            }
            foreach (ContainerItem item in containerItems)
            {
                Entity entity = base.CreateEntity("ContainerContentItem");
                entity.AddComponent <ContainerContentItemComponent>();
                OrderItemComponent component = new OrderItemComponent {
                    Index = ++num
                };
                entity.AddComponent(component);
                if (isRare)
                {
                    entity.AddComponent <RareContainerContentItemComponent>();
                }
                DescriptionBundleItemComponent component3 = new DescriptionBundleItemComponent {
                    Names = container.descriptionBundleItem.Names
                };
                entity.AddComponent(component3);
                if (item.ItemBundles.Count == 1)
                {
                    SimpleContainerContentItemComponent component5 = new SimpleContainerContentItemComponent {
                        MarketItemId        = item.ItemBundles[0].MarketItem,
                        NameLokalizationKey = item.NameLocalizationKey
                    };
                    entity.AddComponent(component5);
                }
                else
                {
                    BundleContainerContentItemComponent component7 = new BundleContainerContentItemComponent {
                        MarketItems         = item.ItemBundles,
                        NameLokalizationKey = item.NameLocalizationKey
                    };
                    entity.AddComponent(component7);
                }
                entity.CreateGroup <ContainerContentItemGroupComponent>();
                container.containerGroup.Attach(entity);
            }
        }