protected void btn_delAll_Click(object sender, EventArgs e) { if (NewsCommentID() != "") { NewsCommentBSO newsCommentBSO = new NewsCommentBSO(); newsCommentBSO.DeleteNewsComment(NewsCommentID()); } NewsCommentView(Convert.ToInt32(hddGroup.Value)); }
protected void btn_disable_Click(object sender, EventArgs e) { if (NewsCommentID() != "") { NewsCommentBSO newsCommentBSO = new NewsCommentBSO(); newsCommentBSO.UpdateNewsComment(NewsCommentID(), "0", Session["Admin_UserName"].ToString(), DateTime.Now); } NewsCommentView(Convert.ToInt32(hddGroup.Value)); }
protected void btn_edit_Click(object sender, EventArgs e) { try { NewsComment newsComment = ReceiveHtml(); NewsCommentBSO newsCommentBSO = new NewsCommentBSO(); newsCommentBSO.UpdateNewsComment(newsComment); //clientview.Text = String.Format(Resources.StringAdmin.UpdateSuccessful, "Nhận xét", newsComment.Title); clientview.Text = "<div class='alert alert-sm alert-danger bg-gradient'>Cập nhật thành công !</div>"; initControl(newsComment.CommentNewsID); } catch (Exception ex) { clientview.Text = ex.Message.ToString(); } }
protected void btn_add_Click(object sender, EventArgs e) { try { NewsComment newsComment = ReceiveHtml(); NewsCommentBSO newsCommentBSO = new NewsCommentBSO(); int id = newsCommentBSO.CreateNewsCommentGet(newsComment); // clientview.Text = String.Format(Resources.StringAdmin.AddNewsSuccessful); clientview.Text = "<div class='alert alert-sm alert-danger bg-gradient'>Thêm mới thành công !</div>"; initControl(id); } catch (Exception ex) { clientview.Text = ex.Message.ToString(); } }
protected void NewsCommentView(int group) { NewsCommentBSO newsCommentBSO = new NewsCommentBSO(); DataTable table = new DataTable(); if (hddNewsID.Value != "-1") { table = newsCommentBSO.GetAllNewsGroupComment(Convert.ToInt32(hddNewsID.Value), group); } else { table = newsCommentBSO.GetAllNewsGroupComment(group); } commonBSO commonBSO = new commonBSO(); commonBSO.FillToGridView(grvNewsComment, table); }
protected void grvNewsComment_RowCommand(object sender, GridViewCommandEventArgs e) { AdminBSO adminBSO = new AdminBSO(); Admin admin = new Admin(); int Id = Convert.ToInt32(e.CommandArgument.ToString()); string cName = e.CommandName.ToLower(); switch (cName) { case "_view": break; case "_edit": //admin = adminBSO.GetAdminById(Session["Admin_UserName"].ToString()); if (Session["Admin_UserName"].ToString().Equals("administrator") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Edit") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Write")) { Response.Redirect("~/Admin/editnewscomment/" + Id + "/Default.aspx"); } else { // Response.Redirect("~/Homepage.aspx?dll=listnews"); } break; case "_delete": //admin = adminBSO.GetAdminById(Session["Admin_UserName"].ToString()); if (Session["Admin_UserName"].ToString().Equals("administrator") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Edit") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Write")) { NewsCommentBSO newsCommentBSO = new NewsCommentBSO(); newsCommentBSO.DeleteNewsComment(Id); NewsCommentView(Convert.ToInt32(hddGroup.Value)); } else { // Response.Redirect("~/Homepage.aspx?dll=listnews"); } break; } }
private void GetNewsCommentById(int cId) { NewsCommentBSO newsCommentBSO = new NewsCommentBSO(); DataTable table = newsCommentBSO.GetNewsCommentByNewsID(cId); if (table.Rows.Count > 0) { lblComment.Text = table.Rows.Count.ToString() + " " + Resources.resource.T_Comment2; } else { lblComment.Text = ""; } DataListProductComment.DataSource = table; DataListProductComment.DataBind(); }
protected void Send_Click(object sender, EventArgs e) { NewsComment newsComment = ReceiveHtml(); if (txtCapcha.Text.ToLower() == Session["Random"].ToString().ToLower()) { NewsCommentBSO newsCommentBSO = new NewsCommentBSO(); newsCommentBSO.CreateNewsComment(newsComment); ConfigBSO configBSO = new ConfigBSO(); Config config = configBSO.GetAllConfig(Language.language); string strBody = Resources.resource.T_Comment_email_title + config.WebName + " (" + config.WebDomain + ") : <br>"; strBody += "<b>" + Resources.resource.T_Comment_Title + ": </b> " + newsComment.Title + "<br>"; strBody += "<b>" + Resources.resource.T_Comment_Name + " : </b> " + newsComment.FullName + "<br>"; strBody += "<b>" + Resources.resource.T_Comment_Email + " : </b> " + newsComment.Email + "<br>"; strBody += "<b>" + Resources.resource.T_Comment_ID + " : </b> " + newsComment.NewsID + "<br>"; strBody += "<b>" + Resources.resource.T_Comment_Content + " : </b> <br>" + newsComment.Content + "<br>"; NewsGroupBSO newsBSO = new NewsGroupBSO(); NewsGroup news = newsBSO.GetNewsGroupById(newsComment.NewsID); strBody += "<b>Title : </b> <a href='" + config.WebDomain + "/d4/news/" + GetString(news.Title) + "-" + hddGroupCate.Value + "-" + newsComment.NewsID + ".aspx'>" + news.Title + "</a><br>"; MailBSO mailBSO = new MailBSO(); mailBSO.EmailFrom = newsComment.Email; mailBSO.EmailFrom = config.Email_from; string strObj = Resources.resource.T_Comment_email_title + config.WebName + " (" + config.WebDomain + ") - Date: " + DateTime.Now.ToString("dd:MM:yyyy"); mailBSO.SendMail(config.Email_to, strObj, strBody); int Id = Convert.ToInt32(txtNewsGroupID.Value); Response.Redirect("~/d5/news/" + GetString(news.Title) + "-" + hddGroupCate.Value + "-" + Id + "-2.aspx"); } }
protected void initControl(int Id) { //txtContent.DisableFilter(Telerik.Web.UI.EditorFilters.ConvertCharactersToEntities); AdminBSO adminBSO = new AdminBSO(); Admin admin = new Admin(); if (Id > 0) { btn_add.Visible = false; btn_edit.Visible = true; btn_add1.Visible = false; btn_edit1.Visible = true; hddCommentID.Value = Convert.ToString(Id); try { NewsCommentBSO newsCommentBSO = new NewsCommentBSO(); NewsComment newsComment = newsCommentBSO.GetNewsCommentById(Id); txtTitle.Text = newsComment.Title; txtFullName.Text = newsComment.FullName; hddNewsID.Value = Convert.ToString(newsComment.NewsID); txtContent.Text = newsComment.Content; txtDateCreated.Text = String.Format("{0:dd/MM/yyyy HH:mm}", newsComment.DateCreated); //DateTime.Parse(newsgroup.PostDate.ToString()).ToString("dd/MM/yyyy hh:mm", ci); // newsgroup.PostDate.ToString(); hddPostDate.Value = String.Format("{0:dd/MM/yyyy HH:mm}", newsComment.DateCreated); // "9/3/2008 16:05:07" .ToString(); txtEmail.Text = newsComment.Email; // rdbActive.SelectedValue = newsComment.Actived.ToString(); hddGroup.Value = newsComment.GroupCate.ToString(); hddApprovalUserName.Value = newsComment.ApprovalUserName; hddApprovalDate.Value = Convert.ToString(newsComment.ApprovalDate); admin = adminBSO.GetAdminById(Session["Admin_UserName"].ToString()); if (Session["Admin_UserName"].ToString().Equals("administrator") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Approval")) { rdbActive.Checked = newsComment.Actived; rdbActive.Enabled = true; } else { rdbActive.Checked = newsComment.Actived; rdbActive.Enabled = false; } } catch (Exception ex) { clientview.Text = ex.Message.ToString(); } } else { btn_add.Visible = true; btn_edit.Visible = false; btn_add1.Visible = true; btn_edit1.Visible = false; // hddNewsID = 0; txtDateCreated.Text = String.Format("{0:dd/MM/yyyy HH:mm}", DateTime.Now); //DateTime.Parse(newsgroup.PostDate.ToString()).ToString("dd/MM/yyyy hh:mm", ci); // newsgroup.PostDate.ToString(); hddPostDate.Value = String.Format("{0:dd/MM/yyyy HH:mm}", DateTime.Now); // "9/3/2008 16:05:07" .ToString(); if (Session["Admin_UserName"].ToString().Equals("administrator") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Approval")) { rdbActive.Enabled = true; } else { rdbActive.Enabled = false; } } }