Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Robert Mitchell 1 post 25 karma points
    Jun 04, 2013 @ 16:08
    Robert Mitchell
    0

    "00:00" time not displayed.

    Hi all,

    Not completely sure that this is a bug or is intended behaviour but I had a client who complained and so had to design a fix.

    Basically if the first time in a set is "00:00" and the second time is any time after midnight then the first hour's box was blank.

    I made a minor change to the OpeningHoursEditor.ascx.cs file that changed the way the times were displayed.

    This means that as long as the second time is not "00:00" and the first time is "00:00", the first time will display instead of being a blank box:

    This is purely a change in the way the times are displayed and does not affect anything else.

    The code change is in the "oh_rptScheduleItems_ItemDataBound" method:

    <code>

    if (scheduleItem.FirstSet.HourEnd.TotalMinutes != 0)
                    {
                        ((TextBox)e.Item.FindControl("tbHourStart")).Text = !Config.Use12HourClock ?
                            scheduleItem.FirstSet.HourStartString :
                            TimespanHelper.ConvertTo12HourClock(scheduleItem.FirstSet.HourStartString);

                        ((TextBox)e.Item.FindControl("tbHourEnd")).Text = !Config.Use12HourClock ?
                            scheduleItem.FirstSet.HourEndString :
                            TimespanHelper.ConvertTo12HourClock(scheduleItem.FirstSet.HourEndString);
                    }

                    if (scheduleItem.SecondSet.HourEnd.TotalMinutes != 0)
                    {
                        ((TextBox)e.Item.FindControl("tbHourStart2")).Text = !Config.Use12HourClock ?
                            scheduleItem.SecondSet.HourStartString :
                            TimespanHelper.ConvertTo12HourClock(scheduleItem.SecondSet.HourStartString);


                        ((TextBox)e.Item.FindControl("tbHourEnd2")).Text = !Config.Use12HourClock ?
                            scheduleItem.SecondSet.HourEndString :
                            TimespanHelper.ConvertTo12HourClock(scheduleItem.SecondSet.HourEndString);
                    }

    </code>

    this replaces:

    <code>

    if (scheduleItem.FirstSet.HourStart.TotalMinutes != 0)
                        ((TextBox)e.Item.FindControl("tbHourStart")).Text = !Config.Use12HourClock ?
                            scheduleItem.FirstSet.HourStartString :
                            TimespanHelper.ConvertTo12HourClock(scheduleItem.FirstSet.HourStartString);

                    if (scheduleItem.FirstSet.HourEnd.TotalMinutes != 0)
                        ((TextBox)e.Item.FindControl("tbHourEnd")).Text = !Config.Use12HourClock ?
                            scheduleItem.FirstSet.HourEndString :
                            TimespanHelper.ConvertTo12HourClock(scheduleItem.FirstSet.HourEndString);

                    if (scheduleItem.SecondSet.HourStart.TotalMinutes != 0)
                        ((TextBox)e.Item.FindControl("tbHourStart2")).Text = !Config.Use12HourClock ?
                            scheduleItem.SecondSet.HourStartString :
                            TimespanHelper.ConvertTo12HourClock(scheduleItem.SecondSet.HourStartString);

                    if (scheduleItem.SecondSet.HourEnd.TotalMinutes != 0)
                        ((TextBox)e.Item.FindControl("tbHourEnd2")).Text = !Config.Use12HourClock ?
                            scheduleItem.SecondSet.HourEndString :
                            TimespanHelper.ConvertTo12HourClock(scheduleItem.SecondSet.HourEndString);

    </code>

Please Sign in or register to post replies

Write your reply to:

Draft