Exemple #1
2
    public Int64 updateData(likeDislikeBo likedislikebo)
    {
        try
        {

            query = "LIKE_DISLIKE_CLICK";
            if (con.State == ConnectionState.Closed)
            {
                con.Open();
            }
            cmd = new SqlCommand(query, con);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@commentId",likedislikebo.commentId);
            cmd.Parameters.AddWithValue("@guid",likedislikebo.guId);
            cmd.Parameters.AddWithValue("@likeDislike",likedislikebo.likeDislike);
             Int64 issueId = Convert.ToInt64( cmd.ExecuteScalar());
             return issueId;
        }
        catch
        {
            throw;
        }
        finally
        {
            if (con.State == ConnectionState.Open)
                con.Close();
            cmd.Dispose();
        }
    }
Exemple #2
2
    protected void ListComments_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        likeDislikeBo likedislikebo = new likeDislikeBo();
        string btncmdname = e.CommandName.ToString();
        Int64 commentId;
        try
        {
            commentId = Convert.ToInt64(e.CommandArgument);
            if (btncmdname == "like")
            {
                likedislikebo.guId = 44; /*** from session ***/
                likedislikebo.commentId = commentId;
                likedislikebo.likeDislike = true;
                likedislikebal.updateData(likedislikebo);
                DataTable dt = new DataTable();
                dt = (DataTable)commentbal.getComment(commentId);
                ((Label)e.Item.FindControl("LBLlikeCount")).Text = dt.Rows[0]["likeCount"].ToString();
                ((Label)e.Item.FindControl("LBLdislikeCount")).Text = dt.Rows[0]["dislikeCount"].ToString();

            }
            if (btncmdname == "dislike")
            {
                likedislikebo.guId = 44;
                likedislikebo.commentId = commentId;
                likedislikebo.likeDislike = false;
                likedislikebal.updateData(likedislikebo);
                DataTable dt = new DataTable();
                dt = (DataTable)commentbal.getComment(commentId);
                ((Label)e.Item.FindControl("LBLlikeCount")).Text = dt.Rows[0]["likeCount"].ToString();
                ((Label)e.Item.FindControl("LBLdislikeCount")).Text = dt.Rows[0]["dislikeCount"].ToString();

            }

        }
        catch
        {
            throw;
        }
        finally
        {
        }
    }
    protected void DataListComments_ItemCommand(object source, DataListCommandEventArgs e)
    {
        likeDislikeBo likedislikebo = new likeDislikeBo();
        string btncmdname = e.CommandName.ToString();
        Int64 commentId;
        try
        {
            commentId = Convert.ToInt64(e.CommandArgument);
            if (btncmdname == "like")
            {
                likedislikebo.guId = 1; /*** from session ***/
                likedislikebo.commentId = commentId;
                likedislikebo.likeDislike = true;
                Int64 issueId = likedislikebal.updateData(likedislikebo);
        //                DataListComments.DataSource = (DataTable)commentbal.getComments(issueId);
          //              DataListComments.DataBind();
                loadDataList();
            }
            if (btncmdname == "dislike")
            {
                likedislikebo.guId = 1;
                likedislikebo.commentId = commentId;
                likedislikebo.likeDislike = false;
                likedislikebal.updateData(likedislikebo);
                Int64 issueId = likedislikebal.updateData(likedislikebo);
                //DataListComments.DataSource = (DataTable)commentbal.getComments(issueId);
                //DataListComments.DataBind();
                loadDataList();
            }

        }
        catch
        {
            throw;
        }
        finally
        {
        }
    }
 private string likeDislike(Int64 commentId,Int64 guid,string val)
 {
     likeDislikeBo likedislikebo = new likeDislikeBo();
     likedislikebo.commentId = commentId;
     likedislikebo.guId = guid;
     likedislikebo.likeDislike = true;
     if (val != " ")
     {
         if (val.ToString() == "like") likedislikebo.likeDislike = true;
         else if (val.ToString() == "dislike") likedislikebo.likeDislike = false;
         DataTable dt = new DataTable();
         dt = (DataTable)(new LikeDislikeBAL()).updateData(likedislikebo);
         return ConvertToJason(dt);
     }
     return "eRRoR";
 }
Exemple #5
0
    public DataTable updateData(likeDislikeBo likedislikebo)
    {
        try
        {

            query = "LIKE_DISLIKE_CLICK1";
            if (con.State == ConnectionState.Closed)
            {
                con.Open();
            }
            dap = new SqlDataAdapter(query, con);

            dap.SelectCommand.CommandType = CommandType.StoredProcedure;
            dap.SelectCommand.Parameters.AddWithValue("@commentId", likedislikebo.commentId);
            dap.SelectCommand.Parameters.AddWithValue("@guid", likedislikebo.guId);
            dap.SelectCommand.Parameters.AddWithValue("@likeDislike", likedislikebo.likeDislike);
            DataTable dt = new DataTable();
            dap.Fill(dt);
            return dt;
        }
        catch
        {
            throw;
        }
        finally
        {
            if (con.State == ConnectionState.Open)
                con.Close();
           dap.Dispose();
        }
    }
    public DataTable updateData(likeDislikeBo likedislikebo)
    {
        try
        {
            query = "LIKE_DISLIKE_CLICK1";
            if (con.State == ConnectionState.Closed)
            {
                con.Open();
            }
            dap = new SqlDataAdapter(query, con);

            dap.SelectCommand.CommandType = CommandType.StoredProcedure;
            dap.SelectCommand.Parameters.AddWithValue("@commentId", likedislikebo.commentId);
            dap.SelectCommand.Parameters.AddWithValue("@guid", likedislikebo.guId);
            dap.SelectCommand.Parameters.AddWithValue("@likeDislike", likedislikebo.likeDislike);
            DataTable dt = new DataTable();
            dap.Fill(dt);
            return(dt);
        }
        catch
        {
            throw;
        }
        finally
        {
            if (con.State == ConnectionState.Open)
            {
                con.Close();
            }
            dap.Dispose();
        }
    }
 public DataTable updateData(likeDislikeBo likedislikebo)
 {
     try
     {
         return(likedislikedal.updateData(likedislikebo));
     }
     catch
     {
         throw;
     }
     finally
     {
     }
 }
