示例#1
0
        public bool Valid()
        {
            ClearErrors();

            if (IsNew && Courses.Any(c => Code == c.Code) || IsNew && Code == 0)
            {
                AddError("Code", Properties.Resources.Error_Exist);
            }
            if (string.IsNullOrEmpty(Title))
            {
                AddError("Title", Properties.Resources.Error_RequiredTitle);
            }
            if (Teacher == null)
            {
                AddError("Teacher", Properties.Resources.Error_Required);
            }
            if (StartDate.CompareTo(FinishDate) > 0 || FinishDate.CompareTo(StartDate) < 0)
            {
                AddError("StartDate", Properties.Resources.Error_StartDate);
                AddError("FinishDate", Properties.Resources.Error_FinishDate);
            }
            if (StartTime.CompareTo(EndTime) > 0)
            {
                AddError("StartTime", Properties.Resources.Error_StartTime);
                AddError("EndTime", Properties.Resources.Error_EndTime);
            }

            RaiseErrors();

            return(true);
        }
        public DataTable GetViewLog(DateTime StartTime, DateTime EndTime)
        {
            if (StartTime.CompareTo(EndTime) > 0) // > 0; t1 ist später als oder gleich t2.
            {
                DateTime rem = StartTime;
                StartTime = EndTime;
                EndTime   = rem;
            }
            else if (StartTime.CompareTo(EndTime) == 0)
            {
                EndTime = EndTime.AddDays(1);
            }

            //CREATE TABLE "Log"("Id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,"LogTime" TEXT NOT NULL, "Topic" TEXT , "Prio" INTEGER NOT NULL, "Content" TEXT)
            string query = "SELECT Id, datetime(LogTime, 'localtime') AS Zeit, Topic AS Bereich, Prio, Content AS Inhalt FROM \"Log\" " +
                           "WHERE LogTime BETWEEN @startTime AND @endTime ORDER BY Id DESC LIMIT 1000";

            Dictionary <string, object> args = new Dictionary <string, object>
            {
                { "@startTime", SqlTime(StartTime) },
                { "@endTime", SqlTime(EndTime) }
            };

            return(SqlSelectDataTable("Logbuch", query, args));
        }
示例#3
0
        public virtual void IsValid()
        {
            var validationErros = new List <string>();

            if (StartTime.IsNull())
            {
                validationErros.Add("Horario de início inválido.");
            }

            if (EndTime.IsNull())
            {
                validationErros.Add("Horario de término inválido.");
            }

            if (validationErros.Count <= 0 && StartTime.CompareTo(EndTime) >= 0)
            {
                validationErros.Add("Horario de início não pode ser maior ou igual ao horário de término.");
            }

            var errorMessage = string.Join(" | ", validationErros);

            if (!string.IsNullOrWhiteSpace(errorMessage))
            {
                throw new ArgumentException(errorMessage);
            }
        }
示例#4
0
 public int CompareTo(FrameElement other)
 {
     if (StartTime.Equals(other.StartTime))
     {
         return(Duration.CompareTo(other.Duration));
     }
     return(StartTime.CompareTo(other.StartTime));
 }
示例#5
0
 private TIME_OF_DAY enumerateStartTimePeriod()
 {
     if (StartTime.CompareTo(EARLIEST_START_TIME) >= 0)
     {
         return(TIME_OF_DAY.PM);
     }
     return(TIME_OF_DAY.AM);
 }
        /// <summary>
        /// Compare calendar events.
        /// </summary>
        /// <param name="other">The other event.</param>
        /// <returns></returns>
        /// <exception cref="ArgumentException">Events may only be compared with other events.</exception>
        public int CompareTo(object other)
        {
            if (!(other is ICalendarEvent otherEvent))
            {
                throw new ArgumentException("Events may only be compared with other events.");
            }

            return(StartTime.CompareTo(otherEvent.StartTime));
        }
示例#7
0
            public int CompareTo(ICommand other)
            {
                var result = StartTime.CompareTo(other.StartTime);

                if (result != 0)
                {
                    return(result);
                }
                return(EndTime.CompareTo(other.EndTime));
            }
示例#8
0
        public int CompareTo(CommandTimeInfo other)
        {
            var compare = StartTime.CompareTo(other.StartTime);

            if (compare == 0)
            {
                compare = EndTime.CompareTo(other.EndTime);
            }
            return(compare);
        }
