コード例 #1
0
        private void ConfigureGridGroupByModelName()
        {
            var grouper = new Subro.Controls.DataGridViewGrouper(productDetailsDataGridView);

            grouper.SetGroupOn(ModelNameColumn);
            grouper.DisplayGroup         += grouper_DisplayGroup;
            grouper.Options.ShowGroupName = false;
            grouper.Options.ShowCount     = false;
        }
コード例 #2
0
        public MainForm()
        {
            InitializeComponent();
            dgvVersions.AutoGenerateColumns = true;
            var grouper = new Subro.Controls.DataGridViewGrouper(dgvVersions);

            grouper.SetGroupOn("Version");
            grouper.DisplayGroup          += grouper_DisplayGroup;
            grouper.Options.StartCollapsed = true;
            grouper.CollapseAll();
        }
        public ProjectsCommentViewPartControl()
        {
            InitializeComponent();
            loadingProgressBar.Visible = false;
            targetLanguageBasedProjectEntryBindingSource.DataSource = _projectEntries;
            var grouper = new Subro.Controls.DataGridViewGrouper(projectsDGV);

            grouper.SetGroupOn <TargetLanguageBasedProjectEntry>(x => x.ProjectName);
            grouper.Options.ShowCount     = false;
            grouper.Options.ShowGroupName = false;
            grouper.DisplayGroup         += GrouperOnDisplayGroup;
        }
コード例 #4
0
 /// <summary>
 /// Clean up any resources being used.
 /// </summary>
 /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
 protected override void Dispose(bool disposing)
 {
     Grouper = null;
     if (cm != null)
     {
         cm.Dispose();
     }
     if (disposing && (components != null))
     {
         components.Dispose();
     }
     base.Dispose(disposing);
 }
            public FormJumpTo(DataGridViewGrouper Grouper)
            {
                this.Grouper     = Grouper;
                this.GrouperGrid = Grouper.DataGridView;


                dg.AutoGenerateColumns = false;
                dg.Columns.Add(new DataGridViewTextBoxColumn()
                {
                    DataPropertyName = "Value",
                    HeaderText       = "Group",
                    AutoSizeMode     = DataGridViewAutoSizeColumnMode.Fill,
                    ReadOnly         = true
                });
                dg.Columns.Add(new DataGridViewTextBoxColumn()
                {
                    DataPropertyName = "Count",
                    Width            = 60,
                    ReadOnly         = true
                });
                dg.Columns.Add(new DataGridViewCheckBoxColumn()
                {
                    DataPropertyName = "Collapsed",
                    HeaderText       = "Collapse",
                    Width            = 60
                });

                dg.AllowUserToAddRows    = false;
                dg.AllowUserToDeleteRows = false;

                ClientSize = new Size(400, 400);

                dg.Dock = DockStyle.Fill;

                Controls.Add(dg);
                Controls.Add(new DataGridSearchBox()
                {
                    DataGridView = dg, Dock = DockStyle.Top, ShowOptionsButton = true
                });
                dg.CreateControl();
            }
コード例 #6
0
        public ExampleWithComponent()
        {
            InitializeComponent();

            //the component can be added in designer, or as done here on the fly
            var grouper = new Subro.Controls.DataGridViewGrouper(dataGridView1);

            grouper.SetGroupOn("AString");

            //also valid:
            //grouper.SetGroupOn<TestData>(t => t.AString);
            //grouper.SetGroupOn(this.dataGridView1.Columns["AString"]);


            //all options available in the control (via the dropdown menu) can be set in code as well and vice versa all options in this example can be set via the control.

            //to start with all rows collapsed on a (re)load or when the group is changed you can set the option startcollapsed:
            //grouper.Options.StartCollapsed = true;

            //to collapse all loaded rows: (the difference with setting the option above, is that after choosing a new grouping (or on a reload), the new groups would expand.
            //grouper.CollapseAll();

            //if you don't want the (rowcount) to be shown in the headers:
            //grouper.Options.ShowCount = false;

            //if you don't want the grouped column name to be repeated in the headers:
            //grouper.Options.ShowGroupName = false;

            //default sort order for the groups is ascending, you can change that in the options as well (ascending, descending or none)
            //grouper.Options.GroupSortOrder = SortOrder.Descending;

            //besides grouping on a property/column value, you can set a custom group:
            //grouper.SetCustomGroup<TestData>(t => t.AnInt % 10, "Mod 10");

            //to customize the grouping display, you can attach to the DisplayGroup event:
            grouper.DisplayGroup += grouper_DisplayGroup;
        }
