private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            ManufacturerItem manu = new ManufacturerItem();
            manu.id = mManufacturers.Count == 0 ? 0 : mManufacturers.Max(x => x.id) + 1;
            manu.uidisplayname = "New manufacturer";
            mManufacturers.Add(manu);

            manufacturersUpdates.Enqueue(() =>
                {
                    mParent.AddManufacturer(manu);
                });
        }
Exemplo n.º 2
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            ManufacturerItem manu = new ManufacturerItem();

            manu.id            = mManufacturers.Count == 0 ? 0 : mManufacturers.Max(x => x.id) + 1;
            manu.uidisplayname = "New manufacturer";
            mManufacturers.Add(manu);

            manufacturersUpdates.Enqueue(() =>
            {
                mParent.AddManufacturer(manu);
            });
        }
Exemplo n.º 3
0
        public void ChangemanufacturerID(int oldID, int newID)
        {
            ManufacturerItem manuf = jsonBase.manufacturers.First(x => x.id == oldID);

            TraverseProducts((product) =>
            {
                if (product.manufacturerid == oldID)
                {
                    product.manufacturerid = newID;
                }
            });

            manuf.id = newID;
        }
Exemplo n.º 4
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Button           b     = sender as Button;
            ManufacturerItem manuf = b.DataContext as ManufacturerItem;

            int idx = mManufacturers.IndexOf(manuf);

            manufacturersUpdates.Enqueue(() => mParent.RemoveManufacturer(manuf.id));
            if (idx < mManufacturers.Count - 1)
            {
                ManufacturerItem lastManufacturer = mManufacturers.Last();
                manufacturersUpdates.Enqueue(() =>
                {
                    mParent.ChangemanufacturerID(lastManufacturer.id, manuf.id);
                });
                lastManufacturer.id = manuf.id;
            }
            mManufacturers.RemoveAt(idx);
        }
Exemplo n.º 5
0
        public void RemoveManufacturer(int manufID)
        {
            ManufacturerItem manuf = jsonBase.manufacturers.First(x => x.id == manufID);

            for (int i = 0; i < jsonBase.elements.Count; i++)                           //izby
            {
                for (int j = 0; j < jsonBase.elements[i].child.Count; j++)              //Typ
                {
                    for (int k = 0; k < jsonBase.elements[i].child[j].child.Count; k++) //Typ Typ
                    {
                        for (int l = jsonBase.elements[i].child[j].child[k].products.Count - 1; l >= 0; l--)
                        {
                            if (jsonBase.elements[i].child[j].child[k].products[l].manufacturerid == manufID)
                            {
                                jsonBase.elements[i].child[j].child[k].products.RemoveAt(l);
                            }
                        }
                    }
                }
            }

            jsonBase.manufacturers.Remove(manuf);
        }
Exemplo n.º 6
0
 public void AddManufacturer(ManufacturerItem manuf)
 {
     jsonBase.manufacturers.Add(manuf);
 }
Exemplo n.º 7
0
 public void AddManufacturer(ManufacturerItem manuf)
 {
     jsonBase.manufacturers.Add(manuf);
 }