//protected void OnSaveCommand() //{ // try // { // if (InvalidEntry()) // { // return; // } // Metrics.Kpi = Kpi; // Metrics.Measure = Measure; // Metrics.DataSource = DataSource; // Metrics.Target = Target; // Metrics.Score = Score; // Metrics.ResponsibleDepartment = Department; // Metrics.Perspective = MetricsPerspective; // //Metrics.CompanyDepartmentJobRole = JobRole; // SaveOperationCompleted(); // metricsSetupService.Modify(Metrics); // } // catch (Exception ex) // { // Utility.DisplayMessage(ex.Message); // } //} private void OnClearCommand() { try { if (MetricsPerspectives != null) { MetricsPerspectives.MoveCurrentToFirst(); } if (Departments != null) { Departments.MoveCurrentToFirst(); } Kpi = ""; Measure = ""; DataSource = ""; Target = 0; Score = 0; //CanSaveMetrics = false; //CanClearMetrics = false; } catch (Exception ex) { Utility.DisplayMessage(ex.Message); } }
protected override void ClearView() { try { base.ClearTargetCollection(); CompanyDepartmentJobRole = null; CompanyDepartmentJobRoles.MoveCurrentToPosition(0); MetricsPerspectives.MoveCurrentToPosition(0); Departments.MoveCurrentToPosition(0); TargetModel = new Metrics(); UpdateViewState(Edit.Mode.Loaded); } catch (Exception ex) { Utility.DisplayMessage(ex.Message); } }
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); } }