コード例 #7
0
        private void khoiTao()
        {
            dictionaryDataSource  = new Dictionary <string, Dictionary <string, GoiMonDataSource> >();
            listLayoutThucAn      = new List <FlowLayoutPanel>();
            listLayoutSanPham     = new List <FlowLayoutPanel>();
            listDictionaryThucAn  = new List <Dictionary <int, List <FoodLayout> > >();
            listDictionarySanPham = new List <Dictionary <int, List <FoodLayout> > >();

            listDictionaryHangHoa = new List <List <Dictionary <int, List <FoodLayout> > > >();

            dictionaryThucAn   = new Dictionary <int, List <FoodLayout> >();
            dictionaryMonAn    = new Dictionary <int, List <HangHoa> >();
            dictionaryTraiCay  = new Dictionary <int, List <FoodLayout> >();
            dictionaryNuocUong = new Dictionary <int, List <FoodLayout> >();
            TongCong           = 0;
            loaiHienTai        = Loai.ThucAn;
            loaiThucAnHienTai  = 1;
            loaiSanPhamHienTai = 1;

            giamGia         = BUS.LoaiKhachHangBUS.LayGiamGia(soHoaDon);
            txtGiamGia.Text = giamGia.ToString() + "%";
            listFoodLayout  = new List <FoodLayout>();
            hashMaHangHoa   = new HashSet <string>();
            dGVHoaDon.AllowUserToAddRows = false;
            bindingSource.Add(new GoiMonDataSource());
            dGVHoaDon.DataSource = bindingSource;
            bindingSource.RemoveAt(0);
            dGVHoaDon.Columns["Ten"].HeaderText = "Tên";

            dGVHoaDon.Columns["Gia"].HeaderText = "Giá";

            dGVHoaDon.Columns["Soluong"].HeaderText     = "Số lượng";
            dGVHoaDon.Columns["Thanhtien"].HeaderText   = "Thành tiền";
            dGVHoaDon.Columns["Ma"].Visible             = false;
            dGVHoaDon.Columns["Loai"].Visible           = false;
            dGVHoaDon.Columns["IndexDict"].Visible      = false;
            dGVHoaDon.Columns["MaLoaiHangHoa"].Visible  = false;
            dGVHoaDon.Columns["TenLoaiHangHoa"].Visible = false;
            dGVHoaDon.Columns["IndexList"].Visible      = false;
            //  dGVHoaDon.Columns["DonViTinh"].Visible = false;
            dGVHoaDon.Columns["Gia"].ReadOnly       = true;
            dGVHoaDon.Columns["Ten"].ReadOnly       = true;
            dGVHoaDon.Columns["Thanhtien"].ReadOnly = true;

            var grouper = new Subro.Controls.DataGridViewGrouper(dGVHoaDon);

            grouper.SetGroupOn("MaLoaiHangHoa");
            //grouper.Options.GroupSortOrder = SortOrder.None;
            grouper.DisplayGroup += grouper_DisplayGroup;

            //lấy danh sách loại thức ăn ra đưa vào tabcontrol nhỏ
            List <LoaiMon> listLoaiMon = BUS.MonAnBUS.XemLoaiMon();

            if (listLoaiMon != null)
            {
                tabControlThucAn.TabPages.Clear();
                for (int i = 0; i < listLoaiMon.Count; i++)
                {
                    FlowLayoutPanel flowFoodLayout = new FlowLayoutPanel();
                    flowFoodLayout.Dock = DockStyle.Fill;
                    listLayoutThucAn.Add(flowFoodLayout);
                    //listDictionaryThucAn
                    Dictionary <int, List <FoodLayout> > dictionary = new Dictionary <int, List <FoodLayout> >();
                    TabPage tabPage = new TabPage(listLoaiMon[i].Ten);
                    tabPage.Controls.Add(flowFoodLayout);
                    tabPage.Name = listLoaiMon[i].Ma;

                    tabControlThucAn.TabPages.Add(tabPage);
                    listDictionaryThucAn.Add(dictionary);
                }
            }
            //lấy danh sách loại sản phẩm đưa vào tabcontrol lớn
            List <LoaiHangHoa> listLoaiHangHoa = BUS.HangHoaBUS.XemLoaiMon((int)Loai.Sanham);

            if (listLoaiHangHoa != null)
            {
                //tabControl.TabPages.Clear();
                for (int i = 0; i < listLoaiHangHoa.Count; i++)
                {
                    FlowLayoutPanel flowFoodLayout = new FlowLayoutPanel();
                    flowFoodLayout.Dock = DockStyle.Fill;
                    listLayoutSanPham.Add(flowFoodLayout);
                    //listDictionaryThucAn
                    Dictionary <int, List <FoodLayout> > dictionary = new Dictionary <int, List <FoodLayout> >();
                    TabPage tabPage = new TabPage(listLoaiHangHoa[i].Ten);
                    tabPage.Controls.Add(flowFoodLayout);
                    tabPage.Name = listLoaiHangHoa[i].Ma;
                    tabControl.TabPages.Add(tabPage);
                    listDictionarySanPham.Add(dictionary);
                }
            }

            listTenGroup = BUS.HangHoaBUS.XemLoaiMon(-1);
            if (listTenGroup != null)
            {
                for (int i = 0; i < listTenGroup.Count; i++)
                {
                    dictionaryDataSource.Add(listTenGroup[i].Ten, new Dictionary <string, GoiMonDataSource>());
                }
            }
            if (soHoaDon != "")
            {
                List <GoiMonDataSource> temp = BUS.HoaDonBUS.XemChiTietHoaDonDatTiec(soHoaDon);
                if (temp != null)
                {
                    uint tongCong = 0;
                    //  bindingSource.DataSource = BUS.HoaDonBUS.XemChiTietHoaDon(soHoaDon);
                    for (int i = 0; i < temp.Count; i++)
                    {
                        hashMaHangHoa.Add(temp[i].Ma);
                        dictionaryDataSource[temp[i].TenLoaiHangHoa].Add(temp[i].Ma, temp[i]);
                        bindingSource.Add(temp[i]);
                        tongCong += uint.Parse(temp[i].Thanhtien);
                    }
                    TongCong = tongCong;
                }
            }

            thayDoiLoai();
        }
