Exemple #1
0
        protected void LoadAllStatusCompletedHelper()
        {
            try
            {
                dispatcher.BeginInvoke
                    (() =>
                {
                    if (Utility.FaultExist(statusService.Fault))
                    {
                        return;
                    }

                    if (statusService.Models != null && statusService.Models.Count > 0)
                    {
                        statusService.Models.Insert(0, new Status()
                        {
                            Name = "<< Select Status >>"
                        });

                        AllStatus = new PagedCollectionView(statusService.Models);
                        AllStatus.MoveCurrentToFirst();
                        AllStatus.CurrentChanged += (s, e) =>
                        {
                            Status = AllStatus.CurrentItem as Status;
                        };
                    }
                });
            }
            catch (Exception ex)
            {
                Utility.DisplayMessage(ex.Message);
            }
        }
        protected void LoadAllUsersCompletedHelper()
        {
            dispatcher.BeginInvoke
                (() =>
            {
                if (Utility.FaultExist(staffService.Fault))
                {
                    return;
                }

                Staffs = new PagedCollectionView(staffService.Models);
                if (staffService.Models != null && staffService.Models.Count > 0)
                {
                    staffService.Models.Insert(0, new Infrastructure.MangoService.Staff()
                    {
                        Id = "-1", FullName = "<< Select User >>"
                    });

                    Staffs.MoveCurrentToFirst();
                    Staffs.CurrentChanged += (s, e) =>
                    {
                        Staff = Staffs.CurrentItem as Infrastructure.MangoService.Staff;

                        if (Roles != null)
                        {
                            foreach (Role role in Roles)
                            {
                                role.HasUser = role.Id == Staff.Role.Id ? true : false;
                            }
                        }
                    };
                }
            });
        }
Exemple #3
0
        private void PopulateYears(int beginYearFrom)
        {
            try
            {
                //dispatcher.BeginInvoke
                //           (() =>
                //           {
                ObservableCollection <Value> years = Utility.CreateYearListFrom(beginYearFrom);

                if (years != null && years.Count > 0)
                {
                    //years.Insert(0, new Value() { Id = 0, Name = "<< Select Year >>" });

                    Years = new PagedCollectionView(years);
                    Years.MoveCurrentToFirst();
                    Years.CurrentChanged += (s, e) =>
                    {
                        Year = Years.CurrentItem as Value;
                    };
                }
                //});
            }
            catch (Exception ex)
            {
                Utility.DisplayMessage(ex.Message);
            }
        }
        protected void LoadRolesCompletedHelper()
        {
            dispatcher.BeginInvoke
                (() =>
            {
                if (Utility.FaultExist(roleService.Fault))
                {
                    return;
                }

                Roles = new PagedCollectionView(roleService.Models);
                if (roleService.Models != null)
                {
                    roleService.Models.Insert(0, new Role()
                    {
                        Id = -1, Name = "<< Select Role >>"
                    });

                    Roles.MoveCurrentToFirst();
                    Roles.CurrentChanged += (s, e) =>
                    {
                        Role = Roles.CurrentItem as Role;
                    };
                }
            });
        }
Exemple #5
0
        protected void LoadAllRatingTypesCompletedHelper()
        {
            try
            {
                dispatcher.BeginInvoke
                    (() =>
                {
                    if (Utility.FaultExist(ratingTypeService.Fault))
                    {
                        return;
                    }

                    if (ratingTypeService.Models != null)
                    {
                        ratingTypeService.Models.Insert(0, new Infrastructure.MangoService.RatingType()
                        {
                            Name = "<< Select Rating Type >>"
                        });

                        RatingTypes = new PagedCollectionView(ratingTypeService.Models);
                        RatingTypes.MoveCurrentToFirst();
                        RatingTypes.CurrentChanged += (s, e) =>
                        {
                            RatingType = RatingTypes.CurrentItem as RatingType;
                        };
                    }
                });
            }
            catch (Exception ex)
            {
                Utility.DisplayMessage(ex.Message);
            }
        }
