Ejemplo n.º 1
0
        public IHttpActionResult GetGroupYoutubeProfiles(string GroupId, string UserId)
        {
            Guid grpId = Guid.Empty;

            try
            {
                grpId = Guid.Parse(GroupId);
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                logger.Error(ex.StackTrace);
                return(BadRequest("Invalid GroupId"));
            }
            List <Domain.Socioboard.Domain.GroupProfile>   lstGroupProfiles  = grpProfilesRepo.GetAllGroupProfilesByProfileType(grpId, "youtube");
            List <Domain.Socioboard.Domain.YoutubeAccount> lstYoutubeAccount = new List <Domain.Socioboard.Domain.YoutubeAccount>();
            YoutubeAccountRepository objYoutubeAccountRepository             = new YoutubeAccountRepository();


            foreach (var profile in lstGroupProfiles)
            {
                try
                {
                    lstYoutubeAccount.Add(objYoutubeAccountRepository.getYoutubeAccountDetailsById(profile.ProfileId));
                }
                catch (Exception ex)
                {
                    logger.Error(ex.Message);
                    logger.Error(ex.StackTrace);
                }
            }
            return(Ok(lstYoutubeAccount));
        }
        public IHttpActionResult GetYoutubeAccount(string ProfileId)
        {
            Domain.Socioboard.Domain.YoutubeAccount objYoutubeAccount = new Domain.Socioboard.Domain.YoutubeAccount();
            try
            {
                objYoutubeAccount.Ytuserid = ProfileId;

                objYoutubeAccount = objYoutubeAccountRepository.getYoutubeAccountDetailsById(ProfileId);

                return(Ok(objYoutubeAccount));
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                return(BadRequest("Something Went Wrong"));
            }
        }
