Beispiel #1
0
        private void FormJobNew_Load(object sender, EventArgs e)
        {
            textSearch.Text = InitialSearchString;
            listBoxUsers.Items.Add("Any");
            _listUsers = Userods.GetDeepCopy(true);
            _listUsers.ForEach(x => listBoxUsers.Items.Add(x.UserName));
            //Statuses
            listBoxStatus.Items.Add("Any");
            _listJobStatuses = Enum.GetValues(typeof(JobPhase)).Cast <JobPhase>().ToList();
            _listJobStatuses.ForEach(x => listBoxStatus.Items.Add(x.ToString()));
            //Categories
            listBoxCategory.Items.Add("Any");
            _listJobCategory = Enum.GetValues(typeof(JobCategory)).Cast <JobCategory>().ToList();
            _listJobCategory.ForEach(x => listBoxCategory.Items.Add(x.ToString()));
            ODThread thread = new ODThread((o) => {
                //We can reduce these calls to DB by passing in more data from calling class. if available.
                if (_listJobsAll == null)
                {
                    _listJobsAll = Jobs.GetAll();
                    Jobs.FillInMemoryLists(_listJobsAll);
                }
                try {
                    _listFeatureRequestsAll = FeatureRequests.GetAll();
                }
                catch (Exception ex) {
                    ex.DoNothing();
                    _listFeatureRequestsAll = new List <FeatureRequest>();
                }
                _listBugsAll = Bugs.GetAll();
                this.Invoke((Action)ReadyForSearch);
            });

            thread.AddExceptionHandler((ex) => { /*todo*/ });
            thread.Start();
        }
Beispiel #2
0
        private void LoadDataAsync()
        {
            ODThread thread = new ODThread((o) => {
                _listBugsAll = Bugs.GetAll();
                this.BeginInvoke((Action)(FillGridMain));
            });

            thread.AddExceptionHandler((ex) => {
                try {
                    this.BeginInvoke((Action)(() => {
                        MessageBox.Show(ex.Message);
                    }));
                }
                catch { }
            });
            thread.Start(true);
        }
Beispiel #3
0
        private void FormJobNew_Load(object sender, EventArgs e)
        {
            textSearch.Text = InitialSearchString;
            listBoxUsers.Items.Add("Any");
            _listUsers = Userods.GetDeepCopy(true);
            _listUsers.ForEach(x => listBoxUsers.Items.Add(x.UserName));
            //Statuses
            listBoxStatus.Items.Add("Any");
            _listJobStatuses = Enum.GetValues(typeof(JobPhase)).Cast <JobPhase>().ToList();
            _listJobStatuses.ForEach(x => listBoxStatus.Items.Add(x.ToString()));
            //Categories
            listBoxCategory.Items.Add("Any");
            _listJobCategory = Enum.GetValues(typeof(JobCategory)).Cast <JobCategory>().ToList();
            _listJobCategory.ForEach(x => listBoxCategory.Items.Add(x.ToString()));
            ODThread thread = new ODThread((o) => {
                //We can reduce these calls to DB by passing in more data from calling class. if available.
                _listJobsAll = Jobs.GetAll();
                Jobs.FillInMemoryLists(_listJobsAll);
                _listTasksAll     = Tasks.GetMany(_listJobsAll.SelectMany(x => x.ListJobLinks).Where(x => x.LinkType == JobLinkType.Task).Select(x => x.FKey).Distinct().ToList());
                _listTaskNotesAll = TaskNotes.GetForTasks(_listTasksAll.Select(x => x.TaskNum).ToList());
                _listPatientAll   = Patients.GetMultPats(_listJobsAll.SelectMany(x => x.ListJobQuotes).Select(x => x.PatNum).Distinct().ToList()).ToList();
                _listPatientAll.AddRange(Patients.GetMultPats(_listTasksAll.FindAll(x => x.ObjectType == TaskObjectType.Patient).Select(x => x.KeyNum).ToList()));
                try {
                    _listFeatureRequestsAll = FeatureRequests.GetAll();
                }
                catch (Exception ex) {
                    ex.DoNothing();
                    _listFeatureRequestsAll = new List <FeatureRequest>();
                }
                _listBugsAll = Bugs.GetAll();
                this.Invoke((Action)ReadyForSearch);
            });

            thread.AddExceptionHandler((ex) => { /*todo*/ });
            thread.Start();
        }