Пример #1
0
        public string GetYoutubeChannelVideos(string userid, string profileid)
        {
            string ret            = string.Empty;
            string strfinaltoken  = string.Empty;
            string channelDetails = string.Empty;

            Domain.Myfashion.Domain.YoutubeAccount objYoutubeAccount = objYoutubeAccountRepository.getYoutubeAccountDetailsById(profileid, Guid.Parse(userid));
            Domain.Myfashion.Domain.YoutubeChannel objYoutubeChannel = objYoutubeChannelRepository.getYoutubeChannelDetailsById(profileid, Guid.Parse(userid));

            oAuthTokenYoutube objoAuthTokenYoutube = new oAuthTokenYoutube();
            string            finaltoken           = objoAuthTokenYoutube.GetAccessToken(objYoutubeAccount.Refreshtoken);
            JObject           objArray             = JObject.Parse(finaltoken);

            //foreach (var item in objArray)
            //{
            try
            {
                strfinaltoken = objArray["access_token"].ToString();
                // break;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }
            //}
            PlaylistItems objPlaylistItems = new PlaylistItems();

            try
            {
                channelDetails = objPlaylistItems.Get_PlaylistItems_List(strfinaltoken, GlobusGooglePlusLib.Authentication.oAuthTokenYoutube.Parts.snippet.ToString(), objYoutubeChannel.Uploadsid);
            }
            catch (Exception ex)
            {
            }



            return(channelDetails);
        }
Пример #2
0
 public string GetYoutubeAccountDetailsById(string UserId, string ProfileId)
 {
     Domain.Myfashion.Domain.YoutubeAccount objYoutubeAccount = new Domain.Myfashion.Domain.YoutubeAccount();
     try
     {
         objYoutubeAccount.Ytuserid = ProfileId;
         objYoutubeAccount.UserId   = Guid.Parse(UserId);
         if (objYoutubeAccountRepository.checkTubmlrUserExists(objYoutubeAccount))
         {
             objYoutubeAccount = objYoutubeAccountRepository.getYoutubeAccountDetailsById(ProfileId, Guid.Parse(UserId));
         }
         else
         {
             objYoutubeAccount = objYoutubeAccountRepository.getYoutubeAccountDetailsById(ProfileId);
         }
         return(new JavaScriptSerializer().Serialize(objYoutubeAccount));
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.StackTrace);
         return("Something Went Wrong");
     }
 }
Пример #3
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.Myfashion.Domain.YoutubeAccount ObjYoutubeAccount = ObjYoutubeAccountRepository.getYoutubeAccountDetailsById(youtubeId, userId);
                AddYouTubeChannels(userId.ToString(), ObjYoutubeAccount.Accesstoken, youtubeId);
                return("Youtube Channel is added");
            }
            catch (Exception ex)
            {
                throw;
            }
        }
        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.Myfashion.Domain.YoutubeAccount ObjYoutubeAccount = ObjYoutubeAccountRepository.getYoutubeAccountDetailsById(youtubeId, userId);
                AddYouTubeChannels(userId.ToString(), ObjYoutubeAccount.Accesstoken, youtubeId);
                return "Youtube Channel is added";
            }
            catch (Exception ex)
            {

                throw;
            }
        }