Beispiel #1
0
    // advance counting with different settings
    public static int Count_Comments(string search, string username, string type, int isEnabled, int isApproved, int filteroption)
    {
        StringBuilder query = new StringBuilder();
        string        logic = CommentsBLL.Return_Comment_Admin_Logic(search, username, type, isEnabled, isApproved, filteroption);

        query.Append("SELECT Count(commentid) FROM comments" + logic);
        return(Convert.ToInt32(SqlHelper.ExecuteScalar(Config.ConnectionString, CommandType.Text, query.ToString(), new SqlParameter("@search", search), new SqlParameter("@username", username), new SqlParameter("@type", type), new SqlParameter("@isenabled", isEnabled), new SqlParameter("@isapproved", isApproved))));
    }
        public ActionResult action()
        {
            var json = new StreamReader(Request.Body).ReadToEnd();
            var data = JsonConvert.DeserializeObject <List <CommentEntity> >(json);

            CommentsBLL.ProcessAction(_context, data);

            return(Ok(new { status = "success", message = SiteConfig.generalLocalizer["_records_processed"].Value }));
        }
        public ActionResult proc()
        {
            var json = new StreamReader(Request.Body).ReadToEnd();
            var data = JsonConvert.DeserializeObject <JGN_Comments>(json);

            data = CommentsBLL.Process(_context, data);

            return(Ok(new { status = "success", record = data, message = SiteConfig.generalLocalizer["_record_created"].Value }));
        }
Beispiel #4
0
    private void BindList()
    {
        int    pagesize = Convert.ToInt32(drp_pagesize.SelectedValue);
        string search   = "";

        if (txt_search.Text != "")
        {
            search = txt_search.Text;
        }

        //if (this.TotalRecords == 0)
        this.TotalRecords = CommentsBLL.Count_Comments(search, this.UserName, drp_type.SelectedValue, Convert.ToInt32(drp_isenable.SelectedValue), Convert.ToInt32(drp_approve.SelectedValue), Convert.ToInt32(drp_filter.SelectedValue));

        if (this.TotalRecords == 0)
        {
            // no record exist
            pnl_main.Visible      = false;
            pnl_norecord.Visible  = true;
            lbl_records.InnerHtml = "<h4>0 records found</h4>";
            return;
        }

        List <Comment_Struct> list = CommentsBLL.Load_Comments(search, this.UserName, drp_type.SelectedValue, Convert.ToInt32(drp_isenable.SelectedValue), Convert.ToInt32(drp_approve.SelectedValue), Convert.ToInt32(drp_filter.SelectedValue), drp_order.SelectedValue, this.PageNumber, pagesize);

        if (list.Count > 0)
        {
            ViewState["script_value"] = "";
            //int count = int.Parse(list.Count.ToString());
            if (this.TotalRecords > 1)
            {
                lbl_records.InnerHtml = "<h4>" + this.TotalRecords + " records found</h4>";
            }
            else
            {
                lbl_records.InnerHtml = this.TotalRecords + " record found";
            }
            // setup pagination
            Pagination_Process.Process_Pagination(MyList, rptPages, lnk_Prev, lnk_Next, pagesize, this.PageNumber, list, this.TotalRecords);

            pnl_main.Visible     = true;
            pnl_norecord.Visible = false;
        }
        else
        {
            pnl_main.Visible      = false;
            pnl_norecord.Visible  = true;
            lbl_records.InnerHtml = "<h4>0 records found</h4>";
        }
    }
        public async Task <ActionResult> load()
        {
            var json   = new StreamReader(Request.Body).ReadToEnd();
            var data   = JsonConvert.DeserializeObject <CommentEntity>(json);
            var _posts = await CommentsBLL.LoadItems(_context, data);

            var _records = 0;

            if (data.id == 0)
            {
                _records = await CommentsBLL.Count(_context, data);
            }

            return(Ok(new { posts = _posts, records = _records }));
        }
