protected void grvNewsLog_RowCommand(object sender, GridViewCommandEventArgs e) { int Id = Convert.ToInt32(e.CommandArgument.ToString()); NewsLogBSO newsLogBSO = new NewsLogBSO(); NewsLog newslog = newsLogBSO.GetNewsLogById(Id); string nName = e.CommandName.ToLower(); AdminBSO adminBSO = new AdminBSO(); Admin admin = new Admin(); switch (nName) { case "_view": break; case "_edit": if (Session["Admin_UserName"].ToString().Equals("administrator") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Edit") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Write")) { // Response.Redirect("~/Admin/editnewslog/" + Id + "/Default.aspx"); Response.Redirect("~/Admin/s/EditNewsbyUser/" + hddNewsGroupID.Value + "/" + Id + "/Default.aspx"); } break; case "_delete": if (Session["Admin_UserName"].ToString().Equals("administrator") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Edit") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Write")) { newsLogBSO.DeleteNewsLog(Id, -1); ViewNewsLog(Convert.ToInt32(hddNewsGroupID.Value)); AspNetCache.Reset(); } break; } }
protected void Page_Load(object sender, EventArgs e) { if (!string.IsNullOrEmpty(Request["dll"])) { NavigationTitle(Request["dll"]); } AdminBSO adminBSO = new AdminBSO(); //Admin admin = new Admin(); //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")) { btn_editpage.Visible = true; btn_enable.Visible = true; btn_disable.Visible = true; btn_delall.Visible = true; } else { btn_editpage.Visible = false; btn_enable.Visible = false; btn_disable.Visible = false; btn_delall.Visible = false; } if (Session["Admin_UserName"].ToString().Equals("administrator") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Approval")) { btn_enable_approval.Visible = true; btn_disable_approval.Visible = true; } else { btn_enable_approval.Visible = false; btn_disable_approval.Visible = false; } int group = -1; //if (!String.IsNullOrEmpty(Request["group"])) // if (!int.TryParse(Request["group"].Replace(",", ""), out group)) // Response.Redirect("~/Admin/home/Default.aspx"); hddGroup.Value = Convert.ToString(group); if (!IsPostBack) { BindControl(group); ViewNewsGroup(group); } }
protected void Page_Load(object sender, EventArgs e) { if (!string.IsNullOrEmpty(Request["dll"])) { NavigationTitle(Request["dll"]); } AdminBSO adminBSO = new AdminBSO(); //Admin admin = new Admin(); //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")) { btn_editpage.Visible = true; btn_delall.Visible = true; } else { btn_editpage.Visible = false; btn_delall.Visible = false; } int group = -1; hddGroup.Value = Convert.ToString(group); if (!IsPostBack) { BindControl(group); ViewNewsGroup(group); } }
protected void grvNewsComment_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { LinkButton image_del = (LinkButton)e.Row.FindControl("btn_delete"); // image_del.Attributes.Add("onclick", "return confirm('Bạn có chắc chắn muốn xóa?');"); LinkButton image_edit = (LinkButton)e.Row.FindControl("btn_edit"); LinkButton image_view = (LinkButton)e.Row.FindControl("btn_view"); image_view.Attributes.Add("onclick", "javascript:window.open('" + ResolveUrl("~/") + "Client/Admin/NewsFlow/ViewNewsComment.aspx?Id=" + DataBinder.Eval(e.Row.DataItem, "NewsGroupID") + "','_blank','width=800,height=600');return false;"); AdminBSO adminBSO = new AdminBSO(); //Admin admin = new Admin(); //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")) { image_del.Attributes.Add("onclick", "javascript:return confirm('Bạn có muốn chắc chắn xóa ???');"); } else { image_edit.Attributes.Add("onclick", "javascript:return confirm('Bạn không có đủ quyền ???');"); image_del.Attributes.Add("onclick", "javascript:return confirm('Bạn không có đủ quyền ???');"); } } }
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 initControl(int Id) { AdminBSO adminBSO = new AdminBSO(); Admin admin = new Admin(); if (Id > 0) { btn_add.Visible = false; btn_edit.Visible = true; btn_add2.Visible = false; btn_add1.Visible = false; btn_edit1.Visible = true; try { NewsGroup newsgroup = new NewsGroup(); NewsGroupBSO newsgroupBSO = new NewsGroupBSO(); newsgroup = newsgroupBSO.GetNewsGroupById(Id); hddNewsGroupID.Value = Convert.ToString(newsgroup.NewsGroupID); ddlCateNews.SelectedValue = Convert.ToString(newsgroup.CateNewsID); hddParentNewsID.Value = Convert.ToString(newsgroup.ParentNewsID); //rdbGroupCate.SelectedValue = Convert.ToString(newsgroup.GroupCate); //Thêm txtTitle.Text = newsgroup.Title; txtRadShort.Text = System.Net.WebUtility.HtmlDecode(newsgroup.ShortDescribe); txtRadFull.Text = newsgroup.FullDescribe; hddImageThumb.Value = newsgroup.ImageThumb; hddImageLarge.Value = newsgroup.ImageLarge; txtimage4_3.Text = newsgroup.ImageThumb; txtimage16_9.Text = newsgroup.ImageLarge; if (newsgroup.ImageThumb != "") { img_thumb.Text = "<img src='" + newsgroup.ImageThumb + "' width='48px' valign='middle'>"; } if (newsgroup.ImageLarge != "") { img_large.Text = "<img src='" + newsgroup.ImageLarge + "' width='48px' valign='middle'>"; } hddFileName.Value = newsgroup.FileName; txtAuthor.Text = newsgroup.Author; txtRadDate.Text = String.Format("{0:dd/MM/yyyy HH:mm}", newsgroup.PostDate); //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}", newsgroup.PostDate); // "9/3/2008 16:05:07" .ToString(); hddRelationTotal.Value = Convert.ToString(newsgroup.RelationTotal); rdbStatus.Checked = newsgroup.Status; rdbIshot.Checked = newsgroup.Ishot; rdbIshome.Checked = newsgroup.Ishome; hddCommentTotal.Value = Convert.ToString(newsgroup.CommentTotal); hddIsView.Value = Convert.ToString(newsgroup.Isview); hddCreateUserName.Value = newsgroup.CreatedUserName; hddApprovalUserName.Value = newsgroup.ApprovalUserName; hddApprovalDate.Value = Convert.ToString(newsgroup.ApprovalDate); txtKeywords.Text = newsgroup.Keyword; txtTags.Text = newsgroup.Tags; txtSlug.Text = newsgroup.Slug; rdbComment.Checked = newsgroup.IsComment; rdbApproval.Checked = newsgroup.IsApproval; if (Session["Admin_UserName"].ToString().Equals("administrator") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Approval")) { rdbApproval.Enabled = true; } else { rdbApproval.Enabled = false; } //admin = adminBSO.GetAdminById(Session["Admin_UserName"].ToString()); //if (Session["Admin_UserName"].ToString().Equals("administrator") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Approval")) //{ // rdbApproval.Checked = newsgroup.IsApproval; // rdbApproval.Enabled = true; //} //else //{ // rdbApproval.Checked = newsgroup.IsApproval; // rdbApproval.Enabled = false; //} hddGroup.Value = newsgroup.GroupCate.ToString(); BindToCateNews(newsgroup.GroupCate); ddlCateNewsGroup.SelectedValue = hddGroup.Value; ddlCateNews.SelectedValue = Convert.ToString(newsgroup.CateNewsID); rdbTypeNews.Checked = newsgroup.TypeNews; txtShortTitle.Text = newsgroup.ShortTitle; chkUrl.Checked = newsgroup.isUrl; txtUrl.Text = newsgroup.Url; if (newsgroup.isUrl) { txtUrl.Visible = true; panelUrl.Visible = true; } else { txtUrl.Visible = false; panelUrl.Visible = false; } hddisDelete.Value = newsgroup.isDelete.ToString(); BindListCate(newsgroup.NewsGroupID); //MultiCate ViewNewsLog(newsgroup.NewsGroupID); } catch (Exception ex) { clientview.Text = ex.Message.ToString(); } } else { txtRadDate.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(); txtUrl.Visible = false; btn_add.Visible = true; btn_edit.Visible = false; btn_add2.Visible = true; btn_add1.Visible = true; btn_edit1.Visible = false; if (Session["Admin_UserName"].ToString().Equals("administrator") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Approval")) { rdbApproval.Enabled = true; } else { rdbApproval.Enabled = false; } txtUrl.Visible = false; panelUrl.Visible = false; chkUrl.Checked = false; } }
protected void grvNewsGroup_RowCommand(object sender, GridViewCommandEventArgs e) { int Id = Convert.ToInt32(e.CommandArgument.ToString()); NewsGroupBSO newsGroupBSO = new NewsGroupBSO(); NewsGroup newsgroup = newsGroupBSO.GetNewsGroupById(Id); string nName = e.CommandName.ToLower(); AdminBSO adminBSO = new AdminBSO(); Admin admin = new Admin(); switch (nName) { case "_listfiles": //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/listnewsfiles/" + Id + "/Default.aspx"); } break; case "_addfiles": //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/editnewsfiles/" + Id + "/0/Default.aspx"); } break; case "_relation": //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/EditNewsRelation/" + Id + "/Default.aspx"); } break; 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/editnewsbyuser/" + Id + "/Default.aspx"); } 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")) { //newsGroupBSO.DeleteNewsGroup(Id); newsGroupBSO.UpdateNewsGroupisDelete(Id, "1"); ViewNewsGroup(Convert.ToInt32(ddlCateNewsGroup.SelectedValue)); //NewsCateBSO newscateBSO = new NewsCateBSO(); //if (newscateBSO.GetNewsCateByNewsGroupID(Id).Rows.Count > 0) // newscateBSO.DeleteNewsCatebyNewsID(Id); AspNetCache.Reset(); } break; case "_approved": //admin = adminBSO.GetAdminById(Session["Admin_UserName"].ToString()); if (Session["Admin_UserName"].ToString().Equals("administrator") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Approval")) { newsGroupBSO.UpdateNewsGroupApproval(Id, "1", Session["Admin_Username"].ToString(), DateTime.Now); ViewNewsGroup(Convert.ToInt32(ddlCateNewsGroup.SelectedValue)); AspNetCache.Reset(); } break; case "_approvedcomment": break; } }
protected void Page_Load(object sender, EventArgs e) { if (!string.IsNullOrEmpty(Request["dll"])) { NavigationTitle(Request["dll"]); } int group = -1; if (!String.IsNullOrEmpty(Request["group"])) { int.TryParse(Request["group"].Replace(",", ""), out group); } hddGroup.Value = Convert.ToString(group); int Id = -1; if (!String.IsNullOrEmpty(Request["Id"])) { int.TryParse(Request["Id"].Replace(",", ""), out Id); } hddNewsID.Value = Convert.ToString(Id); // ltllistnews.Text = "<asp:HyperLink ID='btn_listnews' runat='server' NavigateUrl='~/Homepage.aspx?dll=" + ((group == 1) ? "listnews" : "listannounce") + "'><img src='Admin_Theme/Icons/icon-danhsach.gif' /></asp:HyperLink>"; // ltleditcomment.Text = "<asp:HyperLink ID='btn_editnewscomment' runat='server' NavigateUrl='~/Homepage.aspx?dll=editnewscomment&group=" + Convert.ToString(group) + "' ><img src='Admin_Theme/Icons/icon-taomoi-small.gif' /></asp:HyperLink>"; AdminBSO adminBSO = new AdminBSO(); //Admin admin = new Admin(); //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")) { btn_editpage.Visible = true; btn_delall.Visible = true; } else { btn_editpage.Visible = false; btn_delall.Visible = false; } if (Session["Admin_UserName"].ToString().Equals("administrator") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Approval")) { btn_enable.Visible = true; btn_disable.Visible = true; } else { btn_enable.Visible = false; btn_disable.Visible = false; } if (!IsPostBack) { NewsCommentView(group); } }
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; } } }