Ejemplo n.º 1
0
 /// <summary>
 /// Instantiates a new AuthRepository
 /// </summary>
 /// <param name="boxConfig">The Box configuration that should be used</param>
 /// <param name="boxService">The Box service that will be used to make the requests</param>
 /// <param name="converter">How requests/responses will be serialized/deserialized respectively</param>
 /// <param name="session">The current authenticated session</param>
 public AuthRepository(IBoxConfig boxConfig, IBoxService boxService, IBoxConverter converter, OAuthSession session)
 {
     _config    = boxConfig;
     _service   = boxService;
     _converter = converter;
     Session    = session;
 }
Ejemplo n.º 2
0
        //ToanTXSE
        //Get box List by location ID
        public static List <Models.AndroidBoxVM> GetBoxIdByBrandId()
        {
            IBoxService      boxService      = DependencyUtils.Resolve <IBoxService>();
            ILocationService locationService = DependencyUtils.Resolve <ILocationService>();
            var           AndroidBoxVM       = new List <Models.AndroidBoxVM>();
            IBrandService brandService       = DependencyUtils.Resolve <IBrandService>();
            var           user    = Helper.GetCurrentUser();
            var           boxList = boxService.GetBoxIdByBrandId(user.BrandID);

            foreach (var item in boxList)
            {
                var location       = locationService.Get(item.LocationID);
                var locationString = location.Address + ", Quận " + location.District + ", TP." + location.Province;
                var m = new Models.AndroidBoxVM
                {
                    Name        = item.BoxName,
                    Description = item.Description,
                    BoxId       = item.BoxID,
                    LocationId  = item.LocationID,
                    Location    = locationString,
                };
                AndroidBoxVM.Add(m);
            }
            return(AndroidBoxVM);
        }
