Esempio n. 1
0
 public FunctionHelperService(IGoogleCalendarService googleCalendarService, ITelegramService telegramService,
                              EventRepository eventRepository)
 {
     _googleCalendarService = googleCalendarService;
     _telegramService       = telegramService;
     _eventRepository       = eventRepository;
 }
Esempio n. 2
0
 public MoodTrackerController(UserManager <IdentityUser> userManager, IDatabaseService databaseService, IGoogleCalendarService calendarService, ISmsService smsService, IMusicService musicService)
 {
     _databaseService = databaseService;
     _userManager     = userManager;
     _calendarService = calendarService;
     _smsService      = smsService;
     rand             = new Random();
     _musicService    = musicService;
 }
Esempio n. 3
0
        /// <summary>
        /// Constructor needs access to the calendar service object, and calendar ID, it will be accessing.
        /// </summary>
        /// <param name="calendarService"></param>
        /// <param name="calendarId"></param>
        public GoogleCalendar(IGoogleCalendarService calendarService, string calendarId)
        {
            _calendarService = calendarService;
            _calendarId = calendarId;
            var calendar = _calendarService.Calendars.Get(_calendarId).Execute();
            var calendarOlsonTimeZone = calendar.TimeZone;
            _defaultCalendarTimeZone = OlsonTimeZone.OlsonTimeZoneToTimeZoneInfo(calendarOlsonTimeZone);

            _calendarEventTransformer = new GoogleCalendarEventTransformer(_defaultCalendarTimeZone);
        }
Esempio n. 4
0
 public CalendarImporter(
     IGoogleCalendarService googleCalendarService,
     IEventManagementService eventService,
     IJsonFileRepository <Event> jsonFileRepository,
     IConsole console)
 {
     this.googleCalendarService = googleCalendarService;
     this.eventService          = eventService;
     this.jsonFileRepository    = jsonFileRepository;
     this.console = console;
 }
 public ManageController(
     IManageService manageService,
     IAccountService accountService,
     ILogger <ManageController> logger,
     INotificationService emailNotificationService,
     IGoogleCalendarService googleCalendarService)
 {
     this._manageService            = manageService ?? throw new ArgumentNullException(nameof(manageService));
     this._accountService           = accountService ?? throw new ArgumentNullException(nameof(accountService));
     this._logger                   = logger ?? throw new ArgumentNullException(nameof(logger));
     this._emailNotificationService = emailNotificationService ?? throw new ArgumentNullException(nameof(emailNotificationService));
     this._googleCalendarService    = googleCalendarService ?? throw new ArgumentNullException(nameof(googleCalendarService));
 }
Esempio n. 6
0
 public ProfileViewModel(CalendarSyncProfile syncProfile, IGoogleCalendarService googleCalendarService,
                         IOutlookCalendarService outlookCalendarService,
                         IMessageService messageService, IExchangeWebCalendarService exchangeWebCalendarService,
                         ApplicationLogger applicationLogger, IAccountAuthenticationService accountAuthenticationService)
 {
     SyncProfile = syncProfile;
     ExchangeWebCalendarService   = exchangeWebCalendarService;
     ApplicationLogger            = applicationLogger.GetLogger(GetType());
     AccountAuthenticationService = accountAuthenticationService;
     GoogleCalendarService        = googleCalendarService;
     OutlookCalendarService       = outlookCalendarService;
     MessageService = messageService;
 }
 public CalendarViewModel(ICalendarView calendarView,
                          IGoogleCalendarService googleCalendarService,
                          IOutlookCalendarService outlookCalendarService,
                          IMessageService messageService,
                          IExchangeWebCalendarService exchangeWebCalendarService,
                          ApplicationLogger applicationLogger,
                          IAccountAuthenticationService accountAuthenticationService)
     : base(calendarView)
 {
     ExchangeWebCalendarService = exchangeWebCalendarService;
     Logger = applicationLogger.GetLogger(GetType());
     AccountAuthenticationService = accountAuthenticationService;
     GoogleCalendarService        = googleCalendarService;
     OutlookCalendarService       = outlookCalendarService;
     MessageService = messageService;
 }
