public async Task LoadUsers()
        {
            try
            {
                Users = new BindingList <UserModel>(await _userEndPoint.GetAll());
            }
            catch (Exception ex)
            {
                dynamic settings = new ExpandoObject();
                settings.WindowStartupLocation = WindowStartupLocation.CenterOwner;
                settings.ResizeMode            = ResizeMode.NoResize;
                settings.Title = "Authorization Failed";

                StatusInfoViewModel status = new StatusInfoViewModel();

                if (ex.Message == "Unauthorized")
                {
                    status.UpdateMessage("Unauthorized Access!!", "You do not have permission to access the Sales Screen.");
                }
                else
                {
                    status.UpdateMessage("Fatal Error", ex.Message);
                }

                await _windowManager.ShowDialogAsync(status, null, settings);
                await TryCloseAsync();
            }
        }
 public UserDisplayViewModel(StatusInfoViewModel status,
                             IWindowManager window,
                             IUserEndpoint userEndpoint)
 {
     this.status       = status;
     this.window       = window;
     this.userEndpoint = userEndpoint;
 }
예제 #3
0
 public SalesViewModel(IProductEndpoint productEndpoint, IConfigHelper configHelper, ISaleEndpoint saleEndpoint, IMapper mapper, StatusInfoViewModel status, IWindowManager window)
 {
     _productEndpoint = productEndpoint;
     _saleEndpoint    = saleEndpoint;
     _configHelper    = configHelper;
     _mapper          = mapper;
     _status          = status;
     _window          = window;
 }
예제 #4
0
 public SalesViewModel(IProductEndpoint productEndpoint,
                       ISaleEndpoint saleEndpoint,
                       IConfigHelper configHelper,
                       IMapper mapper,
                       StatusInfoViewModel status,
                       IWindowManager window)
 {
     this.productEndpoint = productEndpoint;
     this.configHelper    = configHelper;
     this.saleEndpoint    = saleEndpoint;
     this.mapper          = mapper;
     this.status          = status;
     this.window          = window;
 }
예제 #5
0
 public SaleViewModel(
     IProductEndpoint productEndPoint,
     ISaleEndPoint saleEndpoint,
     IMapper mapper,
     StatusInfoViewModel status,
     IWindowManager window,
     IConfiguration configuration)
 {
     _productEndpoint = productEndPoint;
     _saleEndpoint    = saleEndpoint;
     _mapper          = mapper;
     _status          = status;
     _window          = window;
     _configuration   = configuration;
 }
 public UserDisplayViewModel(StatusInfoViewModel status, IWindowManager window, IUserEndPoint userEndPoint)
 {
     _status       = status;
     _window       = window;
     _userEndPoint = userEndPoint;
 }