Esempio n. 1
0
        private void FillCategories()
        {
            ItemIntValue none = new ItemIntValue();

            none.ID   = -1;
            none.Name = " - не вибрано - ";
            List <ItemIntValue> items0 = new List <ItemIntValue>();

            WareCategoriesLogic categories = new WareCategoriesLogic(manager);

            items0.Clear();
            //items0.Add(none);
            foreach (var a in categories.GetCategoriesHierarchy().OrderBy(a => a.Name))
            {
                ItemIntValue i = new ItemIntValue();
                i.ID   = a.ID;
                i.Name = a.Name;
                items0.Add(i);
            }
            CategoriesCB.DataSource = items0;
            if ((mode == "new") & (defaultCategoryId != null))
            {
                foreach (ItemIntValue i in CategoriesCB.Items)
                {
                    if (i.ID == Convert.ToInt32(defaultCategoryId))
                    {
                        CategoriesCB.SelectedItem = i;
                    }
                }
            }
            CategoriesCB.ValueMember   = "ID";
            CategoriesCB.DisplayMember = "Name";
            CategoriesCB.Update();
        }
Esempio n. 2
0
        //public string WareName
        //{
        //    get
        //    {
        //        string result = null;
        //        if (NameTB.Text.Length > 0)
        //        {
        //            result = NameTB.Text;
        //        }
        //        return result;
        //    }
        //}

        public void Fill()
        {
            ItemIntValue none = new ItemIntValue();

            none.ID   = -1;
            none.Name = " - не вибрано - ";
            List <ItemIntValue> items0 = new List <ItemIntValue>();

            WareCategoriesLogic categories = new WareCategoriesLogic(manager);

            items0.Clear();
            //items0.Add(none);
            foreach (var a in categories.GetCategoriesHierarchy().OrderBy(a => a.Name))
            {
                ItemIntValue i = new ItemIntValue();
                i.ID   = a.ID;
                i.Name = a.Name;
                items0.Add(i);
            }
            CategoriesCB.DataSource    = items0;
            CategoriesCB.ValueMember   = "ID";
            CategoriesCB.DisplayMember = "Name";
            CategoriesCB.Update();

            WareManufacturersLogic manufacturers = new WareManufacturersLogic(manager);
            List <ItemIntValue>    items1        = new List <ItemIntValue>();

            items1.Clear();
            items1.Add(none);
            foreach (var a in manufacturers.GetAll().OrderBy(a => a.Name))
            {
                ItemIntValue i = new ItemIntValue();
                i.ID   = a.ID;
                i.Name = a.Name;
                items1.Add(i);
            }
            //ManufacturersCB.DataSource = manufacturers.GetAll();
            ManufacturersCB.DataSource    = items1;
            ManufacturersCB.ValueMember   = "ID";
            ManufacturersCB.DisplayMember = "Name";
            ManufacturersCB.Update();

            WareUnitsLogic      units  = new WareUnitsLogic(manager);
            List <ItemIntValue> items2 = new List <ItemIntValue>();

            items2.Clear();
            items2.Add(none);
            foreach (var a in units.GetAll().OrderBy(a => a.Name))
            {
                ItemIntValue i = new ItemIntValue();
                i.ID   = a.ID;
                i.Name = a.Name;
                items2.Add(i);
            }
            UnitsCB.DataSource    = items2;
            UnitsCB.ValueMember   = "ID";
            UnitsCB.DisplayMember = "Name";
            UnitsCB.Update();
        }
Esempio n. 3
0
        public ActionNew()
        {
            InitializeComponent();
            ContextManager          manager = new ContextManager();
            SecurityCategoriesLogic cl      = new SecurityCategoriesLogic(manager);

            CategoriesCB.DataSource = cl.GetAll();

            CategoriesCB.Update();
            //CategoriesCB.Items.AddRange(cl.GetAll());
            //foreach (var c in cl.GetAll())
            //{

            //    CategoriesCB.Items.Add(
            //}
            manager.CloseContext();
        }
Esempio n. 4
0
        private void FillCategories()
        {
            ItemIntValue none = new ItemIntValue();

            none.ID   = -1;
            none.Name = " - не вибрано - ";
            List <ItemIntValue> items0 = new List <ItemIntValue>();

            WareCategoriesLogic categories = new WareCategoriesLogic(manager);

            items0.Clear();
            //items0.Add(none);
            foreach (var a in categories.GetCategoriesHierarchy().OrderBy(a => a.Name))
            {
                ItemIntValue i = new ItemIntValue();
                i.ID   = a.ID;
                i.Name = a.Name;
                items0.Add(i);
            }
            CategoriesCB.DataSource    = items0;
            CategoriesCB.ValueMember   = "ID";
            CategoriesCB.DisplayMember = "Name";
            CategoriesCB.Update();
        }