public QuickPost() { InitializeComponent(); db = new SEMDBDataContext(dbConnectionString); //TWITTER: retrieving the db info, setting up the twit classes, and putting them in a list try { Table <Twitter> t = db.GetTable <Twitter>(); foreach (Twitter item in t) { twitter.Add(new Twit(item.AToken, item.ASecret, item.UserId, item.ScreenName.Trim())); } } catch (Exception ex) { StreamWriter w = new StreamWriter("errorLog.txt"); w.Write(ex.Message + "\n" + "Twitter" + DateTime.Now + "\n\n"); w.Close(); MessageBox.Show("AN ERROR HAS OCCURED WHEN PULLING TWITTER DATA", "Database Error", MessageBoxButton.OK, MessageBoxImage.Error); } //FACEBOOK: retrieves the db info and adds it to a list try { Table <Face> face = db.GetTable <Face>(); foreach (Face fb in face) { fbClass.Add(new FacebookLogic(fb.AToken)); } } catch (Exception ex) { StreamWriter w = new StreamWriter("errorLog.txt"); w.Write(ex.Message + "\n" + "Facebook" + DateTime.Now + "\n\n"); w.Close(); MessageBox.Show("AN ERROR HAS OCCURED WHEN PULLING FACEBOOK DATA", "Database Error", MessageBoxButton.OK, MessageBoxImage.Error); } //EMAIL: retrieves the db info try { Table <UMail> m = db.GetTable <UMail>(); foreach (UMail temp in m) { gMail.Add(new GmailClass(temp.UserName, temp.Password)); } } catch (Exception ex) { StreamWriter w = new StreamWriter("errorLog.txt"); w.Write(ex.Message + "\n" + "Email" + DateTime.Now + "\n\n"); MessageBox.Show("AN ERROR HAS OCCURED WHEN PULLING EMAIL DATA", "Database Error", MessageBoxButton.OK, MessageBoxImage.Error); } fillCombo(); }
private void grabDBInfo() { var db = new SEMDBDataContext(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\SMBDB.mdf;Integrated Security=True;Connect Timeout=30"); // Change this for final DB. Table <Email> clients = db.GetTable <Email>(); foreach (Email address in clients) { EventAttendee attendee = new EventAttendee(); attendee.Email = address.EmailAddress; atList.Add(attendee); } }