Esempio n. 1
0
 public Ware(string n, double p, uint q, WareCategory c)
 {
     name     = n;
     price    = p;
     Quantity = q;
     category = c;
 }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="category">батьківська категорія</param>
        private void FillCategoriesHierarchy(WareCategory category, string prefix, bool start)
        {
            if (start == true)
            {
                items.Clear();
            }
            WareCategoriesLogic categoriesLogic = new WareCategoriesLogic(manager);
            List <WareCategory> categories      = new List <WareCategory>();

            if (category == null)
            {
                categories = categoriesLogic.GetAllRoot();
            }
            else
            {
                categories = categoriesLogic.GetAll(category.ID);
            }

            foreach (WareCategory a in categories)
            {
                ItemIntValue item = new ItemIntValue();
                item.ID    = a.ID;
                item.Name  = prefix + a.Name;
                item.Image = a.Image;
                items.Add(item);
                FillCategoriesHierarchy(a, prefix + @"    ", false);
            }
        }
Esempio n. 3
0
        private void Fill()
        {
            WareCategoriesLogic cl = new WareCategoriesLogic(manager);

            FillCategoriesHierarchy(null, "");
            CategoriesCB.DataSource = items;
            if (mode == "edit")
            {
                WareCategory category = cl.Get(Convert.ToInt32(id));
                if (category != null)
                {
                    NameTB.Text = category.Name;
                    foreach (ItemIntValue i in items)
                    {
                        if (category.ParentCategoryID == i.ID)
                        {
                            CategoriesCB.SelectedItem = i;
                        }
                    }
                    ImagePB.SizeMode = PictureBoxSizeMode.Zoom;
                    _image           = Helpers.ImageOperations.ByteArrayToImage(category.Image);
                    image            = category.Image;
                    ImagePB.Image    = _image;
                }
            }
        }
Esempio n. 4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="category">батьківська категорія</param>
        private void FillCategoriesHierarchy(WareCategory category, string prefix)
        {
            if (items.Count == 0)
            {
                ItemIntValue none = new ItemIntValue();

                none.Name = " - не вибрано -";
                items.Add(none);
            }
            WareCategoriesLogic categoriesLogic = new WareCategoriesLogic(manager);
            List <WareCategory> categories      = new List <WareCategory>();

            if (category == null)
            {
                categories = categoriesLogic.GetAllRoot();
            }
            else
            {
                categories = categoriesLogic.GetAll(category.ID);
            }

            foreach (WareCategory a in categories)
            {
                //TreeNode node = new TreeNode(;
                //node.Text = a.Name;
                //node.
                ItemIntValue item = new ItemIntValue();
                item.ID   = a.ID;
                item.Name = prefix + a.Name;
                items.Add(item);

                //CategoriesTV.Nodes.Add(a.ID.ToString(), a.Name);

                FillCategoriesHierarchy(a, prefix + @"   ");
            }
        }