Esempio n. 1
0
        /// <summary>
        /// Gets a page of data from the cy_PayPalLog table.
        /// </summary>
        /// <param name="pageNumber">The page number.</param>
        /// <param name="pageSize">Size of the page.</param>
        /// <param name="totalPages">total pages</param>
        public static IDataReader GetPage(
            int pageNumber,
            int pageSize,
            out int totalPages)
        {
            int pageLowerBound = (pageSize * pageNumber) - pageSize;

            totalPages = 1;
            int totalRows = GetCount();

            if (pageSize > 0)
            {
                totalPages = totalRows / pageSize;
            }

            if (totalRows <= pageSize)
            {
                totalPages = 1;
            }
            else
            {
                int remainder;
                Math.DivRem(totalRows, pageSize, out remainder);
                if (remainder > 0)
                {
                    totalPages += 1;
                }
            }

            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("SELECT	* ");
            sqlCommand.Append("FROM	cy_PayPalLog  ");
            //sqlCommand.Append("WHERE  ");
            //sqlCommand.Append("ORDER BY  ");
            //sqlCommand.Append("  ");
            sqlCommand.Append("LIMIT :PageSize, :OffsetRows ");
            sqlCommand.Append(";");

            SqliteParameter[] arParams = new SqliteParameter[2];

            arParams[0]           = new SqliteParameter(":PageSize", DbType.Int32);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = pageSize;

            arParams[1]           = new SqliteParameter(":OffsetRows", DbType.Int32);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = pageLowerBound;

            return(SqliteHelper.ExecuteReader(
                       GetConnectionString(),
                       sqlCommand.ToString(),
                       arParams));
        }
Esempio n. 2
0
        public static IDataReader Search(Guid letterInfoGuid, string emailOrIpAddress)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("SELECT ");
            sqlCommand.Append("ls.Guid AS Guid, ");
            sqlCommand.Append("ls.SiteGuid AS SiteGuid, ");
            sqlCommand.Append("ls.LetterInfoGuid AS LetterInfoGuid, ");
            sqlCommand.Append("ls.UserGuid AS UserGuid, ");
            sqlCommand.Append("ls.IsVerified AS IsVerified, ");
            sqlCommand.Append("ls.VerifyGuid AS VerifyGuid, ");
            sqlCommand.Append("ls.BeginUtc AS BeginUtc, ");
            sqlCommand.Append("ls.UseHtml AS UseHtml, ");
            sqlCommand.Append("ls.IpAddress AS IpAddress, ");
            sqlCommand.Append("COALESCE(u.Email, ls.Email) As Email, ");
            sqlCommand.Append("u.Email AS UserEmail, ");
            sqlCommand.Append("COALESCE(u.Name, ls.Email) AS Name ");

            sqlCommand.Append("FROM	cy_LetterSubscribe ls ");

            sqlCommand.Append("LEFT OUTER JOIN cy_Users u ");
            sqlCommand.Append("ON ");
            sqlCommand.Append("u.UserGuid = ls.UserGuid ");

            sqlCommand.Append("WHERE ");
            sqlCommand.Append("ls.LetterInfoGuid = :LetterInfoGuid ");
            sqlCommand.Append(" AND ");
            sqlCommand.Append("(");

            sqlCommand.Append(" (ls.Email LIKE :EmailOrIpAddress) ");
            sqlCommand.Append(" OR ");
            sqlCommand.Append(" (u.Email LIKE :EmailOrIpAddress) ");
            sqlCommand.Append(" OR ");
            sqlCommand.Append(" (ls.IpAddress LIKE :EmailOrIpAddress) ");

            sqlCommand.Append(")");
            sqlCommand.Append(";");

            SqliteParameter[] arParams = new SqliteParameter[2];

            arParams[0]           = new SqliteParameter(":LetterInfoGuid", DbType.String, 36);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = letterInfoGuid.ToString();

            arParams[1]           = new SqliteParameter(":EmailOrIpAddress", DbType.String, 36);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = emailOrIpAddress;

            return(SqliteHelper.ExecuteReader(
                       GetConnectionString(),
                       sqlCommand.ToString(),
                       arParams));
        }