コード例 #8
0
        private void khoiTao()
        {
            dictionaryDataSource = new Dictionary <string, Dictionary <string, HangHoaDataSource> >();

            listLayoutHangHoa = new List <FlowLayoutPanel>();

            listDictionaryHangHoa = new List <Dictionary <int, List <FoodLayout> > >();



            TongCong          = 0;
            loaiHienTai       = 1;
            loaiThucAnHienTai = 1;


            giamGia = 0.0f;
            //txtGiamGia.Text = giamGia.ToString() + "%";
            listFoodLayout = new List <FoodLayout>();
            hashMaHangHoa  = new HashSet <string>();
            dGVHoaDon.AllowUserToAddRows = false;
            bindingSource.Add(new HangHoaDataSource());
            dGVHoaDon.DataSource = bindingSource;
            bindingSource.RemoveAt(0);
            dGVHoaDon.Columns["Ten"].HeaderText = "Tên";

            dGVHoaDon.Columns["Gia"].HeaderText = "Giá";

            dGVHoaDon.Columns["Soluong"].HeaderText     = "Số lượng";
            dGVHoaDon.Columns["Thanhtien"].HeaderText   = "Thành tiền";
            dGVHoaDon.Columns["DonViTinh"].HeaderText   = "Đơn vị tính";
            dGVHoaDon.Columns["Ma"].Visible             = false;
            dGVHoaDon.Columns["Loai"].Visible           = false;
            dGVHoaDon.Columns["IndexDict"].Visible      = false;
            dGVHoaDon.Columns["MaLoaiHangHoa"].Visible  = false;
            dGVHoaDon.Columns["TenLoaiHangHoa"].Visible = false;
            dGVHoaDon.Columns["IndexList"].Visible      = false;


            dGVHoaDon.Columns["Gia"].ReadOnly       = true;
            dGVHoaDon.Columns["Ten"].ReadOnly       = true;
            dGVHoaDon.Columns["Thanhtien"].ReadOnly = true;

            var grouper = new Subro.Controls.DataGridViewGrouper(dGVHoaDon);

            grouper.SetGroupOn("MaLoaiHangHoa");
            //grouper.Options.GroupSortOrder = SortOrder.None;
            grouper.DisplayGroup += grouper_DisplayGroup;

            FlowLayoutPanel flowFoodLayout = new FlowLayoutPanel();

            flowFoodLayout.Dock = DockStyle.Fill;
            listLayoutHangHoa.Add(flowFoodLayout);

            //lấy danh sách loại sản phẩm đưa vào tabcontrol lớn
            List <LoaiHangHoa> listLoaiHangHoa = BUS.HangHoaBUS.XemLoaiMon(1);

            if (listLoaiHangHoa != null)
            {
                //tabControl.TabPages.Clear();
                for (int i = 0; i < listLoaiHangHoa.Count; i++)
                {
                    flowFoodLayout      = new FlowLayoutPanel();
                    flowFoodLayout.Dock = DockStyle.Fill;
                    listLayoutHangHoa.Add(flowFoodLayout);

                    Dictionary <int, List <FoodLayout> > dictionary = new Dictionary <int, List <FoodLayout> >();
                    TabPage tabPage = new TabPage(listLoaiHangHoa[i].Ten);
                    tabPage.Controls.Add(flowFoodLayout);
                    tabPage.Name = listLoaiHangHoa[i].Ma;
                    tabControl.TabPages.Add(tabPage);
                    listDictionaryHangHoa.Add(dictionary);
                }
            }
            listTenGroup = new List <LoaiHangHoa>();
            listTenGroup.AddRange(BUS.HangHoaBUS.XemLoaiMon(2));
            if (listTenGroup != null)
            {
                for (int i = 0; i < listTenGroup.Count; i++)
                {
                    dictionaryDataSource.Add(listTenGroup[i].Ten, new Dictionary <string, HangHoaDataSource>());
                }
            }
            //if (soHoaDon != "")
            //{
            //    List<HangHoaDataSource> temp = BUS.HoaDonBUS.XemChiTietHoaDonGoiMon(soHoaDon);
            //    if (temp != null)
            //    {
            //        uint tongCong = 0;
            //        for (int i = 0; i < temp.Count; i++)
            //        {
            //            hashMaHangHoa.Add(temp[i].Ma);
            //            dictionaryDataSource[temp[i].TenLoaiHangHoa].Add(temp[i].Ma, temp[i]);
            //            bindingSource.Add(temp[i]);
            //            tongCong += uint.Parse(temp[i].Thanhtien);

            //        }
            //        TongCong = tongCong;

            //    }
            //}

            thayDoiLoai();
        }
 public DataGridViewGrouperContextMenuStrip(DataGridViewGrouper Grouper)
     : this()
 {
     this.Grouper = Grouper;
 }