Exemplo n.º 1
0
        public bool PutComment(Comment comment)
        {
            commentBLL = new CommentBLL();
            bool status = commentBLL.PutComment(comment);

            return(status);
        }
Exemplo n.º 2
0
    protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        int      commentid      = 0;
        string   commentcontent = "";
        DateTime modified       = DateTime.Now;
        string   commentstatus  = "";


        commentid      = Convert.ToInt16(((Label)GridView1.Rows[e.RowIndex].FindControl("lblcommentid")).Text);
        commentcontent = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("txtcommentcontent")).Text;
        commentstatus  = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("txtstatus")).Text;

        CommentBLL cb = new CommentBLL();
        int        i  = cb.UpdateComment(commentid, commentcontent, modified, commentstatus);

        if (i == 1)
        {
            Response.Write("<script language='javascript'>alert('Post has been updated !');</script>");
            GridView1.DataBind();
        }
        else
        {
            Response.Write("<script language='javascript'>alert('Post is failed to be updated !');</script>");
            GridView1.DataBind();
        }
    }
Exemplo n.º 3
0
        public ActionResult DeleteComment(string v1, string objectId)
        {
            CommentBLL bll = new CommentBLL();

            try
            {
                //表单验证
                if (isNUll(objectId))
                {
                    return(Content("<script> alert('参数不能为空'); location.href = '" + Url.Action("Getcomments", "Items") + "'</script>"));
                    //return invildRequest("参数不能为空");
                }

                bool result = bll.Delete(objectId);
                if (result)
                {
                    return(Content("<script> alert('删除成功'); location.href = '" + Url.Action("Getcomments", "Items") + "'</script>"));
                    //return ok(new { msg = "ok" });
                }
                return(Content("<script> alert('删除失败'); location.href = '" + Url.Action("Getcomments", "Items") + "'</script>"));
                //return notFound("删除失败");
            }
            catch (Exception e)
            {
                return(Content("<script> alert('" + e.Message + "'); location.href = '" + Url.Action("Getcomments", "Items") + "'</script>"));
                //return execept(e.Message);
            }
        }
Exemplo n.º 4
0
 public void ShowComments()
 {
     commentBLL = new CommentBLL();
     if (!isSearch)
     {
         commentDTO = commentBLL.GetComments();
     }
     else
     {
         commentDTO = commentBLL.GetComments(keyword);
     }
     dataGridView1.DataSource = commentDTO.Comments;
     dataGridView1.Columns["ID"].HeaderText             = "編號";
     dataGridView1.Columns["Title"].HeaderText          = "標題";
     dataGridView1.Columns["CommentContent"].HeaderText = "內容";
     dataGridView1.Columns["MemberID"].Visible          = false;
     dataGridView1.Columns["Member"].HeaderText         = "會員";
     dataGridView1.Columns["AddDate"].HeaderText        = "留言時間";
     dataGridView1.Columns["IsApproved"].HeaderText     = "是否核准";
     dataGridView1.Columns["CategoryID"].Visible        = false;
     dataGridView1.Columns["CategoryName"].HeaderText   = "評論項目";
     dataGridView1.Columns["Rating"].HeaderText         = "評分";
     dataGridView1.Columns["MealOptionID"].Visible      = false;
     dataGridView1.Columns["MealName"].HeaderText       = "餐點";
     dataGridView1.Columns["Feedback"].HeaderText       = "回覆";
     isSearch = false;
 }