Esempio n. 3
0
        /// <summary>
        /// Gets a page of data from the cy_LetterHtmlTemplate table.
        /// </summary>
        /// <param name="pageNumber">The page number.</param>
        /// <param name="pageSize">Size of the page.</param>
        /// <param name="totalPages">total pages</param>
        public static IDataReader GetPage(
            Guid siteGuid,
            int pageNumber,
            int pageSize,
            out int totalPages)
        {
            int pageLowerBound = (pageSize * pageNumber) - pageSize;

            totalPages = 1;
            int totalRows = GetCount(siteGuid);

            if (pageSize > 0)
            {
                totalPages = totalRows / pageSize;
            }

            if (totalRows <= pageSize)
            {
                totalPages = 1;
            }
            else
            {
                int remainder;
                Math.DivRem(totalRows, pageSize, out remainder);
                if (remainder > 0)
                {
                    totalPages += 1;
                }
            }

            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("SELECT	* ");
            sqlCommand.Append("FROM	cy_LetterHtmlTemplate  ");
            sqlCommand.Append("WHERE ");
            sqlCommand.Append("SiteGuid = :SiteGuid ");
            sqlCommand.Append("LIMIT " + pageLowerBound.ToString() + ", :PageSize  ; ");

            SqliteParameter[] arParams = new SqliteParameter[2];

            arParams[0]           = new SqliteParameter(":SiteGuid", DbType.String, 36);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = siteGuid.ToString();

            arParams[1]           = new SqliteParameter(":PageSize", DbType.Int32);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = pageSize;

            return(SqliteHelper.ExecuteReader(
                       GetConnectionString(),
                       sqlCommand.ToString(),
                       arParams));
        }
Esempio n. 4
0
        /// <summary>
        /// Gets an IDataReader with all rows in the cy_BannedIPAddresses table.
        /// </summary>
        public static IDataReader GetAll()
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("SELECT  * ");
            sqlCommand.Append("FROM	cy_BannedIPAddresses ;");

            return(SqliteHelper.ExecuteReader(
                       GetConnectionString(),
                       sqlCommand.ToString(),
                       null));
        }
        /// <summary>
        /// Gets an IDataReader with all rows in the cy_GoogleCheckoutLog table.
        /// </summary>
        public static IDataReader GetAll()
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("SELECT  * ");
            sqlCommand.Append("FROM	cy_GoogleCheckoutLog ");
            sqlCommand.Append(";");

            return(SqliteHelper.ExecuteReader(
                       GetConnectionString(),
                       sqlCommand.ToString(),
                       null));
        }
Esempio n. 6
0
        /// <summary>
        /// Gets a page of data from the cy_TaskQueue table.
        /// </summary>
        /// <param name="pageNumber">The page number.</param>
        /// <param name="pageSize">Size of the page.</param>
        /// <param name="totalPages">total pages</param>
        public static IDataReader GetPageUnfinished(
            int pageNumber,
            int pageSize,
            out int totalPages)
        {
            int pageLowerBound = (pageSize * pageNumber) - pageSize;

            totalPages = 1;
            int totalRows = GetCountUnfinished();

            if (pageSize > 0)
            {
                totalPages = totalRows / pageSize;
            }

            if (totalRows <= pageSize)
            {
                totalPages = 1;
            }
            else
            {
                int remainder;
                Math.DivRem(totalRows, pageSize, out remainder);
                if (remainder > 0)
                {
                    totalPages += 1;
                }
            }

            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("SELECT	* ");
            sqlCommand.Append("FROM	cy_TaskQueue  ");
            sqlCommand.Append("WHERE ");
            sqlCommand.Append("CompleteUTC IS NULL ");
            sqlCommand.Append("ORDER BY  ");
            sqlCommand.Append("QueuedUTC DESC  ");
            sqlCommand.Append("LIMIT " + pageLowerBound.ToString() + ", :PageSize ");
            sqlCommand.Append(";");

            SqliteParameter[] arParams = new SqliteParameter[1];

            arParams[0]           = new SqliteParameter(":PageSize", DbType.Int32);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = pageSize;

            return(SqliteHelper.ExecuteReader(
                       GetConnectionString(),
                       sqlCommand.ToString(),
                       arParams));
        }