Exemple #6
0
        private void LoadAllDepartmentCompletedHelper()
        {
            try
            {
                dispatcher.BeginInvoke
                    (() =>
                {
                    if (Utility.FaultExist(departmentService.Fault))
                    {
                        return;
                    }

                    if (departmentService.Models != null && departmentService.Models.Count > 0)
                    {
                        ObservableCollection <Department> depts = new ObservableCollection <Department>();
                        depts = departmentService.Models;
                        depts.Insert(0, new Department()
                        {
                            Id = "", Name = "<< Select Department >>"
                        });

                        Departments = new PagedCollectionView(depts);
                        Departments.MoveCurrentToFirst();
                        Departments.CurrentChanged += (s, e) =>
                        {
                            Department = Departments.CurrentItem as Department;
                        };
                    }
                });
            }
            catch (Exception ex)
            {
                Utility.DisplayMessage(ex.Message);
            }
        }
        protected void LoadAllJobRolesCompletedHelper()
        {
            try
            {
                dispatcher.BeginInvoke
                    (() =>
                {
                    if (Utility.FaultExist(jobRoleService.Fault))
                    {
                        return;
                    }

                    if (jobRoleService.Models != null && jobRoleService.Models.Count > 0)
                    {
                        jobRoleService.Models.Insert(0, new JobRole()
                        {
                            Id = 0, Name = "<< Select Job Role >>"
                        });

                        JobRoles = new PagedCollectionView(jobRoleService.Models);
                        JobRoles.MoveCurrentToFirst();
                        JobRoles.CurrentChanged += (s, e) =>
                        {
                            JobRole = JobRoles.CurrentItem as JobRole;
                        };
                    }
                });
            }
            catch (Exception ex)
            {
                Utility.DisplayMessage(ex.Message);
            }
        }
Exemple #8
0
        private void LoadAllPeriodTypeCompletedHelper()
        {
            try
            {
                dispatcher.BeginInvoke
                    (() =>
                {
                    if (Utility.FaultExist(periodTypeService.Fault))
                    {
                        return;
                    }

                    if (periodTypeService.Models != null && periodTypeService.Models.Count > 0)
                    {
                        periodTypeService.Models.Insert(0, new PeriodType()
                        {
                            Id = 0, Name = "<< Select Type >>"
                        });

                        Types = new PagedCollectionView(periodTypeService.Models);
                        Types.MoveCurrentToFirst();
                        Types.CurrentChanged += (s, e) =>
                        {
                            Type = Types.CurrentItem as PeriodType;
                        };
                    }
                });
            }
            catch (Exception ex)
            {
                Utility.DisplayMessage(ex.Message);
            }
        }