Exemplo n.º 5
0
        public JsonResult delcommentson(wenzhangpinglunson wps)
        {
            try
            {
                userinfo uif = new userinfo();
                uif.username = HttpContext.Request.Cookies["user"];
                uif.pwd      = HttpContext.Request.Cookies["key"];
                WenZhangBLL wz = new WenZhangBLL();
                uif = DataToEnity <userinfo> .DataRowToEntity(wz.Getuserinfo(uif).Rows[0]);

                CommentBLL cb = new CommentBLL();
                if (cb.iswenzhangzuoze(uif.id, wps.id))
                {
                    wps.pinglunrenid = uif.id;
                    return(Json(new { issuf = cb.delcommentson(wps) }));
                }
                else if (cb.isgaipinglunsonzuoze(uif.id, wps.id))
                {
                    wps.pinglunrenid = uif.id;
                    return(Json(new { issuf = cb.delcommentson(wps) }));
                }
                return(Json(new { issuf = false }));
            }
            catch
            {
                return(Json(new { issuf = true }));
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// 获得所有的评论
        /// </summary>
        /// <param name="uwz"></param>
        /// <returns></returns>
        public JsonResult commentlist(fenyezhuanyong uwz)
        {
            CommentBLL cb         = new CommentBLL();
            List <int> useridlist = new List <int>();
            Result <List <allwenzhengpinglun> > result = cb.GetAllwenzhengpingluns(uwz.id, out useridlist, uwz.page, uwz.pagecount);
            List <userinfo> userinfos = cb.GetUserinfos(useridlist);

            if (result.content != null)
            {
                foreach (allwenzhengpinglun item in result.content)
                {
                    userinfo uif = new userinfo();
                    uif = userinfos.Where(u => u.id == item.pinglunrenid).FirstOrDefault();
                    item.pinglunrennicheng  = uif.nicheng;
                    item.pinglunrenusername = uif.username;
                    item.usertouxiangurl    = uif.touxiangurl == null? @"\images\header-img-comment_03.png":uif.touxiangurl;
                    if (item.wenzhangpinglunsonlist.content != null)
                    {
                        foreach (wenzhangpinglunsonkuozhan wenzhangpinglunson in item.wenzhangpinglunsonlist.content)
                        {
                            uif = userinfos.Where(u => u.id == wenzhangpinglunson.pinglunrenid).FirstOrDefault();
                            wenzhangpinglunson.pinglunrennicheng  = uif.nicheng;
                            wenzhangpinglunson.pinglunrenusername = uif.username;
                            uif = userinfos.Where(u => u.id == wenzhangpinglunson.huifurenid).FirstOrDefault();
                            wenzhangpinglunson.huifurennicheng  = uif.nicheng;
                            wenzhangpinglunson.huifurenusername = uif.username;
                        }
                    }
                }
            }

            return(Json(result));
        }
Exemplo n.º 7
0
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        int commentid = 0;

        commentid = int.Parse(GridView1.DataKeys[e.RowIndex].Values[0].ToString());


        try
        {
            CommentBLL cb = new CommentBLL();

            int i = cb.Delete(commentid);
            if (i == 1)
            {
                Response.Write("<script language='javascript'>alert('Comment has been deleted !');</script>");
                GridView1.DataBind();
            }

            else
            {
                Response.Write("<script language='javascript'>alert('Comment is failed to be deleted !');</script>");
            }
        }
        catch (SqlException ex)
        {
            Response.Write(ex.ToString());
        }
    }
Exemplo n.º 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["jobId"] != null)
            {
                int jobID  = int.Parse(Request.QueryString["jobId"]);
                int userID = int.Parse(Request.Cookies["userInfo"]["id"]);

                if (!CommentBLL.canReadWriteComment(jobID, userID))
                {
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "redirect",
                                                        "alert('Bạn không có quyền xem bình luận'); window.location='" +
                                                        Request.ApplicationPath + "Job.aspx';", true);
                }

                addComment.HRef = "./CommentForm?jobId=" + jobID;

                List <BO.Comment> commentList = CommentBLL.getAllCommentOfJob(jobID);
                GridView1.DataSource = commentList;
                GridView1.DataBind();

                titlePage.InnerText = "Bình luận công việc: " + JobBLL.getJob(int.Parse(Request.QueryString["jobId"])).title;
            }
            else
            {
                Response.Redirect("Job.aspx");
            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// 评论的子集点赞
        /// </summary>
        /// <param name="wzs"></param>
        /// <returns></returns>
        public JsonResult pinglundianzhanson(wenzhangpinglunson wzs)
        {
            CommentBLL commentBLL = new CommentBLL();

            bool issuf = commentBLL.pinglundianzhanson(wzs);

            return(Json(new { issuf = issuf }));
        }
Exemplo n.º 10
0
        public ActionResult Create()
        {
            CommentBLL defComment = new CommentBLL();

            defComment.CommentID = 0;
            ViewBag.GameName     = GetGameItems();
            // ViewBag.UserName = GetGameItems();
            return(View(defComment));
        }
    public void BindMerList()
    {
        int        count;
        CommentBLL cb = new CommentBLL();
        DataSet    ds = cb.GetPageCommentListByMerID(Convert.ToInt32(Session["user_ID"]), MerReplyPager.CurrentPageIndex, MerReplyPager.PageSize, out count);

        MerReplyPager.RecordCount = count;
        CommentListGrd.DataSource = ds;
        CommentListGrd.DataBind();
    }
    public void init()
    {
        CommentBLL cb = new CommentBLL();
        DataSet    ds = cb.GetCommentListByMcID(mcID);

        MerComRe_Content.Text   = ds.Tables[0].Rows[0]["mc_content"].ToString();
        TBip.Text               = ds.Tables[0].Rows[0]["mc_ip"].ToString();
        TBname.Text             = ds.Tables[0].Rows[0]["mc_name"].ToString();
        TBtime.Text             = ds.Tables[0].Rows[0]["mc_time"].ToString();
        Button1.CommandArgument = mcID.ToString();
    }
Exemplo n.º 13
0
        public void RemoveComment(CommentBLL commentBll)
        {
            if (commentBll == null)
            {
                throw new ArgumentNullException("Object cannot be null");
            }
            var comment = _db.Comments.Find(p => p.Id == commentBll.Id).Single();

            _db.Comments.Remove(comment);
            _db.Save();
        }
 public CommentController(
     IMapper mapper,
     CommentBLL comment,
     UserManager <User> userManager,
     IOptionsSnapshot <AppSettings> appSettingsAccessor)
 {
     _appSettings = appSettingsAccessor.Value;
     _mapper      = mapper;
     _comment     = comment;
     _userManager = userManager;
 }
Exemplo n.º 15
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        if (Session["Email_ID"] == null || Session["Email_ID"] == " ")
        {

            string commentcontent = txtcommentcontent.Text;
            DateTime published = DateTime.Now;
            int postid = Convert.ToInt16(lblShowPostID.Text);
            string status = "Valid";
            CommentBLL cb = new CommentBLL();
            int i = cb.NewComment(postid, commentcontent, published, status);
            if (i == 1)
            {
                Response.Write("<script language='javascript'>alert('Your comment has been added !');</script>");
                DataList1.DataBind();

            }
            else
            {
                Response.Write("<script language='javascript'>alert('Your comment is failed to be added !');</script>");
                DataList1.DataBind();

            }
        }

        else
        {
            string emailid = Session["Email_ID"].ToString();
            UserBLL ub = new UserBLL();
            int userid = ub.ShowUserID(emailid);

            string commentcontent = txtcommentcontent.Text;
            DateTime published = DateTime.Now;
            int postid = Convert.ToInt16(lblShowPostID.Text);
            string status = "Valid";
            CommentBLL cb = new CommentBLL();
            int i = cb.NewComment(userid, postid, commentcontent, published, status);
            if (i == 1)
            {
                Response.Write("<script language='javascript'>alert('Your comment has been added !');</script>");
                DataList1.DataBind();
                txtcommentcontent.Text = "";
            }
            else
            {
                Response.Write("<script language='javascript'>alert('Your comment is failed to be added !');</script>");
                DataList1.DataBind();
                txtcommentcontent.Text = "";

            }

        }
    }