Esempio n. 7
0
        /// <summary>
        /// Gets an IDataReader with all rows in the cy_Language table.
        /// </summary>
        public static IDataReader GetAll()
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("SELECT  * ");
            sqlCommand.Append("FROM	cy_Language ");
            sqlCommand.Append("ORDER BY [Sort]  ");
            sqlCommand.Append(";");

            return(SqliteHelper.ExecuteReader(
                       GetConnectionString(),
                       sqlCommand.ToString(),
                       null));
        }
        public static IDataReader GetSharedFiles(int moduleId, int folderId)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("SELECT   ");
            sqlCommand.Append("sf.ItemID, ");
            sqlCommand.Append("sf.ModuleID, ");
            sqlCommand.Append("sf.UploadUserID, ");
            sqlCommand.Append("sf.FriendlyName, ");
            sqlCommand.Append("sf.OriginalFileName, ");
            sqlCommand.Append("sf.ServerFileName, ");
            sqlCommand.Append("sf.SizeInKB, ");
            sqlCommand.Append("sf.UploadDate, ");
            sqlCommand.Append("sf.FolderID, ");
            sqlCommand.Append("sf.ItemGuid, ");
            sqlCommand.Append("sf.FolderGuid, ");
            sqlCommand.Append("sf.UserGuid, ");
            sqlCommand.Append("sf.ModuleGuid, ");
            sqlCommand.Append("sf.Description, ");
            sqlCommand.Append("sf.DownloadCount, ");
            sqlCommand.Append("u.Name As UserName ");

            sqlCommand.Append("FROM	cy_SharedFiles sf ");

            sqlCommand.Append("LEFT OUTER JOIN	cy_Users u ");
            sqlCommand.Append("ON sf.UploadUserID = u.UserID ");

            sqlCommand.Append("WHERE ");
            sqlCommand.Append("sf.ModuleID = :ModuleID ");
            sqlCommand.Append("AND sf.FolderID = :FolderID ");

            sqlCommand.Append("ORDER BY ");
            sqlCommand.Append("sf.FriendlyName ");
            sqlCommand.Append(";");

            SqliteParameter[] arParams = new SqliteParameter[2];

            arParams[0]           = new SqliteParameter(":ModuleID", DbType.Int32);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = moduleId;

            arParams[1]           = new SqliteParameter(":FolderID", DbType.Int32);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = folderId;

            return(SqliteHelper.ExecuteReader(
                       GetConnectionString(),
                       sqlCommand.ToString(),
                       arParams));
        }
Esempio n. 9
0
        public static IDataReader DatabaseHelperGetReader(
            string connectionString,
            string query
            )
        {
            if (string.IsNullOrEmpty(connectionString))
            {
                connectionString = GetConnectionString();
            }

            return(SqliteHelper.ExecuteReader(
                       connectionString,
                       query));
        }
Esempio n. 10
0
        public static Guid GetSiteGuid(string folderName)
        {
            StringBuilder sqlCommand = new StringBuilder();

            SqliteParameter[] arParams = new SqliteParameter[1];

            arParams[0]           = new SqliteParameter(":FolderName", DbType.String, 255);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = folderName;

            Guid siteGuid = Guid.Empty;

            sqlCommand.Append("SELECT SiteGuid ");
            sqlCommand.Append("FROM cy_SiteFolders ");
            sqlCommand.Append("WHERE FolderName = :FolderName ;");

            using (IDataReader reader = SqliteHelper.ExecuteReader(
                       GetConnectionString(),
                       sqlCommand.ToString(),
                       arParams))
            {
                if (reader.Read())
                {
                    siteGuid = new Guid(reader["SiteGuid"].ToString());
                }
            }

            if (siteGuid == Guid.Empty)
            {
                sqlCommand = new StringBuilder();
                sqlCommand.Append("SELECT SiteGuid ");
                sqlCommand.Append("FROM	cy_Sites ");
                sqlCommand.Append("ORDER BY	SiteID ");
                sqlCommand.Append("LIMIT 1 ;");


                using (IDataReader reader = SqliteHelper.ExecuteReader(
                           GetConnectionString(),
                           sqlCommand.ToString(),
                           null))
                {
                    if (reader.Read())
                    {
                        siteGuid = new Guid(reader["SiteGuid"].ToString());
                    }
                }
            }

            return(siteGuid);
        }
