private void InitializeData() { HolidayDataService = new HolidayDataService(); HolidayDataService.HolidayAdded += OnHolidayAdded; ColumnHeaders = new List<ColumnInfo> { new ColumnInfo("Name",0, false), new ColumnInfo("Date",1, false), new ColumnInfo("BusinessState", "txtBusinessDayState",2, true), new ColumnInfo("IsRecurrent", "txtIsRecurrent",3, true), }; AddCommand = new Command(Add, CanAdd); RefreshCommand = new Command(CreateItems); AddGroupCommand = new Command(Add, CanAddGroup); ResetCommand = new Command(Reset, CanReset); CreateItems(null); }
/// <summary> /// Initializes a new instance of the <see cref="HolidayVm"/> class initialized with default values. /// </summary> public HolidayVm(AccessType access, HolidayDataService dataService) : base(access) { _model = Holiday.CreateDefault(); InitializeData(dataService); }
public static Holiday CreateNew(HolidayDataService dataService) { int id = dataService.AddModel(Holiday.CreateDefault()); return dataService.GetSingle(id); }
private void InitializeData(HolidayDataService dataService) { HolidayDataService = dataService; SaveCommand = new Command(Save, CanSave); //combo box issues DayStates.Add(BusinessDayType.Open); DayStates.Add(BusinessDayType.Closed); DayStates.Add(BusinessDayType.HalfClosed); DayStates.Add(BusinessDayType.SpecialDay1); DayStates.Add(BusinessDayType.SpecialDay2); DayStates.Add(BusinessDayType.SpecialDay3); SelectedState = DayStates.FirstOrDefault(x => x == BusinessState); }
/// <summary> /// Initializes a new instance of the <see cref="HolidayVm"/> class from the model. /// </summary> /// <param name="entity">The model.</param> /// <param name="access"></param> /// <param name="dataService"></param> public HolidayVm(Holiday entity, AccessType access, HolidayDataService dataService) : base(access) { _model = entity; InitializeData(dataService); }