Exemple #8
0
 public DataTable updateData(likeDislikeBo likedislikebo)
 {
     try
     {
         return likedislikedal.updateData(likedislikebo);
     }
     catch
     {
         throw;
     }
     finally
     {
     }
 }
    protected void ListComments_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        likeDislikeBo likedislikebo = new likeDislikeBo();
        string        btncmdname;
        Int64         commentId;

        try
        {
            btncmdname = e.CommandName.ToString();
            commentId  = Convert.ToInt64(e.CommandArgument);
            if (btncmdname == "like")
            {
                likedislikebo.guId        = int.Parse(Session["guid"].ToString()); /*** from session ***/
                likedislikebo.commentId   = commentId;
                likedislikebo.likeDislike = true;
                DataTable dt = likedislikebal.updateData(likedislikebo);
                ((Label)e.Item.FindControl("LBLlikeCount")).Text    = dt.Rows[0]["likeCount"].ToString();
                ((Label)e.Item.FindControl("LBLdislikeCount")).Text = dt.Rows[0]["dislikeCount"].ToString();
            }
            else if (btncmdname == "dislike")
            {
                likedislikebo.guId        = int.Parse(Session["guid"].ToString());
                likedislikebo.commentId   = commentId;
                likedislikebo.likeDislike = false;
                DataTable dt = likedislikebal.updateData(likedislikebo);
                ((Label)e.Item.FindControl("LBLlikeCount")).Text    = dt.Rows[0]["likeCount"].ToString();
                ((Label)e.Item.FindControl("LBLdislikeCount")).Text = dt.Rows[0]["dislikeCount"].ToString();
            }
            else if (btncmdname == "reportcomment")
            {
                reportbal.Comment_Report(commentId);
                ((Image)e.Item.FindControl("IMG_ReportComment")).ImageUrl        = "../images/flag-red.png";
                ((LinkButton)e.Item.FindControl("Report_Abuse_Comment")).Enabled = false;
            }

            else
            {
            }
        }
        catch
        {
            throw;
        }
        finally
        {
        }
    }
    private string likeDislike(Int64 commentId, Int64 guid, string val)
    {
        likeDislikeBo likedislikebo = new likeDislikeBo();

        likedislikebo.commentId   = commentId;
        likedislikebo.guId        = guid;
        likedislikebo.likeDislike = true;
        if (val != " ")
        {
            if (val.ToString() == "like")
            {
                likedislikebo.likeDislike = true;
            }
            else if (val.ToString() == "dislike")
            {
                likedislikebo.likeDislike = false;
            }
            DataTable dt = new DataTable();
            dt = (DataTable)(new LikeDislikeBAL()).updateData(likedislikebo);
            return(ConvertToJason(dt));
        }
        return("eRRoR");
    }
    protected void ListComments_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        likeDislikeBo likedislikebo = new likeDislikeBo();
        string btncmdname;
        Int64 commentId;
        try
        {
            btncmdname = e.CommandName.ToString();
            commentId = Convert.ToInt64(e.CommandArgument);
            if (btncmdname == "like")
            {
                likedislikebo.guId = int.Parse(Session["guid"].ToString()); /*** from session ***/
                likedislikebo.commentId = commentId;
                likedislikebo.likeDislike = true;
                 DataTable dt= likedislikebal.updateData(likedislikebo);
                ((Label)e.Item.FindControl("LBLlikeCount")).Text = dt.Rows[0]["likeCount"].ToString();
                ((Label)e.Item.FindControl("LBLdislikeCount")).Text = dt.Rows[0]["dislikeCount"].ToString();

            }
            else if (btncmdname == "dislike")
            {
                likedislikebo.guId = int.Parse(Session["guid"].ToString());
                likedislikebo.commentId = commentId;
                likedislikebo.likeDislike = false;
                DataTable dt = likedislikebal.updateData(likedislikebo);
                ((Label)e.Item.FindControl("LBLlikeCount")).Text = dt.Rows[0]["likeCount"].ToString();
                ((Label)e.Item.FindControl("LBLdislikeCount")).Text = dt.Rows[0]["dislikeCount"].ToString();
            }
            else if (btncmdname == "reportcomment")
            {
                reportbal.Comment_Report(commentId);
                ((Image)e.Item.FindControl("IMG_ReportComment")).ImageUrl = "../images/flag-red.png";
                ((LinkButton)e.Item.FindControl("Report_Abuse_Comment")).Enabled = false;
            }

            else
            {
            }

        }
        catch
        {
            throw;
        }
        finally
        {
        }
    }