Exemplo n.º 16
0
        public string SubmitReviews(string archiveID, string agree)
        {
            global::Ops.Cms.Models.Member m = UserState.Member.Current;
            if (m == null) return "-1";

            //提交点评
            bool result=new CommentBLL().SubmitReviews(archiveID,m.ID,agree.ToLower()=="true");

            //清除文章缓存
           // if (true) ArchiveCache.ClearSingleCache(archiveID);

            return result.ToString(); ;
        }
Exemplo n.º 17
0
 protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
 {
     if (Request.QueryString["jobId"] != null)
     {
         GridView1.PageIndex = e.NewPageIndex;
         List <BO.Comment> commentList = CommentBLL.getAllCommentOfJob(int.Parse(Request.QueryString["jobId"]));
         GridView1.DataSource = commentList;
         GridView1.DataBind();
     }
     else
     {
         Response.Redirect("Job.aspx");
     }
 }
Exemplo n.º 18
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        if (Session["Email_ID"] == null || Session["Email_ID"] == " ")
        {
            string     commentcontent = txtcommentcontent.Text;
            DateTime   published      = DateTime.Now;
            int        postid         = Convert.ToInt16(lblShowPostID.Text);
            string     status         = "Valid";
            CommentBLL cb             = new CommentBLL();
            int        i = cb.NewComment(postid, commentcontent, published, status);
            if (i == 1)
            {
                Response.Write("<script language='javascript'>alert('Your comment has been added !');</script>");
                DataList1.DataBind();
            }
            else
            {
                Response.Write("<script language='javascript'>alert('Your comment is failed to be added !');</script>");
                DataList1.DataBind();
            }
        }



        else
        {
            string  emailid = Session["Email_ID"].ToString();
            UserBLL ub      = new UserBLL();
            int     userid  = ub.ShowUserID(emailid);

            string     commentcontent = txtcommentcontent.Text;
            DateTime   published      = DateTime.Now;
            int        postid         = Convert.ToInt16(lblShowPostID.Text);
            string     status         = "Valid";
            CommentBLL cb             = new CommentBLL();
            int        i = cb.NewComment(userid, postid, commentcontent, published, status);
            if (i == 1)
            {
                Response.Write("<script language='javascript'>alert('Your comment has been added !');</script>");
                DataList1.DataBind();
                txtcommentcontent.Text = "";
            }
            else
            {
                Response.Write("<script language='javascript'>alert('Your comment is failed to be added !');</script>");
                DataList1.DataBind();
                txtcommentcontent.Text = "";
            }
        }
    }
