private void ViewNew(int Id) { NewsBSO newsBSO = new NewsBSO(); News news = newsBSO.GetNewsById(Id); ltlTitle.Text = news.Title; LabelDate.Text = news.PostDate.ToString("dd/MM/yyyy");// Convert.ToString(news.PostDate); ltlDescribe.Text = news.ShortDescribe; FullDescirbe.Text = news.FullDescribe; LabelAuthor.Text = news.Author; if (news.ImageThumb != "") ltlImageThumb.Text = @"<img src='../../Upload/News/NewsThumb/" + news.ImageThumb + "' align='left' class='border_image' width='250' >"; }
private void ViewNews() { int group = 1; NewsBSO newsBSO = new NewsBSO(); DataTable table = new DataTable(); if (!Session["Admin_UserName"].Equals("administrator")) { string strCate = GetCateParentIDArrayByID(group); if (strCate != "") table = newsBSO.GetNewsByCateHomeList(strCate); } else { table = newsBSO.GetNewsAll(Language.language); } commonBSO commonBSO = new commonBSO(); commonBSO.FillToGridView(grvNews, table); BindCateSearch(group); }
private void initControl(int Id) { AdminBSO adminBSO = new AdminBSO(); ETO.Admin admin = new ETO.Admin(); if (Id > 0) { btn_add.Visible = false; btn_edit.Visible = true; try { News news = new News(); NewsBSO newsBSO = new NewsBSO(); news = newsBSO.GetNewsById(Id); hddNewsID.Value = Convert.ToString(news.NewsID); ddlCateNews.SelectedValue = Convert.ToString(news.CateNewsID); hddParentNewsID.Value = Convert.ToString(news.ParentNewsID); txtTitle.Text = news.Title; txtRadShort.Html = news.ShortDescribe; txtRadFull.Html = news.FullDescribe; hddImageThumb.Value = news.ImageThumb; hddImageLarge.Value = news.ImageLarge; txtAuthor.Text = news.Author; txtRadDate.SelectedDate = news.PostDate; hddRelationTotal.Value = Convert.ToString(news.RelationTotal); rdbStatus.SelectedValue = Convert.ToString(news.Status); rdbIshot.SelectedValue = Convert.ToString(news.Ishot); rdbIshome.SelectedValue = Convert.ToString(news.Ishome); hddCommentTotal.Value = Convert.ToString(news.CommentTotal); hddIsView.Value = Convert.ToString(news.Isview); hddCreateUserName.Value = news.CreatedUserName; hddApprovalUserName.Value = news.ApprovalUserName; hddApprovalDate.Value = Convert.ToString(news.ApprovalDate); rdbComment.SelectedValue = Convert.ToString(news.IsComment); admin = adminBSO.GetAdminById(Session["Admin_UserName"].ToString()); if (Session["Admin_UserName"].ToString().Equals("administrator") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Approval")) { rdbApproval.SelectedValue = Convert.ToString(news.IsApproval); rdbApproval.Enabled = true; } else { rdbApproval.SelectedValue = Convert.ToString(news.IsApproval); rdbApproval.Enabled = false; } } catch (Exception ex) { clientview.Text = ex.Message.ToString(); } } else { txtRadDate.SelectedDate = DateTime.Now; btn_add.Visible = true; btn_edit.Visible = false; if (Session["Admin_UserName"].ToString().Equals("administrator") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Approval")) { rdbApproval.Enabled = true; } else { rdbApproval.Enabled = false; } } }
protected void btn_edit_Click(object sender, EventArgs e) { try { News news = ReceiveHtml(); NewsBSO newsBSO = new NewsBSO(); newsBSO.UpdateNews(news); clientview.Text = String.Format(Resources.StringAdmin.UpdateSuccessful, "tin", news.Title); ViewCateNews(); } catch (Exception ex) { clientview.Text = ex.Message.ToString(); } }
protected void btn_add_Click(object sender, EventArgs e) { try { News news = ReceiveHtml(); NewsBSO newsBSO = new NewsBSO(); newsBSO.CreateNews(news); clientview.Text = String.Format(Resources.StringAdmin.AddNewsSuccessful); ViewCateNews(); } catch (Exception ex) { clientview.Text = ex.Message.ToString(); } }
protected void btn_search_Click(object sender, EventArgs e) { if (txtKeyword.Text != "") { int cId = Convert.ToInt32(ddlCateNewsSearch.SelectedValue); NewsBSO newsBSO = new NewsBSO(); DataTable table = newsBSO.NewsSearch(txtKeyword.Text, cId, Language.language); commonBSO commonBSO = new commonBSO(); commonBSO.FillToGridView(grvNews, table); BindCateSearch(1); } }
protected void btn_delall_Click(object sender, EventArgs e) { if (NewsID() != "") { NewsBSO newsBSO = new NewsBSO(); newsBSO.DeleteNews(NewsID()); } ViewNews(); }
protected void btn_disable_approval_Click(object sender, EventArgs e) { if (NewsID() != "") { NewsBSO newsBSO = new NewsBSO(); newsBSO.UpdateNewsApproval(NewsID(), "0", Session["Admin_UserName"].ToString(), DateTime.Now); } ViewNews(); }
protected void btn_disable_Click(object sender, EventArgs e) { if (NewsID() != "") { NewsBSO newsBSO = new NewsBSO(); newsBSO.UpdateNews(NewsID(), "0"); } ViewNews(); }
protected void grvNews_RowCommand(object sender, GridViewCommandEventArgs e) { int Id = Convert.ToInt32(e.CommandArgument.ToString()); string nName = e.CommandName.ToLower(); AdminBSO adminBSO = new AdminBSO(); ETO.Admin admin = new ETO.Admin(); switch (nName) { 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/editnews/" + 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")) { NewsBSO newsBSO = new NewsBSO(); newsBSO.DeleteNews(Id); ViewNews(); } else { // Response.Redirect("~/Homepage.aspx?dll=listnews"); } break; } }