Esempio n. 11
0
        public static IDataReader GetByUrl(string hostName, string friendlyUrl)
        {
            int siteId = 1;

            StringBuilder sqlCommand = new StringBuilder();

            SqliteParameter[] arParams = new SqliteParameter[1];

            arParams[0]           = new SqliteParameter(":HostName", DbType.String, 255);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = hostName;

            sqlCommand.Append("SELECT cy_SiteHosts.SiteID As SiteID ");
            sqlCommand.Append("FROM cy_SiteHosts ");
            sqlCommand.Append("WHERE cy_SiteHosts.HostName = :HostName ;");

            using (IDataReader reader = SqliteHelper.ExecuteReader(
                       GetConnectionString(),
                       sqlCommand.ToString(),
                       arParams))
            {
                if (reader.Read())
                {
                    siteId = Convert.ToInt32(reader["SiteID"]);
                }
            }

            sqlCommand = new StringBuilder();
            sqlCommand.Append("SELECT  * ");
            sqlCommand.Append("FROM	cy_FriendlyUrls ");
            sqlCommand.Append("WHERE ");
            sqlCommand.Append("SiteID = :SiteID ");
            sqlCommand.Append("AND FriendlyUrl = :FriendlyUrl ;");

            arParams = new SqliteParameter[2];

            arParams[0]           = new SqliteParameter(":SiteID", DbType.Int32);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = siteId;

            arParams[1]           = new SqliteParameter(":FriendlyUrl", DbType.String, 255);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = friendlyUrl;

            return(SqliteHelper.ExecuteReader(
                       GetConnectionString(),
                       sqlCommand.ToString(),
                       arParams));
        }
Esempio n. 12
0
        /// <summary>
        /// Gets an IDataReader with all rows in the cy_TaskQueue table.
        /// </summary>
        public static IDataReader GetUnfinished()
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("SELECT  * ");
            sqlCommand.Append("FROM	cy_TaskQueue ");
            sqlCommand.Append("WHERE ");
            sqlCommand.Append("CompleteUTC IS NULL ");
            sqlCommand.Append(";");

            return(SqliteHelper.ExecuteReader(
                       GetConnectionString(),
                       sqlCommand.ToString(),
                       null));
        }
Esempio n. 13
0
        public static IDataReader DatabaseHelperGetReader(
            String connectionString,
            String tableName,
            String whereClause)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("SELECT * ");
            sqlCommand.Append("FROM " + tableName + " ");
            sqlCommand.Append(whereClause);
            sqlCommand.Append(" ; ");

            return(SqliteHelper.ExecuteReader(
                       connectionString,
                       sqlCommand.ToString()));
        }
        /// <summary>
        /// Gets an IDataReader with all rows in the cy_IndexingQueue table.
        /// </summary>
        public static DataTable GetIndexPaths()
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("SELECT DISTINCT IndexPath ");
            sqlCommand.Append("FROM	cy_IndexingQueue ");
            sqlCommand.Append("ORDER BY IndexPath ");
            sqlCommand.Append(";");

            IDataReader reader = SqliteHelper.ExecuteReader(
                GetConnectionString(),
                sqlCommand.ToString(),
                null);

            return(DBPortal.GetTableFromDataReader(reader));
        }
Esempio n. 15
0
        public static IDataReader GetHtmlContentByPage(int siteId, int pageId)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("SELECT  ce.*, ");

            sqlCommand.Append("m.ModuleTitle As ModuleTitle, ");
            sqlCommand.Append("m.ViewRoles As ViewRoles, ");
            sqlCommand.Append("md.FeatureName As FeatureName ");

            sqlCommand.Append("FROM	cy_HtmlContent ce ");

            sqlCommand.Append("JOIN	cy_Modules m ");
            sqlCommand.Append("ON ce.ModuleID = m.ModuleID ");

            sqlCommand.Append("JOIN	cy_ModuleDefinitions md ");
            sqlCommand.Append("ON m.ModuleDefID = md.ModuleDefID ");

            sqlCommand.Append("JOIN	cy_PageModules pm ");
            sqlCommand.Append("ON m.ModuleID = pm.ModuleID ");

            sqlCommand.Append("JOIN	cy_Pages p ");
            sqlCommand.Append("ON p.PageID = pm.PageID ");

            sqlCommand.Append("WHERE ");
            sqlCommand.Append("p.SiteID = :SiteID ");
            sqlCommand.Append("AND pm.PageID = :PageID ");

            //sqlCommand.Append("AND pm.PublishBeginDate < datetime('now','localtime') ");
            //sqlCommand.Append("AND (pm.PublishEndDate IS NULL OR pm.PublishEndDate > datetime('now','localtime'))  ;");
            sqlCommand.Append(" ; ");

            SqliteParameter[] arParams = new SqliteParameter[2];

            arParams[0]           = new SqliteParameter(":SiteID", DbType.Int32);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = siteId;

            arParams[1]           = new SqliteParameter(":PageID", DbType.Int32);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = pageId;

            return(SqliteHelper.ExecuteReader(
                       GetConnectionString(),
                       sqlCommand.ToString(),
                       arParams));
        }
