Exemplo n.º 1
0
        private void FillWares()
        {
            WaresLogic wares = new WaresLogic(manager);

            int?categoryId     = null;
            int?manufacturerId = null;
            int?unitId         = null;

            //string name = wareFilterUC1.WareName;
            categoryId = categoriesUC2.SelectedCategoryID;
            if (categoryId < 0)
            {
                categoryId = null;
            }
            BindingSource   bs        = new BindingSource();
            List <ViewWare> waresList = wares.GetAllView("", categoryId, manufacturerId, unitId);

            view             = new SortableBindingList <ViewWare>(waresList);
            WaresGV.Visible  = false;
            WaresFLP.Visible = false;
            switch (this.WaresViewMode)
            {
            case WaresViewModes.GridView:
            {
                WaresGV.AutoGenerateColumns = false;
                WaresGV.AutoSizeRowsMode    = DataGridViewAutoSizeRowsMode.AllCells;
                WaresGV.DataSource          = view;
                WaresGV.Visible             = true;
                break;
            }

            case WaresViewModes.Button:
            {
                WaresFLP.Controls.Clear();
                WaresFLP.Dock = DockStyle.Fill;

                foreach (var ware in view)
                {
                    this.CreateButton(ware.ID.ToString(), ware.Name.ToString() + "\n" + "1" + ware.UnitName, Helpers.ImageOperations.ByteArrayToImage(ware.Image));
                }
                WaresFLP.Visible = true;
                break;
            }
            }
        }
Exemplo n.º 2
0
        private void FillWares()
        {
            WaresLogic wares = new WaresLogic(manager);

            int?categoryId     = null;
            int?manufacturerId = null;
            int?unitId         = null;

            //string name = wareFilterUC1.WareName;
            if (WareCategoriesLUE.EditValue != null)
            {
                categoryId = Convert.ToInt32(WareCategoriesLUE.EditValue);
            }
            if (UnitLUE.EditValue != null)
            {
                unitId = Convert.ToInt32(UnitLUE.EditValue);
            }

            var waresList = wares.GetAllView("", categoryId, manufacturerId, unitId);
            //var waresList = wares.GetAll("", categoryId, manufacturerId, unitId).Select(a => new
            //{
            //    a.ID,
            //    Name = a.Name,
            //    UnitName = a.WareUnit != null ? a.WareUnit.Name : "",
            //    ManufacturerName = a.WareManufacturer != null ? a.WareManufacturer.Name : "",
            //    CategoryName = a.WareCategory != null ? a.WareCategory.Name : "",
            //    SecondaryUnitID = a.SecondaryUnitID != null ? a.SecondaryUnitID : null,
            //    SecondaryUnitName = a.WareUnit1 != null ? a.WareUnit1.Name : "",
            //    SecondaryUnitQuantity = a.SecondaryUnitQuantity != null ? a.SecondaryUnitQuantity : null,
            //    a.WareCodes
            //});//.OrderBy(a => a.CategoryName).ThenBy(a=> a.Name).ToList();
            List <WareView> viewList = new List <WareView>();

            foreach (var a in waresList)
            {
                WareView wv = new WareView();
                wv.ID                    = a.ID;
                wv.Name                  = a.Name;
                wv.CategoryName          = a.WareCategoryName;
                wv.ManufacturerName      = a.ManufacturerName;
                wv.UnitName              = a.UnitName;
                wv.SecondaryUnitID       = a.SecondaryUnitID;
                wv.SecondaryUnitName     = a.SecondaryUnitName;
                wv.SecondaryUnitQuantity = a.SecondaryUnitQuantity;
                wv.WareCode              = a.WareCode == null ? "": a.WareCode;
                //wv.WareCodes = a.WareCodes.ToList();
                viewList.Add(wv);
            }

            //BindingListView<WareView> view = new BindingListView<WareView>(viewList);
            //bs.DataSource = view;
            //bs.Sort = columnName;

            view = new SortableBindingList <WareView>(viewList);

            WaresLUE.Properties.DataSource    = view;
            WaresLUE.Properties.ValueMember   = "ID";
            WaresLUE.Properties.DisplayMember = "Name";
            WaresLUE.Properties.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo("WareCode", 0, "Код"));
            WaresLUE.Properties.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo("Name", 0, "Назва"));
            WaresLUE.Properties.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo("ManufacturerName", 0, "Виробник"));
            WaresLUE.Properties.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo("UnitName", 0, "Осн. од. вим."));
            WaresLUE.Properties.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo("SecondUnitName", 0, "втор. од. вим."));
            WaresLUE.Properties.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo("CategoryName", 0, "Категорія"));
        }
