private void CompanyFollow(int Id, int cId, int gId) { CompanyBSO companyBSO = new CompanyBSO(); DataTable table = companyBSO.CompanyFollow(Id, cId, 10, gId); if (table.Rows.Count > 0) Label1.Text = "<div class='gt_title'> <div class='title_article_top'>Các tin khác</div></div>"; else Label1.Text = ""; DataListNews.DataSource = table; DataListNews.DataBind(); }
private void ViewCompanyDetail(int Id, int gId) { CompanyBSO companyBSO = new CompanyBSO(); ETO.Company company = companyBSO.GetCompanyById(Id); ltlTitle.Text = company.Title; ltlDescribe.Text = company.Description; LabelAuthor.Text = company.Author; CompanyFollow(company.CompanyID, company.Categories, gId); }
private void ViewCompany() { int group = 2; CompanyBSO companyBSO = new CompanyBSO(); DataTable table = new DataTable(); if (!Session["Admin_UserName"].Equals("administrator")) { string strCate = GetCateParentIDArrayByID(group); if (strCate != "") table = companyBSO.GetCompanyByCateHomeList(strCate); } else { table = companyBSO.GetCompanyAll(Language.language); } commonBSO commonBSO = new commonBSO(); commonBSO.FillToGridView(grvCompany, table); BindCateSearch(group); }
protected void btn_search_Click(object sender, EventArgs e) { if (txtKeyword.Text != "") { int cId = Convert.ToInt32(ddlCateNewsSearch.SelectedValue); CompanyBSO companyBSO = new CompanyBSO(); DataTable table = companyBSO.GetCompanyAll(Language.language, Convert.ToInt32(hddGroup.Value)); DataView dataView = new DataView(table); string sqlCate = ""; if (cId != 0) { sqlCate += " and Categories = " + cId; } string keySearch = "Title like '%" + txtKeyword.Text + "%' or Description like '%" + txtKeyword.Text + "%'"; keySearch += sqlCate; dataView.RowFilter = keySearch; grvCompany.DataSource = dataView; grvCompany.DataBind(); BindCateSearch(Convert.ToInt32(hddGroup.Value)); } }
protected void btn_delall_Click(object sender, EventArgs e) { if (CompanyID() != "") { CompanyBSO companyBSO = new CompanyBSO(); companyBSO.DeleteCompany(CompanyID()); } ViewCompany(Convert.ToInt32(hddGroup.Value)); }
protected void btn_disable_approval_Click(object sender, EventArgs e) { if (CompanyID() != "") { CompanyBSO companyBSO = new CompanyBSO(); companyBSO.UpdateCompany(CompanyID(), "0", Session["Admin_UserName"].ToString(), DateTime.Now); } ViewCompany(Convert.ToInt32(hddGroup.Value)); }
protected void btn_disable_Click(object sender, EventArgs e) { if (CompanyID() != "") { CompanyBSO companyBSO = new CompanyBSO(); companyBSO.UpdateCompany(CompanyID(), "0"); } ViewCompany(Convert.ToInt32(hddGroup.Value)); }
protected void grvCompany_RowCommand(object sender, GridViewCommandEventArgs e) { int Id = Convert.ToInt32(e.CommandArgument.ToString()); string cName = e.CommandName.ToLower(); AdminBSO adminBSO = new AdminBSO(); ETO.Admin admin = new ETO.Admin(); 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/editcompanygroup/" + hddGroup.Value + "/" + 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")) { CompanyBSO companyBSO = new CompanyBSO(); companyBSO.DeleteCompany(Id); ViewCompany(Convert.ToInt32(hddGroup.Value)); } else { // Response.Redirect("~/Homepage.aspx?dll=listnews"); } break; case "_default": 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")) { CompanyBSO companyBSO = new CompanyBSO(); companyBSO.UpdateSetDefault(Id, Convert.ToInt32(hddGroup.Value)); companyBSO.UpdateSetNotDefault(Id, Convert.ToInt32(hddGroup.Value)); ViewCompany(Convert.ToInt32(hddGroup.Value)); } else { // Response.Redirect("~/Homepage.aspx?dll=listnews"); } break; } }
protected void btn_delall_Click(object sender, EventArgs e) { if (CompanyID() != "") { CompanyBSO companyBSO = new CompanyBSO(); companyBSO.DeleteCompany(CompanyID()); } ViewCompany(); }
protected void btn_enable_approval_Click(object sender, EventArgs e) { if (CompanyID() != "") { CompanyBSO companyBSO = new CompanyBSO(); companyBSO.UpdateCompany(CompanyID(), "1", Session["Admin_UserName"].ToString(), DateTime.Now); } ViewCompany(); }
protected void btn_disable_Click(object sender, EventArgs e) { if (CompanyID() != "") { CompanyBSO companyBSO = new CompanyBSO(); companyBSO.UpdateCompany(CompanyID(), "0"); } ViewCompany(); }
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 { CompanyBSO companyBSO = new CompanyBSO(); Company company = companyBSO.GetCompanyById(Id); hddCompanyID.Value = Convert.ToString(company.CompanyID); ddlCategories.SelectedValue = Convert.ToString(company.Categories); txtTitle.Text = company.Title; txtRadDescription.Html = company.Description; txtAuthor.Text = company.Author; rdbIsNormal.SelectedValue = Convert.ToString(company.IsNormal); rdbIsHot.SelectedValue = Convert.ToString(company.IsHot); hddCommentTotal.Value = Convert.ToString(company.CommentTotal); hddVisitTotal.Value = Convert.ToString(company.VisitTotal); hddCreateUserName.Value = company.CreatedUserName; hddApprovalUserName.Value = company.ApprovalUserName; hddApprovalDate.Value = Convert.ToString(company.ApprovalDate); hddCreatedDate.Value = Convert.ToString(company.CreatedDate); rdbComment.SelectedValue = Convert.ToString(company.IsComment); rdbIsDefault.SelectedValue = Convert.ToString(company.IsDefault); 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(company.IsApproval); rdbApproval.Enabled = true; } else { rdbApproval.SelectedValue = Convert.ToString(company.IsApproval); rdbApproval.Enabled = false; } hddGroupCate.Value = company.GroupCate.ToString(); } catch (Exception ex) { clientview.Text = ex.Message.ToString(); } } else { 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_add_Click(object sender, ImageClickEventArgs e) { try { Company company = ReceiveHtml(); CompanyBSO companyBSO = new CompanyBSO(); companyBSO.CreateCompany(company); clientview.Text = String.Format(Resources.StringAdmin.AddNewsSuccessful); ViewCateCompany(Convert.ToInt32(hddGroupCate.Value)); } catch (Exception ex) { clientview.Text = ex.Message.ToString(); } }
protected void btn_edit_Click(object sender, ImageClickEventArgs e) { try { Company company = ReceiveHtml(); CompanyBSO companyBSO = new CompanyBSO(); companyBSO.UpdateCompany(company); clientview.Text = String.Format(Resources.StringAdmin.UpdateSuccessful, "Thong tin", company.Title); ViewCateCompany(); } catch (Exception ex) { clientview.Text = ex.Message.ToString(); } }