Beispiel #6
0
    protected void UpdateApproved(int status)
    {
        // Check whether admin section is in readonly mode.
        if (!Config.isAdminActionAllowed())
        {
            Response.Redirect(Config.GetUrl("adm/sc/Default.aspx?action_error=true"));
            return;
        }
        int  index;
        bool flg = false;

        for (index = 0; index < MyList.Items.Count; index++)
        {
            CheckBox select_chk;
            select_chk = (CheckBox)MyList.Items[index].FindControl("chk_inbox");
            if (select_chk.Checked)
            {
                long   id        = Convert.ToInt64(((Label)MyList.Items[index].FindControl("lbl_id")).Text);
                long   contentid = Convert.ToInt64(((Label)MyList.Items[index].FindControl("lbl_contentid")).Text);
                int    type      = Convert.ToInt32(((Label)MyList.Items[index].FindControl("lbl_type")).Text);
                string profileid = ((Label)MyList.Items[index].FindControl("lbl_profileid")).Text;
                int    OldValue  = Convert.ToInt32(((Label)MyList.Items[index].FindControl("lbl_isapproved")).Text);
                CommentsBLL.Update_Action(id, OldValue, status, contentid, profileid, type, "isapproved", true);

                if (flg == false)
                {
                    flg = true;
                }
            }
        }
        if (flg == false)
        {
            Config.ShowMessageV2(msg, "please select record", "Info!", 2);
        }
        else
        {
            if (status == 1)
            {
                Config.ShowMessageV2(msg, "selected records have been approved successfully", "Success!", 1);
            }
            else
            {
                Config.ShowMessageV2(msg, "selected records have been dis approved successfully", "Success!", 1);
            }
        }

        BindList();
    }
Beispiel #7
0
    // Load photos in admin section
    public static List <Comment_Struct> Load_Comments(string search, string username, string type, int isEnabled, int isApproved, int filteroption, string order, int PageNumber, int PageSize)
    {
        SqlConnection con = new SqlConnection(Config.ConnectionString);

        if (con.State != ConnectionState.Open)
        {
            con.Open();
        }
        List <Comment_Struct> _items = new List <Comment_Struct>();
        Comment_Struct        _item;

        // Query Building
        StringBuilder str   = new StringBuilder();
        StringBuilder query = new StringBuilder();
        string        logic = CommentsBLL.Return_Comment_Admin_Logic(search, username, type, isEnabled, isApproved, filteroption);

        query.Append("commentid,videoid,username,_comment,added_date,isenabled,type,points,isapproved,replyid,profileid FROM comments" + logic);
        // implement paging script for differnt data sources.
        switch (Site_Settings.Pagination_Type)
        {
        case 0:
            // SQL SERVER 2005 or Later Supported Query
            str.Append(Pagination_Process.Prepare_SQLSERVER2005_Pagination(query.ToString(), order, PageNumber, PageSize));
            break;

        case 1:
            // MySQL Supported Query
            string mysql_query = "SELECT " + query.ToString() + " ORDER BY " + order;
            str.Append(Pagination_Process.Prepare_MySQL_Pagination(mysql_query, PageNumber, PageSize));
            break;

        case 2:
            // SQL SERVER 2000 Supported Query
            string normal_query = "SELECT " + query.ToString() + " ORDER BY " + order;
            str.Append(normal_query);
            break;
        }
        // execute sql query
        SqlCommand video_cmd = new SqlCommand(str.ToString(), con);

        video_cmd.Parameters.Add(new SqlParameter("@search", search));
        video_cmd.Parameters.Add(new SqlParameter("@username", username));
        video_cmd.Parameters.Add(new SqlParameter("@type", type));
        video_cmd.Parameters.Add(new SqlParameter("@isenabled", isEnabled));
        video_cmd.Parameters.Add(new SqlParameter("@isapproved", isApproved));
        SqlDataReader reader = video_cmd.ExecuteReader(CommandBehavior.CloseConnection);

        while (reader.Read())
        {
            _item            = new Comment_Struct();
            _item.CommentID  = (long)reader["commentid"];
            _item.Comment    = reader["_comment"].ToString();
            _item.UserName   = reader["username"].ToString();
            _item.VideoID    = (long)reader["videoid"];
            _item.isEnabled  = Convert.ToInt32(reader["isenabled"]);
            _item.isApproved = Convert.ToInt32(reader["isapproved"]);
            _item.Type       = Convert.ToInt32(reader["type"]);
            _item.ReplyID    = (long)reader["replyid"];
            _item.Points     = Convert.ToInt32(reader["points"]);
            _item.Added_Date = (DateTime)reader["added_date"];
            _item.ProfileID  = reader["profileid"].ToString();
            _items.Add(_item);
        }
        reader.Close();
        con.Close(); con.Dispose();

        return(_items);
    }
