Exemple #1
0
    static void FillComment(IDataReader dr, BSComment bsComment)
    {
        bsComment.CommentID    = Convert.ToInt32(dr["CommentID"]);
        bsComment.Content      = dr["Comment"].ToString();
        bsComment.Date         = Convert.ToDateTime(dr["CreateDate"]);
        bsComment.Email        = dr["EMail"].ToString();
        bsComment.GravatarLink = BSHelper.GetGravatar(bsComment.Email);
        bsComment.IP           = dr["IP"].ToString();
        bsComment.PostID       = Convert.ToInt32(dr["PostID"]);
        bsComment.UserID       = Convert.ToInt32(dr["UserID"]);
        bsComment.UserName     = dr["Name"].ToString();
        bsComment.WebPage      = dr["WebPage"].ToString();
        bsComment.Approve      = Convert.ToBoolean(dr["Approve"]);

        if (bsComment.UserID != 0)
        {
            BSUser user = BSUser.GetUser(bsComment.UserID);
            if (user != null)
            {
                bsComment.UserName = user.Name;
                bsComment.WebPage  = user.WebPage;
                bsComment.Email    = user.Email;
                bsComment.IsAdmin  = user.Role.Equals("admin");
            }
        }
    }