Esempio n. 1
0
        protected override void SetSelectedModel()
        {
            try
            {
                Model = Models.CurrentItem as StaffLocation;

                ObservableCollection <Staff> staffs = (ObservableCollection <Staff>)Staffs.SourceCollection;
                if (staffs != null)
                {
                    Staff staff = staffs.Where(s => s.Id == Model.Staff.Id).SingleOrDefault();
                    if (staff != null)
                    {
                        Staffs.MoveCurrentTo(staff);
                    }
                }

                ObservableCollection <Location> locations = (ObservableCollection <Location>)Locations.SourceCollection;
                if (locations != null)
                {
                    Location location = locations.Where(l => l.Id == Model.Location.Id).SingleOrDefault();
                    if (location != null)
                    {
                        Locations.MoveCurrentTo(location);
                    }
                }

                UpdateViewState(Edit.Mode.Editing);
            }
            catch (Exception ex)
            {
                Utility.DisplayMessage(ex.Message);
            }
        }
Esempio n. 2
0
        protected override void SetSelectedModel()
        {
            try
            {
                Model = Models.CurrentItem as Inps;

                if (Staffs != null)
                {
                    ObservableCollection <Infrastructure.MangoService.Staff> staffs = (ObservableCollection <Infrastructure.MangoService.Staff>)Staffs.SourceCollection;
                    Infrastructure.MangoService.Staff staff = staffs.Where(s => s.Id == Model.Staff.Id).SingleOrDefault();
                    Staffs.MoveCurrentTo(staff);
                }

                if (Departments != null)
                {
                    List <Department> departments = (List <Department>)Departments.SourceCollection;
                    Department        department  = departments.Where(d => d.Id == Model.ResponsibleDepartment.Id).SingleOrDefault();
                    Departments.MoveCurrentTo(department);
                }

                UpdateViewState(Edit.Mode.Editing);
            }
            catch (Exception ex)
            {
                Utility.DisplayMessage(ex.Message);
            }
        }
Esempio n. 3
0
        protected override void LoadAllCommandCompletedHelper()
        {
            try
            {
                dispatcher.BeginInvoke
                    (() =>
                {
                    if (Utility.FaultExist(service.Fault))
                    {
                        return;
                    }

                    Models = new PagedCollectionView(service.Models);
                    if (service.Models != null && service.Models.Count > 0)
                    {
                        RecordCount = RecordCountLabel + service.Models.Count;
                        Models.MoveCurrentTo(null);
                        Models.CurrentChanged += (s, e) =>
                        {
                            Model = Models.CurrentItem as StaffCdjr;
                            if (Model != null)
                            {
                                if (CompanyDepartmentJobRoles != null)
                                {
                                    ObservableCollection <CompanyDepartmentJobRole> companyDepartmentJobRoles = (ObservableCollection <CompanyDepartmentJobRole>)CompanyDepartmentJobRoles.SourceCollection;
                                    CompanyDepartmentJobRole companyDepartmentJobRole = companyDepartmentJobRoles.Where(l => l.Id == Model.CompanyDepartmentJobRole.Id).SingleOrDefault();
                                    CompanyDepartmentJobRoles.MoveCurrentTo(companyDepartmentJobRole);
                                }

                                if (Staffs != null)
                                {
                                    ObservableCollection <Infrastructure.MangoService.Staff> staffs = (ObservableCollection <Infrastructure.MangoService.Staff>)Staffs.SourceCollection;
                                    Infrastructure.MangoService.Staff staff = staffs.Where(l => l.Id == Model.Staff.Id).SingleOrDefault();
                                    Staffs.MoveCurrentTo(staff);
                                }
                            }

                            UpdateViewState(Edit.Mode.Editing);
                            CanSaveItem = false;
                        };
                    }
                    else
                    {
                        RecordCount = RecordCountLabel + 0;
                    }
                });
            }
            catch (Exception ex)
            {
                Utility.DisplayMessage(ex.Message);
            }
        }