Exemplo n.º 1
0
        private void RefreshDataGridView(FrmMaster _frmMaster, EGOEntities _egoEntities)
        {
            Cursor.Current = Cursors.WaitCursor;
            _frmMaster.dataGridView.Columns.Clear();
            switch (typeof(T).Name)
            {
            case "FAMILY":
                string           lastNameFamily   = _frmMaster.textBox1.Text;
                FamilySearchView familySearchView = new FamilySearchView(_egoEntities.FAMILY.Where(x => x.LASTNAME.Contains(lastNameFamily)).ToList().OrderBy(x => x.LASTNAME).ToList());
                _frmMaster.dataGridView.DataSource = familySearchView.FamilySearchViews;
                _frmMaster.dataGridView.Columns["FAMILYID"].Visible = false;
                AddColumnEditDeleteToDataGridView(_frmMaster, false);
                DataGridViewControl.SetHeaderName(_frmMaster.dataGridView);
                SetAutoCompletion(_frmMaster.textBox1, familySearchView.FamilySearchViews.Select(x => x.LASTNAME).ToList());
                _frmMaster.label3.Text = "Famille(" + familySearchView.FamilySearchViews.Count + ")";
                break;

            case "PERSON":
                string lastNamePerson = _frmMaster.textBox1.Text;
                PersonMasterSearchView personSearchView = new PersonMasterSearchView(_egoEntities.PERSON.Where(x => x.LASTNAME.Contains(lastNamePerson)).ToList().OrderBy(x => x.LASTNAME).ToList());
                _frmMaster.dataGridView.DataSource = personSearchView.PersonSearchViews;
                _frmMaster.dataGridView.Columns["PERSONID"].Visible = false;
                AddColumnEditDeleteToDataGridView(_frmMaster, false);
                DataGridViewControl.SetHeaderName(_frmMaster.dataGridView);
                SetAutoCompletion(_frmMaster.textBox1, personSearchView.PersonSearchViews.Select(x => x.LASTNAME).ToList());
                _frmMaster.label3.Text = "Adhérent(" + personSearchView.PersonSearchViews.Count + ")";
                break;

            case "GYMGROUP":
                string             gymGroupName       = _frmMaster.textBox1.Text;
                GymGroupSearchView gymGroupSearchView = new GymGroupSearchView(_egoEntities.GYMGROUP.Where(x => x.GYMGROUPNAME.Contains(gymGroupName) && x.GYMGROUPYEAR == _frmMaster.numericUpDown1.Value).ToList());
                _frmMaster.dataGridView.DataSource = gymGroupSearchView.GymGroupSearchViews;
                _frmMaster.dataGridView.Columns["GYMGROUPID"].Visible = false;
                AddColumnEditDeleteToDataGridView(_frmMaster, false);
                DataGridViewControl.SetHeaderName(_frmMaster.dataGridView);
                SetAutoCompletion(_frmMaster.textBox1, gymGroupSearchView.GymGroupSearchViews.Select(x => x.GYMGROUPNAME).ToList());
                _frmMaster.label3.Text = "Groupe - " + _frmMaster.numericUpDown1.Value + "(" + gymGroupSearchView.GymGroupSearchViews.Count + ")";
                break;
            }
            Cursor.Current = Cursors.Default;
        }
Exemplo n.º 2
0
        private void buttonSearch_Click(object sender, EventArgs e)
        {
            dataGridView.Columns.Clear();
            var dataGridViewButtonColumn = new DataGridViewButtonColumn();

            switch (type.Name)
            {
            case "GYMGROUP":
                GymGroupSearchView _gymGroupSearchView = new GymGroupSearchView(egoEntities.GYMGROUP.Where(x => x.GYMGROUPNAME.Contains(textBoxSearch.Text)).ToList());
                dataGridView.DataSource = _gymGroupSearchView.GymGroupSearchViews;
                dataGridView.Columns["GYMGROUPID"].Visible = false;

                dataGridViewButtonColumn.Name       = "Select";
                dataGridViewButtonColumn.HeaderText = "Choix";
                dataGridViewButtonColumn.Text       = "Choisir";
                dataGridViewButtonColumn.UseColumnTextForButtonValue = true;

                dataGridView.Columns.Add(dataGridViewButtonColumn);
                break;

            case "PERSON":
                PersonMasterSearchView _personSearchView = new PersonMasterSearchView(egoEntities.PERSON.Where(x => x.LASTNAME.Contains(textBoxSearch.Text)).ToList());
                dataGridView.DataSource = _personSearchView.PersonSearchViews;
                dataGridView.Columns["PERSONID"].Visible = false;

                dataGridViewButtonColumn.Name       = "Select";
                dataGridViewButtonColumn.HeaderText = "Choix";
                dataGridViewButtonColumn.Text       = "Choisir";
                dataGridViewButtonColumn.UseColumnTextForButtonValue = true;

                dataGridView.Columns.Add(dataGridViewButtonColumn);
                break;

            default:
                break;
            }
        }
Exemplo n.º 3
0
        private void CreateStructure(object _masterObj, Type _type, EGOEntities _egoEntities)
        {
            var         dataGridViewButtonColumn = new DataGridViewButtonColumn();
            List <KIND> Kinds;

            switch (_type.Name)
            {
            case "GYMGROUP":
                textBoxParent.Text = Reflection.GetValue(_masterObj, "LASTNAME").ToString() + " " + Reflection.GetValue(_masterObj, "FIRSTNAME").ToString();
                GymGroupSearchView _gymGroupSearchView = new GymGroupSearchView(_egoEntities.GYMGROUP.ToList());
                dataGridView.DataSource = _gymGroupSearchView.GymGroupSearchViews;
                dataGridView.Columns["GYMGROUPID"].Visible = false;

                dataGridViewButtonColumn.Name       = "Select";
                dataGridViewButtonColumn.HeaderText = "Choix";
                dataGridViewButtonColumn.Text       = "Choisir";
                dataGridViewButtonColumn.UseColumnTextForButtonValue = true;

                dataGridView.Columns.Add(dataGridViewButtonColumn);

                Kinds = _egoEntities.KIND.ToList();
                foreach (var kind in Kinds)
                {
                    ComboboxItem item = new ComboboxItem();
                    item.Text  = kind.KINDNAME;
                    item.Value = kind.KINDID;

                    comboBoxKind.Items.Add(item);
                }
                comboBoxKind.Visible = true;
                break;

            case "PERSON":
                textBoxParent.Text = Reflection.GetValue(_masterObj, "GYMGROUPYEAR").ToString() + " " + Reflection.GetValue(_masterObj, "GYMGROUPNAME").ToString();
                PersonMasterSearchView _personSearchView = new PersonMasterSearchView(_egoEntities.PERSON.ToList());
                dataGridView.DataSource = _personSearchView.PersonSearchViews;
                dataGridView.Columns["PERSONID"].Visible = false;

                dataGridViewButtonColumn.Name       = "Select";
                dataGridViewButtonColumn.HeaderText = "Choix";
                dataGridViewButtonColumn.Text       = "Choisir";
                dataGridViewButtonColumn.UseColumnTextForButtonValue = true;

                dataGridView.Columns.Add(dataGridViewButtonColumn);

                Kinds = _egoEntities.KIND.ToList();
                foreach (var kind in Kinds)
                {
                    ComboboxItem item = new ComboboxItem();
                    item.Text  = kind.KINDNAME;
                    item.Value = kind.KINDID;

                    comboBoxKind.Items.Add(item);
                }
                comboBoxKind.Visible = true;
                break;

            default:
                break;
            }
        }