Ejemplo n.º 3
0
        public string ProfilesConnected(string UserId, string access_token)
        {
            //if (!User.Identity.IsAuthenticated)
            //{
            //    return "Unauthorized access";
            //}
            try
            {

                Guid userid = Guid.Parse(UserId);
                SocialProfilesRepository socialRepo = new SocialProfilesRepository();
                List<Domain.Socioboard.Domain.SocialProfile> lstsocioprofile = socialRepo.getAllSocialProfilesOfUser(userid);
                List<profileConnected> lstProfile = new List<profileConnected>();
                foreach (Domain.Socioboard.Domain.SocialProfile sp in lstsocioprofile)
                {
                    profileConnected pc = new profileConnected();
                    pc.Id = sp.Id;
                    pc.ProfileDate = sp.ProfileDate;
                    pc.ProfileId = sp.ProfileId;
                    pc.ProfileStatus = sp.ProfileStatus;
                    pc.ProfileType = sp.ProfileType;
                    pc.UserId = sp.UserId;
                    if (sp.ProfileType == "facebook")
                    {
                        try
                        {
                            FacebookAccountRepository objFbAccRepo = new FacebookAccountRepository();
                            Domain.Socioboard.Domain.FacebookAccount objFbAcc = objFbAccRepo.getUserDetails(sp.ProfileId);
                            pc.ProfileName = objFbAcc.FbUserName;
                            pc.ProfileImgUrl = "http://graph.facebook.com/" + sp.ProfileId + "/picture?type=small";
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                    }
                    else if (sp.ProfileType == "twitter")
                    {
                        try
                        {
                            TwitterAccountRepository objTwtAccRepo = new TwitterAccountRepository();
                            Domain.Socioboard.Domain.TwitterAccount objTwtAcc = objTwtAccRepo.getUserInfo(sp.ProfileId);
                            pc.ProfileName = objTwtAcc.TwitterScreenName;
                            pc.ProfileImgUrl = objTwtAcc.ProfileImageUrl;
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                    }
                    else if (sp.ProfileType == "instagram")
                    {
                        try
                        {
                            InstagramAccountRepository objInsAccRepo = new InstagramAccountRepository();
                            Domain.Socioboard.Domain.InstagramAccount objInsAcc = objInsAccRepo.getInstagramAccountById(sp.ProfileId);
                            pc.ProfileName = objInsAcc.InsUserName;
                            pc.ProfileImgUrl = objInsAcc.ProfileUrl;
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                    }
                    else if (sp.ProfileType == "linkedin")
                    {
                        try
                        {
                            LinkedInAccountRepository objLiAccRepo = new LinkedInAccountRepository();
                            Domain.Socioboard.Domain.LinkedInAccount objLiAcc = objLiAccRepo.getLinkedinAccountDetailsById(sp.ProfileId);
                            pc.ProfileName = objLiAcc.LinkedinUserName;
                            pc.ProfileImgUrl = objLiAcc.ProfileImageUrl;
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                    }
                    else if (sp.ProfileType == "googleplus")
                    {
                        try
                        {
                            GooglePlusAccountRepository objGpAccRepo = new GooglePlusAccountRepository();
                            Domain.Socioboard.Domain.GooglePlusAccount objGpAcc = objGpAccRepo.getUserDetails(sp.ProfileId);
                            pc.ProfileName = objGpAcc.GpUserName;
                            pc.ProfileImgUrl = objGpAcc.GpProfileImage;
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                    }
                    else if (sp.ProfileType == "tumblr")
                    {
                        try
                        {
                            TumblrAccountRepository objTumblrAccountRepository = new TumblrAccountRepository();
                            Domain.Socioboard.Domain.TumblrAccount objTumblrAccount = objTumblrAccountRepository.getTumblrAccountDetailsById(sp.ProfileId);
                            pc.ProfileName = objTumblrAccount.tblrUserName;
                            pc.ProfileImgUrl = objTumblrAccount.tblrProfilePicUrl;
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                    }
                    else if (sp.ProfileType == "youtube")
                    {
                        try
                        {
                            YoutubeAccountRepository objYoutubeAccountRepository = new YoutubeAccountRepository();
                            Domain.Socioboard.Domain.YoutubeAccount objYoutubeAccount = objYoutubeAccountRepository.getYoutubeAccountDetailsById(sp.ProfileId);
                            pc.ProfileName = objYoutubeAccount.Ytusername;
                            pc.ProfileImgUrl = objYoutubeAccount.Ytprofileimage;
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                    }
                    lstProfile.Add(pc);
                }
                return new JavaScriptSerializer().Serialize(lstProfile);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                return new JavaScriptSerializer().Serialize("Please Try Again");
            }
        }
Ejemplo n.º 4
0
 public string getYoutubeData(string UserId, string youtubeId)
 {
     string ret = string.Empty;
     try
     {
         Guid userId = Guid.Parse(UserId);
         oAuthToken OAuthToken = new oAuthToken();
         OAuthToken.ConsumerKey = ConfigurationManager.AppSettings["YtconsumerKey"];
         OAuthToken.ConsumerSecret = ConfigurationManager.AppSettings["YtconsumerSecret"];
         YoutubeAccountRepository ObjYoutubeAccountRepository = new YoutubeAccountRepository();
         Domain.Socioboard.Domain.YoutubeAccount ObjYoutubeAccount = ObjYoutubeAccountRepository.getYoutubeAccountDetailsById(youtubeId, userId);
         AddYouTubeChannels(userId.ToString(), ObjYoutubeAccount.Accesstoken, youtubeId);
         GetYoutubeChannelVideos(userId.ToString(), youtubeId);
         return "Youtube Channel is added";
     }
     catch (Exception ex)
     {
         return ex.Message;
     }
 }
        public IHttpActionResult GetGroupYoutubeProfiles(string GroupId, string UserId)
        {
            Guid grpId = Guid.Empty;
            try
            {
                grpId = Guid.Parse(GroupId);
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                logger.Error(ex.StackTrace);
                return BadRequest("Invalid GroupId");
            }
            List<Domain.Socioboard.Domain.GroupProfile> lstGroupProfiles = grpProfilesRepo.GetAllGroupProfilesByProfileType(grpId, "youtube");
            List<Domain.Socioboard.Domain.YoutubeAccount> lstYoutubeAccount = new List<Domain.Socioboard.Domain.YoutubeAccount>();
            YoutubeAccountRepository objYoutubeAccountRepository = new YoutubeAccountRepository();


            foreach (var profile in lstGroupProfiles)
            {
                try
                {
                    lstYoutubeAccount.Add(objYoutubeAccountRepository.getYoutubeAccountDetailsById(profile.ProfileId));
                }
                catch (Exception ex)
                {
                    logger.Error(ex.Message);
                    logger.Error(ex.StackTrace);
                }
            }
            return Ok(lstYoutubeAccount);
        }