Exemplo n.º 3
0
        private void FillWares()
        {
            WaresLogic wares = new WaresLogic(manager);

            int? categoryId = null;
            int? manufacturerId = null;
            int? unitId = null;
            //string name = wareFilterUC1.WareName;
            if( WareCategoriesLUE.EditValue != null)
                categoryId =Convert.ToInt32(WareCategoriesLUE.EditValue);
            if(UnitLUE.EditValue != null)
                unitId =Convert.ToInt32(UnitLUE.EditValue);

            var waresList = wares.GetAllView("", categoryId, manufacturerId, unitId);
            //var waresList = wares.GetAll("", categoryId, manufacturerId, unitId).Select(a => new
            //{
            //    a.ID,
            //    Name = a.Name,
            //    UnitName = a.WareUnit != null ? a.WareUnit.Name : "",
            //    ManufacturerName = a.WareManufacturer != null ? a.WareManufacturer.Name : "",
            //    CategoryName = a.WareCategory != null ? a.WareCategory.Name : "",
            //    SecondaryUnitID = a.SecondaryUnitID != null ? a.SecondaryUnitID : null,
            //    SecondaryUnitName = a.WareUnit1 != null ? a.WareUnit1.Name : "",
            //    SecondaryUnitQuantity = a.SecondaryUnitQuantity != null ? a.SecondaryUnitQuantity : null,
            //    a.WareCodes
            //});//.OrderBy(a => a.CategoryName).ThenBy(a=> a.Name).ToList();
            List<WareView> viewList = new List<WareView>();
            foreach (var a in waresList)
            {
                WareView wv = new WareView();
                wv.ID = a.ID;
                wv.Name = a.Name;
                wv.CategoryName = a.WareCategoryName;
                wv.ManufacturerName = a.ManufacturerName;
                wv.UnitName = a.UnitName;
                wv.SecondaryUnitID = a.SecondaryUnitID;
                wv.SecondaryUnitName = a.SecondaryUnitName;
                wv.SecondaryUnitQuantity = a.SecondaryUnitQuantity;
                wv.WareCode = a.WareCode == null ? "": a.WareCode;
                //wv.WareCodes = a.WareCodes.ToList();
                viewList.Add(wv);
            }

            //BindingListView<WareView> view = new BindingListView<WareView>(viewList);
            //bs.DataSource = view;
            //bs.Sort = columnName;

            view = new SortableBindingList<WareView>(viewList);

            WaresLUE.Properties.DataSource = view;
            WaresLUE.Properties.ValueMember = "ID";
            WaresLUE.Properties.DisplayMember = "Name";
            WaresLUE.Properties.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo("WareCode", 0, "Код"));
            WaresLUE.Properties.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo("Name", 0, "Назва"));
            WaresLUE.Properties.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo("ManufacturerName", 0, "Виробник"));
            WaresLUE.Properties.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo("UnitName", 0, "Осн. од. вим."));
            WaresLUE.Properties.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo("SecondUnitName", 0, "втор. од. вим."));
            WaresLUE.Properties.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo("CategoryName", 0, "Категорія"));
        }
Exemplo n.º 4
0
        private void Fill(string columnName)
        {
            DateTime   start = DateTime.Now;
            WaresLogic wares = new WaresLogic(manager);

            DataGV.AutoGenerateColumns = false;
            int?categoryId     = null;
            int?manufacturerId = null;
            int?unitId         = null;

            //string name = wareFilterUC1.WareName;
            if (categoriesFilterUC1.SelectedCategoryID >= 0)
            {
                categoryId = categoriesFilterUC1.SelectedCategoryID;
            }
            //manufacturerId = wareFilterUC1.ManufacturerID;
            //unitId = wareFilterUC1.UnitID;
            BindingSource bs = new BindingSource();



            var waresList = wares.GetAllView("", categoryId, manufacturerId, unitId);
            //    .Select(a => new
            //{
            //    a.ID,
            //    Name = a.Name,
            //    UnitName = a.WareUnit != null ? a.WareUnit.Name : "",
            //    ManufacturerName = a.WareManufacturer != null ? a.WareManufacturer.Name : "",
            //    CategoryName = a.WareCategory != null ? a.WareCategory.Name : "",
            //    CategoryID = a.CategoryID,
            //    SecondaryUnitID = a.SecondaryUnitID != null ? a.SecondaryUnitID : null,

            //   SecondaryUnitName = a.WareUnit1 != null ? a.WareUnit1.Name : "",
            //   SecondaryUnitQuantity = a.SecondaryUnitQuantity != null ? a.SecondaryUnitQuantity : null,
            //   a.WareCodes,
            //   a.WareTimeLimits
            //});//.OrderBy(a => a.CategoryName).ThenBy(a=> a.Name).ToList();
            //List<WareView> viewList = new List<WareView>();

            DateTime start0 = DateTime.Now;

            //foreach (var a in waresList)
            //{
            //    WareView wv = new WareView();
            //    wv.ID = a.ID;
            //    wv.CategoryID = a.CategoryID;
            //    wv.Name = a.Name;
            //    wv.CategoryName = a.CategoryName;
            //    wv.ManufacturerName = a.ManufacturerName;
            //    wv.UnitName = a.UnitName;
            //    wv.SecondaryUnitID = a.SecondaryUnitID;
            //    wv.SecondaryUnitName = a.SecondaryUnitName;
            //    wv.SecondaryUnitQuantity = a.SecondaryUnitQuantity;
            //    //wv.WareCodes = a.WareCodes.ToList();

            //    //var lastTimeLimit = (from aa in a.WareTimeLimits
            //    //                     where aa.Active == true
            //    //                     select aa).FirstOrDefault();
            //    //if (lastTimeLimit != null)
            //    //    wv.TimeLimit = lastTimeLimit.TimeLimit;
            //    //else
            //    //    wv.TimeLimit = 0;

            //    viewList.Add(wv);
            //}
            DateTime start1 = DateTime.Now;

            //BindingListView<WareView> view = new BindingListView<WareView>(viewList);
            //bs.DataSource = view;
            //bs.Sort = columnName;

            view = new SortableBindingList <ViewWare>(waresList);

            ListToDataTable listToDataTable = new ListToDataTable();

            DataGV.DataSource = listToDataTable.ToDataTable <ViewWare>(waresList);

            //DataGV.DataSource = view;
            DataGV.Update();
            DgvFilterManager filterManager = new DgvFilterManager(DataGV);
            DateTime         start2        = DateTime.Now;
            //MessageBox.Show(start.ToString() + " " + start0.ToString() + " " + start1.ToString() + " " + start2.ToString());
        }
