Exemplo n.º 1
0
        public static DataTable GetArticleItems(int ArticleID, ArticleItemStatus status)
        {
            ForumArticleItems FAItems = new ForumArticleItems();

            if (status != ArticleItemStatus.All)
            {
                FAItems.Status = (int)status;
            }

            FAItems.ArticleID = ArticleID;

            return(FAItems.LoadItemsByParams().Tables[0]);
        }
Exemplo n.º 2
0
        public static void UpdateArticleItem(int ArticleItemID, int ArticleID, string Subject, string Reply, ArticleItemStatus status)
        {
            SqlConnection conn = CARETTA.DBI.DBHelper.getConnection();

            conn.Open();

            SqlTransaction Tran = conn.BeginTransaction(IsolationLevel.Serializable);

            try
            {
                ForumArticleItems mArticleItem = new ForumArticleItems();
                mArticleItem.Load(ArticleItemID);

                bool StatusChanged = false;
                if (mArticleItem.Status != (int)status)
                {
                    StatusChanged = true;
                }

                mArticleItem.Reply   = Reply;
                mArticleItem.Status  = (int)status;
                mArticleItem.Subject = Subject;
                mArticleItem.Save();

                ForumArticle mArticle = new ForumArticle();
                mArticle.Load(ArticleID);
                mArticle.ArticleMessage = Reply;
                mArticle.ArticleSubject = Subject;
                mArticle.Save();

                if (StatusChanged)
                {
                    ForumArticle.ArrangeArticle(mArticleItem.ArticleID);
                }

                Tran.Commit();
            }
            catch (Exception ex)
            {
                Tran.Rollback();
                throw;
            }
            finally
            {
                conn.Close();
            }
        }
Exemplo n.º 3
0
        public static int InsertArticleItem(int CategoryID, int ArticleID, string Subject, string Reply, ArticleItemStatus status, int UserID, string NickName)
        {
            SqlConnection conn = CARETTA.DBI.DBHelper.getConnection();

            conn.Open();

            SqlTransaction Tran = conn.BeginTransaction(IsolationLevel.Serializable);

            int ArticleItemID;

            try
            {
                DateTime CreateDate = DateTime.Now;
                string   LastPost   = LastPostTemplate.Replace("||MemberID||", UserID.ToString()).Replace("||NickName||", NickName).Replace("||Date||", CreateDate.ToShortDateString() + " " + CreateDate.ToShortTimeString());

                ForumArticleItems mArticleItem = new ForumArticleItems();
                mArticleItem.ArticleID  = ArticleID;
                mArticleItem.CreateDate = CreateDate;
                mArticleItem.CreatedBy  = UserID;
                mArticleItem.Reply      = Reply;
                mArticleItem.Score      = 0;
                mArticleItem.ScoreCount = 0;
                mArticleItem.Status     = (int)status;
                mArticleItem.Subject    = Subject;
                mArticleItem.Save();
                ArticleItemID = mArticleItem.ArticleItemID;

                ForumArticle mArticle = new ForumArticle();
                mArticle.Load(ArticleID);
                mArticle.LastPost     = LastPost;
                mArticle.LastPostDate = CreateDate;
                mArticle.Replies     += 1;
                mArticle.Save();

                ForumCategory mCategory = new ForumCategory();
                mCategory.Load(CategoryID);
                mCategory.LastPost     = LastPost;
                mCategory.LastPostDate = CreateDate;
                mCategory.Save();

                Tran.Commit();
            }
            catch (Exception ex)
            {
                Tran.Rollback();
                throw;
            }
            finally
            {
                conn.Close();
            }

            return(ArticleItemID);
        }
Exemplo n.º 4
0
 public static string GetArticleItemStatusDesc(ArticleItemStatus status)
 {
     return(ArticleItemStatusDesc[(int)status]);
 }