Exemplo n.º 1
0
        private void ButtonParentIdCheck_Click(object sender, RoutedEventArgs e)
        {
            int?idParent = ViewModel.ParentId;

            if (idParent.HasValue)
            {
                _typeRepository.GetTypeDigest(idParent.Value).Match(
                    None: () => {
                    EllopseParentId.Fill = Brushes.Red;
                    return(Unit());
                },
                    Some: t => {
                    EllopseParentId.Fill   = Brushes.Green;
                    TextBlockIdParent.Text = t.Code + "(" + t.Name + ")";
                    return(Unit());
                }
                    );
            }
            else
            {
                if (ViewModel.TypeCategoryId.HasValue && ViewModel.TypeCategoryId.Value == _typeRepository.GetRootCategoryTypeDigest().Match(() => - 1, t => t.Id))
                {
                    EllopseParentId.Fill = Brushes.Red;
                }
                else
                {
                    EllopseParentId.Fill = Brushes.Green;
                }
            }

            e.Handled = true;
        }