private void SetSource()
        {
            switch (SourceToolStripComboBox.SelectedIndex)
            {
            case 0:    //Objects
                if (_objectSource == null)
                {
                    _objectSource = new ObjectSource();
                }
                _currentSource = _objectSource;
                break;

            case 1:    //DataSet
                if (_dataSetSource == null)
                {
                    _dataSetSource = new DataSetSource();
                }
                _currentSource = _dataSetSource;
                break;

            case 2:    //Linq to SQL
                if (_linqToSQLSource == null)
                {
                    _linqToSQLSource = new LinqSource();
                }
                _currentSource = _linqToSQLSource;
                break;
            }
        }
Beispiel #2
0
        private void EditOrganizationDetails(bool isNewOrganization)
        {
            using (var form = new OrganizationDetailsFrame())
            {
                form.IsNewOrganization = isNewOrganization;

                if (!isNewOrganization)
                {
                    form.Organization = CurrentOrganization;
                }
                else
                {
                    form.Organization = new OrganizationList {
                        OrganizationID = Guid.NewGuid()
                    };
                }

                if (form.ShowDialog() == DialogResult.OK)
                {
                    OnOrganizationUpdated(new OrganizationUpdatedEventArgs(form.Organization));

                    if (isNewOrganization)
                    {
                        LinqSource.Reload();
                        FocusRow(form.Organization.ShortName);
                    }
                    else
                    {
                        ReloadData();
                    }
                }
            }
        }
        private void EditPersonDetails(bool isNewPerson)
        {
            using (var form = new PersonDetailsFrame())
            {
                form.IsNewPerson = isNewPerson;

                if (isNewPerson)
                {
                    form.Person = new PersonList {
                        PersonID = Guid.NewGuid()
                    };
                }
                else
                {
                    if (CurrentPerson == null)
                    {
                        return;
                    }
                    form.Person = CurrentPerson;
                }
                if (form.ShowDialog() == DialogResult.OK)
                {
                    OnPersonUpdated(new PersonUpdateEventArgs(form.Person));
                    if (isNewPerson)
                    {
                        LinqSource.Reload();
                        FocusRow(form.Person.PersonID);
                    }
                    else
                    {
                        ReloadData();
                    }
                }
            }
        }
Beispiel #4
0
        public void ReloadData()
        {
            var focused = MainView.FocusedRowHandle;

            LinqSource.Reload();
            MainView.RefreshData();
            MainView.FocusedRowHandle = focused;
            MainView.SelectRow(focused);
            UpdateMenuState();
        }