示例#1
0
 /// <addgoogleplusActivity>
 /// Add a new googleplus Activity
 /// </summary>
 /// <param name="gpmsg">Set Values in a GooglePlusActivities Class Property and Pass the same Object of GooglePlusActivities Class.(Domain.GooglePlusActivities)</param>
 public void addgoogleplusActivity(GooglePlusActivities gpmsg)
 {
     //Creates a database connection and opens up a session
     using (NHibernate.ISession session = SessionFactory.GetNewSession())
     {
         //After Session creation, start Transaction.
         using (NHibernate.ITransaction transaction = session.BeginTransaction())
         {
             try
             {
                 //Proceed action to save data.
                 session.Save(gpmsg);
                 transaction.Commit();
             }
             catch (Exception Err)
             {
                 Console.Write(Err.Message.ToString());
             }
         } //End Transaction
     }     //End session
 }
示例#2
0
        public void GetUserActivities(string GpUserId, string acces_token, Guid UserId)
        {
            ActivitiesController           obj          = new ActivitiesController();
            GooglePlusActivitiesRepository objgpActRepo = new GooglePlusActivitiesRepository();
            GooglePlusActivities           objgpAct     = new GooglePlusActivities();
            JArray objActivity = obj.GetActivitiesList(GpUserId, acces_token);

            foreach (var itemActivity in objActivity)
            {
                foreach (var itemAct in itemActivity["items"])
                {
                    objgpAct.ActivityId       = itemAct["id"].ToString();
                    objgpAct.ActivityUrl      = itemAct["url"].ToString();
                    objgpAct.Content          = itemAct["object"]["content"].ToString();
                    objgpAct.EntryDate        = DateTime.Now;
                    objgpAct.FromId           = itemAct["actor"]["id"].ToString();
                    objgpAct.FromProfileImage = itemAct["actor"]["image"]["url"].ToString();
                    objgpAct.FromUserName     = itemAct["actor"]["displayName"].ToString();
                    objgpAct.GpUserId         = GpUserId;
                    objgpAct.Id             = Guid.NewGuid();
                    objgpAct.PlusonersCount = int.Parse(itemAct["object"]["plusoners"]["totalItems"].ToString());
                    objgpAct.RepliesCount   = int.Parse(itemAct["object"]["replies"]["totalItems"].ToString());
                    objgpAct.ResharersCount = int.Parse(itemAct["object"]["resharers"]["totalItems"].ToString());
                    objgpAct.PublishedDate  = itemAct["published"].ToString();
                    objgpAct.Title          = itemActivity["title"].ToString();
                    objgpAct.UserId         = UserId;
                    if (!objgpActRepo.checkgoogleplusActivityExists(itemAct["id"].ToString(), UserId))
                    {
                        objgpActRepo.addgoogleplusActivity(objgpAct);
                    }
                    else
                    {
                        objgpActRepo.updategoogleplusActivity(objgpAct);
                    }
                }
            }
        }
 public int updategoogleplusActivity(GooglePlusActivities gpmsg)
 {
     throw new NotImplementedException();
 }
示例#4
0
 public int updategoogleplusActivity(GooglePlusActivities gpmsg)
 {
     throw new NotImplementedException();
 }