예제 #1
0
		String FillPersonen (DataRow IwTRow, Google.GData.Extensions.ExtensionCollection<Who> WhoList )
			{
			String EventIDString = IwTRow ["ID"].ToString ();
			DataTable FullPersonenZuTermine = WordUpWCFAccess.GetCommonDataSet
				("Select * from FullPersonenZuTermine where TermineID = '" + EventIDString + "'").Tables ["FullPersonenZuTermine"];
			if (FullPersonenZuTermine.Rows.Count == 0)
				{
				WhoList.Clear ();
				return String.Empty;
				}

			bool SomethingChanged = false;
			ExtensionCollection<Who> DeleteList = new ExtensionCollection<Who> ();
			foreach (Who Participant in WhoList)
				{
				String Rel = Participant.Rel;
				if (Rel == "http://schemas.google.com/g/2005#event.organizer")
					continue;
				String eMail = Participant.Email;
				DataRow [] ParticipantBase = FullPersonenZuTermine.Select ("eMail = '" + eMail + "'");
				if (ParticipantBase.Length == 1)
					continue;
				DeleteList.Add (Participant);
				}

			foreach (Who ParticipantsToDelete in DeleteList)
				{
				WhoList.Remove (ParticipantsToDelete);
				SomethingChanged = true;
				}

			foreach (DataRow PersonenRow in FullPersonenZuTermine.Rows)
				{
				String eMail = PersonenRow ["eMail"].ToString ();
				String NameID = String.Empty;
				if (String.IsNullOrEmpty (PersonenRow ["PersonalPresentationLink"].ToString ()))
					NameID = PersonenRow ["VorName"].ToString ();
				else
					NameID = "<a href=\"" + PersonenRow ["PersonalPresentationLink"].ToString () + "\" target=\"_blank\">"
						+ PersonenRow ["VorName"].ToString () + "</a>";
				bool IsAvailable = false;
				foreach (Who Participant in WhoList)
					{
					String Rel = Participant.Rel;
					if (Rel == "http://schemas.google.com/g/2005#event.organizer")
						continue;
					String WhoeMail = Participant.Email;
					if (String.Compare(WhoeMail, eMail, StringComparison.CurrentCultureIgnoreCase) == 0)
						{
						Participant.ValueString = NameID;
						IsAvailable = true;
						break;
						}
					}
				if (IsAvailable == false)
					{
					Who NewParticipant = new Who ();
					NewParticipant.Email = eMail;
					NewParticipant.ValueString = NameID;
					NewParticipant.Rel = "http://schemas.google.com/g/2005#event.attendee";
					WhoList.Add (NewParticipant);
					SomethingChanged = true;
					}
				}
			List<String> PersonenInvolved = new List<string> ();
			int LineBreakCounter = 0;
			foreach (Who Participant in WhoList)
				{
				String Rel = Participant.Rel;
				if (Rel == "http://schemas.google.com/g/2005#event.organizer")
					continue;
				String WhoeMail = Participant.Email;
				String WhoNameID = Participant.ValueString;
				if ((++LineBreakCounter % 5) == 0)
					PersonenInvolved.Add ("<br/>" + WhoNameID);
				else
					PersonenInvolved.Add (WhoNameID);
				}
			return "<h4>Teilnehmer</h4>" + String.Join (", ", PersonenInvolved) + "<Br/>";
			}