Ejemplo n.º 1
0
        public static IEnumerable <IHoliday> GetHoliday(this DateTime value, HolidayOccurrenceType holidayOccurrenceType = HolidayOccurrenceType.Actual)
        {
            IEnumerable <IHoliday> returnValue = new IHoliday[0];

            if (holidayOccurrenceType == HolidayOccurrenceType.Actual)
            {
                returnValue = (from tbl in Holidays.MyHolidays
                               where tbl.GetByYear(value.Year) == value.Date
                               select tbl).ToArray();
            }
            if (holidayOccurrenceType == HolidayOccurrenceType.Observed)
            {
                returnValue = (from tbl in Holidays.MyHolidays
                               where tbl is IObservedHoliday &&
                               ((IObservedHoliday)tbl).GetObservedByYear(value.Year) == value.Date
                               select tbl).ToArray();
            }
            else
            {
                returnValue = (from tbl in Holidays.MyHolidays
                               where tbl.GetByYear(value.Year) == value.Date ||
                               (tbl is IObservedHoliday && ((IObservedHoliday)tbl).GetObservedByYear(value.Year) == value.Date)
                               select tbl).ToArray();
            }

            return(returnValue);
        }
Ejemplo n.º 2
0
 private NewYearsDay(DateTime date, WeekendDay weekendDay, WeekendHolidayObservance weekendHolidayObservance, IHoliday nextStrategy)
 {
     _date       = date;
     _weekendDay = weekendDay;
     _weekendHolidayObservance = weekendHolidayObservance;
     _nextStrategy             = nextStrategy;
 }
Ejemplo n.º 3
0
 public FlowTasksService(ITask task, IWorkflow workflow, ITopic messenger, IHoliday holiday, IFlowTasksProxyManager proxyManager)
 {
     _task         = task;
     _workflow     = workflow;
     _messenger    = messenger;
     _holiday      = holiday;
     _proxyManager = proxyManager;
 }
Ejemplo n.º 4
0
        public static IEnumerable <IHoliday> GetHoliday(this DateTimeOffset?value, HolidayOccurrenceType holidayOccurrenceType = HolidayOccurrenceType.Actual)
        {
            IEnumerable <IHoliday> returnValue = new IHoliday[0];

            if (value.HasValue)
            {
                returnValue = value.Value.GetHoliday(holidayOccurrenceType);
            }

            return(returnValue);
        }
Ejemplo n.º 5
0
        public ActionResult Calculate(string action)
        {
            try
            {
                DateTime start = Convert.ToDateTime(Request.Form["startDate"]);
                DateTime end   = Convert.ToDateTime(Request.Form["endDate"]);

                int weekdays = -1;

                if (action.Equals("Default", StringComparison.OrdinalIgnoreCase))
                {
                    IHoliday         holidayFactory  = new HolidaysFactory();
                    IGetBusinessDays getBusinessDays = new BusinessDaysCalculate(holidayFactory);
                    weekdays = getBusinessDays.GetBusinessDaysInBetween(start, end);
                    var message = String.Format("There are {0} business days between {1} and {2}! (Excluded weekends and NSW public holidays)", weekdays, start.ToShortDateString(), end.ToShortDateString());
                    //   TempData["ResultMessage"] = "there are " + weekdays + " days  between " + start.ToShortDateString() + " and " + end.ToShortDateString() ;
                    SetTempDataMessage(weekdays, message);
                }
                else if (action.Equals("GetWorkDays", StringComparison.OrdinalIgnoreCase))
                {
                    IGetBusinessDays getBusinessDays = new BusinessDaysCalculate();
                    weekdays = getBusinessDays.GetBusinessDaysInBetween(start, end);
                    var message = String.Format("There are {0} days between {1} and {2}! (Excludes weekends)", weekdays, start.ToShortDateString(), end.ToShortDateString());
                    SetTempDataMessage(weekdays, message);
                }
                else if (action.Equals("GetWorkDaysFixedHoliday", StringComparison.OrdinalIgnoreCase))
                {
                    IHoliday         holidayFactory  = CreateFixedHolidayFactory();
                    IGetBusinessDays getBusinessDays = new BusinessDaysCalculate(holidayFactory);
                    weekdays = getBusinessDays.GetBusinessDaysInBetween(start, end);
                    var message = String.Format("There are {0} days between {1} and {2}! (Excludes weekends and Fixed Holiday {3})", weekdays, start.ToShortDateString(), end.ToShortDateString(), "1st Jan, 26th Jan, 1st Jun, 25th Dec");
                    SetTempDataMessage(weekdays, message);
                }
                else if (action.Equals("GetWorkDaysDynamicHoliday", StringComparison.OrdinalIgnoreCase))
                {
                    IHoliday         holidayFactory  = CreateDynamicHolidayFactory();
                    IGetBusinessDays getBusinessDays = new BusinessDaysCalculate(holidayFactory);
                    weekdays = getBusinessDays.GetBusinessDaysInBetween(start, end);
                    var message = String.Format("There are {0} days between {1} and {2}! (Excludes weekends and Dynamic Holiday {3})", weekdays, start.ToShortDateString(), end.ToShortDateString(), "1st Jan(New Year - Move to Monday), 26th Jan(Australia Day), 25th Dec(Christmas), Easter Sunday (Apr second Sunday), Easter Monday(Apr third Monday), Father's Day(Sep first Sunday)");
                    SetTempDataMessage(weekdays, message);
                }

                SetSuccess("Get results");
            }
            catch (Exception ex)
            {
                SetError(ex.Message);
            }

            return(RedirectToAction("Index"));
        }
