private void FillWPMediaCalendarContentListe (ref GoogleResult Result, DataSet ToProcessCalendarDataSet, ref DataCollection<Event> CalendarContentListe) { int HasBeenCorrectlyProcessedCounter = 0; Result.NumberOfCheckedEntries = ToProcessCalendarDataSet.Tables ["InformationenWithTimings"].Rows.Count; foreach (DataRow InputRow in ToProcessCalendarDataSet.Tables["InformationenWithTimings"].Rows) { LastUpdate.HighestLastUpdateToken = 0; LastUpdate.CheckForHighestLastUpdateToken (InputRow); if (InputRow ["ID"] == Convert.DBNull) { continue; } Guid InformationenID = (System.Guid) InputRow ["ID"]; if (InputRow ["TimingsID"] == Convert.DBNull) { continue; } System.Guid TimingsID = (System.Guid) InputRow ["TimingsID"]; try { DataSet EntryData = DataWrapper.Instance.GetEntryDataSet (InformationenID, null, null); Informationen DBInformation; try { DBInformation = DataModell. LoadDBInformationenFullTreeFromEntryDataSet(EntryData); if (DBInformation == null) { WMB.Basics.ReportErrorToEventViewer("Beim Eintrag \"" + InformationenID.ToString() + "\" (TimingsID = \"" + TimingsID.ToString() + "\") war kein Informationen Eintrag zu finden"); continue; } } catch (Exception Excp) { WMB.Basics.ReportErrorToEventViewer("Beim Eintrag \"" + InformationenID.ToString() + "\" (TimingsID = \"" + TimingsID.ToString() + "\") trat folgender Fehler auf:\r\n" + Excp.ToString ()); continue; } Event NewEvent = CheckForExistingAndCompletness(TimingsID.ToString(), LastUpdate.CheckForHighestLastUpdateToken(EntryData)); if (StopTheLoop) break; if (NewEvent == null) { //if (HasBeenCorrectlyProcessedCounter++ > 100) // break; continue; } NewEvent.Start = new EventDateTime() { TimeZone = TimeZoneName, DateTime = Convert.ToDateTime(InputRow["TimeA"]) }; NewEvent.Start.DateTime = Convert.ToDateTime(InputRow["TimeA"]); NewEvent.End = new EventDateTime() { TimeZone = TimeZoneName, DateTime = Convert.ToDateTime(InputRow["TimeB"]) }; if (NewEvent.End.DateTime < NewEvent.Start.DateTime) { WMB.Basics.ReportErrorToEventViewer("Beim Eintrag \"" + InformationenID.ToString() + "\" (\"" + InputRow["Titel"].ToString() + "\" ist das Von Datum kleiner als das Bis Datum"); continue; } try { foreach (InformationenAddOn InfoAddOn in DBInformation.ConnectedInformationenAddOn) { if ( (InfoAddOn.DataDependencyID == DataDependencyEnums.RootFDDIDsForEreignisse.KontaktpersonRoot) // "Kontaktperson") || (InfoAddOn.DataDependencyID == DataDependencyEnums.RootFDDIDsForEreignisse.VeranstalterRoot) //"Veranstalter") || (InfoAddOn.DataDependencyID == DataDependencyEnums.RootFDDIDsForEreignisse.VeranstaltungsOrtRoot)) //"VeranstaltungsOrt") ) { NewEvent.ExtendedProperties.Shared.Add(new KeyValuePair<string, string> (DataModell.FullDataDependencyCacheInstance.AvailableFullDataDependencies [(Guid) InfoAddOn.DataDependencyID].ActuallBezeichner, InfoAddOn.GetCorrectFreiText (FreiTextFormat.Small))); } } } catch (Exception Excp) { WMB.Basics.ReportErrorToEventViewer("Bei InformationenID = \"" + DBInformation.ID.ToString( ) + "\"\r\nFehler in InfoAddOn Loop:\r\n" + Excp.ToString()); continue; } try { String WPMediaTyp = DataWrapper.Instance.GetTypFromEntryDataSet(EntryData); String ColorTypeName = DataModell.GetTypColorFromEntryDataSet(EntryData); if (Parent.AltErlaaInfoColorConverter.ContainsKey(ColorTypeName)) { NewEvent.ColorId = Parent.WordUpColorConverter[ColorTypeName]; } NewEvent.Summary = DataModell.GetTitleFromEntryDataSet(EntryData); NewEvent.ExtendedProperties.Shared.Add(new KeyValuePair<string, string> ("WPMediaTyp", WPMediaTyp)); NewEvent.ExtendedProperties.Shared.Add(new KeyValuePair<string, string> ("WPMediaZielGruppe", DataModell.GetZielGruppenFromEntryDataSet(EntryData))); NewEvent.Description = DataModell.GetFullUtilityDataView(EntryData); } catch (Exception Excp) { WMB.Basics.ReportErrorToEventViewer("Fehler Additional Data:\r\n" + Excp.ToString()); continue; } #if DEBUG //if (TestCounter++ > 3) // break; #endif if (NewEvent.Status == "cancelled") { NewEvent.Status = "confirmed"; ModifyEventEntry(NewEvent); Result.NumberOfModifiedEntries++; } else { NewEvent.Status = "confirmed"; NewEvent = ImportEventEntry(NewEvent); Result.NumberOfImportedEntries++; } if (StopTheLoop) break; #if DEBUG //if (TestCounter++ > 3) // break; #endif CalendarContentListe.Add(NewEvent); SendPropertyChanged("CalendarContentListe"); } catch (Exception Excp) { WMB.Basics.ReportErrorToEventViewer("Fehler:\r\n" + Excp.ToString()); } } }
private void FillWordUpCalendarContentListe(ref GoogleResult Result, String TypeIDSelectClause, ref DataCollection<Event> CalendarContentListe, String Key) { int TestCounter = 0; String SelectStatement = "Select * from Termine where " + TypeIDSelectClause + " and WordUpRootID = '" + WordUp23.Basics.Instance.WordUpID.ToString () + "' Order by LastUpdateToken desc"; DataSet ToProcessCalendarDataSet = Parent.WordUpWCFAccess.GetCommonDataSet(SelectStatement); List<System.Guid> ListOfTerminTypenWithTypOrtNaming = WordUp23.Basics.Instance.GetTerminTypenWithTypOrtNaming(); int HasBeenCorrectlyProcessedCounter = 0; Result.NumberOfCheckedEntries = ToProcessCalendarDataSet.Tables["Termine"].Rows.Count; foreach (DataRow InputRow in ToProcessCalendarDataSet.Tables["Termine"].Rows) { LastUpdate.HighestLastUpdateToken = 0; #if DEBUG //if (TestCounter++ > 20) // break; #endif String EventEntryElementID = String.Empty; if (InputRow ["ID"] == Convert.DBNull) { continue; } if ((InputRow ["Von"] == Convert.DBNull) || (InputRow ["Bis"] == Convert.DBNull)) continue; EventEntryElementID = InputRow ["ID"].ToString (); try { String TerminBeschreibung = GetTerminBeschreibung(InputRow); String Label = String.Empty; String Value = String.Empty; String OrtsBeschreibung = GetLocation(InputRow, ref Label, ref Value); String PersonenBeschreibung = WordUp23.Basics.Instance.GetTypeParticipantText(InputRow); String ColorTypeName = WordUp23.Basics.Instance.GetTypeColor (InputRow); Event NewEvent = CheckForExistingAndCompletness(EventEntryElementID, LastUpdate.CheckForHighestLastUpdateToken(InputRow)); if (StopTheLoop) break; if (NewEvent == null) { if (HasBeenCorrectlyProcessedCounter++ > 10) break; continue; } if (Parent.WordUpColorConverter.ContainsKey(ColorTypeName)) { NewEvent.ColorId = Parent.WordUpColorConverter [ColorTypeName]; } NewEvent.Start = new EventDateTime () { TimeZone = TimeZoneName, DateTime = Convert.ToDateTime (InputRow ["Von"]) }; NewEvent.End = new EventDateTime () { TimeZone = TimeZoneName, DateTime = Convert.ToDateTime (InputRow ["Bis"]) }; if (NewEvent.End.DateTime < NewEvent.Start.DateTime) { WMB.Basics.ReportErrorToEventViewer ("Beim Eintrag \"" + EventEntryElementID + "\" (\"" + InputRow ["Titel"].ToString () + "\" ist das Von Datum kleiner als das Bis Datum"); continue; } String OrteID = InputRow ["OrteID"].ToString (); String Ortsbezeichnung = "Nicht definiert"; if (String.IsNullOrEmpty (OrteID) == false) Ortsbezeichnung = WordUp23.Basics.Instance.Orte [OrteID] ["Bezeichnung"].ToString () + " " + WordUp23.Basics.Instance.Orte [OrteID] ["Beschreibung"].ToString (); if (ListOfTerminTypenWithTypOrtNaming.Contains ((System.Guid) InputRow ["TermineTypID"]) == true) { NewEvent.Summary = WordUp23.Basics.Instance.GetTypeBeschreibung (InputRow) + "-" + Ortsbezeichnung; } else { NewEvent.Summary = WordUp23.Basics.Instance.GetTypeBeschreibung (InputRow) + "-" + Ortsbezeichnung; } if (InputRow ["TermineTypID"].ToString () == "f61d9cb1-59a4-430b-ad67-ebdcc5df1d11") { NewEvent.Status = "tentative"; } NewEvent.Location = Value; NewEvent.Attendees = new List<EventAttendee> (); PersonenBeschreibung = FillAttendiees (InputRow, NewEvent.Attendees as List<EventAttendee>); // da ist es passiert String OrganisationsBeschreibung = FillOrganisationsBeschreibung (InputRow); NewEvent.Description = TerminBeschreibung + OrtsBeschreibung + OrganisationsBeschreibung + PersonenBeschreibung; CalendarContentListe.Add (NewEvent); if (NewEvent.Status == "cancelled") { NewEvent.Status = "confirmed"; ModifyEventEntry(NewEvent); Result.NumberOfModifiedEntries++; } else { NewEvent.Status = "confirmed"; NewEvent = ImportEventEntry(NewEvent); Result.NumberOfImportedEntries++; } if (StopTheLoop) break; SendPropertyChanged("CalendarContentListe"); } catch (Exception Excp) { WMB.Basics.ReportErrorToEventViewer ("Fehler:\r\n" + Excp.ToString ()); } } }
public GoogleResult LoadAppCalendarContents(ref DataCollection<Event> CalendarContentListe, String KeyToProcess = "") { CalendarContentListe = new DataCollection<Event>(); if (String.IsNullOrEmpty (KeyToProcess)) KeyToProcess = Key; ModifiedEvents.Clear (); GoogleResult Result = new GoogleResult (this, KeyToProcess); if (KeyToProcess == "AltErlaaInfo") { //SelectAllStatement = "Select * from InformationenWithTimings where " // + " TimingTypID = 'EventVonBis' order by LastUpdateToken desc"; SelectAllStatement = "Select * from InformationenWithTimings where " + " TimingTypID = 'EventVonBis' and TimeA > " + WMB.Basics.GetSQLFormattedDateTime(DateTime.Now.AddDays(-14)) + " order by TimeA, ModifyTimeStamp desc"; //SelectUnconnectedStatement = "Select * from InformationenWithTimings where " // + " TimingTypID = 'EventVonBis' and ConnectedType = 'Informationen' " // + "and GoogleEventID Is NULL order by TimeA, ModifyTimeStamp desc"; DataSet ToProcessCalendarDataSet = Parent.AltErlaaInfoWCFAccess.GetCommonDataSet(SelectAllStatement); if (ToProcessCalendarDataSet.Tables["InformationenWithTimings"].Rows.Count == 0) { if (WMB.Basics.IsTestRun) WMB.Basics.ReportInformationToEventViewer("\"" + SelectAllStatement + "\"\r\nNumber of Entries to Process = 0"); } else { if (WMB.Basics.IsTestRun) WMB.Basics.ReportInformationToEventViewer("\"" + SelectAllStatement + "\"\r\nNumber of Entries to Process = " + Convert.ToString(ToProcessCalendarDataSet.Tables["InformationenWithTimings"].Rows.Count)); } FillWPMediaCalendarContentListe(ref Result, ToProcessCalendarDataSet, ref CalendarContentListe); } if (KeyToProcess == "WordUpStaff") { List<Guid> TerminTypeIDsToProcess = WordUp23.Basics.Instance.GetIDsWithSpecialTyp ("Termine", "Team"); String TypeIDSelectClause = WordUp23.Basics.Instance.GetTypSelectPart(TerminTypeIDsToProcess); FillWordUpCalendarContentListe (ref Result, TypeIDSelectClause, ref CalendarContentListe, Key); } if (KeyToProcess == "WordUpPublic") { List<Guid> TerminTypeIDsToProcess = WordUp23.Basics.Instance.GetIDsWithSpecialTyp("Termine", "Public"); String TypeIDSelectClause = WordUp23.Basics.Instance.GetTypSelectPart(TerminTypeIDsToProcess); FillWordUpCalendarContentListe(ref Result, TypeIDSelectClause, ref CalendarContentListe, Key); } Result.NumberOfCheckedEntries = CalendarContentListe.Count; return Result; }