- [Flags]
- public enum Weekday
- {
- None = 0,
- Mon = 1,
- Tue = 2,
- Wed = 4,
- Thu = 8,
- Fir = 16,
- Sat = 32,
- Sun = 64
- }
-
- public class WorkingDay
- {
- public bool Mon { get; set; }
- public bool Tue { get; set; }
- public bool Wed { get; set; }
- public bool Thu { get; set; }
- public bool Fir { get; set; }
- public bool Sat { get; set; }
- public bool Sun { get; set; }
- public Weekday AllWorkingDays {
- get {
- return (Weekday)WorkingDayFlag;
- }
- set
- {
- int result = (int)value;
- this.WorkingDayFlag = result;
- }
- }
- public int WorkingDayFlag
- {
- get
- {
- Weekday result = this.Mon ? Weekday.Mon : 0;
- result |= this.Tue ? Weekday.Tue : 0;
- result |= this.Wed ? Weekday.Wed : 0;
- result |= this.Thu ? Weekday.Thu : 0;
- result |= this.Fir ? Weekday.Fir : 0;
- result |= this.Sat ? Weekday.Sat : 0;
- result |= this.Sun ? Weekday.Sun : 0;
- return (int)result;
- }
- set
- {
- this.Mon = ((Weekday)value & Weekday.Mon) == Weekday.Mon;
- this.Tue = ((Weekday)value & Weekday.Tue) == Weekday.Tue;
- this.Wed = ((Weekday)value & Weekday.Wed) == Weekday.Wed;
- this.Thu = ((Weekday)value & Weekday.Thu) == Weekday.Thu;
- this.Fir = ((Weekday)value & Weekday.Fir) == Weekday.Fir;
- this.Sat = ((Weekday)value & Weekday.Sat) == Weekday.Sat;
- this.Sun = ((Weekday)value & Weekday.Sun) == Weekday.Sun;
- }
- }
- }
-
-