Exemple #9
0
        private void PopulateStaffs()
        {
            try
            {
                List <Staff> staffs = staffService.Models.Where(s => s.Id == "0").ToList();
                if (staffs == null || staffs.Count == 0)
                {
                    staffService.Models.Insert(0, new Infrastructure.MangoService.Staff()
                    {
                        Id = "0", IsActive = true, FullName = "<< Select Satff >>"
                    });
                }

                Staffs = new PagedCollectionView(staffService.Models);
                Staffs.MoveCurrentToFirst();
                Staffs.CurrentChanged += (s, e) =>
                {
                    Staff = Staffs.CurrentItem as Infrastructure.MangoService.Staff;
                };
            }
            catch (Exception ex)
            {
                Utility.DisplayMessage(ex.Message);
            }
        }
        public void OnPropertyChangedTest()
        {
            List <EditableTestClass>         efbList      = new List <EditableTestClass>();
            ObservableCollection <TestClass> fbCollection = new ObservableCollection <TestClass>();

            PagedCollectionView pcv1 = new PagedCollectionView(efbList);
            PagedCollectionView pcv2 = new PagedCollectionView(fbCollection);

            pcv1.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(this.PagedCollectionViewPropertyChanged);
            pcv2.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(this.PagedCollectionViewPropertyChanged);

            this._expectedPropertyNames.Clear();
            this._expectedPropertyNames.Add("Count");
            this._expectedPropertyNames.Add("IsEmpty");
            this._expectedPropertyNames.Add("IsCurrentAfterLast");
            this.AssertExpectedEvent(delegate { fbCollection.Add(new TestClass()); });
            this.CheckExpectedPropertyNamesFound();

            this._expectedPropertyNames.Clear();
            this._expectedPropertyNames.Add("IsCurrentBeforeFirst");
            this._expectedPropertyNames.Add("CurrentPosition");
            this._expectedPropertyNames.Add("CurrentItem");
            this.AssertExpectedEvent(delegate { pcv2.MoveCurrentToFirst(); });
            this.CheckExpectedPropertyNamesFound();

            this._expectedPropertyNames.Clear();
            this._expectedPropertyNames.Add("SortDescriptions");
            this.AssertExpectedEvent(delegate { pcv1.SortDescriptions.Add(new System.ComponentModel.SortDescription("IntProperty", System.ComponentModel.ListSortDirection.Ascending)); });
            this.CheckExpectedPropertyNamesFound();

            this._expectedPropertyNames.Clear();
            this._expectedPropertyNames.Add("Culture");
            this.AssertExpectedEvent(delegate { pcv1.Culture = CultureInfo.InvariantCulture; });
            this.CheckExpectedPropertyNamesFound();

            this._expectedPropertyNames.Clear();
            this._expectedPropertyNames.Add("Filter");
            this.AssertExpectedEvent(delegate { pcv2.Filter = new Predicate <object>(this.FilterNegativeNumbers); });
            this.CheckExpectedPropertyNamesFound();

            // Attempt to move to Page 0 should fail while PageSize is still 0.
            Assert.AreEqual(0, pcv1.PageSize);
            Assert.IsFalse(pcv1.MoveToPage(0));

            this._expectedPropertyNames.Clear();
            this._expectedPropertyNames.Add("PageSize");
            this.AssertExpectedEvent(delegate { pcv1.PageSize = 10; });
            this.CheckExpectedPropertyNamesFound();

            pcv1.PropertyChanged -= new System.ComponentModel.PropertyChangedEventHandler(this.PagedCollectionViewPropertyChanged);
            pcv2.PropertyChanged -= new System.ComponentModel.PropertyChangedEventHandler(this.PagedCollectionViewPropertyChanged);
        }
Exemple #11
0
        protected void LoadAllCompanyDepartmentJobRoleCompletedHelper()
        {
            try
            {
                dispatcher.BeginInvoke
                    (() =>
                {
                    if (Utility.FaultExist(companyDepartmentJobRoleService.Fault))
                    {
                        return;
                    }

                    if (companyDepartmentJobRoleService.Models != null)
                    {
                        List <CompanyDepartmentJobRole> companyDepartmentJobRoles = companyDepartmentJobRoleService.Models.Where(p => p.Id != 0).ToList();
                        if (companyDepartmentJobRoles.Count > 0)
                        {
                            companyDepartmentJobRoles.Insert(0, new CompanyDepartmentJobRole()
                            {
                                Company = new Company()
                                {
                                    Symbol = "<< Select Job Role >>"
                                }
                            });
                        }

                        CompanyDepartmentJobRoles = new PagedCollectionView(companyDepartmentJobRoles);
                        CompanyDepartmentJobRoles.MoveCurrentToFirst();
                        CompanyDepartmentJobRoles.CurrentChanged += (s, e) =>
                        {
                            CompanyDepartmentJobRole = CompanyDepartmentJobRoles.CurrentItem as CompanyDepartmentJobRole;
                            PopulateMetricsByCdjr();
                        };

                        JobRoles = new PagedCollectionView(companyDepartmentJobRoles);
                        JobRoles.MoveCurrentToFirst();
                        JobRoles.CurrentChanged += (s, e) =>
                        {
                            JobRole = JobRoles.CurrentItem as CompanyDepartmentJobRole;
                        };
                    }
                });
            }
            catch (Exception ex)
            {
                Utility.DisplayMessage(ex.Message);
            }
        }
