Esempio n. 1
0
        public void Fill()
        {
            ItemIntValue none = new ItemIntValue();
            none.ID = -1;
            none.Name = " - не вибрано - ";
            List<ItemIntValue> items0 = new List<ItemIntValue>();

            DocumentTypesLogic documentTypesLogic = new DocumentTypesLogic(manager);
            items0.Clear();
            items0.Add(none);
            foreach (var a in documentTypesLogic.GetAll().OrderBy(a => a.Name))
            {
                ItemIntValue i = new ItemIntValue();
                i.ID = a.ID;
                i.Name = a.Name;
                items0.Add(i);
            }
            DocumentTypesCB.DataSource = items0;
            DocumentTypesCB.ValueMember = "ID";
            DocumentTypesCB.DisplayMember = "Name";
            DocumentTypesCB.Update();

            DateTime startDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
        }
Esempio n. 2
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+@"   ");
            }
        }
Esempio n. 3
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. 4
0
        private void FillSelectedEmployees()
        {
            if (sheduler != null)
            {
                StaffShedulerEmployeesLogic shedulerEmployees = new StaffShedulerEmployeesLogic(manager);

                var employees = shedulerEmployees.GetBySheduler(sheduler.ID).Select(a => new { a.StaffEmployee.ID, Name = a.StaffEmployee.LastName + " "
                    + a.StaffEmployee.FirstName + " "
                    + a.StaffEmployee.MiddleName });
                foreach (var employee in employees)
                {
                    ItemIntValue item = new ItemIntValue();
                    item.ID = employee.ID;
                    item.Name = employee.Name;
                    SelectedEmployeesLB.Items.Add(item);
                }
            }
        }
Esempio n. 5
0
        private void FillAvailableEmployees()
        {
            AvailableEmployeesLB.Items.Clear();
            StaffEmployeeLogic employeesLogic = new StaffEmployeeLogic(manager);
            StaffEmployeePositionsLogic employeePositionsLogic = new StaffEmployeePositionsLogic(manager);

            //List<StaffEmployee> employees = employeesLogic.GetAll().Select(a => new { a.ID, a.LastName + " " + a.FirstName + " " + a.MiddleName});
            AvailableEmployeesLB.ValueMember = "ID";
            AvailableEmployeesLB.DisplayMember = "Name";

            int structureObjectId = Convert.ToInt32(StructureObjectsCB.SelectedValue);

            //BindingList<Helpers.ItemIntValue> structureObjects = structureObjectsLogic.GetStructureObjectsHierarchy(false, structureObjectId);

            List<StaffEmployee> filteredEmloyees = employeePositionsLogic.GetByPositionID(Convert.ToInt32(PositionsCB.SelectedValue)).Select(a => a.StaffEmployee).ToList();
            var employees = employeesLogic.GetAll().Where(a => filteredEmloyees.Contains(a)).Select(a => new { a.ID, Name = a.LastName + " " + a.FirstName + " " + a.MiddleName });
            foreach(var employee in employees)
            {
                ItemIntValue item = new ItemIntValue();
                item.ID = employee.ID;
                item.Name = employee.Name;
                AvailableEmployeesLB.Items.Add(item);
            }
        }
Esempio n. 6
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. 7
0
 private void FillStates()
 {
     StatesCB.Items.Clear();
     StatesOfDocumentsLogic statesLogic = new StatesOfDocumentsLogic(manager);
     Compas.Helpers.ItemIntValue item = new ItemIntValue();
     StatesCB.DisplayMember = "Name";
     StatesCB.ValueMember = "ID";
     item.ID = -1;
     item.Name = "- не обрано -";
     StatesCB.Items.Add(item);
     foreach (var s in statesLogic.GetAll())
     {
         item = new ItemIntValue();
         item.ID = s.ID;
         item.Name = s.Name;
         StatesCB.Items.Add(item);
     }
     StatesCB.SelectedIndex = 0;
 }