Esempio n. 16
0
        public static IDataReader SchemaVersionGetNonCore()
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("SELECT  * ");
            sqlCommand.Append("FROM	cy_SchemaVersion ");
            sqlCommand.Append("WHERE ");
            sqlCommand.Append("ApplicationID <> '077E4857-F583-488E-836E-34A4B04BE855' ");
            sqlCommand.Append("ORDER BY ApplicationName ");
            sqlCommand.Append(";");


            return(SqliteHelper.ExecuteReader(
                       GetConnectionString(),
                       sqlCommand.ToString(),
                       null));
        }
Esempio n. 17
0
        /// <summary>
        /// Gets an IDataReader with all tasks in the cy_TaskQueue table that have completed but not yet sent notification.
        /// </summary>
        public static IDataReader GetTasksForNotification()
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("SELECT  * ");
            sqlCommand.Append("FROM	cy_TaskQueue ");
            sqlCommand.Append("WHERE ");
            sqlCommand.Append("NotifyOnCompletion = 1 ");
            sqlCommand.Append("AND CompleteUTC IS NOT NULL ");
            sqlCommand.Append("AND NotificationSentUTC IS NULL ");
            sqlCommand.Append(";");

            return(SqliteHelper.ExecuteReader(
                       GetConnectionString(),
                       sqlCommand.ToString(),
                       null));
        }
        /// <summary>
        /// Gets an DataTable with rows from the cy_IndexingQueue table with the passed path.
        /// </summary>
        public static DataTable GetByPath(string indexPath)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("SELECT  * ");
            sqlCommand.Append("FROM	cy_IndexingQueue ");
            sqlCommand.Append("WHERE ");
            sqlCommand.Append("IndexPath = :IndexPath ");
            sqlCommand.Append("ORDER BY RowId ");
            sqlCommand.Append(";");

            SqliteParameter[] arParams = new SqliteParameter[1];

            arParams[0]           = new SqliteParameter(":IndexPath", DbType.String, 255);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = indexPath;

            DataTable dt = new DataTable();

            dt.Columns.Add("RowId", typeof(int));
            dt.Columns.Add("IndexPath", typeof(String));
            dt.Columns.Add("SerializedItem", typeof(String));
            dt.Columns.Add("ItemKey", typeof(String));
            dt.Columns.Add("RemoveOnly", typeof(bool));

            using (IDataReader reader = SqliteHelper.ExecuteReader(
                       GetConnectionString(),
                       sqlCommand.ToString(),
                       arParams))
            {
                while (reader.Read())
                {
                    DataRow row = dt.NewRow();
                    row["RowId"]          = reader["RowId"];
                    row["IndexPath"]      = reader["IndexPath"];
                    row["SerializedItem"] = reader["SerializedItem"];
                    row["ItemKey"]        = reader["ItemKey"];
                    row["RemoveOnly"]     = Convert.ToBoolean(reader["RemoveOnly"]);

                    dt.Rows.Add(row);
                }
            }

            return(dt);
        }
Esempio n. 19
0
        public static IDataReader GetById(int roleId)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("SELECT * ");
            sqlCommand.Append("FROM	cy_Roles ");
            sqlCommand.Append("WHERE RoleID = :RoleID ; ");

            SqliteParameter[] arParams = new SqliteParameter[1];

            arParams[0]           = new SqliteParameter(":RoleID", DbType.Int32);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = roleId;

            return(SqliteHelper.ExecuteReader(
                       GetConnectionString(),
                       sqlCommand.ToString(),
                       arParams));
        }