Ejemplo n.º 3
0
 public BoxServiceTest()
 {
     // Initial Setup
     _converter = new BoxJsonConverter();
     _handler   = new Mock <IRequestHandler>();
     _service   = new BoxService(_handler.Object);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Instantiates a new AuthRepository
 /// </summary>
 /// <param name="boxConfig">The Box configuration that should be used</param>
 /// <param name="boxService">The Box service that will be used to make the requests</param>
 /// <param name="converter">How requests/responses will be serialized/deserialized respectively</param>
 /// <param name="session">The current authenticated session</param>
 public AuthRepository(IBoxConfig boxConfig, IBoxService boxService, IBoxConverter converter, OAuthSession session)
 {
     _config = boxConfig;
     _service = boxService;
     _converter = converter;
     Session = session;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Instantiates the base class for the Box resource managers
 /// </summary>
 /// <param name="config"></param>
 /// <param name="service"></param>
 /// <param name="converter"></param>
 /// <param name="auth"></param>
 public BoxResourceManager(IBoxConfig config, IBoxService service, IBoxConverter converter, IAuthRepository auth)
 {
     _config    = config;
     _service   = service;
     _converter = converter;
     _auth      = auth;
 }
Ejemplo n.º 6
0
 public CourierMainWindow(User user)
 {
     InitializeComponent();
     _boxService = new BoxXmlService();
     RefreshDataGridView();
     comboBoxStatus.DataSource = Enum.GetValues(typeof(StatusEnum));
 }
Ejemplo n.º 7
0
        public BoxModule(IBoxService boxService) : base("boxes")
        {
            this.RequiresAuthentication();

            Get("", async args => await boxService.GetNamesForUserAsync(CurrentUsername));

            Get("{name}", async args =>
            {
                var name      = (string)args.name;
                var hasAccess = await boxService.HasAccessAsync(name, CurrentUsername);
                if (!hasAccess)
                {
                    return(HttpStatusCode.Forbidden);
                }

                var box = await boxService.GetAsync(name);
                if (box == null)
                {
                    return(HttpStatusCode.NotFound);
                }

                return(new
                {
                    name = box.Name,
                    owner = box.Owner,
                    createdAt = box.CreatedAt.FormatToString(),
                    updatedAt = box.UpdatedAt.FormatToString(),
                    entries = box.Entries.Select(x => x.Key).ToList(),
                    users = box.Users.Select(x => new
                    {
                        username = x.Username,
                        role = x.Role.ToString().ToLowerInvariant(),
                        isActive = x.IsActive
                    })
                });
            });

            Post("{name}", async args =>
            {
                var name = (string)args.name;
                await boxService.CreateAsync(name, CurrentUsername);

                return(Created($"boxes/{name}"));
            });

            Delete("{name}", async args =>
            {
                var name      = (string)args.name;
                var hasAccess = await boxService.HasManagementAccess(name, CurrentUsername);
                if (!hasAccess)
                {
                    return(HttpStatusCode.Forbidden);
                }

                await boxService.DeleteAsync(name);

                return(HttpStatusCode.NoContent);
            });
        }
Ejemplo n.º 8
0
 public ManageBasket(IBoxService bs)
 {
     _bs = bs;
     if (HttpContext.Current.Session["cartDetails"] == null)
     {
         List <OrderDetailDTO> orders = new List <OrderDetailDTO>();
         HttpContext.Current.Session["cartDetails"] = orders;
     }
 }
Ejemplo n.º 9
0
 public BoxJWTAuthTest()
 {
     // Initial Setup
     _handler   = new Mock <IRequestHandler>();
     _service   = new BoxService(_handler.Object);
     _boxConfig = new Mock <IBoxConfig>();
     _boxConfig.SetupGet(x => x.EnterpriseId).Returns("12345");
     _jwtAuth = new BoxJWTAuth(_boxConfig.Object, _service);
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Instantiates the base class for the Box resource managers
 /// </summary>
 /// <param name="config"></param>
 /// <param name="service"></param>
 /// <param name="converter"></param>
 /// <param name="auth"></param>
 public BoxResourceManager(IBoxConfig config, IBoxService service, IBoxConverter converter, IAuthRepository auth, string asUser, bool?suppressNotifications)
 {
     _config                = config;
     _service               = service;
     _converter             = converter;
     _auth                  = auth;
     _asUser                = asUser;
     _suppressNotifications = suppressNotifications;
 }
Ejemplo n.º 11
0
        public BoxController(IBoxService boxService)
        {
            if (boxService == null)
            {
                throw new ArgumentNullException("Target 'boxService' must not be null.");
            }

            _boxService = boxService;
        }
Ejemplo n.º 12
0
 public BoxController(
     IBoxService boxService,
     IPlayerService playerService,
     IUnitOfWorkFactory unitOfWorkFactory)
 {
     this.boxService        = boxService;
     this.playerService     = playerService;
     this.unitOfWorkFactory = unitOfWorkFactory;
 }
Ejemplo n.º 13
0
        /// <summary>
        /// Initializes a new BoxClient with the provided config, converter, service and auth objects.
        /// </summary>
        /// <param name="boxConfig">The config object to use</param>
        /// <param name="boxConverter">The box converter object to use</param>
        /// <param name="boxService">The box service to use</param>
        /// <param name="auth">The auth repository object to use</param>
        public BoxClient(IBoxConfig boxConfig, IBoxConverter boxConverter, IBoxService boxService, IAuthRepository auth)
        {
            Config     = boxConfig;
            Auth       = auth;
            _converter = boxConverter;
            _service   = boxService;

            InitManagers();
        }
Ejemplo n.º 14
0
        public BoxResourceManagerTest()
        {
            // Initial Setup
            _converter = new BoxJsonConverter();
            _handler   = new Mock <IRequestHandler>();
            _service   = new BoxService(_handler.Object);
            _config    = new Mock <IBoxConfig>();

            _authRepository = new AuthRepository(_config.Object, _service, _converter, new OAuthSession("fakeAccessToken", "fakeRefreshToken", 3600, "bearer"));
        }
        public BoxResourceManagerTest()
        {
            // Initial Setup
            _converter = new BoxJsonConverter();
            _handler = new Mock<IRequestHandler>();
            _service = new BoxService(_handler.Object);
            _config = new Mock<IBoxConfig>();

            _authRepository = new AuthRepository(_config.Object, _service, _converter, new OAuthSession("fakeAccessToken", "fakeRefreshToken", 3600, "bearer"));
        }
Ejemplo n.º 16
0
 public HomeController(IBoxService boxService)
 {
     if (boxService != null)
     {
         _boxService = boxService;
     }
     else
     {
         throw new ArgumentNullException("Argument 'ideaService' must not be null");
     }
 }
Ejemplo n.º 17
0
        /// <summary>
        /// Instantiates a BoxClient that uses JWT authentication
        /// </summary>
        /// <param name="boxConfig">The config object to be used</param>
        /// <param name="authRepository">An IAuthRepository that knows how to retrieve new tokens using JWT</param>
        public BoxClient(IBoxConfig boxConfig, IAuthRepository authRepository)
        {
            Config = boxConfig;

            _handler   = new HttpRequestHandler();
            _converter = new BoxJsonConverter();
            _service   = new BoxService(_handler);
            Auth       = authRepository;

            InitManagers();
        }
Ejemplo n.º 18
0
        /// <summary>
        ///     Constructeur paramétré qui initialise les propriétés du view model.
        /// </summary>
        /// <param name="boxService">
        ///     Instance du service d'accès aux données de l'entité <see cref="Box"/>.
        /// </param>
        /// <param name="storageService">
        ///     Instance du service d'accès aux données de stockage local.
        /// </param>
        /// <param name="navigationService">
        ///     Instance du service de navigation.
        /// </param>
        /// <param name="localizationService">
        ///     Instance du service d'accès aux données de localization.
        /// </param>
        /// <param name="dialogService">
        ///     Instance du service d'affichage de popups.
        /// </param>
        public CreateBoxViewModel(IBoxService boxService, IStorageService storageService, INavigationService navigationService,
                                  ILocalizationService localizationService, IDialogService dialogService)
        {
            this.boxService          = boxService;
            this.storageService      = storageService;
            this.navigationService   = navigationService;
            this.localizationService = localizationService;
            this.dialogService       = dialogService;

            this.CreateBoxCommand = new RelayCommand(this.CreateBox, this.CanCreateBoxExecute);
        }
Ejemplo n.º 19
0
        /// <summary>
        /// Initializes a new BoxClient with the provided config, converter, service and auth objects.
        /// </summary>
        /// <param name="boxConfig">The config object to use</param>
        /// <param name="boxConverter">The box converter object to use</param>
        /// <param name="boxService">The box service to use</param>
        /// <param name="auth">The auth repository object to use</param>
        public BoxClient(IBoxConfig boxConfig, IBoxConverter boxConverter, IRequestHandler requestHandler, IBoxService boxService, IAuthRepository auth)
        {
            Config = boxConfig;

            _handler   = requestHandler;
            _converter = boxConverter;
            _service   = boxService;
            Auth       = auth;

            InitManagers();
        }
Ejemplo n.º 20
0
        /// <summary>
        /// Instantiates a BoxClient with the provided config object and auth session
        /// </summary>
        /// <param name="boxConfig">The config object to be used</param>
        /// <param name="authSession">A fully authenticated auth session</param>
        public BoxClient(IBoxConfig boxConfig, OAuthSession authSession)
        {
            Config = boxConfig;

            _handler   = new HttpRequestHandler();
            _converter = new BoxJsonConverter();
            _service   = new BoxService(_handler);
            Auth       = new AuthRepository(Config, _service, _converter, authSession);

            InitManagers();
        }
Ejemplo n.º 21
0
        /// <summary>
        ///     Constructeur paramétré qui initialise les propriétés du view model.
        /// </summary>
        /// <param name="boxService">
        ///     Instance du service d'accès aux données de l'entité <see cref="Box"/>.
        /// </param>
        /// <param name="navigationService">
        ///     Instance du service de navigation.
        /// </param>
        /// <param name="localizationService">
        ///     Instance du service d'accès aux données de localization.
        /// </param>
        /// <param name="dialogService">
        ///     Instance du service d'affichage de popups.
        /// </param>
        public EditBoxViewModel(IBoxService boxService, INavigationService navigationService,
                                ILocalizationService localizationService, IDialogService dialogService)
        {
            this.boxService          = boxService;
            this.navigationService   = navigationService;
            this.localizationService = localizationService;
            this.dialogService       = dialogService;

            this.UpdateBoxCommand = new RelayCommand(this.UpdateBox, this.CanUpdateBoxExecute);

            this.IsUpdating = false;
        }
Ejemplo n.º 22
0
        /// <summary>
        /// Instantiates a BoxClient with the provided config object and auth session
        /// </summary>
        /// <param name="boxConfig">The config object to be used</param>
        /// <param name="authSession">A fully authenticated auth session</param>
        public BoxClient(IBoxConfig boxConfig, OAuthSession authSession)
        {
            _config = boxConfig;
            
            IRequestHandler handler = new HttpRequestHandler();
            _converter = new BoxJsonConverter();

            _service = new BoxService(handler);

            Auth = new AuthRepository(_config, _service, _converter, authSession);

            InitManagers();
        }
Ejemplo n.º 23
0
        /// <summary>
        /// Instantiates a BoxClient with the provided config object
        /// </summary>
        /// <param name="boxConfig">The config object to be used</param>
        /// <param name="asUser">The user ID to set as the 'As-User' header parameter; used to make calls in the context of a user using an admin token</param>
        public BoxClient(IBoxConfig boxConfig, string asUser = null)
        {
            Config = boxConfig;

            _asUser = asUser;

            _handler   = new HttpRequestHandler();
            _converter = new BoxJsonConverter();
            _service   = new BoxService(_handler);
            Auth       = new AuthRepository(Config, _service, _converter, null);

            InitManagers();
        }
Ejemplo n.º 24
0
 public BoxCCGAuthTest()
 {
     // Initial Setup
     _handler   = new Mock <IRequestHandler>();
     _service   = new BoxService(_handler.Object);
     _boxConfig = new Mock <IBoxConfig>();
     _boxConfig.SetupGet(x => x.EnterpriseId).Returns("12345");
     _boxConfig.SetupGet(x => x.ClientId).Returns("123");
     _boxConfig.SetupGet(x => x.ClientSecret).Returns("SECRET");
     _boxConfig.SetupGet(x => x.BoxApiHostUri).Returns(new Uri(Constants.BoxApiHostUriString));
     _boxConfig.SetupGet(x => x.BoxAuthTokenApiUri).Returns(new Uri(Constants.BoxAuthTokenApiUriString));
     _ccgAuth = new BoxCCGAuth(_boxConfig.Object, _service);
 }
        public BoxResourceManagerTest()
        {
            // Initial Setup
            _converter = new BoxJsonConverter();
            _handler   = new Mock <IRequestHandler>();
            _service   = new BoxService(_handler.Object);
            _config    = new Mock <IBoxConfig>();
            _config.SetupGet(x => x.CollaborationsEndpointUri).Returns(new Uri(Constants.CollaborationsEndpointString));
            _config.SetupGet(x => x.FoldersEndpointUri).Returns(_FoldersUri);
            _config.SetupGet(x => x.FilesEndpointUri).Returns(_FilesUri);
            _config.SetupGet(x => x.UserEndpointUri).Returns(_usersUri);

            _authRepository = new AuthRepository(_config.Object, _service, _converter, new OAuthSession("fakeAccessToken", "fakeRefreshToken", 3600, "bearer"));
        }
Ejemplo n.º 26
0
        /// <summary>
        /// Initializes a new BoxClient with the provided config, converter, service and auth objects.
        /// </summary>
        /// <param name="boxConfig">The config object to use</param>
        /// <param name="boxConverter">The box converter object to use</param>
        /// <param name="requestHandler">The box request handler to use</param>
        /// <param name="boxService">The box service to use</param>
        /// <param name="auth">The auth repository object to use</param>
        /// <param name="asUser">The user ID to set as the 'As-User' header parameter; used to make calls in the context of a user using an admin token</param>
        /// <param name="suppressNotifications">Whether or not to suppress both email and webhook notifications. Typically used for administrative API calls. Your application must have “Manage an Enterprise” scope, and the user making the API calls is a co-admin with the correct "Edit settings for your company" permission.</param>
        public BoxClient(IBoxConfig boxConfig, IBoxConverter boxConverter, IRequestHandler requestHandler, IBoxService boxService, IAuthRepository auth, string asUser = null, bool?suppressNotifications = null)
        {
            Config = boxConfig;

            _asUser = asUser;
            _suppressNotifications = suppressNotifications;

            _handler   = requestHandler;
            _converter = boxConverter;
            _service   = boxService;
            Auth       = auth;

            InitManagers();
        }
Ejemplo n.º 27
0
        /// <summary>
        /// Instantiates a BoxClient that uses JWT authentication
        /// </summary>
        /// <param name="boxConfig">The config object to be used</param>
        /// <param name="authRepository">An IAuthRepository that knows how to retrieve new tokens using JWT</param>
        /// <param name="asUser">The user ID to set as the 'As-User' header parameter; used to make calls in the context of a user using an admin token</param>
        /// <param name="suppressNotifications">Whether or not to suppress both email and webhook notifications. Typically used for administrative API calls. Your application must have “Manage an Enterprise” scope, and the user making the API calls is a co-admin with the correct "Edit settings for your company" permission.</param>
        public BoxClient(IBoxConfig boxConfig, IAuthRepository authRepository, string asUser = null, bool?suppressNotifications = null)
        {
            Config = boxConfig;

            _asUser = asUser;
            _suppressNotifications = suppressNotifications;

            _handler   = new HttpRequestHandler();
            _converter = new BoxJsonConverter();
            _service   = new BoxService(_handler);
            Auth       = authRepository;

            InitManagers();
        }
Ejemplo n.º 28
0
        /// <summary>
        /// Instantiates a BoxClient with the provided config object and auth session
        /// </summary>
        /// <param name="boxConfig">The config object to be used</param>
        /// <param name="authSession">A fully authenticated auth session</param>
        /// <param name="asUser">The user ID to set as the 'As-User' header parameter; used to make calls in the context of a user using an admin token</param>
        /// <param name="suppressNotifications">Whether or not to suppress both email and webhook notifications. Typically used for administrative API calls. Your application must have “Manage an Enterprise” scope, and the user making the API calls is a co-admin with the correct "Edit settings for your company" permission.</param>
        public BoxClient(IBoxConfig boxConfig, OAuthSession authSession, string asUser = null, bool?suppressNotifications = null)
        {
            Config = boxConfig;

            _asUser = asUser;
            _suppressNotifications = suppressNotifications;

            _handler   = new HttpRequestHandler(boxConfig.WebProxy);
            _converter = new BoxJsonConverter();
            _service   = new BoxService(_handler);
            Auth       = new AuthRepository(Config, _service, _converter, authSession);

            InitManagers();
        }
Ejemplo n.º 29
0
        protected BoxResourceManagerTest()
        {
            // Initial Setup
            Converter = new BoxJsonConverter();
            Handler   = new Mock <IRequestHandler>();
            Service   = new BoxService(Handler.Object);
            Config    = new Mock <IBoxConfig>();
            Config.SetupGet(x => x.CollaborationsEndpointUri).Returns(new Uri(Constants.CollaborationsEndpointString));
            Config.SetupGet(x => x.FoldersEndpointUri).Returns(FoldersUri);
            Config.SetupGet(x => x.FilesEndpointUri).Returns(FilesUri);
            Config.SetupGet(x => x.FilesUploadEndpointUri).Returns(FilesUploadUri);
            Config.SetupGet(x => x.UserEndpointUri).Returns(UserUri);
            Config.SetupGet(x => x.InviteEndpointUri).Returns(InviteUri);

            AuthRepository = new AuthRepository(Config.Object, Service, Converter, new OAuthSession("fakeAccessToken", "fakeRefreshToken", 3600, "bearer"));
        }
Ejemplo n.º 30
0
        /// <summary>
        ///     Constructeur qui initialise les propriétés du view model.
        /// </summary>
        /// <param name="postService">
        ///     Instance du service d'accès aux données de l'entité <see cref="Post"/>.
        /// </param>
        /// <param name="boxService">
        ///     Instance du service d'accès aux données de l'entité <see cref="Box"/>.
        /// </param>
        /// <param name="navigationService">
        ///     Instance du service de navigation.
        /// </param>
        /// <param name="storageService">
        ///     Instance du service d'accès aux données de stockage local.
        /// </param>
        /// <param name="dialogService">
        ///     Instance du service d'affichage de popups.
        /// </param>
        public BoxViewModel(IPostService postService, IBoxService boxService, INavigationService navigationService,
                            IStorageService storageService, IDialogService dialogService)
        {
            this.postService       = postService;
            this.boxService        = boxService;
            this.navigationService = navigationService;
            this.storageService    = storageService;
            this.dialogService     = dialogService;

            this.ShowPostCommand    = new RelayCommand <Post>(this.ShowPost);
            this.CreatePostCommand  = new RelayCommand <string>(this.CreatePost, this.CanCreatePostExecute);
            this.SubscribeCommand   = new RelayCommand(this.Subscribe, this.CanSubscribeExecute);
            this.UnsubscribeCommand = new RelayCommand(this.Unsubscribe, this.CanUnsubscribeExecute);
            this.ShowEditBoxCommand = new RelayCommand(this.ShowEditBox);
            this.DeleteBoxCommand   = new RelayCommand(this.DeleteBox, this.CanDeleteBoxExecute);

            this.IsLoading       = false;
            this.IsPosting       = false;
            this.IsSubscribing   = false;
            this.IsUnsubscribing = false;
            this.Posts           = new ObservableCollection <Post>();

            // Si nous sommes en mode design ==> chargement d'une boite fictive.
            if (this.IsInDesignMode)
            {
                this.Initialize(new Box
                {
                    Title       = "Lorem",
                    Description = "Donec laoreet accumsan eros ut scelerisque. Integer sollicitudin justo nulla, a pulvinar nulla bibendum sit amet. Ut orci ex, viverra sit amet ornare varius, rutrum ac eros. Quisque consequat porttitor nulla, non convallis ex tristique sit amet. Morbi sed varius massa.",
                    Id          = 1,
                    Subscribers = new List <User>
                    {
                        new User {
                            FirstName = "David", LastName = "Pierce"
                        },
                        new User {
                            FirstName = "Thomas", LastName = "Edison"
                        }
                    },
                    Creator = new User {
                        FirstName = "John", LastName = "Doe", Id = 1
                    }
                });
            }
        }
Ejemplo n.º 31
0
        /// <summary>
        /// Constructor for JWT authentication
        /// </summary>
        /// <param name="boxConfig">Config contains information about client id, client secret, enterprise id, private key, private key password, public key id </param>
        /// <param name="boxService">Box service is used to perform GetToken requests</param>
        public BoxJWTAuth(IBoxConfig boxConfig, IBoxService boxService)
        {
            this.boxConfig  = boxConfig;
            this.boxService = boxService;

            // the following allows creation of a BoxJWTAuth object without valid keys but with a valid JWT UserToken
            // this allows code like this:

            // var boxConfig = new BoxConfig("", "", "", "", "", "");
            // var boxJwt = new BoxJWTAuth(boxConfig);
            // const string userToken = "TOKEN_OBTAINED_BY_CALLING_FULL_BOXJWTAUTH";  // token valid for 1 hr.
            // UserClient = boxJwt.UserClient(userToken, null);  // this user client can do normal file operations.

            if (!string.IsNullOrEmpty(boxConfig.JWTPrivateKey) && !string.IsNullOrEmpty(boxConfig.JWTPrivateKeyPassword))
            {
                var    pwf = new PEMPasswordFinder(this.boxConfig.JWTPrivateKeyPassword);
                object key = null;
                using (var reader = new StringReader(this.boxConfig.JWTPrivateKey))
                {
                    var privateKey = new PemReader(reader, pwf).ReadObject();

                    key = privateKey;
                }

                if (key == null)
                {
                    throw new BoxException("Invalid private key!");
                }

                RSA rsa = null;
                if (key is AsymmetricCipherKeyPair)
                {
                    var ackp = (AsymmetricCipherKeyPair)key;
                    rsa = RSAUtilities.ToRSA((RsaPrivateCrtKeyParameters)ackp.Private);
                }
                else if (key is RsaPrivateCrtKeyParameters)
                {
                    var rpcp = (RsaPrivateCrtKeyParameters)key;
                    rsa = RSAUtilities.ToRSA(rpcp);
                }

                credentials = new SigningCredentials(new RsaSecurityKey(rsa), SecurityAlgorithms.RsaSha256);
            }
        }
Ejemplo n.º 32
0
        // GET: Location/Delete/:id
        public ActionResult Delete(int id)
        {
            var            location         = this.locationService.Get(id);
            IBoxService    boxService       = DependencyUtils.Resolve <IBoxService>();
            IScreenService screenService    = DependencyUtils.Resolve <IScreenService>();
            var            boxInLocation    = boxService.Get(a => a.LocationID == id).FirstOrDefault();
            var            screenInLocation = screenService.Get(a => a.LocationID == id).FirstOrDefault();
            bool           result           = false;

            if (location != null && boxInLocation == null && screenInLocation == null)
            {
                this.locationService.Delete(location);
                result = true;
            }
            return(Json(new
            {
                success = result,
            }, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 33
0
        /// <summary>
        ///     Constructeur paramétré qui initialize les propriétés du view model.
        /// </summary>
        /// <param name="boxService">
        ///     Instance du service d'accès aux données de l'entité <see cref="Box"/>.
        /// </param>
        /// <param name="storageService">
        ///     Instance du service d'accès aux données de stockage local.
        /// </param>
        /// <param name="navigationService">
        ///     Instance du service de navigation.
        /// </param>
        /// <param name="localizationService">
        ///     Instance du service d'accès aux données de localization.
        /// </param>
        /// <param name="dialogService">
        ///     Instance du service d'affichage de popups.
        /// </param>
        public MyBoxesViewModel(IBoxService boxService, IStorageService storageService,
                                INavigationService navigationService, ILocalizationService localizationService,
                                IDialogService dialogService)
        {
            this.boxService          = boxService;
            this.storageService      = storageService;
            this.navigationService   = navigationService;
            this.localizationService = localizationService;
            this.dialogService       = dialogService;

            this.ShowBoxCommand       = new RelayCommand <Box>(this.ShowBox);
            this.ShowCreateBoxCommand = new RelayCommand(this.ShowCreateBox);

            this.IsLoading = false;
            this.Boxes     = new ObservableCollection <Box>();

            if (this.IsInDesignMode)
            {
                this.Initialize();
            }
        }
Ejemplo n.º 34
0
        /// <summary>
        ///     Constructeur de paramétré qui initialize les propriétés du view model.
        /// </summary>
        /// <param name="boxService">
        ///     Instance du service d'accès aux données de l'entité <see cref="Box"/>.
        /// </param>
        /// <param name="navigationService">
        ///     Instance du service de navigation.
        /// </param>
        /// <param name="localizationService">
        ///     Instance du service de localization.
        /// </param>
        /// <param name="dialogService">
        ///     Instance du service d'affichage de popups.
        /// </param>
        public DiscoverViewModel(IBoxService boxService, INavigationService navigationService,
                                 ILocalizationService localizationService, IDialogService dialogService)
        {
            this.boxService          = boxService;
            this.navigationService   = navigationService;
            this.localizationService = localizationService;
            this.dialogService       = dialogService;

            this.ShowBoxCommand   = new RelayCommand <Box>(this.ShowBox);
            this.SearchBoxCommand = new RelayCommand <string>(this.SearchBox);

            this.IsLoading     = false;
            this.IsSearching   = false;
            this.TopBoxes      = new ObservableCollection <Box>();
            this.SearchResults = new ObservableCollection <Box>();

            if (this.IsInDesignMode)
            {
                this.ReloadTopBoxes();
            }
        }
Ejemplo n.º 35
0
 public BoxIntegration(Game game)
 {
     boxService = game.Services.GetRequiredService<IBoxService>();
     storageService = game.Services.GetRequiredService<IStorageService>();
 }
Ejemplo n.º 36
0
 /// <summary>
 /// Instantiates a new AuthRepository
 /// </summary>
 /// <param name="boxConfig">The Box configuration that should be used</param>
 /// <param name="boxService">The Box service that will be used to make the requests</param>
 /// <param name="converter">How requests/responses will be serialized/deserialized respectively</param>
 public AuthRepository(IBoxConfig boxConfig, IBoxService boxService, IBoxConverter converter) : this(boxConfig, boxService, converter, null)
 {
 }
 public BoxFilesManager(IBoxConfig config, IBoxService service, IBoxConverter converter, IAuthRepository auth)
     : base(config, service, converter, auth) { }
 public BoxMetadataManager(IBoxConfig config, IBoxService service, IBoxConverter converter, IAuthRepository auth)
     : base(config, service, new BoxMetadataJsonConverter(), auth) { }
Ejemplo n.º 39
0
 public BoxCollectionsManager(IBoxConfig config, IBoxService service, IBoxConverter converter, IAuthRepository auth, string asUser = null, bool? suppressNotifications = null)
     : base(config, service, converter, auth, asUser, suppressNotifications) { }
 public BoxCommentsManager(IBoxConfig config, IBoxService service, IBoxConverter converter, IAuthRepository auth, string asUser = null)
     : base(config, service, converter, auth, asUser) { }
Ejemplo n.º 41
0
 /// <summary>
 /// Instantiates a new AuthRepository
 /// </summary>
 /// <param name="boxConfig">The Box configuration that should be used</param>
 /// <param name="boxService">The Box service that will be used to make the requests</param>
 /// <param name="converter">How requests/responses will be serialized/deserialized respectively</param>
 public AuthRepository(IBoxConfig boxConfig, IBoxService boxService, IBoxConverter converter) : this(boxConfig, boxService, converter, null) { }