示例#9
0
文件: TimeTest.cs 项目: dkm2110/veyor
        public void SimpleTimeComparison()
        {
            long ts  = new Random(RandomSeed).Next(0, 100);
            var  st1 = new StartTime(ts);
            var  st2 = new StartTime(ts);

            Assert.False(ReferenceEquals(st1, st2));
            Assert.Equal(st1, st2);
            Assert.Equal(st1.GetHashCode(), st2.GetHashCode());
            Assert.True(st1.CompareTo(st2) == 0);
        }
示例#10
0
        public int CompareTo(IMark other)
        {
            int rv = StartTime.CompareTo(other.StartTime);

            if (rv != 0)
            {
                return(rv);
            }

            return(EndTime.CompareTo(other.EndTime));
        }
示例#11
0
 public int CompareTo(TransformationEvent other)
 {
     if (StartTime != other.StartTime)
     {
         return(StartTime.CompareTo(other.StartTime));
     }
     if (EndTime != other.EndTime)
     {
         return(EndTime.CompareTo(other.EndTime));
     }
     return(Transformtype.CompareTo(other.Transformtype));
 }
示例#12
0
        public int CompareTo(IProcess other)
        {
            // Choose largest CPU time first.
            var ret = -CPUTimeMSec.CompareTo(other.CPUTimeMSec);

            if (ret != 0)
            {
                return(ret);
            }
            // Otherwise go by date (reversed)
            return(-StartTime.CompareTo(other.StartTime));
        }
示例#13
0
文件: Element.cs 项目: ctmal/vixen
        public int CompareTo(Element other)
        {
            int rv = StartTime.CompareTo(other.StartTime);

            if (rv != 0)
            {
                return(rv);
            }
            else
            {
                return(EndTime.CompareTo(other.EndTime));
            }
        }
示例#14
0
        public int CompareTo(HitObject other)
        {
            if ((this is HitObjectDummy) || (other is HitObjectDummy))
            {
                return(EndTime.CompareTo(other.EndTime));
            }

            if (StartTime == other.StartTime)
            {
                return(other.NewCombo.CompareTo(NewCombo));
            }
            return(StartTime.CompareTo(other.StartTime));
        }
示例#15
0
        /// <summary>
        /// Compare commands by start time, then end time, then name
        /// </summary>
        public int CompareTo(S2VXCommand other)
        {
            var compare = StartTime.CompareTo(other.StartTime);

            if (compare == 0)
            {
                compare = EndTime.CompareTo(other.EndTime);
            }
            if (compare == 0)
            {
                compare = string.Compare(GetType().Name, other.GetType().Name, StringComparison.OrdinalIgnoreCase);
            }
            return(compare);
        }
        /// <summary>
        ///     Compare the input obj and this event by time
        /// </summary>
        /// <param name="obj">
        ///     Object compared with the current event
        /// </param>
        /// <returns>
        ///     Throw a NullReferenceException if obj is null
        ///     Positive if the obj is earlier than the current event
        ///     Negative if the obj is later than the current event
        ///     0 if the two times are the same
        /// </returns>
        public int CompareTo(object obj)
        {
            if (obj == null)
            {
                throw new NullReferenceException();
            }

            if (obj is EventInformation otherEventInformation)
            {
                return(StartTime.CompareTo(otherEventInformation.StartTime));
            }

            throw new ArgumentException("Object is not a EventInformation");
        }