Esempio n. 8
0
 public CompanyCalendarService(
     IMapper mapper,
     IRepository <CompanyCalendar> companyCalendarRepository,
     IUnitOfWork unitOfWork,
     ILog <CompanyCalendarService> log,
     IGoogleCalendarService googleCalendarService,
     UpdateCompanyCalendarContractValidator updateCompanyCalendarContractValidator,
     CreateCompanyCalendarContractValidator createCompanyCalendarContractValidator
     )
 {
     _mapper     = mapper;
     _unitOfWork = unitOfWork;
     _companyCalendarRepository = companyCalendarRepository;
     _log = log;
     _updateCompanyCalendarContractValidator = updateCompanyCalendarContractValidator;
     _createCompanyCalendarContractValidator = createCompanyCalendarContractValidator;
     _googleCalendarService = googleCalendarService;
 }
Esempio n. 9
0
 public DaysOffService(
     IMapper mapper,
     IRepository <DaysOff> daysOffRepository,
     IUnitOfWork unitOfWork,
     ILog <DaysOffService> log,
     IGoogleCalendarService googleCalendarService,
     UpdateDaysOffContractValidator updateDaysOffContractValidator,
     CreateDaysOffContractValidator createDaysOffContractValidator
     )
 {
     _mapper            = mapper;
     _unitOfWork        = unitOfWork;
     _daysOffRepository = daysOffRepository;
     _log = log;
     _updateDaysOffContractValidator = updateDaysOffContractValidator;
     _createDaysOffContractValidator = createDaysOffContractValidator;
     _googleCalendarService          = googleCalendarService;
 }
Esempio n. 10
0
        public GoogleCalendarScheduler(IDateTimeProvider dateTimeProvider, IFlexKidsConfig flexKidsConfig /*IGoogleCalendarService googleCalendarService*/)
        {
            //       if (googleCalendarService == null)
            //           throw new ArgumentNullException("googleCalendarService");

            //       calendarService = googleCalendarService;

            googleCalendarId      = flexKidsConfig.GoogleCalendarId;
            googleCalendarAccount = flexKidsConfig.GoogleCalendarAccount;

            //TODO Check if file exists and make it more robust.
            var certificate = new X509Certificate2(@flexKidsConfig.GoogleCalendarKeyFile, "notasecret", X509KeyStorageFlags.Exportable);

            var credential = new ServiceAccountCredential(
                new ServiceAccountCredential.Initializer(googleCalendarAccount)
            {
                Scopes = new[] { CalendarService.Scope.Calendar }
            }.FromCertificate(certificate));

            // Create the service.
            var service = new CalendarService(new BaseClientService.Initializer
            {
                HttpClientFactory     = new Google.Apis.Http.HttpClientFactory(),
                HttpClientInitializer = credential,
                ApplicationName       = "FlexKids Rooster by CoenM",
            });

            if (service == null)
            {
                throw new Exception("Cannot create service.");
            }

            calendarService = new GoogleCalendarService(service);


            var calendar = calendarService.GetCalendarById(googleCalendarId);

            if (calendar == null)
            {
                throw new Exception("Cannot find calendar");
            }
        }
Esempio n. 11
0
 public SettingsViewModel(ISettingsView view,
                          IGoogleCalendarService googleCalendarService,
                          Settings settings,
                          ISettingsSerializationService serializationService, IOutlookCalendarService outlookCalendarService,
                          IMessageService messageService, IExchangeWebCalendarService exchangeWebCalendarService,
                          ApplicationLogger applicationLogger, IWindowsStartupService windowsStartupService,
                          IAccountAuthenticationService accountAuthenticationService)
     : base(view)
 {
     Settings = settings;
     ExchangeWebCalendarService = exchangeWebCalendarService;
     ApplicationLogger          = applicationLogger;
     Logger = applicationLogger.GetLogger(GetType());
     WindowsStartupService        = windowsStartupService;
     AccountAuthenticationService = accountAuthenticationService;
     GoogleCalendarService        = googleCalendarService;
     SettingsSerializationService = serializationService;
     OutlookCalendarService       = outlookCalendarService;
     MessageService = messageService;
 }