Exemplo n.º 19
0
        public ActionResult Register(Models.RegistrationModel collection)
        {
            try
            {
                using (ContextBLL ctx = new ContextBLL())
                {
                    if (!ModelState.IsValid)
                    {
                        ViewBag.Games = GetGameItems(ctx);
                        return(View(collection));
                    }
                    UserBLL user = ctx.FindUserByUserName(collection.UserName);
                    if (user != null)
                    {
                        collection.Message = $"The UserName  '{collection.UserName}' already exists in the database";
                        ViewBag.Games      = GetGameItems(ctx);
                        return(View(collection));
                    }
                    user = new UserBLL();
                    CommentBLL comment = new CommentBLL();
                    user.FirstName   = collection.FirstName;
                    user.LastName    = collection.LastName;
                    user.UserName    = collection.UserName;
                    user.DateOfBirth = collection.DateOfBirth;
                    user.SALT        = System.Web.Helpers.Crypto.GenerateSalt(Constants.SaltSize);
                    user.HASH        = System.Web.Helpers.Crypto.HashPassword(collection.Password + user.SALT);
                    user.Email       = collection.Email;
                    user.RoleID      = 3;
                    //comment.Liked = collection.Liked;
                    comment.Liked       = true;
                    comment.GameID      = collection.GameID;
                    comment.GameName    = collection.GameName;
                    comment.GameComment = "User Initial Comment";
                    comment.UserID      = ctx.CreateUser(user);

                    ctx.CreateComment(comment);
                    Session["AUTHUserName"] = user.UserName;
                    Session["AUTHRoles"]    = user.RoleName;
                    Session["AUTHTYPE"]     = "HASHED";
                }
                return(RedirectToAction("Index", "Home"));
            }
            catch (Exception ex)
            {
                ViewBag.Exception = ex;
                return(View("Error"));
            }
        }