示例#17
0
 public int CompareTo(HitObject other)
 {
     if (other == null)
     {
         return(1);
     }
     if (other == this)
     {
         return(0);
     }
     return(StartTime == other.StartTime
         ? Type.CompareTo(other.Type)
         : StartTime.CompareTo(other.StartTime));
 }
        /// <summary>
        /// Events are ordered by the <see cref="StartTime"/> field.
        /// </summary>
        /// <param name="obj">Some other instance.</param>
        /// <returns><see cref="DateTime.CompareTo(DateTime)"/> of the <see cref="StartTime"/>
        /// or -1 if the parameter is not an <see cref="ProgramGuideEntry"/>.</returns>
        public int CompareTo(object obj)
        {
            // Check other
            ProgramGuideEntry other = obj as ProgramGuideEntry;

            // Not comparable - we are left of these
            if (other == null)
            {
                return(-1);
            }

            // Forward
            return(StartTime.CompareTo(other.StartTime));
        }
        private bool Validata(out string msg)
        {
            if (SearchItems.SearchItems.Count <= 0)
            {
                msg = "检索范围为空";
                return(false);
            }
            if ((FeatureType & E_SEARCH_FEATURE_TYPE.E_SEARCH_FEATURE_TYPE_PASSLINE) > 0)
            {
                if (PassLineSet == new List <PassLine>() && RegionSet == new List <BreakRegion>())
                {
                    msg = "尚未绘制越界线或闯入闯出框";
                    return(false);
                }
            }
            if ((FeatureType & E_SEARCH_FEATURE_TYPE.E_SEARCH_FEATURE_TYPE_GLOBAL) > 0)
            {
                if (ObjRect == new System.Drawing.Rectangle())
                {
                    msg = "尚未绘制全局特征框";
                    return(false);
                }
            }
            if ((FeatureType & E_SEARCH_FEATURE_TYPE.E_SEARCH_FEATURE_TYPE_PARTICAL) > 0)
            {
                if (ObjDetailRect == new System.Drawing.Rectangle())
                {
                    msg = "尚未绘制局部特征框";
                    return(false);
                }
            }

            foreach (var item in SearchItems.SearchItems)
            {
                if (!item.IsHistoryTask && StopTime.Subtract(StartTime).TotalMinutes > 12 * 60 + 1)
                {
                    msg = "实时视频检索不能超过 12 小时";
                    return(false);
                }
            }

            if (StartTime.CompareTo(StopTime) > 0)
            {
                msg = "结束时间不能小于开始时间";
                return(false);
            }
            msg = "";
            return(true);
        }
示例#20
0
        private bool CheckTime(System.TimeSpan time)
        {
            if (StartTime.CompareTo(EndTime) < 0)
            {
                return(time.CompareTo(StartTime) >= 0 &&
                       time.CompareTo(EndTime) <= 0);
            }
            else if (StartTime.CompareTo(EndTime) > 0)
            {
                return(time.CompareTo(StartTime) >= 0 ||
                       time.CompareTo(EndTime) <= 0);
            }

            return(true);
        }
示例#21
0
        public int CompareTo(Object obj)
        {
            VisualTransaction otherTransaction = obj as VisualTransaction;

            int result = StartTime.CompareTo(otherTransaction.StartTime);

            if (result != 0)
            {
                return(result);
            }
            else
            {
                return(index.CompareTo(otherTransaction.index));
            }
        }
示例#22
0
        /// <summary>
        /// return true if time falls within StartTime/EndTime
        /// </summary>
        /// <param name="time"></param>
        /// <returns></returns>
        private bool CheckDay(System.DateTime time)
        {
            if (NonStopSession)
            {
                throw new InvalidOperationException("NonStopSession is set -- this should never be called.");
            }
            if (StartDay < EndDay)
            {
                if (time.DayOfWeek < StartDay || time.DayOfWeek > EndDay)
                {
                    return(false);
                }
                else if (time.DayOfWeek < EndDay)
                {
                    return((StartDay < time.DayOfWeek) || (StartTime.CompareTo(time.TimeOfDay) <= 0));
                }
                else
                {
                    return((time.DayOfWeek < EndDay) || (EndTime.CompareTo(time.TimeOfDay) >= 0));
                }
            }

            if (EndDay < StartDay)
            {
                if (EndDay < time.DayOfWeek && time.DayOfWeek < StartDay)
                {
                    return(false);
                }
                else if (time.DayOfWeek < StartDay)
                {
                    return((time.DayOfWeek < EndDay) || (EndTime.CompareTo(time.TimeOfDay) >= 0));
                }
                else
                {
                    return((time.DayOfWeek > StartDay) || (StartTime.CompareTo(time.TimeOfDay) <= 0));
                }
            }

            //start day must be same as end day
            if (StartTime >= EndTime)
            {
                return(time.DayOfWeek != StartDay || CheckTime(time.TimeOfDay));
            }
            else
            {
                return(time.DayOfWeek == StartDay && CheckTime(time.TimeOfDay));
            }
        }
示例#23
0
        public int CompareTo(Build other)
        {
            if (ReferenceEquals(this, other))
            {
                return(0);
            }

            if (other is null)
            {
                return(1);
            }

            var startComparison = StartTime.CompareTo(other.StartTime);

            return(startComparison != 0 ? startComparison : string.Compare(ProjectPath, other.ProjectPath, StringComparison.Ordinal));
        }
