Example #1
0
        public string GetWorkHoursPartText(WorkHoursPart part)
        {
            switch (part)
            {
            case WorkHoursPart.MorningStart:
                return("Morning Start");

            case WorkHoursPart.MorningEnd:
                return("Morning End");

            case WorkHoursPart.AfternoonStart:
                return("Afternoon Start");

            case WorkHoursPart.AfternoonEnd:
                return("Afternoon End");

            default:
                throw new ArgumentException("part");
            }
        }
Example #2
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());
        }
Example #3
0
        public static void SetValue(this KeyValuePair <DayOfWeek, StaffTimeInfo> kvp, string value, WorkHoursPart part)
        {
            StaffTimeValue timeValue = kvp.TimeValue(part);

            timeValue.Value = StaffTimeValue.Parse(value);
        }
Example #4
0
        public static TimeRange TimeRange(this KeyValuePair <DayOfWeek, StaffTimeInfo> kvp, WorkHoursPart part)
        {
            switch (part)
            {
            case WorkHoursPart.MorningStart:
            case WorkHoursPart.MorningEnd:
                return(kvp.Value.AM);

            case WorkHoursPart.AfternoonStart:
            case WorkHoursPart.AfternoonEnd:
                return(kvp.Value.PM);

            default:
                throw new ArgumentException("part");
            }
        }
Example #5
0
        public static IHtmlString WorkHoursTimeTextBox(this HtmlHelper helper, KeyValuePair <DayOfWeek, StaffTimeInfo> kvp, WorkHoursPart part)
        {
            string name = kvp.WorkHoursTimeTextBoxName(part);

            switch (part)
            {
            case WorkHoursPart.MorningStart:
                return(helper.TextBox(name, kvp.Value.AM.Start, new { @class = "time-text form-control" }));

            case WorkHoursPart.MorningEnd:
                return(helper.TextBox(name, kvp.Value.AM.End, new { @class = "time-text form-control", @data_toggle = "popover" }));

            case WorkHoursPart.AfternoonStart:
                return(helper.TextBox(name, kvp.Value.PM.Start, new { @class = "time-text form-control", @data_toggle = "popover" }));

            case WorkHoursPart.AfternoonEnd:
                return(helper.TextBox(name, kvp.Value.PM.End, new { @class = "time-text form-control", @data_toggle = "popover" }));

            default:
                throw new ArgumentException("part");
            }
        }
Example #6
0
 public static string WorkHoursTimeTextBoxName(this KeyValuePair <DayOfWeek, StaffTimeInfo> kvp, WorkHoursPart part)
 {
     return(string.Format("{0}{1}", kvp.WorkHoursDayName(), Enum.GetName(typeof(WorkHoursPart), part)));
 }