Esempio n. 8
0
        private void FillUnits()
        {
            ItemIntValue none = new ItemIntValue();
            none.ID = -1;
            none.Name = " - не вибрано - ";

            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();
            if(UnitsCB.Items.Count > 1)
                UnitsCB.SelectedIndex = 1;
        }
Esempio n. 9
0
        private void FillManufacturers()
        {
            ItemIntValue none = new ItemIntValue();
            none.ID = -1;
            none.Name = " - не вибрано - ";
            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 = items1;
            ManufacturersCB.ValueMember = "ID";
            ManufacturersCB.DisplayMember = "Name";
            ManufacturersCB.Update();
        }
Esempio n. 10
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. 11
0
        private void Fill()
        {
            ItemIntValue none = new ItemIntValue();
            none.ID = -1;
            none.Name = " - не вибрано - ";

            FillCategories();

            FillManufacturers();

            FillUnits();

            FillSecondaryUnits();

            FillCodes();

            FillTimeLimits();

            if (mode == "edit")
            {
                WaresLogic wares = new WaresLogic(manager);

                var ware = wares.Get(Convert.ToInt32(id));
                if (ware != null)
                {
                    NameTB.Text = ware.Name;
                    int? categoryId = ware.CategoryID;
                    int? manufacturerId = ware.ManufacturerID;
                    int? unitId = ware.UnitID;
                    int? secondaryUnitId = ware.SecondaryUnitID;
                    decimal? secondaryUnitQuantity = ware.SecondaryUnitQuantity;
                    if (secondaryUnitQuantity != null)
                        SecondaryQuantityNUD.Value = Convert.ToDecimal(secondaryUnitQuantity);

                    if (categoryId != null)
                    {
                       int i = 0;
                       foreach (ItemIntValue a in CategoriesCB.Items)
                       {
                           if (a.ID == categoryId)
                           {
                               CategoriesCB.SelectedIndex = i;
                           }
                           i++;
                       }
                    }

                    if (unitId != null)
                    {
                        int i = 0;
                        foreach (ItemIntValue a in UnitsCB.Items)
                        {
                            if (a.ID == unitId)
                            {
                                UnitsCB.SelectedIndex = i;
                            }
                            i++;
                        }
                    }

                    if (secondaryUnitId != null)
                    {
                        int i = 0;
                        foreach (ItemIntValue a in SecondaryUnitsCB.Items)
                        {
                            if (a.ID == secondaryUnitId)
                            {
                                SecondaryUnitsCB.SelectedIndex = i;
                            }
                            i++;
                        }
                    }

                    if (manufacturerId != null)
                    {
                        int i = 0;
                        foreach (ItemIntValue a in ManufacturersCB.Items)
                        {
                            if (a.ID == manufacturerId)
                            {
                                ManufacturersCB.SelectedIndex = i;
                            }
                            i++;
                        }
                    }

                    ImagePB.SizeMode = PictureBoxSizeMode.Zoom;
                    _image = Helpers.ImageOperations.ByteArrayToImage(ware.Image);
                    image = ware.Image;
                    ImagePB.Image = _image;
                }
            }
        }
Esempio n. 12
0
        private void FillStructureObjects()
        {
            StaffStructureObjectsLogic StructureObjects = new StaffStructureObjectsLogic(manager);
            StructureObjectsCB.ValueMember = "ID";
            StructureObjectsCB.DisplayMember = "Name";
            StructureObjectsCB.DropDownStyle = ComboBoxStyle.DropDownList;
            ItemIntValue none = new ItemIntValue();
            //none.ID = -1;
            none.Name = "- не вибрано -";
            List<ItemIntValue> list = new List<ItemIntValue>();
            list.Add(none);
            list.AddRange(StructureObjects.GetStructureObjectsHierarchy(true).Select(a => a));

            StructureObjectsCB.DataSource = list;
        }