private void Page_Load(object sender, System.EventArgs e) { //로그인되었는지 확인 KistelSite.Admins.CompanyMgr.Staffs.LoginProcess.LoginOK(); // 여기에 사용자 코드를 배치하여 페이지를 초기화합니다. db = Request.QueryString["db"]; cid = int.Parse(Request.QueryString["cid"]); if (!Page.IsPostBack) { //CommentBiz objComment = new CommentBiz(db+"Comment", cid); BrdsCmtBiz objComment = new BrdsCmtBiz(db + "Comment", cid); //if (Context.User.Identity.Name == objComment.UserID) if (Cookie.Self["staff_id"] == objComment.UserID) { Comment.Text = objComment.Comment; } else { ClientAction.ShowMsgAndClose("정상적인 접근이 아닙니다"); //ErrorLogin("?db="+db+"&cid="+cid); } } }
private void CommentButton_Click(object sender, System.Web.UI.ImageClickEventArgs e) { string userID, userName; int result; if (Comment.Text.Length > 0) { //if(Context.User.Identity.IsAuthenticated) //{ BrdsCmtBiz objComment = new BrdsCmtBiz(db + "Comment"); //SiteIdentity currUser = (SiteIdentity)Context.User.Identity; userName = Cookie.Self["sName"]; //currUser.NickName; userID = Cookie.Self["staff_id"]; //currUser.UserID; result = objComment.Insert(id, userID, userName, Server.HtmlEncode(Comment.Text)); if (result == 1) { Response.Redirect("ForumView.aspx?db=" + db + "&id=" + id + "&pageno=" + pageNo); } else { ClientAction.ShowMsgBack("등록에 실패하였습니다."); } //} //else //{ // ErrorLogin("?db=" + db + "&id=" + id + "&pageno=" + pageNo); //} } }
private void CommentListBind() { // 코멘트 목록 바인딩 BrdsCmtBiz objComment = new BrdsCmtBiz(db + "Comment"); CommentList.DataSource = objComment.GetBoardList(id); CommentList.DataBind(); }
private void EditButton_Click(object sender, System.Web.UI.ImageClickEventArgs e) { //SiteIdentity currUser = (SiteIdentity)Context.User.Identity; if (IsValid) { //CommentBiz objComment = new CommentBiz(db+"Comment"); BrdsCmtBiz objComment = new BrdsCmtBiz(db + "Comment"); //if (Context.User.Identity.IsAuthenticated) //objComment.Update(cid, currUser.UserID, currUser.UserName, Comment.Text); objComment.Update(cid, Cookie.Self["staff_id"], Cookie.Self["sName"], Comment.Text); ClientAction.ReloadOpenerClose(); } }
private void Page_Load(object sender, System.EventArgs e) { //로그인되었는지 확인 KistelSite.Admins.CompanyMgr.Staffs.LoginProcess.LoginOK(); // 여기에 사용자 코드를 배치하여 페이지를 초기화합니다. //if(Context.User.Identity.IsAuthenticated) //{ if (Request.QueryString["db"] == null) { ClientAction.ShowMsgBack("테이블명이 없습니다. 다시 접속하십시오."); } else { db = Request.QueryString["db"]; } id = int.Parse(Request.QueryString["id"]); cid = int.Parse(Request.QueryString["cid"]); pageNo = int.Parse(Request.QueryString["pageno"]); //CommentBiz objComment = new CommentBiz(db+"Comment", cid); BrdsCmtBiz objComment = new BrdsCmtBiz(db + "Comment", cid); //Response.Write("--> " + objComment.UserID); //if (objComment.UserID == Context.User.Identity.Name) if (objComment.UserID == Cookie.Self["staff_id"]) { int rowsAffected = objComment.Delete(cid); if (rowsAffected == 1) { Response.Redirect("ForumView.aspx?db=" + db + "&id=" + id + "&pageno=" + pageNo); } else { ClientAction.ShowMsgBack("코멘트 삭제에 실패하였습니다."); } } //} }
protected string GetCommentCount(int id) { int commentCount; string retVal; BrdsCmtBiz objComment = new BrdsCmtBiz(db + "Comment"); commentCount = objComment.GetBoardRecordCount(id); // <---------- 문제 if (commentCount == 0) { retVal = ""; } else { retVal = "(" + commentCount.ToString() + ")"; } return(retVal); }