/// <summary> /// Get Assignment DNA /// </summary> /// <param name="timeBox"></param> /// <param name="source">Should be assignment type</param> /// <returns></returns> public static string GetShiftprint(this TimeBox timeBox, Term source) { var summary = new StringBuilder(string.Format("{0:yyyy/MM/dd HH:mm}%{1:yyyy/MM/dd HH:mm}#{2}", source.Start, source.End, source.Id)); foreach (var item in timeBox.GetCoveredTermsWithAbsent(source)) { summary.Append(string.Format("{0:yyyy/MM/dd HH:mm}%{1:yyyy/MM/dd HH:mm}#{2}", item.Start, item.End, item.Id)); } var m = new MD5CryptoServiceProvider(); byte[] s = m.ComputeHash(Encoding.UTF8.GetBytes(summary.ToString())); return(BitConverter.ToString(s)); }
public static bool VerifyAnyOverlap(this Term source, TimeBox timeBox) { var lowestTerm = source.GetLowestTerm() as Term; var convertTerms = timeBox.GetCoveredTermsWithAbsent(lowestTerm).ToArray(); if (lowestTerm == source) { return(timeBox.TermSet.Where(o => o != source && o.Level == source.Level).Any(o => { var overlap = source.AnyOverlap(o); return overlap; })); } var closestBottomTerm = timeBox.GetClosestBottom(source); if (closestBottomTerm != source.Bottom) { return(true); } return(convertTerms.Where(o => o != source || o.Id != source.Id).OrderBy(o => o.Start).Any(o => o.Id != source.Id && o.Level > source.Level ? source.OverlapNotEnclosed(o) : o.OverlapNotEnclosed(source))); }