Exemple #12
0
        private void LoadAllCdjrCompletedHelper()
        {
            try
            {
                dispatcher.BeginInvoke
                    (() =>
                {
                    if (Utility.FaultExist(cdjrService.Fault))
                    {
                        return;
                    }

                    if (cdjrService.Models != null && cdjrService.Models.Count > 0)
                    {
                        CompanyDepartmentJobRole cdjr = cdjrService.Models.Where(c => c.Id == 0).SingleOrDefault();
                        if (cdjr == null)
                        {
                            cdjrService.Models.Insert(0, new CompanyDepartmentJobRole()
                            {
                                Id = 0, JobRole = new JobRole()
                                {
                                    Name = "<< Select CDJR >>"
                                }
                            });
                        }

                        if (cdjrService.Models != null && cdjrService.Models.Count > 0)
                        {
                            CompanyDepartmentJobRoles = new PagedCollectionView(cdjrService.Models);

                            CompanyDepartmentJobRoles.MoveCurrentToFirst();
                            CompanyDepartmentJobRoles.CurrentChanged += (s, e) =>
                            {
                                CompanyDepartmentJobRole = CompanyDepartmentJobRoles.CurrentItem as CompanyDepartmentJobRole;
                                LoadMetricsByPeriodAndCompanyDepartmentJobRole();
                            };
                        }
                    }
                });
            }
            catch (Exception ex)
            {
                Utility.DisplayMessage(ex.Message);
            }
        }
Exemple #13
0
        protected void LoadAllMetricsPerspectiveCompletedHelper()
        {
            try
            {
                dispatcher.BeginInvoke
                    (() =>
                {
                    if (Utility.FaultExist(metricsPerspectiveService.Fault))
                    {
                        return;
                    }

                    if (metricsPerspectiveService.Models != null && metricsPerspectiveService.Models.Count > 0)
                    {
                        //List<MetricsPerspective> metricsPerspectives = metricsPerspectiveService.Models.Where(d => d.Id != 0).ToList();

                        List <MetricsPerspective> metricsPerspectives = metricsPerspectiveService.Models.Where(d => d.Id == 3 || d.Id == 5).ToList();
                        if (metricsPerspectives.Count > 0)
                        {
                            metricsPerspectives.Insert(0, new MetricsPerspective()
                            {
                                Name = "<< Select Metrics Perspective >>"
                            });
                        }

                        MetricsPerspectives = new PagedCollectionView(metricsPerspectives);
                        MetricsPerspectives.MoveCurrentToFirst();
                        MetricsPerspectives.CurrentChanged += (s, e) =>
                        {
                            MetricsPerspective = MetricsPerspectives.CurrentItem as MetricsPerspective;
                            if (MetricsPerspective != null && MetricsPerspective.Id > 0)
                            {
                                LoadMetricsByPeriodAndPerspectiveCompleted();
                                metricsSetupService.GetAllMetricsByPeriodAndPerspective(Utility.Period, MetricsPerspective);
                            }
                        };
                    }
                });
            }
            catch (Exception ex)
            {
                Utility.DisplayMessage(ex.Message);
            }
        }
Exemple #14
0
        protected void LoadAllInpsTypeCompletedHelper()
        {
            try
            {
                dispatcher.BeginInvoke
                    (() =>
                {
                    if (Utility.FaultExist(inpsTypeService.Fault))
                    {
                        return;
                    }

                    if (inpsTypeService.Models != null && inpsTypeService.Models.Count > 0)
                    {
                        List <InpsType> inpsTypes = inpsTypeService.Models.Where(d => d.Id != 0).ToList();
                        if (inpsTypes.Count > 0)
                        {
                            inpsTypes.Insert(0, new InpsType()
                            {
                                Name = "<< Select a Type >>"
                            });
                        }

                        InpsTypes = new PagedCollectionView(inpsTypes);
                        InpsTypes.MoveCurrentToFirst();
                        InpsTypes.CurrentChanged += (s, e) =>
                        {
                            InpsType = InpsTypes.CurrentItem as InpsType;
                            if (InpsType != null && InpsType.Id > 0)
                            {
                                //GetAllInpsByPeriodAndType();

                                LoadAllInpsRatingsByPeriodAndTypeCompleted();
                                inpsRatingService.LoadByPeriodAndType(Utility.Period, InpsType);
                            }
                        };
                    }
                });
            }
            catch (Exception ex)
            {
                Utility.DisplayMessage(ex.Message);
            }
        }
