Beispiel #1
0
 public static void CheckAzureDBConnectivity()
 {
     DatabaseUtility.SQLConnectionString = "Data Source=tczxnf5cbu.database.windows.net;Initial Catalog=ArchiveService;Integrated Security=false;User ID=cxp;Password=ConferenceXP!";
     if (DatabaseUtility.CheckConnectivity())
     {
         Debug.WriteLine("Azure database is alive.");
         Conference[] confs = DatabaseUtility.GetConferences();
     }
     else
     {
         Debug.WriteLine("Azure database is not alive.");
     }
 }
        private void lookupThreadProc()
        {
            working.Reset();

            if (!DatabaseUtility.CheckConnectivity())
            {
                done            = true;
                sqlConnectError = true;
                working.Set();
                return;
            }

            Conference[] confs = DatabaseUtility.GetConferences();
            this.conferenceData = new ArrayList();

            participantCount = DatabaseUtility.CountParticipants();
            if (participantCount < 1)
            {
                done            = true;
                sqlConnectError = false;
                working.Set();
                return;
            }

            currentParticipant = 0;

            foreach (Conference c in confs)
            {
                if (stopNow)
                {
                    break;
                }
                ConferenceWrapper cw = new ConferenceWrapper();
                cw.Conference   = c;
                cw.Description  = "Conference: " + c.Start.ToString() + " - " + c.Description;
                cw.Participants = new ArrayList();

                Participant[] participants = DatabaseUtility.GetParticipants(c.ConferenceID);
                foreach (Participant part in participants)
                {
                    if (stopNow)
                    {
                        break;
                    }
                    ParticipantWrapper pw = new ParticipantWrapper();

                    pw.Description   = "Participant: " + part.CName;
                    pw.Participant   = part;
                    pw.StreamGrouper = new StreamGrouper(part.CName);

                    //Here is the slow part:
                    Stream[] streams = DatabaseUtility.GetStreams(part.ParticipantID);
                    currentParticipant++;

                    if (streams == null)
                    {
                        continue;
                    }

                    foreach (Stream str in streams)
                    {
                        pw.StreamGrouper.AddStream(str);
                    }

                    //Only show the participants that sent some supported data
                    if (pw.StreamGrouper.GroupCount > 0)
                    {
                        cw.Participants.Add(pw);
                    }
                }

                conferenceData.Add(cw);
            }
            done = true;
            working.Set();
        }