Exemplo n.º 20
0
        /// <summary>
        /// 获取评论数量
        /// </summary>
        /// <param name="caseEntities"></param>
        /// <returns></returns>
        protected List <CaseEntity> CaseListCommentCountByList(List <CaseEntity> caseEntities)
        {
            if (caseEntities.Count() > 0)
            {
                int[] idInts = caseEntities.Select(it => it.caseId).ToArray();

                CommentBLL           commentBLL      = new CommentBLL();
                List <CommentEntity> commentEntities = commentBLL.ListByTypeAndObjIdInts((int)Entity.TypeEnumEntity.TypeEnum.案例, idInts);
                if (commentEntities.Count() > 0)
                {
                    Dictionary <int, int> keyValuePairs = commentEntities
                                                          .GroupBy(it => it.objId)
                                                          .Select(it => new
                    {
                        id    = it.Key,
                        count = it.Count()
                    })
                                                          .ToDictionary(it => it.id, it => it.count);

                    caseEntities = (from c in caseEntities
                                    join e in keyValuePairs on c.caseId equals e.Key into se
                                    from ses in se.DefaultIfEmpty()
                                    select new CaseEntity
                    {
                        caseId = c.caseId,
                        coverImage = c.coverImage,
                        createDate = c.createDate,
                        describe = c.describe,
                        integral = c.integral,
                        isDel = c.isDel,
                        modifyDate = c.modifyDate,
                        name = c.name,
                        portrait = c.portrait,
                        state = c.state,
                        tips = c.tips,
                        title = c.title,
                        userId = c.userId,
                        commentCount = ses.Value,
                        endorseCount = c.endorseCount,
                        isEndorse = c.isEndorse,
                        readCount = c.readCount
                    })
                                   .ToList();
                }
            }

            return(caseEntities);
        }
 public void ShowComments()
 {
     commentBLL = new CommentBLL();
     commentDTO = commentBLL.GetApprovedComments();
     dataGridView1.DataSource                           = commentDTO.Comments;
     dataGridView1.Columns["ID"].Visible                = false;
     dataGridView1.Columns["Title"].HeaderText          = "標題";
     dataGridView1.Columns["CommentContent"].HeaderText = "內容";
     dataGridView1.Columns["MemberID"].Visible          = false;
     dataGridView1.Columns["Member"].HeaderText         = "會員";
     dataGridView1.Columns["AddDate"].HeaderText        = "留言時間";
     dataGridView1.Columns["IsApproved"].Visible        = false;
     dataGridView1.Columns["MealID"].Visible            = false;
     dataGridView1.Columns["MealName"].HeaderText       = "評論餐點";
     dataGridView1.Columns["Rating"].HeaderText         = "評分";
 }
    protected void Button1_Command(object sender, CommandEventArgs e)
    {
        CommentBLL cb = new CommentBLL();
        McComm     mc = new McComm();

        mc.ReplyContent = MerComRe_Reply.Text;
        mc.ReplyTime    = DateTime.Now;
        mc.McID         = mcID;
        mc.McReplyer    = Session["username"].ToString();
        int i = cb.CommentReply(mc, Convert.ToInt32(e.CommandArgument));

        if (i > 0)
        {
            Response.Redirect("MerchantCommentList.aspx");
        }
    }
Exemplo n.º 23
0
        public string SubmitReviews(string archiveID, string agree)
        {
            global::Ops.Cms.Models.Member m = UserState.Member.Current;
            if (m == null)
            {
                return("-1");
            }

            //提交点评
            bool result = new CommentBLL().SubmitReviews(archiveID, m.ID, agree.ToLower() == "true");

            //清除文章缓存
            // if (true) ArchiveCache.ClearSingleCache(archiveID);

            return(result.ToString());;
        }
Exemplo n.º 24
0
        /// <summary>
        /// 获取评论数量
        /// </summary>
        /// <param name="shareEntities"></param>
        /// <returns></returns>
        protected List <ShareEntity> ShareListCommentCountByList(List <ShareEntity> shareEntities)
        {
            if (shareEntities.Count() > 0)
            {
                int[] shareIdInts = shareEntities.Select(it => it.shareId).ToArray();

                CommentBLL           commentBLL      = new CommentBLL();
                List <CommentEntity> commentEntities = commentBLL.ListByTypeAndObjIdInts((int)Entity.TypeEnumEntity.TypeEnum.说说, shareIdInts);
                if (commentEntities.Count() > 0)
                {
                    Dictionary <int, int> keyValuePairs = commentEntities
                                                          .GroupBy(it => it.objId)
                                                          .Select(it => new
                    {
                        id    = it.Key,
                        count = it.Count()
                    })
                                                          .ToDictionary(it => it.id, it => it.count);

                    shareEntities = (from s in shareEntities
                                     join e in keyValuePairs on s.shareId equals e.Key into se
                                     from ses in se.DefaultIfEmpty()
                                     select new ShareEntity
                    {
                        contents = s.contents,
                        createDate = s.createDate,
                        commentCount = ses.Value,
                        img = s.img,
                        integral = s.integral,
                        modifyDate = s.modifyDate,
                        shareId = s.shareId,
                        shareTopicId = s.shareTopicId,
                        shareTypeId = s.shareTypeId,
                        userId = s.userId,
                        isDel = s.isDel,
                        name = s.name,
                        portrait = s.portrait,
                        isEndorse = s.isEndorse,
                        endorseCount = s.endorseCount,
                        readCount = s.readCount
                    })
                                    .ToList();
                }
            }

            return(shareEntities);
        }
