Exemple #1
0
        public Domain.Myfashion.Domain.TwitterAccount getUserInformation(string twtuserid)
        {
            //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 get account details by user id and twitter id.
                        List <Domain.Myfashion.Domain.TwitterAccount> objlst = session.CreateQuery("from TwitterAccount where  TwitterUserId = :Twtuserid")

                                                                               .SetParameter("Twtuserid", twtuserid)
                                                                               .List <Domain.Myfashion.Domain.TwitterAccount>().ToList <Domain.Myfashion.Domain.TwitterAccount>();
                        Domain.Myfashion.Domain.TwitterAccount result = new Domain.Myfashion.Domain.TwitterAccount();
                        if (objlst.Count > 0)
                        {
                            result = objlst[0];
                        }
                        return(result);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                        return(null);
                    }
                } //End Transaction
            }     //End Session
        }
Exemple #2
0
 /// <updateTwitterUser>
 /// Update Twitter User
 /// </summary>
 /// <param name="TwtAccount">Set Values in a TwitterAccount Class Property and Pass the Object of TwitterAccount Class.(Domein.TwitterAccount)</param>
 /// <returns>Return 1 for success and 0 for failure.(int) </returns>
 public int updateTwitterUser(Domain.Myfashion.Domain.TwitterAccount TwtAccount)
 {
     //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 update Account details.
                 int i = session.CreateQuery("Update TwitterAccount set TwitterScreenName =:twtScreenName,OAuthToken=:twtToken,OAuthSecret=:tokenSecret,FollowersCount=:followerscount,FollowingCount=:followingcount,ProfileImageUrl=:imageurl where TwitterUserId = :id and UserId =:userid")
                         .SetParameter("twtScreenName", TwtAccount.TwitterScreenName)
                         .SetParameter("twtToken", TwtAccount.OAuthToken)
                         .SetParameter("tokenSecret", TwtAccount.OAuthSecret)
                         .SetParameter("followerscount", TwtAccount.FollowersCount)
                         .SetParameter("followingcount", TwtAccount.FollowingCount)
                         .SetParameter("imageurl", TwtAccount.ProfileImageUrl)
                         .SetParameter("id", TwtAccount.TwitterUserId)
                         .SetParameter("userid", TwtAccount.UserId)
                         .ExecuteUpdate();
                 transaction.Commit();
                 return(i);
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.StackTrace);
                 return(0);
             }
         } //End Transaction
     }     //End Session
 }
Exemple #3
0
        /// <getUserInformation>
        /// Get User account Information by screen Name and user id.
        /// </summary>
        /// <param name="screenname">Tqitter account screen name.(String)</param>
        /// <param name="userid">User id.(Guid)</param>
        /// <returns>Return the object of TwitterAccount class with value.(Domain.TwitterAccount)</returns>
        public Domain.Myfashion.Domain.TwitterAccount getUserInformation(string screenname, Guid userid)
        {
            //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 get twitter account details by screen name and user id.
                        NHibernate.IQuery query = session.CreateQuery("from TwitterAccount where UserId = :userid and TwitterUserId = :Twtuserid");
                        query.SetParameter("userid", userid);
                        query.SetParameter("Twtuserid", screenname);
                        Domain.Myfashion.Domain.TwitterAccount result = query.UniqueResult <Domain.Myfashion.Domain.TwitterAccount>();
                        return(result);

                        //TwitterAccount result= session.QueryOver<TwitterAccount>().Where(x => x.UserId == userid).And(x=>x.TwitterUserId == twtuserid).SingleOrDefault<TwitterAccount>();
                        //return result;
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                        return(null);
                    }
                } //End Transaction
            }     //End Session
        }
