protected void LoadAllCompaniesCompletedHelper() { try { dispatcher.BeginInvoke (() => { if (Utility.FaultExist(companyService.Fault)) { return; } if (companyService.Models != null && companyService.Models.Count > 0) { Company = companyService.Models.Where(c => c.Id == 2).SingleOrDefault(); if (Company != null) { Companies = new PagedCollectionView(companyService.Models); Companies.MoveCurrentTo(Company); LoadAllCompanyDepartmentsByCompanyCompleted(); companyDepartmentService.LoadBy(Company); } } }); } catch (Exception ex) { Utility.DisplayMessage(ex.Message); } }
protected virtual void SetCurrentTargetCollection(ObservableCollection <Metrics> refreshedModels) { try { Metrices = new PagedCollectionView(refreshedModels); if (refreshedModels != null) { //UpdateMetricsRecordCount(refreshedModels); Metrices.MoveCurrentTo(null); Metrices.CurrentChanged += (s, e) => { //SelectedTargetCollection(); Metrics = Metrices.CurrentItem as Metrics; if (Metrics != null) { LoadMetricRatingByMetricsCompleted(); metricRatingService.LoadByMetrics(Metrics); } }; } } catch (Exception ex) { Utility.DisplayMessage(ex.Message); } }
protected void LoadAllLoginDetailCompletedHelper() { try { dispatcher.BeginInvoke (() => { if (Utility.FaultExist(service.Fault)) { return; } LoginDetails = new PagedCollectionView(service.LoginDetails); if (service.LoginDetails != null && service.LoginDetails.Count > 0) { RecordCount = "Record Count: " + service.LoginDetails.Count; LoginDetails.MoveCurrentTo(null); LoginDetails.CurrentChanged += (s, e) => { LoginDetail = LoginDetails.CurrentItem as LoginDetail; CanSaveItem = true; CanResetItem = true; CanClearView = true; }; } }); } catch (Exception ex) { Utility.DisplayMessage(ex.Message); } }
protected override void LoadAllCommandCompletedHelper() { try { dispatcher.BeginInvoke (() => { if (Utility.FaultExist(staffService.Fault)) { return; } Models = new PagedCollectionView(staffService.Models); if (Models != null) { RecordCount = RecordCountLabel + staffService.Models.Count; Models.MoveCurrentTo(null); Models.CurrentChanged += (s, e) => { Model = Models.CurrentItem as Infrastructure.MangoService.Staff; UpdateViewState(Edit.Mode.Editing); }; } }); } catch (Exception ex) { Utility.DisplayMessage(ex.Message); } }
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); } }
public override object Process(ServiceResponse response) { this.ServiceError = null; if (response.IsSuccess) { if (response.InfoMessage == null || response.InfoMessage.ToLower() == "null") { this.DataSource = null; return(null); } object current = null; var pageIndex = 0; var currentPosition = 0; if (this.DataSource != null && this.DataSource.CurrentItem != null) { current = this.DataSource.CurrentItem; pageIndex = this.DataSource.PageIndex; currentPosition = this.DataSource.CurrentPosition; } var ds = new PagedCollectionView(InfoExchange.DeConvert <IList>(response.InfoMessage, InfoExchange.SetingsKonwnTypesBinder)); if (current != null) { var item = ds.OfType <object>().Where(c => c.Equals(current)).FirstOrDefault(); if (item != null) { ds.MoveCurrentTo(item); } else { try { ds.MoveToPage(pageIndex); ds.MoveCurrentToPosition(currentPosition); } catch (Exception) { } } } this.DataSource = ds; } else { this.DataSource = null; this.ServiceError = response.ExceptionMessage; } return(this.DataSource); }
protected void GetAllInpsByPeriodCompletedHelper() { try { dispatcher.BeginInvoke (() => { if (Utility.FaultExist(uploadService.Fault)) { return; } Models = new PagedCollectionView(uploadService.Inpss); Models.MoveCurrentTo(null); Models.CurrentChanged += (s, e) => { Model = Models.CurrentItem as Inps; SetSelectedModel(); //if (InpsType != null && InpsType.Id > 0) //{ // GetAllInpsByPeriodAndType(); //} }; //Models = uploadService.Inpss; //if (Inpss != null && Inpss.Count > 0) //{ // CanSaveInps = false; // CanClearInps = false; //} //else //{ // Utility.DisplayMessage("No data exist for " + InpsType.Name); //} //UpdateUiState(); }); } catch (Exception ex) { Utility.DisplayMessage(ex.Message); } }
protected void LoadMetricsByPeriodCompletedHelper() { try { dispatcher.BeginInvoke (() => { if (Utility.FaultExist(metricsService.Fault)) { return; } if (metricsService.Models != null) { Metrices = new PagedCollectionView(metricsService.Models); Metrices.MoveCurrentTo(null); PropertyGroupDescription groupDescription = new PropertyGroupDescription("JobRoleName"); if (Metrices != null) { Metrices.GroupDescriptions.Add(groupDescription); if (MetricesLoaded != null) { MetricesLoaded(this, null); } } Metrices.CurrentChanged += (s, e) => { Metrics = Metrices.CurrentItem as Metrics; if (Metrics != null) { LoadMetricRatingByMetricsCompleted(); metricRatingService.LoadByMetrics(Metrics); } }; } }); } catch (Exception ex) { Utility.DisplayMessage(ex.Message); } }
protected virtual void SetCurrentTargetCollection(ObservableCollection <T> refreshedModels) { try { TargetCollection = new PagedCollectionView(refreshedModels); if (refreshedModels != null) { UpdateMetricsRecordCount(refreshedModels); TargetCollection.MoveCurrentTo(null); TargetCollection.CurrentChanged += (s, e) => { SelectedTargetCollection(); }; } } 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) { Roles.MoveCurrentTo(null); Roles.CurrentChanged += (s, e) => { Role = Roles.CurrentItem as Role; }; } }); }
protected void LoadMetricsByCompanyDepartmentJobRoleAndPeriodCompletedHelper() { try { dispatcher.BeginInvoke (() => { if (Utility.FaultExist(metricsSetupService.Fault)) { return; } if (metricsSetupService.Models != null && metricsSetupService.Models.Count > 0) { RecordCount = "Record Count: " + metricsSetupService.Models.Count; Metrices = new PagedCollectionView(metricsSetupService.Models); Metrices.MoveCurrentTo(null); Metrices.CurrentChanged += (s, e) => { Metrics = Metrices.CurrentItem as Metrics; if (Metrics != null) { if (MetricsPerspectives != null) { List <MetricsPerspective> perspectives = (List <MetricsPerspective>)MetricsPerspectives.SourceCollection; MetricsPerspective perspective = perspectives.Where(mp => mp.Id == Metrics.Perspective.Id).SingleOrDefault(); MetricsPerspectives.MoveCurrentTo(perspective); } if (Departments != null) { List <Department> departments = (List <Department>)Departments.SourceCollection; Department department = departments.Where(d => d.Id == Metrics.ResponsibleDepartment.Id).SingleOrDefault(); Departments.MoveCurrentTo(department); } if (JobRoles != null) { List <CompanyDepartmentJobRole> jobRoles = (List <CompanyDepartmentJobRole>)JobRoles.SourceCollection; CompanyDepartmentJobRole jobRole = jobRoles.Where(d => d.Id == Metrics.CompanyDepartmentJobRole.Id).SingleOrDefault(); JobRoles.MoveCurrentTo(jobRole); } Kpi = Metrics.Kpi; Measure = Metrics.Measure; DataSource = Metrics.DataSource; Target = Metrics.Target.GetValueOrDefault(); Score = Metrics.Score.GetValueOrDefault(); CanSaveMetrics = true; CanClearMetrics = true; } }; } }); } catch (Exception ex) { Utility.DisplayMessage(ex.Message); } }