コード例 #1
0
        public MasterDetailFlagCommentCollection FetchByQuery(Query qry)
        {
            MasterDetailFlagCommentCollection coll = new MasterDetailFlagCommentCollection();

            coll.LoadAndCloseReader(qry.ExecuteReader());
            return(coll);
        }
コード例 #2
0
        protected void CommentsListRepeater_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            switch (e.CommandName)
            {
            case "Flag":

                // Flag a comment as inappropriate
                long commentRecId = Convert.ToInt64(e.CommandArgument);

                // Check to see if this user has already flagged this comment
                if (Page.User.Identity.IsAuthenticated)
                {
                    // If user is logged in, check the user account id
                    MasterDetailFlagCommentCollection collUserAcct = new MasterDetailFlagCommentCollection()
                                                                     .Where(MasterDetailFlagComment.Columns.CommentId, commentRecId)
                                                                     .Where(MasterDetailFlagComment.Columns.CreatedBy, Page.User.Identity.Name)
                                                                     .Load();
                    if (collUserAcct.Count > 0)
                    {
                        ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "showAlertMessage",
                                                            "alert('Comment has already been flagged, and will be reviewed shortly.');", true);
                        return;
                    }
                }

                // Check to see if this comment has been previously flagged from the same IP
                MasterDetailFlagCommentCollection collIP = new MasterDetailFlagCommentCollection()
                                                           .Where(MasterDetailFlagComment.Columns.CommentId, commentRecId)
                                                           .Where(MasterDetailFlagComment.Columns.IPAddress, Request.ServerVariables["REMOTE_ADDR"])
                                                           .Load();
                if (collIP.Count > 0)
                {
                    ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "showAlertMessage2",
                                                        "alert('Comment has already been flagged, and will be reviewed shortly.');", true);
                    return;
                }

                MasterDetailFlagComment flagRec = new MasterDetailFlagComment();
                flagRec.CommentId = commentRecId;
                flagRec.IPAddress = Request.ServerVariables["REMOTE_ADDR"];
                flagRec.CreatedBy = Page.User.Identity.IsAuthenticated ? Page.User.Identity.Name : "Anonymous";
                flagRec.Save();

                ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "showAlertMessage3",
                                                    "alert('This comment is now flagged to be reviewed by a website administrator.');", true);
                break;

            default:
                break;
            }
        }
コード例 #3
0
        public MasterDetailFlagCommentCollection FetchAll()
        {
            MasterDetailFlagCommentCollection coll = new MasterDetailFlagCommentCollection();
            Query qry = new Query(MasterDetailFlagComment.Schema);

            // Begin Bayshore custom code block (rread 6/26/07)
            // Ignore records marked for deletion when doing a FetchAll
            if (MasterDetailFlagComment.Schema.GetColumn("IsDeleted") != null)
            {
                qry.WHERE("IsDeleted <> true");
            }
            else if (MasterDetailFlagComment.Schema.GetColumn("Deleted") != null)
            {
                qry.WHERE("Deleted <> true");
            }
            // End Bayshore custom code block

            coll.LoadAndCloseReader(qry.ExecuteReader());
            return(coll);
        }
コード例 #4
0
        public MasterDetailFlagCommentCollection FetchByID(object Id)
        {
            MasterDetailFlagCommentCollection coll = new MasterDetailFlagCommentCollection().Where("Id", Id).Load();

            return(coll);
        }