Exemple #4
0
 /// <addTwitterkUser>
 /// Add new Twitter account.
 /// </summary>
 /// <param name="TwtAccount">Set Values in a TwitterAccount Class Property and Pass the Object of TwitterAccount Class.(Domein.TwitterAccount)</param>
 public void addTwitterkUser(Domain.Myfashion.Domain.TwitterAccount TwtAccount)
 {
     //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())
         {
             //Proceed action, to save data.
             session.Save(TwtAccount);
             transaction.Commit();
         } //End Transaction
     }     //End Session
 }
 public ISocialSiteAccount BindJArray(Newtonsoft.Json.Linq.JObject jObject)
 {
     TwitterAccount objTwitterAccount = new TwitterAccount();
     //Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount();
     //JObject FacebookAccountDetails = JObject.Parse(ApiobjFacebookAccount.getFacebookAccountDetailsById(objUser.Id.ToString(), objTeamMemberProfile.ProfileId.ToString()));
     objTwitterAccount.Id = Guid.Parse(jObject["Id"].ToString());
     objTwitterAccount.TwitterUserId = jObject["TwitterUserId"].ToString();
     objTwitterAccount.TwitterScreenName = jObject["TwitterScreenName"].ToString();
     objTwitterAccount.OAuthToken = jObject["OAuthToken"].ToString();
     objTwitterAccount.OAuthSecret = Convert.ToString(jObject["OAuthSecret"]);
     objTwitterAccount.UserId = Guid.Parse(jObject["UserId"].ToString());
     objTwitterAccount.IsActive = Convert.ToBoolean(jObject["IsActive"].ToString());
     objTwitterAccount.FollowersCount = Convert.ToInt16(Convert.ToString(jObject["FollowersCount"]));
     objTwitterAccount.FollowingCount = Convert.ToInt16(Convert.ToString(jObject["FollowingCount"]));
     objTwitterAccount.ProfileUrl = jObject["ProfileUrl"].ToString();
     objTwitterAccount.ProfileImageUrl = jObject["ProfileImageUrl"].ToString();
     objTwitterAccount.TwitterName = jObject["TwitterName"].ToString();
     return objTwitterAccount;
 }
