/// <summary>
        /// Queries Graph containing Facebook context items for Facebook Post info
        /// and calls MyLoDB method to add to DB
        /// </summary>
        private void AddFacebookPosts()
        {
            string sparqlQ = "PREFIX mylo: <http://mylo.com/schema/> " +
                             "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> " +
                             "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> " +
                             "SELECT DISTINCT ?activity ?time ?placename ?sourceId ?lat ?long ?state ?street ?city ?zip ?country " +
                             "WHERE {" +
                             "      ?activity rdf:type mylo:Activity ." +
                             "      ?activity rdf:type mylo:FacebookPost ." +
                             "      ?activity mylo:HasLocation ?loc ." +
                             "      ?activity mylo:HasSourceId ?sourceId ." +
                             "      ?loc mylo:HasLocationName ?placename ." +
                             "      ?loc mylo:HasGpsLatitude ?lat ." +
                             "      ?loc mylo:HasGpsLongitude ?long ." +
                             "      ?activity mylo:HasTimePeriod ?period ." +
                             "      ?period rdf:type mylo:Instant ." +
                             "      ?period mylo:HasTimeValue ?time ." +
                             "      OPTIONAL { ?loc mylo:HasAddress ?adr }" +
                             "      OPTIONAL { ?adr mylo:HasState ?state }" +
                             "      OPTIONAL { ?adr mylo:HasCity ?city }" +
                             "      OPTIONAL { ?adr mylo:HasZip ?zip }" +
                             "      OPTIONAL { ?adr mylo:HasCountry ?country }" +
                             "      OPTIONAL { ?adr mylo:HasStreet ?street }" +
                             "}";
            try
            {
                SparqlQueryParser sparqlparser = new SparqlQueryParser();
                SparqlQuery query = sparqlparser.ParseFromString(sparqlQ);
                Object results = _store.ExecuteQuery(query);
                if (results is SparqlResultSet)
                {
                    Dictionary<string, INode> vals = new Dictionary<string, INode>();
                    SparqlResultSet rset = (SparqlResultSet)results;
                    foreach (SparqlResult r in rset)
                    {
                        foreach (string var in rset.Variables)
                        {

                            if (r.HasValue(var))
                            {
                                vals[var] = r[var];
                            }
                            else
                            {
                                vals[var] = null;
                            }
                        }
                        try
                        {
                            Activity act = new Activity();
                            Address loc = new Address();
                            TimePeriod startDate = new TimePeriod();
                            TimePeriod endDate = new TimePeriod();
                            if (vals["sourceId"] != null)
                            {
                                act.SourceId = vals["sourceId"].ToString();
                            }
                            if (vals["time"] != null)
                            {
                                string[] parts = vals["time"].ToString().Split('^');
                                startDate.AltKey = Convert.ToDateTime(parts[0]);
                                endDate.AltKey = DateTime.MinValue;
                                act.StartDate = startDate.AltKey;
                                startDate.Hour = (short)startDate.AltKey.Hour;
                                startDate.Year = (short)startDate.AltKey.Year;
                                startDate.Month = (short)startDate.AltKey.Month;
                                startDate.Day = startDate.AltKey.DayOfWeek.ToString();
                                startDate.DayNumber = (short)startDate.AltKey.Day;
                            }
                            if (vals["placename"] != null)
                            {
                                act.ActivityName = vals["placename"].ToString();
                            }
                            if (vals["lat"] != null)
                            {
                                string[] parts = vals["lat"].ToString().Split('^');
                                act.Latitude = Convert.ToDouble(parts[0]);
                            }
                            if (vals["long"] != null)
                            {
                                string[] parts = vals["long"].ToString().Split('^');
                                act.Longitude = Convert.ToDouble(parts[0]);
                            }

                            Address locGps = new Address(); ;
                            if (vals["lat"] != null && vals["long"] != null)
                            {
                                locGps = ReverseLookupGPScoordinates(act.Latitude, act.Longitude);
                            }

                            if (vals["street"] != null)
                            {
                                loc.Street = vals["street"].ToString();
                            }
                            else
                            {
                                if (locGps.Street != null || locGps.Street != " ")
                                {
                                    loc.Street = locGps.Street;
                                }
                            }
                            if (vals["city"] != null)
                            {
                                loc.City = vals["city"].ToString();
                            }
                            else
                            {
                                if (locGps.City != null || locGps.City != " ")
                                {
                                    loc.City = locGps.City;
                                }
                            }
                            if (vals["state"] != null)
                            {
                                loc.State = vals["state"].ToString();
                            }
                            else
                            {
                                if (locGps.State != null || locGps.State != " ")
                                {
                                    loc.State = locGps.State;
                                }
                            }
                            if (vals["zip"] != null)
                            {
                                loc.Zip = vals["zip"].ToString();
                            }
                            else
                            {
                                if (locGps.Zip != null || locGps.Zip != " ")
                                {
                                    loc.Zip = locGps.Zip;
                                }
                            }
                            if (vals["country"] != null)
                            {
                                loc.Country = vals["country"].ToString();
                            }
                            else
                            {
                                if (locGps.Country != null || locGps.Country != " ")
                                {
                                    loc.Country = locGps.Country;
                                }
                            }

                            //if (vals["lat"] != null && vals["long"] != null)
                            //{
                            //    loc = ReverseLookupGPScoordinates(act.Latitude, act.Longitude);
                            //}
                            //else
                            //{
                            //    if (vals["street"] != null)
                            //    {
                            //        loc.Street = vals["street"].ToString();
                            //    }
                            //    if (vals["city"] != null)
                            //    {
                            //        loc.City = vals["city"].ToString();
                            //    }
                            //    if (vals["state"] != null)
                            //    {
                            //        loc.State = vals["state"].ToString();
                            //    }
                            //    if (vals["zip"] != null)
                            //    {
                            //        loc.Zip = vals["zip"].ToString();
                            //    }
                            //    if (vals["country"] != null)
                            //    {
                            //        loc.Country = vals["country"].ToString();
                            //    }
                            //}

                            act.Source = "Facebook";
                            act.ActivityKind = "FacebookPost";
                            long result = _myloStore.AddActivity(_userId, act, startDate, endDate, loc);
                        }
                        catch (MyLoDataStoreException dsEx)
                        {
                            throw new MyLoException("DataStore Error: Inner exception: " + dsEx);
                        }
                        catch (Exception ex)
                        {
                            throw new MyLoException("Add Activity Error: Inner exception: " + ex);
                        }
                    }

                }
            }
            catch (RdfException rdfEx)
            {
                throw new MyLoException("Save Context Error: Inner exception: " + rdfEx);
            }
            catch (Exception ex)
            {
                throw new MyLoException("Save Context Error: Inner exception: " + ex);
            }
        }
 private Address ReverseLookupGPScoordinates(double latitude, double longitude)
 {
     string city = String.Empty, street = String.Empty, zip = String.Empty, country = String.Empty, state = String.Empty;
     Address loc = new Address();
     gpsLookup.LatLongToAddressLookup(latitude, longitude, out street, out city, out state, out zip, out country);
     loc.Street = street;
     loc.City = city;
     loc.State = state;
     loc.Zip = zip;
     loc.Country = country;
     return loc;
 }
        //private long AddGeneratedActivity(EventCluster ec, int eventCount, DataTable photos)
        private long AddGeneratedActivity(EventCluster ec, int eventCount, string genedName)
        {
            Activity act = new Activity();

            //DataRow p1 = photos.Rows[ec.ecIndex1];
            //string[] parts1 = p1["dateTaken"].ToString().Split('^');

            //DataRow p2 = photos.Rows[ec.ecIndex2];
            //string[] parts2 = p2["dateTaken"].ToString().Split('^');

            act.ActivityKind = "Generated";
            //act.EndDate = (DateTime)p2["dateTaken"];
            act.EndDate = ec.endTime;
            act.Source = "LinearClusterIndexer";
            act.SourceId = genedName + eventCount.ToString();
            act.ActivityName = genedName + eventCount.ToString();
            act.Latitude = 0;
            act.Longitude = 0;

            TimePeriod tpStart = new TimePeriod();
            tpStart.Year = (short)act.StartDate.Year;
            tpStart.Month = (short)act.StartDate.Month;
            tpStart.Hour = (short)act.StartDate.Hour;
            tpStart.Day = act.StartDate.DayOfWeek.ToString();
            tpStart.DayNumber = (short)act.StartDate.Day;
            //tpStart.AltKey = Convert.ToDateTime(parts1[0]);
            tpStart.AltKey = ec.startTime;

            act.StartDate = tpStart.AltKey;

            TimePeriod tpEnd = new TimePeriod();
            tpEnd.Year = (short)act.EndDate.Year;
            tpEnd.Month = (short)act.EndDate.Month;
            tpEnd.Hour = (short)act.EndDate.Hour;
            tpEnd.Day = act.EndDate.DayOfWeek.ToString();
            tpEnd.DayNumber = (short)act.EndDate.Day;
            //tpEnd.AltKey = Convert.ToDateTime(parts1[0]);
            tpEnd.AltKey = ec.endTime;

            //act.StartDate = tpEnd.AltKey;

            Address loc = new Address();
            //return _store.AddActivity(_userId, act, tpStart, tpEnd, loc);
            return _store.AddActivity(_userId, act, tpStart, tpEnd, loc);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Adds Activity to MyLo datastore using PostgreSQL function 'addActivity'
        /// </summary>
        /// <param name="userId">A validated MyLo account Id</param>
        /// <param name="act">An Activity instance</param>
        /// <param name="startDate">A TimePeriod instance representing the start of the Activity</param>
        /// <param name="endDate">A TimePeriod instance representing the end of the Activity</param>
        /// <param name="loc">A Location instance represents where the Activity takes place</param>
        public long AddActivity(long userId, Activity act, TimePeriod startDate, TimePeriod endDate, Address loc)
        {
            try
            {

                NpgsqlCommand command = new NpgsqlCommand("AddActivityHierarchical", _conn);
                command.CommandType = CommandType.StoredProcedure;

                // create 25 parameters for this function
                for (int i = 0; i < 25; i++)
                {
                    command.Parameters.Add(new NpgsqlParameter());
                }

                command.Parameters[0].DbType = DbType.Int64;
                command.Parameters[0].Value = userId;
                command.Parameters[1].DbType = DbType.String;
                command.Parameters[1].Value = act.ActivityKind;
                command.Parameters[2].DbType = DbType.String;
                command.Parameters[2].Value = act.Source;
                command.Parameters[3].DbType = DbType.String;
                command.Parameters[3].Value = act.SourceId;
                command.Parameters[4].DbType = DbType.DateTime;
                command.Parameters[4].Value = startDate.AltKey;
                command.Parameters[5].DbType = DbType.DateTime;
                command.Parameters[5].Value = endDate.AltKey;

                command.Parameters[6].DbType = DbType.Int16;
                command.Parameters[6].Value = startDate.Year;
                command.Parameters[7].DbType = DbType.Int16;
                command.Parameters[7].Value = startDate.Month;
                command.Parameters[8].DbType = DbType.String;
                command.Parameters[8].Value = startDate.Day;
                command.Parameters[9].DbType = DbType.Int16;
                command.Parameters[9].Value = startDate.DayNumber;
                command.Parameters[10].DbType = DbType.Int16;
                command.Parameters[10].Value = startDate.Hour;

                command.Parameters[11].DbType = DbType.Int16;
                command.Parameters[11].Value = endDate.Year;
                command.Parameters[12].DbType = DbType.Int16;
                command.Parameters[12].Value = endDate.Month;
                command.Parameters[13].DbType = DbType.String;
                command.Parameters[13].Value = endDate.Day;
                command.Parameters[14].DbType = DbType.Int16;
                command.Parameters[14].Value = endDate.DayNumber;
                command.Parameters[15].DbType = DbType.Int16;
                command.Parameters[15].Value = endDate.Hour;

                command.Parameters[16].DbType = DbType.String;
                command.Parameters[16].Value = act.ActivityName;
                command.Parameters[17].DbType = DbType.Double;
                command.Parameters[17].Value = act.Latitude;
                command.Parameters[18].DbType = DbType.Double;
                command.Parameters[18].Value = act.Longitude;
                command.Parameters[19].DbType = DbType.String;
                command.Parameters[19].Value = String.IsNullOrEmpty(loc.Street) ? null : loc.Street;
                command.Parameters[20].DbType = DbType.String;
                command.Parameters[20].Value = String.IsNullOrEmpty(loc.City) ? null : loc.City;
                command.Parameters[21].DbType = DbType.String;
                command.Parameters[21].Value = String.IsNullOrEmpty(loc.State) ? null : loc.State;
                command.Parameters[22].DbType = DbType.String;
                command.Parameters[22].Value = String.IsNullOrEmpty(loc.Zip) ? null : loc.Zip;
                command.Parameters[23].DbType = DbType.String;
                command.Parameters[23].Value = String.IsNullOrEmpty(loc.Country) ? null : loc.Country;
                command.Parameters[24].DbType = DbType.Int64;
                command.Parameters[24].Value = 0;
                Debug.WriteLine("AddActivity Loc is: {0}, {1}, {2}, {3}, {4}", command.Parameters[19].Value, command.Parameters[20].Value, command.Parameters[21].Value, command.Parameters[22].Value, command.Parameters[23].Value);
                Debug.WriteLine("AddActivity Time is: {0}, {1}", command.Parameters[4].Value, command.Parameters[5].Value);
                long result = (long)command.ExecuteScalar();
                return result;
            }
            catch (NpgsqlException npex)
            {
                _conn.Close();
                throw new MyLoDataStoreException(npex.Message, npex);
            }
            catch (Exception ex)
            {
                _conn.Close();
                throw new MyLoDataStoreException(ex.Message);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Retrieves Selected Photos in a MyLo DataStore for current account holder
        /// Using Dimension Ids
        /// </summary>
        /// <param name="userId">An identifier for a MyLo Account</param>
        /// <param name="timePeriod">An identifier for a Time Period</param>
        /// <param name="person">An identifier for a Party</param>
        /// <param name="address">An identifier for a Location</param>
        public DataSet GetPhotosByDimensionFields(long userId, Address addr, TimePeriod timePeriod, Party person)
        {
            DataSet ds = new DataSet();
            NpgsqlDataAdapter da = new NpgsqlDataAdapter();
            NpgsqlCommand command = new NpgsqlCommand();
            string withClause = "WITH parties AS ( " +
                                        "SELECT PAP.activityid FROM partyactivityparticipation AS PAP " +
                                        "JOIN person AS P ON P.partyid = PAP.partyid " +
                                        "WHERE P.name = @personname) ";
            string selectClause = "SELECT P.uri, P.datetaken, P.camera, P.gpslat, P.gpslong, P.thumbnail FROM photo AS P " +
                                                                "LEFT JOIN Activity AS A ON P.activityId = A.activityId " +
                                                                "JOIN TimePeriod AS TP ON A.starttimeperiodid = TP.timeperiodid " +
                                                                "LEFT JOIN Address AS L ON A.addressid = L.addressid ";
            string joinWithClause = "JOIN parties AS PTY ON PTY.activityid = A.activityid ";

            int i = 0;

            if (person.Name != String.Empty)
            {
                command.Parameters.Add(new NpgsqlParameter("personname", DbType.String));
                command.Parameters[i].Value = person.Name; i++;
                command.CommandText += withClause;
                command.CommandText += selectClause;
                command.CommandText += joinWithClause;
            }
            else
            {
                command.CommandText += selectClause;
            }
            string whereClause = " WHERE P.MyLoAccountId = @userid ";
            command.Parameters.Add(new NpgsqlParameter("userid", DbType.Int64));
            command.Parameters[i].Value = userId; i++;

            if (addr.City != String.Empty)
            {
                whereClause += "AND L.city = @city ";
                command.Parameters.Add(new NpgsqlParameter("city", DbType.String));
                command.Parameters[i].Value = addr.City; i++;
            }
            if (addr.Country != String.Empty)
            {
                whereClause += "AND L.country = @country ";
                command.Parameters.Add(new NpgsqlParameter("country", DbType.String));
                command.Parameters[i].Value = addr.Country; i++;
            }
            if (timePeriod.Year != 0)
            {
                whereClause += "AND TP.year = @year ";
                command.Parameters.Add(new NpgsqlParameter("year", DbType.Int16));
                command.Parameters[i].Value = timePeriod.Year; i++;
            }
            if (timePeriod.Month != 0)
            {
                whereClause += "AND TP.month = @month ";
                command.Parameters.Add(new NpgsqlParameter("month", DbType.Int16));
                command.Parameters[i].Value = timePeriod.Month; i++;
            }
            if (timePeriod.Day != String.Empty)
            {
                whereClause += "AND TP.dayname = @day ";
                command.Parameters.Add(new NpgsqlParameter("day", DbType.String));
                command.Parameters[i].Value = timePeriod.Day; i++;
            }

            command.CommandText += whereClause;
            command.Connection = _conn;
            da.SelectCommand = command;

            da.Fill(ds);
            _conn.Close();
            if (ds != null)
            {
                return ds;
            }
            else
            {
                return null;
            }
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Method for returning a all Photos using slection by Dimension(Time Party, Location) in a given context
 /// </summary>
 /// <param name="country">A country name</param>
 /// <param name="city">A city name</param>
 /// <param name="year">A year</param>
 /// <param name="month">A month</param>
 /// <param name="day">A day name</param>
 /// <param name="name">A unique name for a person</param>
 public DataSet GetPhotosByDimensionFields(string country, string city, string year, string month, string day, string name)
 {
     try
     {
         DataSet ds = new DataSet();
         if (country == String.Empty && city == String.Empty
             && year == String.Empty && month == String.Empty
             && day == String.Empty && name == String.Empty)
         {
             return ds;
         }
         else
         {
             Address loc = new Address();
             loc.Country = country; loc.City = city;
             TimePeriod tp = new TimePeriod();
             if (year != String.Empty)
             {
                 tp.Year = Convert.ToInt16(year);
             }
             else
             {
                 tp.Year = 0;
             }
             if (month != String.Empty)
             {
                 tp.Month = Convert.ToInt16(month);
             }
             else
             {
                 tp.Month = 0;
             }
             tp.Day = day;
             Party p = new Party();
             p.Name = name;
             return ds = _myLoStore.GetPhotosByDimensionFields(_userId, loc, tp, p);
         }
     }
     catch (MyLoException ex)
     {
         throw new Exception(ex.Message);
     }
 }
        private void AddEvents()
        {
            Address loc = new Address();
            TimePeriod start = new TimePeriod();
            TimePeriod end = new TimePeriod();
            Party person = new Party();
            Activity activity = new Activity();
            BingMapsGPSlookup gpsl = new BingMapsGPSlookup();

            // Setup the event called "Jeff and Tami's Wedding
            string city, street, zip, country, state;
            gpsl.LatLongToAddressLookup(47.7337578, -122.1469737, out street, out city, out state, out zip, out country);
            loc.Street = street;
            loc.City = city;
            loc.State = state;
            loc.Zip = zip;
            loc.Country = country;

            start.Year = 2012;
            start.Month = 6;
            start.DayNumber = 2;
            start.Day = "Saturday";
            start.Hour = 10;
            start.AltKey = new DateTime(2012, 6, 2, 10, 0, 0, DateTimeKind.Local);

            end.Year = 2012;
            end.Month = 6;
            end.DayNumber = 2;
            end.Day = "Saturday";
            end.Hour = 16;
            end.AltKey = new DateTime(2012, 6, 2, 16, 0, 0, DateTimeKind.Local);

            activity.ActivityKind = "Calendar";
            activity.Source = "Outlook";
            activity.SourceId = "0001";
            activity.StartDate = new DateTime(2012, 6, 2, 10, 0, 0, DateTimeKind.Local);
            activity.EndDate = new DateTime(2012, 6, 2, 16, 0, 0, DateTimeKind.Local);
            activity.ActivityName = "Jeff and Tami's Wedding";
            activity.Latitude = 47.7337578;
            activity.Longitude = -122.1469737;

            activity.ActivityId = _myloStore.AddActivity(_userId, activity, start, end,loc);

            person.Name = "Rebecca Short";
            person.PartyId = _myloStore.AddParty(_userId, person);
            person.PartyKind = "Person";
            long paId = _myloStore.AddPartyToActivityByIds(_userId, person, activity);

            // Setup the event called "Cabo San Lucas Vacation"
            gpsl.LatLongToAddressLookup(22.890980, -109.916676, out street, out city, out state, out zip, out country);
            loc.Street = street;
            loc.City = city;
            loc.State = state;
            loc.Zip = zip;
            loc.Country = country;

            start.Year = 2012;
            start.Month = 2;
            start.DayNumber = 20;
            start.Day = "Monday";
            start.Hour = 10;
            start.AltKey = new DateTime(2012, 2, 20, 10, 0, 0, DateTimeKind.Local);

            end.Year = 2012;
            end.Month = 2;
            end.DayNumber = 26;
            end.Day = "Sunday";
            end.Hour = 18;
            end.AltKey = new DateTime(2012, 2, 26, 18, 0, 0, DateTimeKind.Local);

            activity.ActivityKind = "Calendar";
            activity.Source = "Outlook";
            activity.SourceId = "0002";
            activity.StartDate = new DateTime(2012, 2, 20, 10, 0, 0, DateTimeKind.Local);
            activity.EndDate = new DateTime(2012, 2, 26, 18, 0, 0, DateTimeKind.Local);
            activity.ActivityName = "Cabo San Lucas Vacation";
            activity.Latitude = 22.890980;
            activity.Longitude = -109.916676;

            activity.ActivityId = _myloStore.AddActivity(_userId, activity, start, end, loc);

            person.Name = "Rebecca Short";
            person.PartyKind = "Person";
            person.PartyId = _myloStore.AddParty(_userId, person);
            long paId2 = _myloStore.AddPartyToActivityByIds(_userId, person, activity);

            // Setup the event called "Wine Club and Steven's 50th"
            gpsl.LatLongToAddressLookup(47.6885173, -122.1321265, out street, out city, out state, out zip, out country);
            loc.Street = street;
            loc.City = city;
            loc.State = state;
            loc.Zip = zip;
            loc.Country = country;

            start.Year = 2012;
            start.Month = 6;
            start.DayNumber = 8;
            start.Day = "Friday";
            start.Hour = 19;
            start.AltKey = new DateTime(2012, 6, 8, 19, 0, 0, DateTimeKind.Local);

            end.Year = 2012;
            end.Month = 6;
            end.DayNumber = 8;
            end.Day = "Friday";
            end.Hour = 23;
            end.AltKey = new DateTime(2012, 6, 8, 23, 0, 0, DateTimeKind.Local);

            activity.ActivityKind = "Calendar";
            activity.Source = "Outlook";
            activity.SourceId = "0003";
            activity.StartDate = new DateTime(2012, 6, 8, 19, 0, 0, DateTimeKind.Local);
            activity.EndDate = new DateTime(2012, 6, 8, 23, 0, 0, DateTimeKind.Local);
            activity.ActivityName = "Wine Club and Steven's 50th";
            activity.Latitude = 47.6885173;
            activity.Longitude = -122.1321265;

            activity.ActivityId = _myloStore.AddActivity(_userId, activity, start, end, loc);

            person.Name = "Rebecca Short";
            person.PartyKind = "Person";
            person.PartyId = _myloStore.AddParty(_userId, person);
            long paId3 = _myloStore.AddPartyToActivityByIds(_userId, person, activity);

            // Setup the event called "Maui Vacation"
            gpsl.LatLongToAddressLookup(20.7180257, -156.4472008, out street, out city, out state, out zip, out country);
            loc.Street = street;
            loc.City = city;
            loc.State = state;
            loc.Zip = zip;
            loc.Country = country;

            start.Year = 2011;
            start.Month = 12;
            start.DayNumber = 5;
            start.Day = "Monday";
            start.Hour = 11;
            start.AltKey = new DateTime(2011, 12, 5, 11, 0, 0, DateTimeKind.Local);

            end.Year = 2011;
            end.Month = 12;
            end.DayNumber = 10;
            end.Day = "Saturday";
            end.Hour = 22;
            end.AltKey = new DateTime(2011, 12, 10, 22, 0, 0, DateTimeKind.Local);

            activity.ActivityKind = "Calendar";
            activity.Source = "Outlook";
            activity.SourceId = "0004";
            activity.StartDate = new DateTime(2011, 12, 5, 11, 0, 0, DateTimeKind.Local);
            activity.EndDate = new DateTime(2011, 12, 10, 22, 0, 0, DateTimeKind.Local);
            activity.ActivityName = "Vacation in Maui";
            activity.Latitude = 20.7180257;
            activity.Longitude = -156.4472008;

            activity.ActivityId = _myloStore.AddActivity(_userId, activity, start, end, loc);

            person.Name = "Rebecca Short";
            person.PartyKind = "Person";
            person.PartyId = _myloStore.AddParty(_userId, person);
            long paId4 = _myloStore.AddPartyToActivityByIds(_userId, person, activity);

            // Setup the event called "Mount Haleakela"
            gpsl.LatLongToAddressLookup(20.709722, -156.253333, out street, out city, out state, out zip, out country);
            loc.Street = street;
            loc.City = city;
            loc.State = state;
            loc.Zip = zip;
            loc.Country = country;

            start.Year = 2011;
            start.Month = 12;
            start.DayNumber = 7;
            start.Day = "Wednesday";
            start.Hour = 5;
            start.AltKey = new DateTime(2011, 12, 7, 5, 0, 0, DateTimeKind.Local);

            end.Year = 2011;
            end.Month = 12;
            end.DayNumber = 7;
            end.Day = "Wednesday";
            end.Hour = 14;
            end.AltKey = new DateTime(2011, 12, 7, 14, 0, 0, DateTimeKind.Local);

            activity.ActivityKind = "Calendar";
            activity.Source = "Outlook";
            activity.SourceId = "0005";
            activity.StartDate = new DateTime(2011, 12, 7, 5, 0, 0, DateTimeKind.Local);
            activity.EndDate = new DateTime(2011, 12, 7, 14, 0, 0, DateTimeKind.Local);
            activity.ActivityName = "Mount Haleakala";
            activity.Latitude = 20.709722;
            activity.Longitude = -156.253333;

            activity.ActivityId = _myloStore.AddActivity(_userId, activity, start, end, loc);

            person.Name = "Rebecca Short";
            person.PartyKind = "Person";
            person.PartyId = _myloStore.AddParty(_userId, person);
            long paId5 = _myloStore.AddPartyToActivityByIds(_userId, person, activity);

            // Setup the event called "Florence Vacation"
            gpsl.LatLongToAddressLookup(43.777417, 11.251117, out street, out city, out state, out zip, out country);
            loc.Street = street;
            loc.City = city;
            loc.State = state;
            loc.Zip = zip;
            loc.Country = country;

            start.Year = 2012;
            start.Month = 04;
            start.DayNumber = 21;
            start.Day = "Saturday";
            start.Hour = 12;
            start.AltKey = new DateTime(2012, 4, 21, 12, 0, 0, DateTimeKind.Local);

            end.Year = 2012;
            end.Month = 4;
            end.DayNumber = 25;
            end.Day = "Wednesday";
            end.Hour = 14;
            end.AltKey = new DateTime(2012, 4, 25, 14, 0, 0, DateTimeKind.Local);

            activity.ActivityKind = "Calendar";
            activity.Source = "Outlook";
            activity.SourceId = "0006";
            activity.StartDate = new DateTime(2012, 4, 21, 12, 0, 0, DateTimeKind.Local);
            activity.EndDate = new DateTime(2012, 4, 25, 14, 0, 0, DateTimeKind.Local);
            activity.ActivityName = "Florence Vacation";
            activity.Latitude = 43.777417;
            activity.Longitude = 11.251117;

            activity.ActivityId = _myloStore.AddActivity(_userId, activity, start, end, loc);

            person.Name = "Rebecca Short";
            person.PartyKind = "Person";
            person.PartyId = _myloStore.AddParty(_userId, person);
            long paId6 = _myloStore.AddPartyToActivityByIds(_userId, person, activity);

            // Setup the event called "Italy Vacation"
            //gpsl.LatLongToAddressLookup(43.777417, 11.251117, out street, out city, out state, out zip, out country);
            loc.Country = "Italy";

            start.Year = 2012;
            start.Month = 04;
            start.DayNumber = 21;
            start.Day = "Saturday";
            start.Hour = 12;
            start.AltKey = new DateTime(2012, 4, 21, 12, 0, 0, DateTimeKind.Local);

            end.Year = 2012;
            end.Month = 4;
            end.DayNumber = 28;
            end.Day = "Saturday";
            end.Hour = 18;
            end.AltKey = new DateTime(2012, 4, 28, 18, 0, 0, DateTimeKind.Local);

            activity.ActivityKind = "Calendar";
            activity.Source = "Outlook";
            activity.SourceId = "0007";
            activity.StartDate = new DateTime(2012, 4, 21, 12, 0, 0, DateTimeKind.Local);
            activity.EndDate = new DateTime(2012, 4, 28, 18, 0, 0, DateTimeKind.Local);
            activity.ActivityName = "Italy Vacation";
            activity.Latitude = 0;
            activity.Longitude = 0;

            activity.ActivityId = _myloStore.AddActivity(_userId, activity, start, end, loc);

            person.Name = "Rebecca Short";
            person.PartyKind = "Person";
            person.PartyId = _myloStore.AddParty(_userId, person);
            long paId7 = _myloStore.AddPartyToActivityByIds(_userId, person, activity);

            // Setup the event called "Walla Walla Wine Tasting"
            //gpsl.LatLongToAddressLookup(43.777417, 11.251117, out street, out city, out state, out zip, out country);
            loc.Country = "United States";

            start.Year = 2012;
            start.Month = 08;
            start.DayNumber = 24;
            start.Day = "Friday";
            start.Hour = 10;
            start.AltKey = new DateTime(2012, 8, 24, 10, 0, 0, DateTimeKind.Local);

            end.Year = 2012;
            end.Month = 8;
            end.DayNumber = 26;
            end.Day = "Sunday";
            end.Hour = 18;
            end.AltKey = new DateTime(2012, 8, 26, 18, 0, 0, DateTimeKind.Local);

            activity.ActivityKind = "Calendar";
            activity.Source = "Outlook";
            activity.SourceId = "0008";
            activity.StartDate = new DateTime(2012, 8, 24, 10, 0, 0, DateTimeKind.Local);
            activity.EndDate = new DateTime(2012, 8, 26, 18, 0, 0, DateTimeKind.Local);
            activity.ActivityName = "Walla Wall Wine Tasting Weekend";
            activity.Latitude = 0;
            activity.Longitude = 0;

            activity.ActivityId = _myloStore.AddActivity(_userId, activity, start, end, loc);

            person.Name = "Rebecca Short";
            person.PartyKind = "Person";
            person.PartyId = _myloStore.AddParty(_userId, person);
            long paId8 = _myloStore.AddPartyToActivityByIds(_userId, person, activity);
        }