Esempio n. 20
0
        public static IDataReader GetHtmlContent(int moduleId, int itemId)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("SELECT * ");
            sqlCommand.Append("FROM	cy_HtmlContent ");
            sqlCommand.Append("WHERE ItemID = :ItemID  ;");

            SqliteParameter[] arParams = new SqliteParameter[1];

            arParams[0]           = new SqliteParameter(":ItemID", DbType.Int32);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = itemId;

            return(SqliteHelper.ExecuteReader(
                       GetConnectionString(),
                       sqlCommand.ToString(),
                       arParams));
        }
        public static DataTable GetModuleDefinitionsBySite(int siteId)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("SELECT md.* ");
            sqlCommand.Append("FROM	cy_ModuleDefinitions md ");

            sqlCommand.Append("JOIN	cy_SiteModuleDefinitions smd  ");
            sqlCommand.Append("ON md.ModuleDefID = smd.ModuleDefID  ");

            sqlCommand.Append("WHERE smd.SiteID = :SiteID ");
            sqlCommand.Append("ORDER BY md.SortOrder, md.FeatureName ;");

            SqliteParameter[] arParams = new SqliteParameter[1];

            arParams[0]           = new SqliteParameter(":SiteID", DbType.Int32);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = siteId;

            DataTable dt = new DataTable();

            dt.Columns.Add("ModuleDefID", typeof(int));
            dt.Columns.Add("FeatureName", typeof(String));
            dt.Columns.Add("ControlSrc", typeof(String));

            using (IDataReader reader = SqliteHelper.ExecuteReader(
                       GetConnectionString(),
                       sqlCommand.ToString(),
                       arParams))
            {
                while (reader.Read())
                {
                    DataRow row = dt.NewRow();
                    row["ModuleDefID"] = reader["ModuleDefID"];
                    row["FeatureName"] = reader["FeatureName"];
                    row["ControlSrc"]  = reader["ControlSrc"];
                    dt.Rows.Add(row);
                }
            }

            return(dt);
        }
Esempio n. 22
0
        public static IDataReader GetHistoryFile(int id)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("SELECT  * ");
            sqlCommand.Append("FROM	cy_SharedFilesHistory ");
            sqlCommand.Append("WHERE ");
            sqlCommand.Append("ID = :ID ;");

            SqliteParameter[] arParams = new SqliteParameter[1];

            arParams[0]           = new SqliteParameter(":ID", DbType.Int32);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = id;

            return(SqliteHelper.ExecuteReader(
                       GetConnectionString(),
                       sqlCommand.ToString(),
                       arParams));
        }
Esempio n. 23
0
        /// <summary>
        /// Gets an IDataReader with rows from the cy_BannedIPAddresses table.
        /// </summary>
        /// <param name="ipAddress"> ipAddress </param>
        public static IDataReader GeByIpAddress(string ipAddress)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("SELECT  * ");
            sqlCommand.Append("FROM	cy_BannedIPAddresses ");
            sqlCommand.Append("WHERE ");
            sqlCommand.Append("BannedIP = :BannedIP ;");

            SqliteParameter[] arParams = new SqliteParameter[1];

            arParams[0]           = new SqliteParameter(":BannedIP", DbType.String, 50);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = ipAddress;

            return(SqliteHelper.ExecuteReader(
                       GetConnectionString(),
                       sqlCommand.ToString(),
                       arParams));
        }
Esempio n. 24
0
        /// <summary>
        /// Gets an IDataReader with all rows in the cy_LetterSendLog table.
        /// </summary>
        public static IDataReader GetByLetter(Guid letterGuid)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("SELECT  * ");
            sqlCommand.Append("FROM	cy_LetterSendLog ");
            sqlCommand.Append("WHERE ");
            sqlCommand.Append("LetterGuid = :LetterGuid ;");

            SqliteParameter[] arParams = new SqliteParameter[1];

            arParams[0]           = new SqliteParameter(":LetterGuid", DbType.String, 36);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = letterGuid.ToString();

            return(SqliteHelper.ExecuteReader(
                       GetConnectionString(),
                       sqlCommand.ToString(),
                       arParams));
        }
