示例#1
0
        private void btnAddGroup_Click(object sender, EventArgs e)
        {
            GroupCategroy.BaseGroupForm bgf = new GroupCategroy.BaseGroupForm();
            bgf.SetDontShowControls();
            bgf.MultiSelect = false;
            DialogResult dr = bgf.ShowDialog();

            if (dr == System.Windows.Forms.DialogResult.OK)
            {
                this.TheGroup = taali.Groups.Where(g => g.GroupID == bgf.SelectedItems
                                                   .SelectedItems[0].GroupID).Single();
                this.boxGroup.Text          = this.TheGroup.Title;
                this.btnAddGroup.Enabled    = false;
                this.btnDeleteGroup.Enabled = true;
                this.btnAddSubject.Enabled  = true;
            }
        }
示例#2
0
        private void btnAddGroup_Click(object sender, EventArgs e)
        {
            GroupCategroy.BaseGroupForm bgf = new GroupCategroy.BaseGroupForm();
            bgf.SetDontShowControls();
            bgf.MultiSelect = true;
            DialogResult dr = bgf.ShowDialog();

            if (dr == System.Windows.Forms.DialogResult.OK)
            {
                int id = 0;
                if (bgf.SelectedItems.SelectedItems == null || bgf.SelectedItems.SelectedItems.Count == 0)
                {
                    return;
                }
                if (this.groups == null || this.groups.Count() == 0)
                {
                    this.groups = bgf.SelectedItems.SelectedItems.OrderBy(g => g.Title).ToList();
                }
                else
                {
                    this.groups.AddRange(from g in bgf.SelectedItems.SelectedItems
                                         where this.groups.Where(gr =>
                                                                 gr.GroupID == g.GroupID).Count() == 0
                                         select g);
                    this.groups = this.groups.OrderBy(g => g.Title).ToList();
                }
                id = bgf.SelectedItems.SelectedItems[bgf.SelectedItems.SelectedItems.Count - 1].GroupID;
                this.refreshGridView();
                this.dataSource.Position = this.groups.IndexOf(this.groups.Where
                                                                   (g => g.GroupID == id).Single());
                if (this.groupDataGridView.RowCount > 0)
                {
                    this.btnDeleteGroup.Enabled = true;
                }
                this.styleView();
            }
        }