private bool ValueExists() { switch (Constant.SelectedIndex) { case 0: return(BusinessEntity.Exists((long)(Values.SelectedItem as TextBlock).Tag)); case 1: return(Activity.Exists((long)(Values.SelectedItem as TextBlock).Tag)); default: return(ActivityDirection.Exists((long)(Values.SelectedItem as TextBlock).Tag)); } }
private void Save_CanExecute(object sender, CanExecuteRoutedEventArgs e) { if (TextBox.Text != string.Empty) { switch ((Owner as ConstantsWindow).Constant.SelectedIndex) { case 0: e.CanExecute = !ErrorWindow.CriticalError && !BusinessEntity.Exists(TextBox.Text, (long)Tag); break; case 1: e.CanExecute = !ErrorWindow.CriticalError && !Activity.Exists(TextBox.Text, (long)Tag); break; case 2: e.CanExecute = !ErrorWindow.CriticalError && !ActivityDirection.Exists(TextBox.Text, (long)Tag); break; } } }