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); }
private NewYearsDay(DateTime date, WeekendDay weekendDay, WeekendHolidayObservance weekendHolidayObservance, IHoliday nextStrategy) { _date = date; _weekendDay = weekendDay; _weekendHolidayObservance = weekendHolidayObservance; _nextStrategy = nextStrategy; }
public FlowTasksService(ITask task, IWorkflow workflow, ITopic messenger, IHoliday holiday, IFlowTasksProxyManager proxyManager) { _task = task; _workflow = workflow; _messenger = messenger; _holiday = holiday; _proxyManager = proxyManager; }
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); }
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")); }
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); } }
public NewYearsDay(DateTime date, IHoliday nextStrategy) : this(date, new WeekendDay(date), new WeekendHolidayObservance(new DateTime(new ObservanceYear(date), 1, 1), date), nextStrategy) { }
public ThanksgivingDay(DateTime date, IHoliday nextStrategy) { _date = date; _nextStrategy = nextStrategy; }
public DayAfterThanksgiving(DateTime date, IHoliday nextStrategy) { _date = date; _nextStrategy = nextStrategy; }
/// <summary> /// /// </summary> /// <param name="holiday"></param> public void AddHolidy(IHoliday holiday) { Holidays.Add(holiday); }
/// <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>(); }
/// <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; }
public HåkanHellströmCountryCustoms(IHoliday holiday, IDateTime dateTime) : base(1000) { _holiday = holiday; _dateTime = dateTime; InitRules(); }
public void InitializeIHoliday(IHoliday hostform, LoginDetails LD) { this._host = hostform; UserInfo = LD; }
public ChristmasDay(DateTime date, IHoliday nextStrategy) { _date = date; _nextStrategy = nextStrategy; }
public IndependenceDay(DateTime date, IHoliday nextStrategy) { _date = date; _nextStrategy = nextStrategy; }
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>(); }
/// <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)); }
private HolidayChain(IHoliday strategy) => _strategy = strategy;
public IplAttendanceTracking() { _iplHoliday = SingletonIpl.GetInstance <IplHoliday>(); _iplEmployeePayroll = SingletonIpl.GetInstance <IplEmployee_Payroll>(); }
public LaborDay(DateTime date, IHoliday nextStrategy) { _date = date; _nextStrategy = nextStrategy; }