Beispiel #8
0
    private void Load_Comments()
    {
        StringBuilder str = new StringBuilder();
        // store comment flags
        int TotalPages = 1;

        if (this.TotalComments > this.PageSize)
        {
            TotalPages = (int)Math.Ceiling((double)this.TotalComments / this.PageSize);
        }
        str.Append("<span style=\"display:none;\" id=\"cmt_tcmts\">" + this.TotalComments + "</span>\n"); // store total pages info in <span>
        str.Append("<span style=\"display:none;\" id=\"cmt_tpages\">" + TotalPages + "</span>\n");        // store total pages info in <span>
        str.Append("<span style=\"display:none;\" id=\"cmt_psize\">" + PageSize + "</span>\n");           // store page size infor in <span>
        str.Append("<span style=\"display:none;\" id=\"cmt_pnum\">1</span>\n");                           // current page index <span>
        if (this.TotalComments == 0)
        {
            str.Append("<div class=\"bx_msg\">");
            str.Append("<h4>Be the first to post comment on this " + ContentType.ToLower() + "!</h4>");
            str.Append("</div>");
            lst.InnerHtml = str.ToString();
            return;
        }
        // check for comments
        List <Comment_Struct> _list = CommentsBLL.Fetch_Comments_V2(this.ContentID, this.ProfileID, this.Type, this.PageNumber, this.PageSize, this.Order, this.ShowAuthorPhoto);

        if (_list.Count > 0)
        {
            // load comments
            int i = 0;

            str.Append("<div class=\"item\">");
            for (i = 0; i <= _list.Count - 1; i++)
            {
                // set post layout
                CmtItem postitem = new CmtItem();
                postitem.Height = 50;
                postitem.Width  = 50;

                postitem.ShowDate        = true;
                postitem.ShowAuthor      = true;
                postitem.ShowAuthorImage = this.ShowAuthorPhoto;
                postitem.Height          = this.Height;
                postitem.Width           = this.Width;
                postitem.isAdmin         = this.isAdmin;
                postitem.isHoverEffect   = true;
                postitem.isRoundCorners  = false;
                postitem.LeftWidth       = 8;  // %
                postitem.RightWidth      = 91; // %
                postitem.ShowReplyLink   = true;
                postitem.ShowVotes       = true;
                postitem.AuthorUserName  = this.AuthorUserName; // Author Of Post
                string PosterUserName = "";
                if (Page.User.Identity.IsAuthenticated)
                {
                    PosterUserName = Page.User.Identity.Name;
                }
                postitem.PosterUserName = PosterUserName; // Currently logged in User
                postitem.ShowReplyLink  = this.ShowReplyLink;
                postitem.ShowVotes      = this.ShowVoteLink;

                postitem.isHoverEffect = this.HoverEffect;
                postitem.TemplateID    = this.TemplateID;
                str.Append(postitem.Process(_list[i]));
            }
            if (this.PaginationType == 1)
            {
                str.Append("<div id=\"cmt_load_cnt\"></div>\n"); // load more comment container
            }
            str.Append("<div id=\"cmt_loading\"></div>\n");      // show loading progres
            str.Append("<div class=\"clear\"></div>");           // clear floating items


            str.Append("</div>");
            // ********************************************
            // PAGINATION SCRIPT
            // ********************************************
            pg.Visible  = false;
            apg.Visible = false;
            if (TotalPages > 1)
            {
                switch (this.PaginationType)
                {
                case 0:
                    // jquery ajax pagination
                    apg.Visible = true;
                    apagination1.TotalRecords        = this.TotalComments;
                    apagination1.PageSize            = this.PageSize;
                    apagination1.PageNumber          = this.PageNumber;
                    apagination1.LoadHandler         = Config.GetUrl("modules/comments/hdr/load.ashx");
                    apagination1.LoadParams          = this.Load_Params;
                    apagination1.LoadContainer       = lst.ClientID;
                    apagination1.LoadStatusContainer = "cmt_loading";
                    apagination1.BindPagination();
                    break;

                case 1:
                    // jquery load more pagination
                    str.Append("<div id=\"cmt_more\" class=\"item_pad_4 bx_br_both\" style=\"padding:5px 0px;\">\n");
                    str.Append("<span class=\"ui-icon ui-icon-triangle-1-s\" style=\"float: left; margin-right: .3em;\"></span><a id=\"cmt_ld_more\"  href=\"#\" class=\"bold\" title=\"load more comments\">Load more...</a>\n");
                    str.Append("</div>\n");
                    break;

                case 2:
                    // normal pagination
                    pg.Visible = true;
                    pagination1.TotalRecords   = this.TotalComments;
                    pagination1.PageSize       = this.PageSize;
                    pagination1.PageNumber     = this.PageNumber;
                    pagination1.Default_Url    = this.DefaultUrl;
                    pagination1.Pagination_Url = this.PaginationUrl;
                    pagination1.BindPagination();
                    break;
                }
            }
        }
        else
        {
            str.Append("<div class=\"bx_msg\">");
            str.Append("<h4>Be the first to post comment on this " + ContentType.ToLower() + "!</h4>");
            str.Append("</div>");
        }
        lst.InnerHtml = str.ToString();
    }