Exemple #15
0
        protected void LoadAllCdjrCompletedHelper()
        {
            try
            {
                dispatcher.BeginInvoke
                    (() =>
                {
                    if (Utility.FaultExist(cdjrService.Fault))
                    {
                        return;
                    }

                    if (cdjrService.Models != null && cdjrService.Models.Count > 0)
                    {
                        //cdjrService.Models.Insert(0, new CompanyDepartmentJobRole() { Id = 0, Company = new Company() { Symbol = "<< Select CDJR >>" } });

                        cdjrService.Models.Insert(0, new CompanyDepartmentJobRole()
                        {
                            Id = 0, JobRole = new JobRole()
                            {
                                Name = "<< Select CDJR >>"
                            }
                        });
                        if (cdjrService.Models != null && cdjrService.Models.Count > 0)
                        {
                            CompanyDepartmentJobRoles = new PagedCollectionView(cdjrService.Models);

                            CompanyDepartmentJobRoles.MoveCurrentToFirst();
                            CompanyDepartmentJobRoles.CurrentChanged += (s, e) =>
                            {
                                CompanyDepartmentJobRole = CompanyDepartmentJobRoles.CurrentItem as CompanyDepartmentJobRole;
                            };
                        }
                    }
                });
            }
            catch (Exception ex)
            {
                Utility.DisplayMessage(ex.Message);
            }
        }
Exemple #16
0
        protected void LoadAllDepartmentCompletedHelper()
        {
            try
            {
                dispatcher.BeginInvoke
                    (() =>
                {
                    if (Utility.FaultExist(departmentService.Fault))
                    {
                        return;
                    }

                    if (departmentService.Models != null && departmentService.Models.Count > 0)
                    {
                        List <Department> departments = departmentService.Models.Where(d => d.Id != null && d.Id != "").ToList();
                        if (departments.Count > 0)
                        {
                            departments.Insert(0, new Department()
                            {
                                Name = "<< Select Department >>"
                            });
                        }

                        Departments = new PagedCollectionView(departments);
                        Departments.MoveCurrentToFirst();
                        Departments.CurrentChanged += (s, e) =>
                        {
                            Department = Departments.CurrentItem as Department;
                        };
                    }
                });
            }
            catch (Exception ex)
            {
                Utility.DisplayMessage(ex.Message);
            }
        }
        protected void LoadAllPeriodCompletedHelper()
        {
            try
            {
                dispatcher.BeginInvoke
                    (() =>
                {
                    if (Utility.FaultExist(service.Fault))
                    {
                        return;
                    }

                    if (service.Models != null && service.Models.Count > 0)
                    {
                        service.Models.Insert(0, new Period()
                        {
                            Id = 0, Name = "<< Select Period >>"
                        });

                        Periods = new PagedCollectionView(service.Models);
                        Periods.MoveCurrentToFirst();
                        Periods.CurrentChanged += (s, e) =>
                        {
                            Period = Periods.CurrentItem as Period;
                            if (Period != null && Period.Id > 0)
                            {
                                IsCurrentPeriodSettable = true;
                            }
                        };
                    }
                });
            }
            catch (Exception ex)
            {
                Utility.DisplayMessage(ex.Message);
            }
        }