Esempio n. 12
0
 public ReservationService(IMapper mapper,
                           IRepository <Reservation> ReservationRepository,
                           IRepository <Consultant> ConsultantRepository,
                           IRepository <Room> RoomRepository,
                           IUnitOfWork unitOfWork,
                           ILog <ReservationService> log,
                           IGoogleCalendarService googleCalendarService,
                           UpdateReservationContractValidator updateReservationContractValidator,
                           CreateReservationContractValidator createReservationContractValidator)
 {
     _mapper                = mapper;
     _unitOfWork            = unitOfWork;
     _ReservationRepository = ReservationRepository;
     _log = log;
     _updateReservationContractValidator = updateReservationContractValidator;
     _createReservationContractValidator = createReservationContractValidator;
     _RoomRepository        = RoomRepository;
     _ConsultantRepository  = ConsultantRepository;
     _googleCalendarService = googleCalendarService;
 }
        public GoogleCalendarScheduler(GoogleCalendarConfig config)
        {
            _ = config ?? throw new ArgumentNullException(nameof(config));
            _googleCalendarId = config.GoogleCalendarId;

            var credential = new ServiceAccountCredential(
                new ServiceAccountCredential.Initializer(config.GoogleCalendarAccount)
            {
                Scopes = new[] { CalendarService.Scope.Calendar, },
            }
                .FromPrivateKey(config.Pkcs8PrivateKey));

            var service = new CalendarService(new BaseClientService.Initializer
            {
                HttpClientFactory     = new Google.Apis.Http.HttpClientFactory(),
                HttpClientInitializer = credential,
                ApplicationName       = "FlexKids Rooster",
            });

            _calendarService = new GoogleCalendarService(service);
        }
        /// <summary>
        /// Initialize and authorize the user
        /// </summary>
        private void InitializeCalendarService()
        {
            // Make the credentials 
            var credentials = GoogleWebAuthorizationBroker.AuthorizeAsync(
                new ClientSecrets
                {
                    ClientId = _serviceConfiguration.ApiClientId,
                    ClientSecret = _serviceConfiguration.ApiClientSecret,
                },
                new[] { CalendarService.Scope.Calendar },
                _calendarConfiguration.UserName,
                CancellationToken.None).Result;


            // Create the service.
            var calendarService = new CalendarService(new BaseClientService.Initializer()
            {
                HttpClientInitializer = credentials,
                ApplicationName = "RK Calendar Sync",
            });

            // Drop it in our wrapper.
            _calendarService = new GoogleCalendarService(calendarService);
        }
Esempio n. 15
0
 public ShowEventsStepHandler(IConsole console, IGoogleCalendarService calendarService, IConsoleColorFactory consoleColorFactory)
 {
     this.console             = console;
     this.calendarService     = calendarService;
     this.consoleColorFactory = consoleColorFactory;
 }
 public CalendarPurge( IGoogleCalendarService service, string calendarUrl )
 {
     _service = service;
     _calendarUrl = calendarUrl;
 }
Esempio n. 17
0
 public NotificationRepository(ApplicationDbContext context, IGoogleCalendarService calendar)
 {
     _context  = context;
     _calendar = calendar;
 }
Esempio n. 18
0
 public CalendarController(IGoogleCalendarService googleCalendarService)
 {
     this.googleCalendarService = googleCalendarService;
 }
Esempio n. 19
0
 public AuthController(IEmployeeService service, IGoogleCalendarService calendarService, IEventService eventService)
 {
     this.service         = service;
     this.calendarService = calendarService;
     this.eventService    = eventService;
 }
 public ProfileViewModel(CalendarSyncProfile syncProfile, IGoogleCalendarService googleCalendarService,
     IOutlookCalendarService outlookCalendarService,
     IMessageService messageService, IExchangeWebCalendarService exchangeWebCalendarService,
     ApplicationLogger applicationLogger, IAccountAuthenticationService accountAuthenticationService)
 {
     SyncProfile = syncProfile;
     ExchangeWebCalendarService = exchangeWebCalendarService;
     ApplicationLogger = applicationLogger.GetLogger(GetType());
     AccountAuthenticationService = accountAuthenticationService;
     GoogleCalendarService = googleCalendarService;
     OutlookCalendarService = outlookCalendarService;
     MessageService = messageService;
 }
Esempio n. 21
0
 public HomeController(ILogger <HomeController> logger, IPortCrawler portCrawler, IGoogleCalendarService googleCalendarService)
 {
     _logger                    = logger;
     this.portCrawler           = portCrawler;
     this.googleCalendarService = googleCalendarService;
 }
 public ChooseCalendarStepHandler(IConsole console, IGoogleCalendarService calendarService)
 {
     this.console         = console;
     this.calendarService = calendarService;
 }