Exemple #6
0
        /// <getUserInfo>
        /// getUserAccount Information by profile id.
        /// </summary>
        /// <param name="profileid">Account profile id.(String)</param>
        /// <returns>Return the object of TwitterAccount class with value.(Domain.TwitterAccount)</returns>
        public Domain.Myfashion.Domain.TwitterAccount getUserInfo(string profileid)
        {
            //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
                    {
                        try
                        {
                            //Proceed action, to get account details by profile id.
                            NHibernate.IQuery query = session.CreateQuery("from TwitterAccount where TwitterUserId = :Twtuserid");
                            query.SetParameter("Twtuserid", profileid);
                            Domain.Myfashion.Domain.TwitterAccount twtAccount = new Domain.Myfashion.Domain.TwitterAccount();
                            foreach (Domain.Myfashion.Domain.TwitterAccount item in query.Enumerable <Domain.Myfashion.Domain.TwitterAccount>())
                            {
                                twtAccount = item;
                                break;
                            }

                            return(twtAccount);

                            //TwitterAccount result= session.QueryOver<TwitterAccount>().Where(x => x.UserId == userid).And(x=>x.TwitterUserId == twtuserid).SingleOrDefault<TwitterAccount>();
                            //return result;
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                            return(null);
                        }
                    }

                    catch
                    {
                        return(null);
                    }
                } //End Transaction
            }     //End Session
        }
        public string AddTwitterAccount(string client_id, string client_secret, string redirect_uri, string UserId, string GroupId, string requestToken, string requestSecret, string requestVerifier)
        {
            try
            {
                System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls;

                string ret = string.Empty;
                GlobusTwitterLib.Twitter.Core.UserMethods.Users userinfo = new GlobusTwitterLib.Twitter.Core.UserMethods.Users();
                oAuthTwitter OAuth = new oAuthTwitter(client_id, client_secret, redirect_uri);
                OAuth.AccessToken = requestToken;
                OAuth.AccessTokenSecret = requestVerifier;
                OAuth.AccessTokenGet(requestToken, requestVerifier);
                JArray profile = userinfo.Get_Users_LookUp_ByScreenName(OAuth, OAuth.TwitterScreenName);

                if (profile != null)
                {
                    logger.Error("Twitter.asmx >> AddTwitterAccount >> Twitter profile : " + profile);
                }
                else
                {
                    logger.Error("Twitter.asmx >> AddTwitterAccount >> NULL Twitter profile : " + profile);
                }

                objTwitterAccount = new Domain.Myfashion.Domain.TwitterAccount();
                TwitterUser twtuser;
                foreach (var item in profile)
                {
                    #region Add Twitter Account
                    try
                    {
                        objTwitterAccount.FollowingCount = Convert.ToInt32(item["friends_count"].ToString());
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.StackTrace);
                    }
                    try
                    {
                        objTwitterAccount.FollowersCount = Convert.ToInt32(item["followers_count"].ToString());
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    objTwitterAccount.Id = Guid.NewGuid();
                    objTwitterAccount.IsActive = true;
                    objTwitterAccount.OAuthSecret = OAuth.AccessTokenSecret;
                    objTwitterAccount.OAuthToken = OAuth.AccessToken;
                    try
                    {
                        objTwitterAccount.ProfileImageUrl = item["profile_image_url"].ToString().TrimStart('"').TrimEnd('"');
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);

                    }
                    try
                    {
                        objTwitterAccount.ProfileUrl = string.Empty;
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    try
                    {
                        objTwitterAccount.TwitterUserId = item["id_str"].ToString().TrimStart('"').TrimEnd('"');
                    }
                    catch (Exception er)
                    {
                        try
                        {
                            objTwitterAccount.TwitterUserId = item["id"].ToString().TrimStart('"').TrimEnd('"');
                        }
                        catch (Exception ex)
                        {
                            logger.Error(ex.StackTrace);
                        }
                        Console.WriteLine(er.StackTrace);

                    }

                    try
                    {
                        objTwitterAccount.TwitterScreenName = item["screen_name"].ToString().TrimStart('"').TrimEnd('"');
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.StackTrace);
                    }
                    objTwitterAccount.UserId = Guid.Parse(UserId);
                    #endregion
                    if (!objTwitterAccountRepository.checkTwitterUserExists(objTwitterAccount.TwitterUserId, Guid.Parse(UserId)))
                    {
                        objTwitterAccountRepository.addTwitterkUser(objTwitterAccount);
                        #region Add TeamMemberProfile
                        Domain.Myfashion.Domain.Team objTeam = objTeamRepository.GetTeamByGroupId(Guid.Parse(GroupId));
                        Domain.Myfashion.Domain.TeamMemberProfile objTeamMemberProfile = new Domain.Myfashion.Domain.TeamMemberProfile();
                        objTeamMemberProfile.Id = Guid.NewGuid();
                        objTeamMemberProfile.TeamId = objTeam.Id;
                        objTeamMemberProfile.Status = 1;
                        objTeamMemberProfile.ProfileType = "twitter";
                        objTeamMemberProfile.StatusUpdateDate = DateTime.Now;
                        objTeamMemberProfile.ProfileId = objTwitterAccount.TwitterUserId;

                        objTeamMemberProfile.ProfileName = objTwitterAccount.TwitterScreenName;
                        objTeamMemberProfile.ProfilePicUrl = objTwitterAccount.ProfileImageUrl;

                        objTeamMemberProfileRepository.addNewTeamMember(objTeamMemberProfile);
                        #endregion
                        #region SocialProfile
                        Domain.Myfashion.Domain.SocialProfile objSocialProfile = new Domain.Myfashion.Domain.SocialProfile();
                        objSocialProfile.Id = Guid.NewGuid();
                        objSocialProfile.ProfileType = "twitter";
                        objSocialProfile.ProfileId = objTwitterAccount.TwitterUserId;
                        objSocialProfile.UserId = Guid.Parse(UserId);
                        objSocialProfile.ProfileDate = DateTime.Now;
                        objSocialProfile.ProfileStatus = 1;
                        #endregion
                        #region Add Twitter Stats
                        if (!objSocialProfilesRepository.checkUserProfileExist(objSocialProfile))
                        {
                            objSocialProfilesRepository.addNewProfileForUser(objSocialProfile);
                        }
                        objTwitterStats = new Domain.Myfashion.Domain.TwitterStats();
                        Random rNum = new Random();
                        objTwitterStats.Id = Guid.NewGuid();
                        objTwitterStats.TwitterId = objTwitterAccount.TwitterUserId;
                        objTwitterStats.UserId = Guid.Parse(UserId);
                        objTwitterStats.FollowingCount = objTwitterAccount.FollowingCount;
                        objTwitterStats.FollowerCount = objTwitterAccount.FollowersCount;
                        objTwitterStats.Age1820 = rNum.Next(objTwitterAccount.FollowersCount);
                        objTwitterStats.Age2124 = rNum.Next(objTwitterAccount.FollowersCount);
                        objTwitterStats.Age2534 = rNum.Next(objTwitterAccount.FollowersCount);
                        objTwitterStats.Age3544 = rNum.Next(objTwitterAccount.FollowersCount);
                        objTwitterStats.Age4554 = rNum.Next(objTwitterAccount.FollowersCount);
                        objTwitterStats.Age5564 = rNum.Next(objTwitterAccount.FollowersCount);
                        objTwitterStats.Age65 = rNum.Next(objTwitterAccount.FollowersCount);
                        objTwitterStats.EntryDate = DateTime.Now;
                        if (!objTwtstats.checkTwitterStatsExists(objTwitterAccount.TwitterUserId, Guid.Parse(UserId)))
                        {
                            objTwtstats.addTwitterStats(objTwitterStats);
                        }
                        #endregion

                        #region AddTwitterFollowerCount
                        Domain.Myfashion.Domain.TwitterAccountFollowers objTwitterAccountFollowers = new Domain.Myfashion.Domain.TwitterAccountFollowers();
                        TwitterAccountFollowersRepository objTwitterAccountFollowersRepository = new TwitterAccountFollowersRepository();
                        objTwitterAccountFollowers.Id = Guid.NewGuid();
                        objTwitterAccountFollowers.UserId = Guid.Parse(UserId);
                        objTwitterAccountFollowers.EntryDate = DateTime.Now;
                        objTwitterAccountFollowers.FollowingsCount = Convert.ToInt32(item["friends_count"].ToString());
                        objTwitterAccountFollowers.FollowersCount = Convert.ToInt32(item["followers_count"].ToString());
                        try
                        {
                            objTwitterAccountFollowers.ProfileId = item["id_str"].ToString().TrimStart('"').TrimEnd('"');
                        }
                        catch (Exception er)
                        {
                            try
                            {
                                objTwitterAccountFollowers.ProfileId = item["id"].ToString().TrimStart('"').TrimEnd('"');
                            }
                            catch (Exception ex)
                            {
                                logger.Error(ex.StackTrace);
                            }
                            Console.WriteLine(er.StackTrace);

                        }
                        objTwitterAccountFollowersRepository.addTwitterAccountFollower(objTwitterAccountFollowers);
                        #endregion

                        ret = "Account Added Successfully";
                    }
                    else
                    {
                        ret = "Account already Exist !";
                    }
                }
                getTwitterMessages(UserId, OAuth);

                getUserRetweets(UserId, OAuth);


                //edited by avinash[24-03-15]

                getTwitterEngagement(UserId, OAuth);

                getUserTweets(UserId, OAuth);

                getTwitterFeeds(UserId, OAuth);

                getTwitterDirectMessageSent(UserId, OAuth);
                getTwittwrDirectMessageRecieved(OAuth,UserId);
                getUserMentions(OAuth, objTwitterAccount.TwitterUserId, Guid.Parse(UserId));
                getUserFollowers(OAuth, objTwitterAccount.TwitterScreenName, objTwitterAccount.TwitterUserId, Guid.Parse(UserId));
                getUserRetweet(OAuth, objTwitterAccount.TwitterUserId, Guid.Parse(UserId));

                //return ret;
                return new JavaScriptSerializer().Serialize(objTwitterAccount);
            }
            catch (Exception ex)
            {
                logger.Error(ex.StackTrace);
                return "";
            }
        }
        public string TwitterLogIn(string client_id, string client_secret, string redirect_uri, string requestToken, string requestSecret, string requestVerifier)
        {
            System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls;
            string ret = string.Empty;
            GlobusTwitterLib.Twitter.Core.UserMethods.Users userinfo = new GlobusTwitterLib.Twitter.Core.UserMethods.Users();
            oAuthTwitter OAuth = new oAuthTwitter(client_id, client_secret, redirect_uri);
            OAuth.AccessToken = requestToken;
            OAuth.AccessTokenSecret = requestVerifier;
            OAuth.AccessTokenGet(requestToken, requestVerifier);
            JArray profile = userinfo.Get_Users_LookUp_ByScreenName(OAuth, OAuth.TwitterScreenName);

            if (profile != null)
            {
                logger.Error("Twitter.asmx >> TwitterLogIn >> Twitter profile : " + profile);
            }
            else
            {
                logger.Error("Twitter.asmx >> TwitterLogIn >> NULL Twitter profile : " + profile);
            }
            string TwitterUserId = string.Empty;
            objTwitterAccount = new Domain.Myfashion.Domain.TwitterAccount();
            Domain.Myfashion.Domain.User objUser = new Domain.Myfashion.Domain.User();
            foreach (var item in profile)
            {
                #region Login Twitter Account
                try
                {
                    objUser.ProfileUrl = item["profile_image_url"].ToString().TrimStart('"').TrimEnd('"');
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                }
                try
                {
                    TwitterUserId = item["id_str"].ToString().TrimStart('"').TrimEnd('"');
                }
                catch (Exception er)
                {
                    try
                    {
                        TwitterUserId = item["id"].ToString().TrimStart('"').TrimEnd('"');
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.StackTrace);
                    }
                    Console.WriteLine(er.StackTrace);
                }
                //objUser.SocialLogin = "******" + TwitterUserId;
                try
                {
                    objUser.UserName = item["name"].ToString().TrimStart('"').TrimEnd('"');
                }
                catch (Exception ex)
                {
                    logger.Error(ex.StackTrace);
                }

                #endregion
            }
            return new JavaScriptSerializer().Serialize(objUser);
        }
 public string TwitterProfileDetails(string userid, string profileid)
 {
     Domain.Myfashion.Domain.TwitterAccount objTwitterAccount = new Domain.Myfashion.Domain.TwitterAccount();
     TwitterAccountRepository _objTwitterAccountRepository = new TwitterAccountRepository();
     if (_objTwitterAccountRepository.checkTwitterUserExists(profileid, Guid.Parse(userid)))
     {
         objTwitterAccount = _objTwitterAccountRepository.getUserInformation(profileid, Guid.Parse(userid));
     }
     else
     {
         objTwitterAccount = _objTwitterAccountRepository.getUserInformation(profileid);
     }
     return new JavaScriptSerializer().Serialize(objTwitterAccount);
 }
        public void getUserProile(oAuthTwitter OAuth, string TwitterScreenName, Guid userId)
        {
            try
            {
                GlobusTwitterLib.Twitter.Core.UserMethods.Users userinfo = new GlobusTwitterLib.Twitter.Core.UserMethods.Users();
                //TwitterAccount twitterAccount = new TwitterAccount();
                Domain.Myfashion.Domain.TwitterAccount twitterAccount = new Domain.Myfashion.Domain.TwitterAccount();
                TwitterAccountRepository twtrepo = new TwitterAccountRepository();
                JArray profile = userinfo.Get_Users_LookUp(OAuth, TwitterScreenName);
                foreach (var item in profile)
                {
                    try
                    {
                        twitterAccount.FollowingCount = Convert.ToInt32(item["friends_count"].ToString());
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    try
                    {
                        twitterAccount.FollowersCount = Convert.ToInt32(item["followers_count"].ToString());
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);

                    }
                    twitterAccount.IsActive = true;
                    twitterAccount.OAuthSecret = OAuth.AccessTokenSecret;
                    twitterAccount.OAuthToken = OAuth.AccessToken;
                    try
                    {
                        twitterAccount.ProfileImageUrl = item["profile_image_url"].ToString().TrimStart('"').TrimEnd('"');
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);

                    }
                    try
                    {
                        twitterAccount.ProfileUrl = string.Empty;
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    try
                    {
                        twitterAccount.TwitterUserId = item["id_str"].ToString().TrimStart('"').TrimEnd('"');
                    }
                    catch (Exception er)
                    {
                        try
                        {
                            twitterAccount.TwitterUserId = item["id"].ToString().TrimStart('"').TrimEnd('"');
                        }
                        catch (Exception err)
                        {
                            Console.WriteLine(err.StackTrace);

                        }
                        Console.WriteLine(er.StackTrace);

                    }
                    try
                    {
                        twitterAccount.TwitterScreenName = item["screen_name"].ToString().TrimStart('"').TrimEnd('"');
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    twitterAccount.UserId = userId;

                    if (twtrepo.checkTwitterUserExists(twitterAccount.TwitterUserId, userId))
                    {
                        twtrepo.updateTwitterUser(twitterAccount);
                    }
                    getTwitterStats(twitterAccount);
                }

            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }
        }
        public string SheduleTwitterMessage(string TwitterId, string UserId, string sscheduledmsgguid)
        {


            string str = string.Empty;
            string ret = string.Empty;
            bool rt = false;
            try
            {

                oAuthTwitter OAuthTwt = new oAuthTwitter();
                objScheduledMessage = objScheduledMessageRepository.GetScheduledMessageDetails(Guid.Parse(sscheduledmsgguid));
                objTwitterAccount = objTwitterAccountRepository.GetUserInformation(Guid.Parse(UserId), TwitterId);

                //OAuthTwt.AccessToken = objTwitterAccount.OAuthToken;
                //OAuthTwt.AccessTokenSecret = objTwitterAccount.OAuthSecret;
                //OAuthTwt.TwitterScreenName = objTwitterAccount.TwitterScreenName;
                //OAuthTwt.TwitterUserId = objTwitterAccount.TwitterUserId;

                str = PostTwitterMessage(objScheduledMessage.ShareMessage, objTwitterAccount.TwitterUserId, UserId, objScheduledMessage.PicUrl, true, sscheduledmsgguid);

                #region Commented

                //#region For Testing
                //// For Testing 

                ////OAuthTwt.ConsumerKey = "udiFfPxtCcwXWl05wTgx6w";
                ////OAuthTwt.ConsumerKeySecret = "jutnq6N32Rb7cgbDSgfsrUVgRQKMbUB34yuvAfCqTI";
                ////OAuthTwt.AccessToken = "1904022338-Ao9chvPouIU8ejE1HMG4yJsP3hOgEoXJoNRYUF7";
                ////OAuthTwt.AccessTokenSecret = "Wj93a8csVFfaFS1MnHjbmbPD3V6DJbhEIf4lgSAefORZ5";
                ////OAuthTwt.TwitterScreenName = "";
                ////OAuthTwt.TwitterUserId = ""; 
                //#endregion

                //if (objTwitterAccount != null)
                //{
                //    try
                //    {
                //        //TwitterUser twtuser = new TwitterUser();
                //        string message = objScheduledMessage.ShareMessage;
                //        string picurl = objScheduledMessage.PicUrl;
                //        //if (string.IsNullOrEmpty(objScheduledMessage.ShareMessage))
                //        //{
                //        //    objScheduledMessage.ShareMessage = "There is no data in Share Message !";
                //        //}
                //        if (string.IsNullOrEmpty(message) && string.IsNullOrEmpty(picurl))
                //        {
                //            str = "There is no data in Share Message !";
                //        }
                //        else
                //        {
                //            JArray post = new JArray();
                //            try
                //            {
                //                Tweet twt = new Tweet();
                //                if (!string.IsNullOrEmpty(picurl))
                //                {
                //                    PhotoUpload ph = new PhotoUpload();
                //                    string res = string.Empty;
                //                    rt = ph.NewTweet(picurl, message, OAuthTwt, ref res);
                //                }
                //                else
                //                {
                //                    post = twt.Post_Statuses_Update(OAuthTwt, message);
                //                    ret = post[0]["id_str"].ToString();
                //                }
                //                //post = twtuser.Post_Status_Update(OAuthTwt, objScheduledMessage.ShareMessage);
                //            }
                //            catch (Exception ex)
                //            {
                //                Console.WriteLine(ex.StackTrace);
                //                ret = "";
                //            }
                //            if (!string.IsNullOrEmpty(ret) || rt == true)
                //            {
                //                str = "Message post on twitter for Id :" + objTwitterAccount.TwitterUserId + " and Message: " + objScheduledMessage.ShareMessage;
                //                ScheduledMessage schmsg = new ScheduledMessage();
                //                schmsg.UpdateScheduledMessageByMsgId(Guid.Parse(sscheduledmsgguid));
                //            }
                //            else
                //            {
                //                str = "Message not posted";
                //            }
                //        }
                //    }
                //    catch (Exception ex)
                //    {
                //        Console.WriteLine(ex.StackTrace);
                //        str = ex.Message;
                //    }
                //}
                //else
                //{
                //    str = "facebook account not found for id" + objScheduledMessage.ProfileId;
                //} 
                #endregion
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                str = ex.Message;
            }
            return str;
        }