//private String GetTimingsDisplayString(DataTable Timings) // { // List<String> Elements = TimingsBasics.GetTimingsDisplayStrings(Timings); // if (Elements.Count == 0) // return String.Empty; // List<String> TableRows = new List<string>(); // foreach (String Element in Elements) // { // TableRows.Add("<tr>" // + "<td><small><small>" // + Element.Replace(";", "</small></small></td><td><small><small>") // + "</small></small></td>" // + "</tr>"); // } // return "<table class=\"SmallTable\" ><tr><td>" + String.Join("</td><td>", TableRows) + "</td></tr></table>"; // } private String GetSendeZeitenDisplayString(Beitrag beitrag) { Dictionary<System.Guid, int> BlockOccurencies = new Dictionary<Guid, int>(); Dictionary<System.Guid, DataRow> UniqueBlockTimings = new Dictionary<Guid, DataRow>(); foreach (BeitragZuSendung beitragZuSendung in Data.DbServer3.WPMedia.BeitraegeZuSendungen .Load_via_BeitragId(beitrag.BeitragId)) { foreach (SendungZuProgrammBlock sendungZuProgrammBlock in Data.DbServer3.WPMedia .SendungenZuProgrammBloecke.Where(sel => sel.SendungId == beitragZuSendung.SendungId)) { foreach (ProgrammBlockZuSender programmBlockZuSender in Data.DbServer3.WPMedia .ProgrammBloeckeZuSender.Where(sel => sel.BlockId == sendungZuProgrammBlock.BlockId)) { } } } return "Not implemented up to now"; /* foreach (DataRow SendungRow in BeitraegezuSendernZugeordnet.Rows) { DataTable BlockTimings = SchedulingFunctions.SchedulingFunctionsData.Instance.GetBlockTimingsForSendung( (System.Guid) SendungRow["SendungID"]); foreach (DataRow BlockTiming in BlockTimings.Rows) { System.Guid BlockID = (System.Guid) BlockTiming["ConnectedID"]; if (BlockOccurencies.ContainsKey(BlockID)) BlockOccurencies[BlockID]++; else BlockOccurencies[BlockID] = 1; if (UniqueBlockTimings.ContainsKey(BlockID) != true) UniqueBlockTimings[BlockID] = BlockTiming; } } List<String> TableRows = new List<string>(); foreach (DataRow BlockTiming in UniqueBlockTimings.Values) { String Element = TimingsBasics.GetDisplayableAndDecoratedTimingLine(BlockTiming); System.Guid BlockID = (System.Guid) BlockTiming["ConnectedID"]; double BlockDurationInMinutes = (Convert.ToDateTime(BlockTiming["TimeB"]).TimeOfDay - Convert.ToDateTime(BlockTiming["TimeA"]).TimeOfDay).TotalMinutes; int NumberOfSlots = 0; if (BlockOccurencies.ContainsKey(BlockID) == true) NumberOfSlots = BlockOccurencies[BlockID]; int From = (int) (NumberOfSlots*(BlockDurationInMinutes/80)); int To = (int) (NumberOfSlots*(BlockDurationInMinutes/45)); String OccurenceString = Convert.ToString(From) + " bis " + Convert.ToString(To) + " mal auf Sendung"; TableRows.Add("<tr>" + "<td><small><small>" + Element.Replace(";", "</small></small></td><td><small><small>") + "</small></small></td>" + "<td><small><small>" + OccurenceString + "</small></small></td>" + "</tr>"); } return "<table class=\"SmallTable\" ><tr><td>" + String.Join("</td><td>", TableRows) + "</td></tr></table>"; */ }
private void AnalyzeDuplicatesForOneBeitrag(Beitrag beitrag) { Debug.WriteLine($"Beitrag {beitrag.BeitragId} - {beitrag.Name} {beitrag.ShortDescription}"); MMUnit mmUnit = Data.DbServer3.MultiMedia.MMUnits.Find(beitrag.BeitragId); if ((mmUnit == null) || (beitrag == null)) { String mmUnitText = (mmUnit == null) ? "Keine MMunit" : $"{mmUnit.NameId}"; Debug.WriteLine($"------------- Fehler bei {beitrag.BeitragId}"); Debug.WriteLine($"\t{mmUnitText}"); return; } foreach (BeitragZuSendung beitragZuSendung in Data.DbServer3.WPMedia.BeitraegeZuSendungen .Where(whe => whe.BeitragId == beitrag.BeitragId).OrderBy(ord => ord.Sendung.Name)) { Debug.WriteLine($"\tassigned to old {beitragZuSendung.Sendung.Name}"); foreach (DbEntities.dbserver3.wpmedia.rows.Timing source in Data.DbServer3.WPMedia.Timings.Where(whe => whe.ConnectedId == beitrag.BeitragId) .OrderBy(ord => ord.TimeA)) { Debug.WriteLine($"\t\t{source.FreiText}"); } } foreach (MMUnitTiming mmUnitTiming in Data.DbServer3.MultiMedia.MMUnitTimings .Where(whe => whe.MMUnitId == mmUnit.Id).OrderBy(ord => ord.MMSlot.NameId)) { Debug.WriteLine($"\tassigned to new {mmUnitTiming.MMSlot.NameId} {mmUnitTiming.FreiText}"); } }