Exemple #18
0
        protected void LoadAllLocationsCompletedHelper()
        {
            try
            {
                dispatcher.BeginInvoke
                    (() =>
                {
                    if (Utility.FaultExist(locationService.Fault))
                    {
                        return;
                    }

                    if (locationService.Models != null && locationService.Models.Count > 0)
                    {
                        Location location = locationService.Models.Where(s => s.Id == "").SingleOrDefault();
                        if (location == null)
                        {
                            locationService.Models.Insert(0, new Location()
                            {
                                Id = "", Name = "<< Select Location >>"
                            });
                        }

                        Locations = new PagedCollectionView(locationService.Models);
                        Locations.MoveCurrentToFirst();
                        Locations.CurrentChanged += (s, e) =>
                        {
                            Location = Locations.CurrentItem as Location;
                        };
                    }
                });
            }
            catch (Exception ex)
            {
                Utility.DisplayMessage(ex.Message);
            }
        }
Exemple #19
0
        private void LoadAllMetricsPerspectiveCompletedCompletedHelper()
        {
            try
            {
                dispatcher.BeginInvoke
                    (() =>
                {
                    if (Utility.FaultExist(metricsPerspectiveService.Fault))
                    {
                        return;
                    }

                    if (metricsPerspectiveService.Models != null && metricsPerspectiveService.Models.Count > 0)
                    {
                        metricsPerspectiveService.Models.Insert(0, new MetricsPerspective()
                        {
                            Id = 0, Name = "<< Select Perspective >>"
                        });
                        if (metricsPerspectiveService.Models != null && metricsPerspectiveService.Models.Count > 0)
                        {
                            MetricsPerspectives = new PagedCollectionView(metricsPerspectiveService.Models);

                            MetricsPerspectives.MoveCurrentToFirst();
                            MetricsPerspectives.CurrentChanged += (s, e) =>
                            {
                                MetricsPerspective = MetricsPerspectives.CurrentItem as MetricsPerspective;
                            };
                        }
                    }
                });
            }
            catch (Exception ex)
            {
                Utility.DisplayMessage(ex.Message);
            }
        }
        protected void LoadAllCompanyDepartmentsByCompanyCompletedHelper()
        {
            try
            {
                dispatcher.BeginInvoke
                    (() =>
                {
                    if (Utility.FaultExist(companyDepartmentService.Fault))
                    {
                        return;
                    }

                    if (companyDepartmentService.CompanyDepartments != null && companyDepartmentService.CompanyDepartments.Count > 0)
                    {
                        companyDepartmentService.CompanyDepartments.Insert(0, new CompanyDepartment()
                        {
                            Department = new Department()
                            {
                                Id = "0", Name = "<< Select Department >>"
                            }
                        });

                        CompanyDepartments = new PagedCollectionView(companyDepartmentService.CompanyDepartments);
                        CompanyDepartments.MoveCurrentToFirst();
                        CompanyDepartments.CurrentChanged += (s, e) =>
                        {
                            CompanyDepartment = CompanyDepartments.CurrentItem as CompanyDepartment;
                        };
                    }
                });
            }
            catch (Exception ex)
            {
                Utility.DisplayMessage(ex.Message);
            }
        }
        protected void LoadAllJobLevelCompletedHelper()
        {
            try
            {
                dispatcher.BeginInvoke
                    (() =>
                {
                    if (Utility.FaultExist(levelService.Fault))
                    {
                        return;
                    }

                    if (levelService.Models != null && levelService.Models.Count > 0)
                    {
                        levelService.Models.Insert(0, new Level()
                        {
                            Id = "", Name = "<< Select Job Level >>"
                        });
                        if (levelService.Models != null && levelService.Models.Count() > 0)
                        {
                            JobLevels = new PagedCollectionView(levelService.Models);

                            JobLevels.MoveCurrentToFirst();
                            JobLevels.CurrentChanged += (s, e) =>
                            {
                                JobLevel = JobLevels.CurrentItem as Level;
                            };
                        }
                    }
                });
            }
            catch (Exception ex)
            {
                Utility.DisplayMessage(ex.Message);
            }
        }