private void ExecuteSaveCommand(UiShooter obj) { _selectedUiSession.ShooterId = obj.ShooterId; _sessionDatastore.Update(UiBusinessObjectMapper.ToSession(SelectedUiSession)); ExecuteSearchShooterCommand(ShooterNumber); _events.ShooterDataStoreChanged(); }
private void ExecuteSearchShooterCommand(string obj) { int shooterNumber; if (int.TryParse(obj, out shooterNumber)) { Shooter shooter = _shooterDatastore.FindByShooterNumber(shooterNumber); if (shooter != null) { if (shooter.PersonId != null) { UiShooter uiShooter = UiBusinessObjectMapper.ToUiShooter(shooter).FetchPerson(_personDatastore.FindById((int)shooter.PersonId)); CurrentShooterLabel = string.Format("{0} {1} ({2})", uiShooter.LastName, uiShooter.FirstName, uiShooter.ShooterNumber); } int shooterId = shooter.ShooterId; List <UiSession> session = _sessionDatastore.FindByShooterId(shooterId).Select(UiBusinessObjectMapper.ToUiSession).ToList(); session.ForEach(_ => { if (_.ProgramItemId != null) { _.ProgramDescription = string.Format("{0}", _programItemDatastore.FindById((int)_.ProgramItemId).ProgramName); } }); UiSessions = new ObservableCollection <UiSession>(session); SelectedUiSession = UiSessions.FirstOrDefault(); } } }
private void ExecuteDeleteCommand(UiSession session) { _sessionDatastore.Delete(UiBusinessObjectMapper.ToSession(session)); ExecuteSearchShooterCommand(ShooterNumber); _events.ShooterDataStoreChanged(); }