Exemplo n.º 5
0
        private void Fill(string columnName)
        {
            DateTime start = DateTime.Now;
            WaresLogic wares = new WaresLogic(manager);
            DataGV.AutoGenerateColumns = false;
            int? categoryId = null;
            int? manufacturerId = null;
            int? unitId = null;
            //string name = wareFilterUC1.WareName;
            if(categoriesFilterUC1.SelectedCategoryID >= 0)
                categoryId = categoriesFilterUC1.SelectedCategoryID;
            //manufacturerId = wareFilterUC1.ManufacturerID;
            //unitId = wareFilterUC1.UnitID;
            BindingSource bs = new BindingSource();

            var waresList = wares.GetAllView("", categoryId, manufacturerId, unitId);
            //    .Select(a => new
            //{
            //    a.ID,
            //    Name = a.Name,
            //    UnitName = a.WareUnit != null ? a.WareUnit.Name : "",
            //    ManufacturerName = a.WareManufacturer != null ? a.WareManufacturer.Name : "",
            //    CategoryName = a.WareCategory != null ? a.WareCategory.Name : "",
            //    CategoryID = a.CategoryID,
            //    SecondaryUnitID = a.SecondaryUnitID != null ? a.SecondaryUnitID : null,

            //   SecondaryUnitName = a.WareUnit1 != null ? a.WareUnit1.Name : "",
            //   SecondaryUnitQuantity = a.SecondaryUnitQuantity != null ? a.SecondaryUnitQuantity : null,
            //   a.WareCodes,
            //   a.WareTimeLimits
            //});//.OrderBy(a => a.CategoryName).ThenBy(a=> a.Name).ToList();
            //List<WareView> viewList = new List<WareView>();

            DateTime start0 = DateTime.Now;

            //foreach (var a in waresList)
            //{
            //    WareView wv = new WareView();
            //    wv.ID = a.ID;
            //    wv.CategoryID = a.CategoryID;
            //    wv.Name = a.Name;
            //    wv.CategoryName = a.CategoryName;
            //    wv.ManufacturerName = a.ManufacturerName;
            //    wv.UnitName = a.UnitName;
            //    wv.SecondaryUnitID = a.SecondaryUnitID;
            //    wv.SecondaryUnitName = a.SecondaryUnitName;
            //    wv.SecondaryUnitQuantity = a.SecondaryUnitQuantity;
            //    //wv.WareCodes = a.WareCodes.ToList();

            //    //var lastTimeLimit = (from aa in a.WareTimeLimits
            //    //                     where aa.Active == true
            //    //                     select aa).FirstOrDefault();
            //    //if (lastTimeLimit != null)
            //    //    wv.TimeLimit = lastTimeLimit.TimeLimit;
            //    //else
            //    //    wv.TimeLimit = 0;

            //    viewList.Add(wv);
            //}
            DateTime start1 = DateTime.Now;
            //BindingListView<WareView> view = new BindingListView<WareView>(viewList);
            //bs.DataSource = view;
            //bs.Sort = columnName;

            view = new SortableBindingList<ViewWare>(waresList);

            ListToDataTable listToDataTable = new ListToDataTable();
            DataGV.DataSource = listToDataTable.ToDataTable<ViewWare>(waresList);

            //DataGV.DataSource = view;
            DataGV.Update();
            DgvFilterManager filterManager = new DgvFilterManager(DataGV);
            DateTime start2 = DateTime.Now;
            //MessageBox.Show(start.ToString() + " " + start0.ToString() + " " + start1.ToString() + " " + start2.ToString());
        }