当前位置: 首页>>代码示例>>C#>>正文


C# clsDBQueryManager.GetUserIdForuser_follower_details方法代码示例

本文整理汇总了C#中BaseLib.clsDBQueryManager.GetUserIdForuser_follower_details方法的典型用法代码示例。如果您正苦于以下问题:C# clsDBQueryManager.GetUserIdForuser_follower_details方法的具体用法?C# clsDBQueryManager.GetUserIdForuser_follower_details怎么用?C# clsDBQueryManager.GetUserIdForuser_follower_details使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BaseLib.clsDBQueryManager的用法示例。


在下文中一共展示了clsDBQueryManager.GetUserIdForuser_follower_details方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetUserIDFromUsername

        public static string GetUserIDFromUsername(string username, out string Status)
        {
            string GetStatus = string.Empty;
            Globussoft.GlobusHttpHelper httpHelper = new Globussoft.GlobusHttpHelper();

            clsDBQueryManager DB = new clsDBQueryManager();
            DataSet ds = DB.GetUserIdForuser_follower_details(username);
            string user_id = string.Empty;

            if (ds.Tables[0].Rows.Count > 0)
            {
                //foreach (DataRow dataRow in ds.Tables["tb_UsernameDetails"].Rows)
                foreach (DataRow dataRow in ds.Tables["tb_user_follower_details"].Rows)
                {
                    user_id = dataRow.ItemArray[0].ToString();
                    Status = "No Error";
                    return user_id;
                }
            }


            try
            {
                #region gs httpHelper code
                //if (username.Contains("@"))
                //{

                //}
                //string pagesource = httpHelper.getHtmlfromUrl(new Uri("https://api.twitter.com/1/users/show.xml?screen_name=" + username), "api.twitter.com", ""); 
                #endregion
                string id = string.Empty;

                ChilkatHttpHelpr httpHelper1 = new ChilkatHttpHelpr();
                string pagesource = httpHelper1.GetHtml("https://api.twitter.com/1/users/show.xml?screen_name=" + username);

                if (!pagesource.Contains("Rate limit exceeded. Clients may not make more than 150 requests per hour.") && !pagesource.Contains("Sorry, that page does not exist") && !pagesource.Contains("User has been suspended"))
                {
                    int length = pagesource.IndexOf("</id>");
                    id = pagesource.Substring(pagesource.IndexOf("<id>"), length - pagesource.IndexOf("<id>")).Replace("<id>", "");
                    user_id = id;
                    GetStatus = "No Error";
                }
                else if (pagesource.Contains("Rate limit exceeded. Clients may not make more than 150 requests per hour."))
                {
                    GetStatus = "Rate limit exceeded";
                }
                else if (pagesource.Contains("Sorry, that page does not exist"))
                {
                    GetStatus = "Sorry, that page does not exist";
                }
                else if (pagesource.Contains("User has been suspended"))
                {
                    GetStatus = "User has been suspended";
                }
            }
            catch (Exception ex)
            {
                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> GetUserIDFromUsername() -- " + username + " --> " + ex.Message, Globals.Path_TwitterDataScrapper);
                Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine("Error --> GetUserIDFromUsername() -- " + username + " --> " + ex.Message, Globals.Path_TwtErrorLogs);
                GetStatus = "Error";
            }
            Status = GetStatus;
            return user_id;
        }
开发者ID:prog-moh,项目名称:twtboard,代码行数:64,代码来源:TwitterSignup_TwitterDataScrapper.cs


注:本文中的BaseLib.clsDBQueryManager.GetUserIdForuser_follower_details方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。