Ejemplo n.º 1
0
        public override void CreateTopicStatus(IEnumerable<int> threadIDs, TopicStatuType type, DateTime endDate)
        {
            using (SqlQuery query = new SqlQuery())
            {
                StringBuilder sql = new StringBuilder();

                int i = 0;
                foreach (int threadID in threadIDs)
                {
                    sql.AppendFormat(@"
IF EXISTS(SELECT * FROM [bx_TopicStatus] WHERE ThreadID = @ThreadID_{0} AND Type = @Type)
    UPDATE [bx_TopicStatus] SET [EndDate] = @EndDate WHERE ThreadID = @ThreadID_{0} AND Type = @Type;
ELSE
    INSERT INTO [bx_TopicStatus](ThreadID,Type,EndDate) VALUES(@ThreadID_{0},@Type,@EndDate);
", i);
                    query.CreateParameter<int>("@ThreadID_" + i, threadID, SqlDbType.Int);
                    i++;
                }

                query.CreateParameter<int>("Type", (int)type, SqlDbType.TinyInt);
                query.CreateParameter<DateTime>("EndDate", endDate, SqlDbType.DateTime);

                query.CommandText = sql.ToString();
                query.CommandType = CommandType.Text;

                query.ExecuteNonQuery();
            }
        }
Ejemplo n.º 2
0
 public abstract void CreateTopicStatus(IEnumerable <int> threadIDs, TopicStatuType type, DateTime endDate);
Ejemplo n.º 3
0
        public override void DeleteTopicStatus(IEnumerable<int> threadIDs, TopicStatuType type)
        {
            using (SqlQuery query = new SqlQuery())
            {
                query.CommandText = "DELETE [bx_TopicStatus] WHERE ThreadID IN(@ThreadIDs) AND Type=@Type;";
                query.CommandType = CommandType.Text;
                query.CommandTimeout = int.MaxValue;

                query.CreateInParameter<int>("@ThreadIDs", threadIDs);
                query.CreateParameter<int>("@Type", (int)type, SqlDbType.TinyInt);

                query.ExecuteNonQuery();
            }
        }
Ejemplo n.º 4
0
 public abstract void DeleteTopicStatus(IEnumerable <int> threadIDs, TopicStatuType type);