Exemplo n.º 25
0
        public JsonResult Delete([FromForm] string token, [FromForm] int commentId)
        {
            DataResult dr = new DataResult();

            try
            {
                if (commentId < 10000)
                {
                    dr.code = "201";
                    dr.msg  = "参数错误";
                    return(Json(dr));
                }

                UserEntity userEntity = this.GetUserByToken(token);

                CommentBLL    commentBLL    = new CommentBLL();
                CommentEntity commentEntity = commentBLL.GetById(commentId);

                if (userEntity.userId != commentEntity.userId)
                {
                    dr.code = "201";
                    dr.msg  = "不是你的评论";
                    return(Json(dr));
                }

                commentEntity.isDel      = true;
                commentEntity.modifyDate = DateTime.Now;
                int rows = commentBLL.ActionDal.ActionDBAccess.Updateable(commentEntity).ExecuteCommand();
                if (rows > 0)
                {
                    dr.code = "200";
                    dr.msg  = "成功";
                }
                else
                {
                    dr.code = "201";
                    dr.msg  = "失败";
                }
            }
            catch (Exception ex)
            {
                dr.code = "999";
                dr.msg  = ex.Message;
            }
            return(Json(dr));
        }
Exemplo n.º 26
0
        /// <summary>
        /// 创建评论条
        /// </summary>
        /// <param name="wzp"></param>
        /// <returns></returns>
        public JsonResult Addcomment(wenzhangpinglun wzp)
        {
            userinfo uif = new userinfo();

            uif.username = HttpContext.Request.Cookies["user"];
            uif.pwd      = HttpContext.Request.Cookies["key"];
            if (wzp.wenzhangid == 0 || wzp.pinglunneirong == null)
            {
                return(Json(new { msg = "操作出错" }));
            }
            if (string.IsNullOrEmpty(uif.username))
            {
                userinfo userinfo = new userinfo()
                {
                    id = 0, nicheng = "欠名", username = "******", touxiangurl = @"\images\header-img-comment_03.png"
                };
                wenzhangpinglun wenzhangpinglun = new CommentBLL().addWenZhangPingLun(wzp);
                return(Json(new { issuf = true, wenzhangpinglun, userinfo }));
            }
            else
            {
                WenZhangBLL uib     = new WenZhangBLL();
                var         uifdata = uib.Getuserinfo(uif);
                wzp.pinglunrenid = uifdata.Rows.Count != 0 ? Convert.ToInt32(uifdata.Rows[0]["id"]) : 0;
                if (wzp.pinglunrenid == 0)
                {
                    return(Json(new { msg = "非法登陆,评论失败" }));
                }
                else
                {
                    var userinfo = DataToEnity <userinfo> .DataRowToEntity(uifdata.Rows[0]);

                    if (userinfo.touxiangurl == null)
                    {
                        userinfo.touxiangurl = @"\images\header-img-comment_03.png";
                    }
                    if (userinfo.nicheng == null || userinfo.nicheng == "")
                    {
                        userinfo.nicheng = "未设置昵称";
                    }
                    wenzhangpinglun wenzhangpinglun = new CommentBLL().addWenZhangPingLun(wzp);
                    return(Json(new { issuf = true, wenzhangpinglun, userinfo }));
                }
            }
        }
