Exemplo n.º 1
0
        public bool timeEmatch()
        {
            String AMTime;
            String PMTime;

            AMTime = inif.Read("AMStartTime", "AM");
            PMTime = inif.Read("PMEndTime", "PM");

            String[] AMtime = AMTime.Split(':');
            String[] PMtime = PMTime.Split(':');

            TimeSpan start = new TimeSpan(Convert.ToInt16(AMtime[0]), Convert.ToInt16(AMtime[1]), 0); //10 o'clock
            TimeSpan end   = new TimeSpan(Convert.ToInt16(PMtime[0]), Convert.ToInt16(PMtime[1]), 0);
            TimeSpan now   = DateTime.Now.TimeOfDay;

            TimeSpan time1       = TimeSpan.FromHours(1);
            TimeSpan startserver = start.Add(time1);

            TimeSpan endserver = end.Add(time1);


            if ((now > start) && (now < startserver))
            {
                return(true);
            }
            else if ((now > end) && (now < endserver))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 2
0
        public bool timeStartFirstmatch()
        {
            String AMTime;
            String PMTime;

            AMTime = inif.Read("AMStartTime", "AM");
            PMTime = inif.Read("PMEndTime", "PM");

            String[] AMtime = AMTime.Split(':');
            String[] PMtime = PMTime.Split(':');

            TimeSpan start = new TimeSpan(Convert.ToInt16("7"), Convert.ToInt16("00"), 0);
            TimeSpan now   = DateTime.Now.TimeOfDay;

            TimeSpan time1       = TimeSpan.FromMinutes(15);
            TimeSpan startserver = start.Add(time1);

            if ((now > start) && (now < startserver))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 3
0
        public bool timeDaymatch()
        {
            DateTime  date      = DateTime.Now;
            string    dateToday = date.ToString("d");
            DayOfWeek day       = DateTime.Now.DayOfWeek;
            string    dayToday  = day.ToString();

            String AMTime;
            String PMTime;

            AMTime = inif.Read("AMStartTime", "AM");
            PMTime = inif.Read("PMEndTime", "PM");

            String[] AMtime = AMTime.Split(':');
            String[] PMtime = PMTime.Split(':');

            TimeSpan start = new TimeSpan(Convert.ToInt16(AMtime[0]), Convert.ToInt16(AMtime[1]), 0); //10 o'clock
            TimeSpan end   = new TimeSpan(Convert.ToInt16(PMtime[0]), Convert.ToInt16(PMtime[1]), 0);
            TimeSpan now   = DateTime.Now.TimeOfDay;

            TimeSpan time1       = TimeSpan.FromMinutes(15);
            TimeSpan startserver = start.Add(time1);

            TimeSpan endserver = end.Add(time1);


            if ((dayToday == DayOfWeek.Friday.ToString()))
            {
                if ((now > start) && (now < startserver))
                {
                    return(true);
                }
                else if ((now > end) && (now < endserver))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 4
0
        public bool timematch()
        {
            String AMTime;
            String PMTime;

            AMTime = inif.Read("AMStartTime", "AM");
            PMTime = inif.Read("PMEndTime", "PM");

            String[] AMtime = AMTime.Split(':');
            String[] PMtime = PMTime.Split(':');

            TimeSpan start = new TimeSpan(Convert.ToInt16(AMtime[0]), Convert.ToInt16(AMtime[1]), 0); //10 o'clock
            TimeSpan end   = new TimeSpan(Convert.ToInt16(PMtime[0]), Convert.ToInt16(PMtime[1]), 0);
            TimeSpan now   = DateTime.Now.TimeOfDay;

            if ((now > start) && (now < end))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }