示例#1
0
        public static DataSet GetEvents(
            int moduleId,
            DateTime beginDate,
            DateTime endDate)
        {
            StringBuilder sqlCommand = new StringBuilder();

            FbParameter[] arParams = new FbParameter[3];
            arParams[0] = new FbParameter("@ModuleID", FbDbType.Integer);
            arParams[1] = new FbParameter("@BeginDate", FbDbType.TimeStamp);
            arParams[2] = new FbParameter("@EndDate", FbDbType.TimeStamp);

            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = moduleId;


            sqlCommand.Append("SELECT  ");
            sqlCommand.Append("ItemID, ");
            sqlCommand.Append("ModuleID, ");
            sqlCommand.Append("Title, ");
            sqlCommand.Append("Description, ");
            sqlCommand.Append("ImageName, ");
            sqlCommand.Append("EventDate, ");
            sqlCommand.Append("CAST(StartTime AS TIMESTAMP) As StartTime, ");
            sqlCommand.Append("CAST(EndTime AS TIMESTAMP) As EndTime, ");
            sqlCommand.Append("CreatedDate, ");
            sqlCommand.Append("UserID, ");
            sqlCommand.Append("ItemGuid, ");
            sqlCommand.Append("ModuleGuid, ");
            sqlCommand.Append("UserGuid, ");
            sqlCommand.Append("LastModUserGuid, ");
            sqlCommand.Append("Location, ");
            sqlCommand.Append("LastModUtc, ");
            sqlCommand.Append("RequiresTicket, ");
            sqlCommand.Append("TicketPrice ");


            sqlCommand.Append("FROM	mp_CalendarEvents ");
            sqlCommand.Append("WHERE ");
            sqlCommand.Append("ModuleID = @ModuleID ");

            sqlCommand.Append("AND EventDate >= @BeginDate ");
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = beginDate;


            sqlCommand.Append("AND EventDate <= @EndDate ");
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value     = endDate;


            sqlCommand.Append(" ;");

            return(FBSqlHelper.ExecuteDataset(
                       GetConnectionString(),
                       sqlCommand.ToString(),
                       arParams));
        }
示例#2
0
        public static void DatabaseHelperDoVersion2320PostUpgradeTasks(
            String overrideConnectionInfo)
        {
            string connectionString;

            if (
                (overrideConnectionInfo != null) &&
                (overrideConnectionInfo.Length > 0)
                )
            {
                connectionString = overrideConnectionInfo;
            }
            else
            {
                connectionString = GetConnectionString();
            }


            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("SELECT  ");
            sqlCommand.Append("u.SiteGuid, ");
            sqlCommand.Append("ls.LetterInfoGuid, ");
            sqlCommand.Append("ls.UserGuid, ");
            sqlCommand.Append("u.Email, ");
            sqlCommand.Append("ls.BeginUTC, ");
            sqlCommand.Append("ls.UseHtml ");


            sqlCommand.Append("FROM ");
            sqlCommand.Append("mp_LetterSubscriber ls ");
            sqlCommand.Append("JOIN ");
            sqlCommand.Append("mp_Users u ");
            sqlCommand.Append("ON ");
            sqlCommand.Append("u.UserGuid = ls.UserGuid ");
            sqlCommand.Append(" ; ");

            DataSet ds = FBSqlHelper.ExecuteDataset(
                connectionString,
                sqlCommand.ToString());

            DataTable dataTable = ds.Tables[0];

            foreach (DataRow row in dataTable.Rows)
            {
                DBLetterSubscription.Create(
                    Guid.NewGuid(),
                    new Guid(row["SiteGuid"].ToString()),
                    new Guid(row["LetterInfoGuid"].ToString()),
                    new Guid(row["UserGuid"].ToString()),
                    row["Email"].ToString().ToLower(),
                    true,
                    new Guid("00000000-0000-0000-0000-000000000000"),
                    Convert.ToDateTime(row["BeginUTC"]),
                    Convert.ToBoolean(row["UseHtml"])
                    );
            }
        }
示例#3
0
        public static DataTable DatabaseHelperGetTable(
            String connectionString,
            String tableName,
            String whereClause)
        {
            StringBuilder sqlCommand = new StringBuilder();

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

            DataSet ds = FBSqlHelper.ExecuteDataset(
                connectionString,
                sqlCommand.ToString());

            return(ds.Tables[0]);
        }
示例#4
0
        public static void DatabaseHelperDoForumVersion2203PostUpgradeTasks(
            String overrideConnectionInfo)
        {
            string connectionString;

            if (
                (overrideConnectionInfo != null) &&
                (overrideConnectionInfo.Length > 0)
                )
            {
                connectionString = overrideConnectionInfo;
            }
            else
            {
                connectionString = ConnectionString.GetWriteConnectionString();
            }

            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("SELECT SubscriptionID ");
            sqlCommand.Append("FROM mp_ForumSubscriptions ");
            sqlCommand.Append(" where (SubGuid is null OR SubGuid = '00000000-0000-0000-0000-000000000000') ");
            sqlCommand.Append(" ; ");

            DataSet ds = FBSqlHelper.ExecuteDataset(
                connectionString,
                sqlCommand.ToString());

            DataTable dataTable = ds.Tables[0];


            foreach (DataRow row in dataTable.Rows)
            {
                DatabaseHelperUpdateTableField(
                    "mp_ForumSubscriptions",
                    "SubscriptionID",
                    row["SubscriptionID"].ToString(),
                    "SubGuid",
                    Guid.NewGuid().ToString(),
                    "  ");
            }



            sqlCommand = new StringBuilder();
            sqlCommand.Append("SELECT ThreadSubscriptionID ");
            sqlCommand.Append("FROM mp_ForumThreadSubscriptions ");
            sqlCommand.Append(" where (SubGuid is null OR SubGuid = '00000000-0000-0000-0000-000000000000') ");
            sqlCommand.Append(" ; ");

            ds = FBSqlHelper.ExecuteDataset(
                connectionString,
                sqlCommand.ToString());

            dataTable = ds.Tables[0];


            foreach (DataRow row in dataTable.Rows)
            {
                DatabaseHelperUpdateTableField(
                    "mp_ForumThreadSubscriptions",
                    "ThreadSubscriptionID",
                    row["ThreadSubscriptionID"].ToString(),
                    "SubGuid",
                    Guid.NewGuid().ToString(),
                    "  ");
            }
        }