Exemplo n.º 27
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     string commentcontent = txtcommentcontent.Text;
     DateTime modifieddate = DateTime.Now;
     int commentid = Convert.ToInt16(GridView1.SelectedValue);
     CommentBLL cl = new CommentBLL();
     int i = cl.UpdateComment(commentid,commentcontent,modifieddate);
     if (i == 1)
     {
         Response.Write("<script language='javascript'>alert('Comment has been updated !');</script>");
         GridView1.DataBind();
     }
     else
     {
         Response.Write("<script language='javascript'>alert('Comment is failed to be updated !');</script>");
         GridView1.DataBind();
     }
 }
Exemplo n.º 28
0
        protected void Accept_Edit(object sender, EventArgs e)
        {
            BO.Comment cmt = new BO.Comment();
            cmt.id      = int.Parse(Request.QueryString["id"]);
            cmt.content = content.Value;

            if (CommentBLL.editComment(cmt))
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "redirect",
                                                    "alert('Sửa bình luận thành công'); window.location='" +
                                                    Request.ApplicationPath + "Job.aspx';", true);
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "redirect",
                                                    "alert('Xảy ra lỗi'); window.location='" +
                                                    Request.ApplicationPath + "Job.aspx';", true);
            }
        }
Exemplo n.º 29
0
        public JsonResult GetById([FromForm] string token, [FromForm] int caseId)
        {
            DataResult dr = new DataResult();

            try
            {
                CaseBLL    caseBLL    = new CaseBLL();
                CaseEntity caseEntity = caseBLL.GetById(caseId);

                CommentBLL commentBLL = new CommentBLL();
                caseEntity.commentCount = commentBLL.ListByTypeAndObjId((int)Entity.TypeEnumEntity.TypeEnum.案例, caseEntity.caseId).Count();

                EndorseBLL           endorseBLL      = new EndorseBLL();
                List <EndorseEntity> endorseEntities = endorseBLL.ListByTypeAndObjId((int)Entity.TypeEnumEntity.TypeEnum.案例, caseEntity.caseId);

                caseEntity.endorseCount = endorseEntities.Count();
                UserEntity userEntity = new UserEntity();
                if (!string.IsNullOrWhiteSpace(token))
                {
                    userEntity = this.GetUserByToken(token);
                    if (endorseEntities.ToList().Exists(it => it.userId == userEntity.userId))
                    {
                        caseEntity.isEndorse = true;
                    }
                }

                CaseStepBLL caseStepBLL = new CaseStepBLL();
                caseEntity.caseStepEntities = caseStepBLL.ListByCaseId(caseEntity.caseId);

                CaseTagCorrelationBLL caseTagCorrelationBLL = new CaseTagCorrelationBLL();
                caseEntity.caseTagEntities = caseTagCorrelationBLL.CaseTagListByCaseId(caseEntity.caseId);

                dr.code = "200";
                dr.data = caseEntity;
            }
            catch (Exception ex)
            {
                dr.code = "999";
                dr.msg  = ex.Message;
            }

            return(Json(dr));
        }
Exemplo n.º 30
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        string     commentcontent = txtcommentcontent.Text;
        DateTime   modifieddate   = DateTime.Now;
        int        commentid      = Convert.ToInt16(GridView1.SelectedValue);
        CommentBLL cl             = new CommentBLL();
        int        i = cl.UpdateComment(commentid, commentcontent, modifieddate);

        if (i == 1)
        {
            Response.Write("<script language='javascript'>alert('Comment has been updated !');</script>");
            GridView1.DataBind();
        }
        else
        {
            Response.Write("<script language='javascript'>alert('Comment is failed to be updated !');</script>");
            GridView1.DataBind();
        }
    }
Exemplo n.º 31
0
        public void bindcomment(HttpContext context)
        {
            int roomId = 0;

            if (context.Request["roomId"] != null)
            {
                roomId = int.Parse(context.Request["roomId"]);
            }

            List <T_CommentModel>            list   = new CommentBLL().GetList(roomId);
            RetInfo <List <T_CommentModel> > result = new RetInfo <List <T_CommentModel> >()
            {
                Code = 0, Value = list
            };
            var serializer = new JavaScriptSerializer();
            var json       = serializer.Serialize(result);

            context.Response.ContentType = "application/json";
            context.Response.Write(json);
        }
