示例#1
0
        /// <summary>
        /// Constructor use DI for required resources
        /// </summary>
        /// <param name="mongoSettings">The database settings data</param>
        /// <param name="appSettings">The app settings data</param>
        /// <param name="serverTaskService"></param>
        public ReservationUpdaterService(
            IRoomServiceMongoSettings mongoSettings,
            IAppSettings appSettings,
            ServerTaskUtils serverTaskService,
            PushService pushService
            )
        {
            //Create a mongo client
            var client = new MongoClient(mongoSettings.ConnectionString);

            //Connect to target database
            var database = client.GetDatabase(mongoSettings.DatabaseName);

            //Connect to target collection repo
            _reservationRepo = database.GetCollection <Reservation>(mongoSettings.ReservationCollection);
            _userRepo        = database.GetCollection <UserModel>(mongoSettings.UserCollection);
            //Tasks
            _serverTasks     = appSettings.ServerTasks; //Use database for tasks???
            _serverTaskUtils = serverTaskService;

            this._pushService = pushService;

            this._pushService.SendBroadcast("Notifica di test");

            //Start an update and timer
            this.UpdateReservation();
            InitTasks(DateTime.Today);
        }
示例#2
0
 /// <summary>
 /// Constructor sets the DI
 /// </summary>
 /// <param name="settings">The required settings</param>
 public WorkSpaceService(IRoomServiceMongoSettings settings)
 {
     //Base init
     base.Init(settings, settings.WorkSpaceCollection);
     //Get collections
     _reservationRepo          = Database.GetCollection <Reservation>(settings.ReservationCollection);
     _workSpaceReservationRepo = Database.GetCollection <WorkSpaceReservation>(settings.WorkSpaceReservationCollection);
 }
示例#3
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="settings">The mongo settings wrapper</param>
        public BuildingService(IRoomServiceMongoSettings settings)
        {
            base.Init(settings, settings.BuildingCollection);

            this._workSpaceReservationRepo = Database.GetCollection <WorkSpaceReservation>(settings.ReservationCollection);
            this._workSpaceRepo            = Database.GetCollection <WorkSpace>(settings.WorkSpaceCollection);
            this._reservationRepo          = Database.GetCollection <Reservation>(settings.ReservationCollection);
        }
示例#4
0
        /// <summary>
        /// Constructor gets the mongo settings from DI
        /// </summary>
        /// <param name="settings">The mongo database settings</param>
        public ReservationService(IRoomServiceMongoSettings settings)
        {
            //Init base class
            base.Init(settings, settings.ReservationCollection);

            //Connect to required extra collections
            _workSpaceRepo            = Database.GetCollection <WorkSpace>(settings.WorkSpaceCollection);
            _workSpaceReservationRepo = Database.GetCollection <WorkSpaceReservation>(settings.WorkSpaceReservationCollection);
        }
示例#5
0
        /// <summary>
        /// Push Service
        /// </summary>
        /// <param name="settings">Mongo Client</param>
        public PushService(IRoomServiceMongoSettings settings)
        {
            var client = new MongoClient(settings.ConnectionString);

            this._database = client.GetDatabase(settings.DatabaseName);

            _collection = _database.GetCollection <SubscriptionWrapper>("Subscriptions");

            this._pushClient = new PushServiceClient
            {
                DefaultAuthentication = new VapidAuthentication
                                            ("BPWObu3Sq-QOaJiOS0CXNEKP9_r2Sm4qWnSXi6k4cDiyb6C-BhviCi9m7VK9jWJcYb75CfPDSrRbcg-M3a4wOV0",
                                            "tUOAgJJTZhH5bNafx-t0CjBx-3K-H3TAMKK2PuhHCK8")
            };
        }
        /// <summary>
        /// Constructor sets the DI
        /// </summary>
        /// <param name="settings">The required settings</param>
        /// <param name="appSettings">The whole app settings wrapper</param>
        /// <param name="cryptProvider">The utility service for password encrypt</param>
        public UserService(IRoomServiceMongoSettings settings, IAppSettings appSettings, CrypProvider cryptProvider)
        {
            //Init base
            base.Init(settings, settings.UserCollection);

            //Set Encryption Data
            this._sectet        = appSettings.Secret;
            this._cryptProvider = cryptProvider;
            this._TokenLifetime = appSettings.TokenDuration;

            //Gets extra collections
            this._reservationRepo          = Database.GetCollection <Reservation>(settings.ReservationCollection);
            this._favouriteRepo            = Database.GetCollection <Favourites> (settings.FavouritesCollection);
            this._workSpaceRepo            = Database.GetCollection <WorkSpace>  (settings.WorkSpaceCollection);
            this._workSpaceReservationRepo = Database.GetCollection <WorkSpaceReservation>(settings.WorkSpaceReservationCollection);
        }
示例#7
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="settings">Mongo settings file wrapper</param>
 public FavouritesService(IRoomServiceMongoSettings settings)
 {
     base.Init(settings, settings.FavouritesCollection);
 }