Beispiel #1
0
 public SheetGeneratorBase(IHolidayProvider holidayApi, DateTime?start, DateTime?end)
 {
     StartPeriod = start.GetValueOrDefault();
     EndPeriod   = end.GetValueOrDefault();
     HolidayApi  = holidayApi;
     HolidayApi.StartIn(StartPeriod).EndIn(EndPeriod);
 }
Beispiel #2
0
        public MainWindowViewModel(IUnityContainer container)
        {
            _container = container;

            _holidayApi = _container.Resolve <IHolidayProvider>();
            _container.RegisterType(typeof(ISheetGenerator), typeof(AmItSheetGenerator), new InjectionConstructor
                                    (
                                        _holidayApi,
                                        new DateTime(2018, 1, 1),
                                        new DateTime(2018, 12, 31)
                                    ));

            _generator = _container.Resolve <ISheetGenerator>();
            //(
            //    new ResolverOverride[]
            //    {
            //        new ParameterOverride(null, _holidayApi),
            //        new ParameterOverride(null, new DateTime(2018, 1, 1)),
            //        new ParameterOverride(null, new DateTime(2018, 12, 31))
            //    }
            //);

            Start();
            // _generator = generator;
            // _generator.Start("");

            //Interfaces.IHolidayProvider ss = new HolidayProvider.GoogleProvider();
            // holidays = ss.GetHolidays("My", "Kuala", ResourceManagement.GetResourceFileStream("Timesheet.amIT.credentials.json")).Result.ToList();
        }
Beispiel #3
0
        /// <summary>
        /// Register
        /// </summary>
        /// <param name="provider"></param>
        /// <param name="registerHolidayTypes"></param>
        /// <exception cref="ArgumentNullException"></exception>
        public void Register(IHolidayProvider provider, params HolidayType[] registerHolidayTypes)
        {
            if (provider == null)
            {
                throw new ArgumentNullException(nameof(provider));
            }

            var type = provider.GetType();

            lock (_lockObj)
            {
                //step 1. register holiday
                if (registerHolidayTypes == null || registerHolidayTypes.Length == 0)
                {
                    provider.RegisterAll();
                }
                else
                {
                    provider.Register(registerHolidayTypes);
                }

                //step 2. register provider own.
                if (_providerCache.ContainsKey(type))
                {
                    return;
                }
                _providerCache.Add(type, provider);
            }
        }
 public MainViewModel(WeekProvider weekProvider, ISchoolClassProvider schoolClassProvider, ReportGenerator reportGenerator, IHolidayProvider holidayProvider, HolidayManagement holidayManagement)
 {
     this.weekProvider        = weekProvider;
     this.schoolClassProvider = schoolClassProvider;
     this.reportGenerator     = reportGenerator;
     this.holidayProvider     = holidayProvider;
     this.holidayManagement   = holidayManagement;
 }
Beispiel #5
0
 public WorkingDaysProvider(IHolidayProvider holidayProvider, IWeekDaysProvider weekDaysProvider)
 {
     this.holidayProvider  = holidayProvider;
     this.weekDaysProvider = weekDaysProvider;
 }
 public AmItSheetGenerator(IHolidayProvider holidayApi, DateTime?start, DateTime?end) : base(holidayApi, start, end)
 {
 }