Exemplo n.º 32
0
        private void skinButton1_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(rtfRichTextBox1.Text))
            {
                MessageBox.Show("请输入评论信息!", "系统提示");
                return;
            }
            int uid = LoginUser.UserId;
            int i   = new CommentBLL().InsertComment(uid, fid, rtfRichTextBox1.Text);

            if (i > 0)
            {
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            else
            {
                MessageBox.Show("评论添加失败!", "系统提示");
            }
        }
Exemplo n.º 33
0
        //List<SelectListItem> GetRoleItems()
        //{
        //    List<SelectListItem> ProposedReturnValue = new List<SelectListItem>();
        //    using (ContextBLL ctx = new ContextBLL())
        //    {
        //        List<RoleBLL> roles = ctx.GetRoles(0, 25);
        //        foreach (RoleBLL role in roles)
        //        {
        //            SelectListItem item = new SelectListItem();
        //            item.Value = role.RoleID.ToString();
        //            item.Text = role.RoleName;
        //            ProposedReturnValue.Add(item);
        //        }
        //    }
        //    return ProposedReturnValue;
        //}


        // GET: RegisterUser/Create
        public ActionResult Register()
        {
            RegistrationModel Model = new RegistrationModel();

            using (ContextBLL ctx = new ContextBLL())
            {
                ViewBag.Games = GetGameItems(ctx);
                UserBLL defGame = new UserBLL();
                defGame.UserID = 0;
                CommentBLL defComment = new CommentBLL();
                defComment.CommentID = 0;
                GameBLL thisGame = new GameBLL();
                //GameBLL game = ctx.FindGameByGameID(id);
                thisGame.GameID = 0;
                //CommentBLL comment = ctx.FindCommentByCommentID(id);
                //List<CommentBLL> comment = ctx.GetComments(skip, take);
                //return View(Model);
            }
            return(View(Model));
        }
Exemplo n.º 34
0
    protected void DataList1_ItemCommand(object source, DataListCommandEventArgs e)
    {
        if (e.CommandName == "Reply")
        {
            int cmid = Convert.ToInt16(e.CommandArgument.ToString());
            Label lb = (Label)e.Item.FindControl("Label4");
            if (lb.Text == "")
                Response.Write("<script language='javascript'>alert('Your comment is failed to be added !');</script>");

            else
            {
                int parentcomment = Convert.ToInt16(lb.Text);
                if (Session["Email_ID"] == null || Session["Email_ID"] == " ")
                {

                    string commentcontent = txtcommentcontent.Text;
                    DateTime published = DateTime.Now;
                    int postid = Convert.ToInt16(lblShowPostID.Text);
                    string status = "Valid";
                    CommentBLL cb = new CommentBLL();
                    int i = cb.NewComment(postid, commentcontent, published, status,parentcomment);
                    if (i == 1)
                    {
                        Response.Write("<script language='javascript'>alert('Your comment has been added !');</script>");
                        DataList1.DataBind();
                        txtcommentcontent.Text = "";

                    }
                    else
                    {
                        Response.Write("<script language='javascript'>alert('Your comment is failed to be added !');</script>");
                        DataList1.DataBind();
                        txtcommentcontent.Text = "";

                    }
                }

                else
                {
                    string emailid = Session["Email_ID"].ToString();
                    UserBLL ub = new UserBLL();
                    int userid = ub.ShowUserID(emailid);

                    string commentcontent = txtcommentcontent.Text;
                    DateTime published = DateTime.Now;
                    int postid = Convert.ToInt16(lblShowPostID.Text);
                    string status = "Valid";
                    CommentBLL cb = new CommentBLL();
                    int i = cb.NewComment(userid, postid, commentcontent, published, status,parentcomment);
                    if (i == 1)
                    {
                        Response.Write("<script language='javascript'>alert('Your comment has been added !');</script>");
                        DataList1.DataBind();
                        txtcommentcontent.Text = "";
                    }
                    else
                    {
                        Response.Write("<script language='javascript'>alert('Your comment is failed to be added !');</script>");
                        DataList1.DataBind();
                        txtcommentcontent.Text = "";

                    }

                }

            }

        }
    }