示例#24
0
        /// <summary>
        /// Compare the shift with another.  Comparison is based on start time.  If start times are the same,
        /// comparison is based on duration.
        /// </summary>
        /// <param name="obj">Object to compare with.  Should be another shift.</param>
        /// <returns>Comparison based on start time, then duration.</returns>
        public int CompareTo(object obj)
        {
            if (!obj.GetType().Equals(this.GetType()))
            {
                throw new ArgumentException("Object is not a Shift.");
            }

            Shift shift      = (Shift)obj;
            int   comparison = StartTime.CompareTo(shift.StartTime);

            if (comparison != 0)
            {
                return(comparison);
            }

            // Start times are the same, so compare based on duration.
            return(Duration.CompareTo(shift.Duration));
        }
示例#25
0
        private bool CheckDay(System.DateTime time)
        {
            if (StartDay < EndDay)
            {
                if (time.DayOfWeek < StartDay || time.DayOfWeek > EndDay)
                {
                    return(false);
                }
                else if (time.DayOfWeek < EndDay)
                {
                    return((StartDay < time.DayOfWeek) || (StartTime.CompareTo(time.TimeOfDay) <= 0));
                }
                else
                {
                    return((time.DayOfWeek < EndDay) || (EndTime.CompareTo(time.TimeOfDay) >= 0));
                }
            }

            if (EndDay < StartDay)
            {
                if (EndDay < time.DayOfWeek && time.DayOfWeek < StartDay)
                {
                    return(false);
                }
                else if (time.DayOfWeek < StartDay)
                {
                    return((time.DayOfWeek < EndDay) || (EndTime.CompareTo(time.TimeOfDay) >= 0));
                }
                else
                {
                    return((time.DayOfWeek > StartDay) || (StartTime.CompareTo(time.TimeOfDay) <= 0));
                }
            }

            //start day must be same as end day
            if (StartTime >= EndTime)
            {
                return(time.DayOfWeek != StartDay || CheckTime(time.TimeOfDay));
            }
            else
            {
                return(time.DayOfWeek == StartDay && CheckTime(time.TimeOfDay));
            }
        }
示例#26
0
        /// <inheritdoc />
        public int CompareTo(EventInformation?other)
        {
            if (ReferenceEquals(this, other))
            {
                return(0);
            }
            if (other is null)
            {
                return(1);
            }
            var classroomComparison = string.Compare(Classroom, other.Classroom, StringComparison.Ordinal);

            if (classroomComparison != 0)
            {
                return(classroomComparison);
            }
            var startTimeComparison = StartTime.CompareTo(other.StartTime);

            return(startTimeComparison != 0 ? startTimeComparison : EventDuration.CompareTo(other.EventDuration));
        }
示例#27
0
        public int CompareTo(GarminSessionHeader other)
        {
            if (NumberOfLaps == 0 && other.NumberOfLaps == 0)
            {
                return(0);
            }
            if (NumberOfLaps == 0 && other.NumberOfLaps > 0)
            {
                return(1);
            }
            if (NumberOfLaps > 0 && other.NumberOfLaps == 0)
            {
                return(-1);
            }

            var startTimeComparison = StartTime.CompareTo(other.StartTime);

            return(startTimeComparison != 0
               ? startTimeComparison
               : FinishTime.CompareTo(other.FinishTime));
        }
        public int CompareTo(RegisteredAction other)
        {
            if (ReferenceEquals(this, other))
            {
                return(0);
            }
            if (ReferenceEquals(null, other))
            {
                return(1);
            }
            var idComparison = string.Compare(Id, other.Id, StringComparison.Ordinal);

            if (idComparison != 0)
            {
                return(idComparison);
            }
            var startTimeComparison = StartTime.CompareTo(other.StartTime);

            if (startTimeComparison != 0)
            {
                return(startTimeComparison);
            }
            var durationComparison = Duration.CompareTo(other.Duration);

            if (durationComparison != 0)
            {
                return(durationComparison);
            }
            var projectMemberIdComparison = string.Compare(ProjectMemberId, other.ProjectMemberId, StringComparison.Ordinal);

            if (projectMemberIdComparison != 0)
            {
                return(projectMemberIdComparison);
            }
            return(string.Compare(ProjectActionId, other.ProjectActionId, StringComparison.Ordinal));
        }
示例#29
0
 public int CompareTo(EventBreak other)
 {
     return(StartTime.CompareTo(other.StartTime));
 }
示例#30
0
 public int CompareTo(IntentSegmentNode <T> other)
 {
     return(StartTime.CompareTo(other.StartTime));
 }