Example #1
0
        public void GetUerProfile(GooglePlusAccount objgpAcc,string acces_token,string refresh_token,Guid UserId)
        { 
              PeopleController obj = new PeopleController();
              oAuthToken objtoken = new oAuthToken();
              GooglePlusAccountRepository objgpRepo = new GooglePlusAccountRepository();
           
              SocialProfilesRepository socioprofilerepo = new SocialProfilesRepository();
              SocialProfile socioprofile = new SocialProfile();
                     
                    socioprofile.Id = Guid.NewGuid();
                    socioprofile.ProfileDate = DateTime.Now;
                    socioprofile.ProfileId = objgpAcc.GpUserId;
                    socioprofile.ProfileType = "googleplus";
                    socioprofile.UserId = UserId;

                  
                    JArray objPeopleList = obj.GetPeopleList(objgpAcc.GpUserId, acces_token, "visible");
                    objgpAcc.PeopleCount = objPeopleList.Count();


                    if (!objgpRepo.checkGooglePlusUserExists(objgpAcc.GpUserId, UserId))
                    {
                        objgpRepo.addGooglePlusUser(objgpAcc);
                        if (!socioprofilerepo.checkUserProfileExist(socioprofile))
                        {
                            socioprofilerepo.addNewProfileForUser(socioprofile);
                        }
                        else
                        {
                            socioprofilerepo.updateSocialProfile(socioprofile);
                        }
                    }
                    else
                    {
                        objgpRepo.updateGooglePlusUser(objgpAcc);
                        if (!socioprofilerepo.checkUserProfileExist(socioprofile))
                        {
                            socioprofilerepo.addNewProfileForUser(socioprofile);
                        }
                        else
                        {
                            socioprofilerepo.updateSocialProfile(socioprofile);
                        }
                    }
                    GetUserActivities(objgpAcc.GpUserId, acces_token, UserId);
                }