Ejemplo n.º 6
0
 public BlockViewModel(IMvxNavigationService navigationService, IHoliday holidayService)
 {
     _startDate          = DateTime.Now.Date;
     _endDate            = DateTime.Now.AddDays(1).Date;
     _startTime          = new TimeSpan(12, 0, 0);
     _endTime            = new TimeSpan(12, 0, 0);
     _visibleToCustomers = false;
     _informationalOnly  = false;
     _repeat             = false;
     _navigationService  = navigationService;
     _holidayService     = holidayService;
     if (FormsApp.CurrentBlockId != null)
     {
         _currentBlockId = Convert.ToInt32(FormsApp.CurrentBlockId);
     }
 }
Ejemplo n.º 7
0
 public NewYearsDay(DateTime date, IHoliday nextStrategy) :
     this(date, new WeekendDay(date), new WeekendHolidayObservance(new DateTime(new ObservanceYear(date), 1, 1), date), nextStrategy)
 {
 }
Ejemplo n.º 8
0
 public ThanksgivingDay(DateTime date, IHoliday nextStrategy)
 {
     _date         = date;
     _nextStrategy = nextStrategy;
 }
Ejemplo n.º 9
0
 public DayAfterThanksgiving(DateTime date, IHoliday nextStrategy)
 {
     _date         = date;
     _nextStrategy = nextStrategy;
 }
Ejemplo n.º 10
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="holiday"></param>
 public void AddHolidy(IHoliday holiday)
 {
     Holidays.Add(holiday);
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Register a holiday to be considered by extensions methods within this library.
 /// </summary>
 /// <param name="holiday">An instance of <see cref="IHoliday"/>.</param>
 public static void Register(IHoliday holiday)
 {
     Holidays.MyHolidays.Add(holiday);
 }
 public HolidayController()
 {
     _iplHoliday = SingletonIpl.GetInstance <IplHoliday>();
 }
Ejemplo n.º 13
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="format"></param>
 /// <param name="obj"></param>
 /// <param name="cul"></param>
 protected HolidayToString(string format, object obj, CultureInfo cul)
 {
     FormatStr = format;
     Holiday = obj as IHoliday;
     Cul = cul;
 }
Ejemplo n.º 14
0
 public HåkanHellströmCountryCustoms(IHoliday holiday, IDateTime dateTime) : base(1000)
 {
     _holiday  = holiday;
     _dateTime = dateTime;
     InitRules();
 }
Ejemplo n.º 15
0
 public void InitializeIHoliday(IHoliday hostform, LoginDetails LD)
 {
     this._host = hostform;
     UserInfo   = LD;
 }
Ejemplo n.º 16
0
 public ChristmasDay(DateTime date, IHoliday nextStrategy)
 {
     _date         = date;
     _nextStrategy = nextStrategy;
 }
Ejemplo n.º 17
0
 public IndependenceDay(DateTime date, IHoliday nextStrategy)
 {
     _date         = date;
     _nextStrategy = nextStrategy;
 }
Ejemplo n.º 18
0
 public MemorialDay(DateTime date, IHoliday nextStrategy)
 {
     _date         = date;
     _nextStrategy = nextStrategy;
 }
 public AttendanceTracking_HistoryController()
 {
     _iplAttendanceTracking = SingletonIpl.GetInstance <IplAttendanceTracking>();
     _iplEmployee           = SingletonIpl.GetInstance <IplEmployee>();
     _iplHoliday            = SingletonIpl.GetInstance <IplHoliday>();
 }
Ejemplo n.º 20
0
 /// <summary>
 /// Register a holiday to be considered by extensions methods within this library.
 /// </summary>
 /// <param name="holiday">An instance of <see cref="IHoliday"/>.</param>
 public static Task RegisterAsync(IHoliday holiday)
 {
     Holidays.Register(holiday);
     return(Task.FromResult(0));
 }
Ejemplo n.º 21
0
 private HolidayChain(IHoliday strategy) => _strategy = strategy;
Ejemplo n.º 22
0
 public IplAttendanceTracking()
 {
     _iplHoliday         = SingletonIpl.GetInstance <IplHoliday>();
     _iplEmployeePayroll = SingletonIpl.GetInstance <IplEmployee_Payroll>();
 }
Ejemplo n.º 23
0
 public LaborDay(DateTime date, IHoliday nextStrategy)
 {
     _date         = date;
     _nextStrategy = nextStrategy;
 }