Esempio n. 25
0
        public static IDataReader GetUserPage(Guid userPageId)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("SELECT  * ");
            sqlCommand.Append("FROM	cy_UserPages ");
            sqlCommand.Append("WHERE ");
            sqlCommand.Append("UserPageID = :UserPageID ;");

            SqliteParameter[] arParams = new SqliteParameter[1];

            arParams[0]           = new SqliteParameter(":UserPageID", DbType.String, 36);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = userPageId.ToString();

            return(SqliteHelper.ExecuteReader(
                       GetConnectionString(),
                       sqlCommand.ToString(),
                       arParams));
        }
        /// <summary>
        /// Gets an IDataReader with one row from the cy_ContentRating table.
        /// </summary>
        /// <param name="rowGuid"> rowGuid </param>
        public static IDataReader GetOne(Guid rowGuid)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("SELECT  * ");
            sqlCommand.Append("FROM	cy_ContentRating ");
            sqlCommand.Append("WHERE ");
            sqlCommand.Append("RowGuid = :RowGuid ");
            sqlCommand.Append(";");

            SqliteParameter[] arParams = new SqliteParameter[1];

            arParams[0]           = new SqliteParameter(":RowGuid", DbType.String, 36);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = rowGuid.ToString();

            return(SqliteHelper.ExecuteReader(
                       GetConnectionString(),
                       sqlCommand.ToString(),
                       arParams));
        }
Esempio n. 27
0
        /// <summary>
        /// Gets an IDataReader with one row from the cy_SavedQuery table.
        /// </summary>
        /// <param name="name"> name </param>
        public static IDataReader GetOne(string name)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("SELECT  * ");
            sqlCommand.Append("FROM	cy_SavedQuery ");
            sqlCommand.Append("WHERE ");
            sqlCommand.Append("Name = :Name ");
            sqlCommand.Append(";");

            SqliteParameter[] arParams = new SqliteParameter[1];

            arParams[0]           = new SqliteParameter(":Name", DbType.String, 36);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = name;

            return(SqliteHelper.ExecuteReader(
                       GetConnectionString(),
                       sqlCommand.ToString(),
                       arParams));
        }
Esempio n. 28
0
        public static IDataReader GetLinks(int moduleId)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("SELECT * ");
            sqlCommand.Append("FROM	cy_Links ");

            sqlCommand.Append("WHERE ModuleID = :ModuleID ");
            sqlCommand.Append("ORDER BY ViewOrder, Title ;");

            SqliteParameter[] arParams = new SqliteParameter[1];

            arParams[0]           = new SqliteParameter(":ModuleID", DbType.Int32);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = moduleId;

            return(SqliteHelper.ExecuteReader(
                       GetConnectionString(),
                       sqlCommand.ToString(),
                       arParams));
        }
        /// <summary>
        /// Gets an IDataReader with rows from the cy_EmailSendQueue table where DateToSend >= CurrentTime.
        /// </summary>
        /// <param name="currentTime"> currentTime </param>
        public static IDataReader GetEmailToSend(DateTime currentTime)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("SELECT  * ");
            sqlCommand.Append("FROM	cy_EmailSendQueue ");
            sqlCommand.Append("WHERE ");
            sqlCommand.Append("DateToSend >= :CurrentTime ");
            sqlCommand.Append(";");

            SqliteParameter[] arParams = new SqliteParameter[1];

            arParams[0]           = new SqliteParameter(":CurrentTime", DbType.DateTime);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = currentTime;

            return(SqliteHelper.ExecuteReader(
                       GetConnectionString(),
                       sqlCommand.ToString(),
                       arParams));
        }
Esempio n. 30
0
        /// <summary>
        /// Gets an IDataReader with one row from the cy_GeoCountry table.
        /// </summary>
        /// <param name="countryISOCode2"> countryISOCode2 </param>
        public static IDataReader GetByISOCode2(string countryISOCode2)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("SELECT  * ");
            sqlCommand.Append("FROM	cy_GeoCountry ");
            sqlCommand.Append("WHERE ");
            sqlCommand.Append("ISOCode2 = :ISOCode2 ");
            sqlCommand.Append(";");

            SqliteParameter[] arParams = new SqliteParameter[1];

            arParams[0]           = new SqliteParameter(":ISOCode2", DbType.String, 2);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = countryISOCode2;

            return(SqliteHelper.ExecuteReader(
                       GetConnectionString(),
                       sqlCommand.ToString(),
                       arParams));
        }