GetWorker() public static method

public static GetWorker ( ) : DataAccessBaseEx
return DataAccessBaseEx
コード例 #1
0
ファイル: DataHandler.cs プロジェクト: stgaup/404handler
        public static Dictionary <string, int> GetReferers(string url)
        {
            var dataAccess = DataAccessBaseEx.GetWorker();
            var referersDs = dataAccess.GetRequestReferers(url);

            Dictionary <string, int> referers = new Dictionary <string, int>();

            if (referersDs.Tables[0] != null)
            {
                int unknownReferers = 0;
                for (int i = 0; i < referersDs.Tables[0].Rows.Count; i++)
                {
                    var referer = referersDs.Tables[0].Rows[i][0].ToString();
                    int count   = Convert.ToInt32(referersDs.Tables[0].Rows[i][1].ToString());
                    if (referer.Trim() != string.Empty && !referer.Contains("(null)"))
                    {
                        if (!referer.Contains("://"))
                        {
                            referer = referer.Insert(0, "/");
                        }
                        referers.Add(referer, count);
                    }
                    else
                    {
                        unknownReferers += count;
                    }
                }
                if (unknownReferers > 0)
                {
                    referers.Add(UknownReferer, unknownReferers);
                }
            }
            return(referers);
        }
コード例 #2
0
ファイル: DataHandler.cs プロジェクト: ruifrvaz/404handler
        public static int GetTotalSuggestionCount()
        {
            var dataAccess             = DataAccessBaseEx.GetWorker();
            var totalSuggestionCountDs = dataAccess.GetTotalNumberOfSuggestions();

            if (totalSuggestionCountDs?.Tables != null &&
                totalSuggestionCountDs.Tables.Count > 0)
            {
                return(Convert.ToInt32(totalSuggestionCountDs.Tables[0].Rows[0][0]));
            }
            return(0);
        }
コード例 #3
0
ファイル: DataHandler.cs プロジェクト: ruifrvaz/404handler
        public static Dictionary <string, int> GetRedirects()
        {
            var keyCounts = new Dictionary <string, int>();
            var dabe      = DataAccessBaseEx.GetWorker();
            var allkeys   = dabe.GetAllClientRequestCount();

            foreach (DataTable table in allkeys.Tables)
            {
                foreach (DataRow row in table.Rows)
                {
                    var oldUrl = row[0].ToString();
                    keyCounts.Add(oldUrl, Convert.ToInt32(row[1]));
                }
            }

            return(keyCounts);
        }
コード例 #4
0
        public static Dictionary <string, int> GetReferers(string url)
        {
            var dataAccess = DataAccessBaseEx.GetWorker();
            var referers   = new Dictionary <string, int>();

            using (var referersDs = dataAccess.GetRequestReferers(url))
            {
                var table = referersDs.Tables[0];
                if (table == null)
                {
                    return(referers);
                }

                var unknownReferers = 0;
                foreach (DataRow row in table.Rows)
                {
                    var referer = row[0].ToString();
                    var count   = Convert.ToInt32(row[1].ToString());
                    if (referer.Trim() != string.Empty &&
                        !referer.Contains("(null)"))
                    {
                        if (!referer.Contains("://"))
                        {
                            referer = referer.Insert(0, "/");
                        }
                        referers.Add(referer, count);
                    }
                    else
                    {
                        unknownReferers += count;
                    }
                }
                if (unknownReferers > 0)
                {
                    referers.Add(UknownReferer, unknownReferers);
                }
            }

            return(referers);
        }
コード例 #5
0
        public static int GetTotalSuggestionCount()
        {
            var dataAccess = DataAccessBaseEx.GetWorker();

            return(dataAccess.GetTotalNumberOfSuggestions());
        }