private void Window_Loaded(object sender, RoutedEventArgs e) { CustomIdentity identity = null; try { var username = "******"; // Admin, Guest, Mary, Bob identity = Csla.DataPortal.Fetch<CustomIdentity>( new Csla.Security.UsernameCriteria(username, "")); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Login error", MessageBoxButton.OK, MessageBoxImage.Exclamation); } var principal = new CustomPrincipal(identity); Csla.ApplicationContext.User = principal; UserTextBlock.Text = Csla.ApplicationContext.User.Identity.Name; try { var cust = CustomerEdit.GetCustomer(123); var dp = Resources["Customer"] as Csla.Xaml.CslaDataProvider; dp.ObjectInstance = cust; } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Error", MessageBoxButton.OK, MessageBoxImage.Exclamation); } //if (User.HasPermission("Customer.City.Read")) // CityPanel.Visibility = Visibility.Visible; //else // CityPanel.Visibility = Visibility.Collapsed; }
private void Window_Loaded(object sender, RoutedEventArgs e) { CustomIdentity identity = null; try { var username = "******"; // Admin, Guest, Mary, Bob identity = Csla.DataPortal.Fetch <CustomIdentity>( new Csla.Security.UsernameCriteria(username, "")); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Login error", MessageBoxButton.OK, MessageBoxImage.Exclamation); } var principal = new CustomPrincipal(identity); Csla.ApplicationContext.User = principal; UserTextBlock.Text = Csla.ApplicationContext.User.Identity.Name; try { var cust = CustomerEdit.GetCustomer(123); var dp = Resources["Customer"] as Csla.Xaml.CslaDataProvider; dp.ObjectInstance = cust; } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Error", MessageBoxButton.OK, MessageBoxImage.Exclamation); } //if (User.HasPermission("Customer.City.Read")) // CityPanel.Visibility = Visibility.Visible; //else // CityPanel.Visibility = Visibility.Collapsed; }