示例#1
0
        public string GetWorkHoursTime(DayOfWeek day, WorkHoursPart part)
        {
            if (staffTime == null)
            {
                StaffDirectory sd = DA.Current.Single <StaffDirectory>(StaffDirectoryID);

                if (sd == null)
                {
                    throw new StaffDirectoryNotFoundException(StaffDirectoryID);
                }

                staffTime = new StaffTimeInfoCollection(sd.HoursXML);
            }

            StaffTimeInfo  timeInfo  = staffTime[day];
            StaffTimeValue timeValue = null;

            switch (part)
            {
            case WorkHoursPart.MorningStart:
                timeValue = timeInfo.AM.Start;
                break;

            case WorkHoursPart.MorningEnd:
                timeValue = timeInfo.AM.End;
                break;

            case WorkHoursPart.AfternoonStart:
                timeValue = timeInfo.PM.Start;
                break;

            case WorkHoursPart.AfternoonEnd:
                timeValue = timeInfo.PM.End;
                break;

            default:
                throw new ArgumentException("part");
            }

            return(timeValue.Value.ToString());
        }
示例#2
0
        public static void SetValue(this KeyValuePair <DayOfWeek, StaffTimeInfo> kvp, string value, WorkHoursPart part)
        {
            StaffTimeValue timeValue = kvp.TimeValue(part);

            timeValue.Value = StaffTimeValue.Parse(value);
        }