private void FullHotNewsGetGroup(string lang, int groupcate)
 {
     NewsGroupBSO newsGroupBSO = new NewsGroupBSO();
     DataTable table = newsGroupBSO.GetNewsGroupHot(lang, Convert.ToInt32(hddRecord.Value), groupcate);
     rptListHotReport.DataSource = table;
     rptListHotReport.DataBind();
 }
 private void GetNewsbyGroup(string lang, string groupCate)
 {
     var newsGroupBso = new NewsGroupBSO();
     var table = newsGroupBso.GetNewsGroupHot(lang, Convert.ToInt32(hddRecord.Value), "1",
                                              Convert.ToInt32(groupCate));
     rptNews.DataSource = table;
     rptNews.DataBind();
 }
Пример #3
0
        //private void ViewNewsResult(string keyword)
        //{
        //    NewsGroupBSO newsBSO = new NewsGroupBSO();
        //    DataTable table = newsBSO.GetNewsGroupAll(Language.language);
        //    DataView dataView = new DataView(table);
        //    string sqlSearch = "";

        //    sqlSearch = "(Title like '%" + keyword + "%' or ShortDescribe like '%" + keyword + "%') And Status =1 And IsApproval=1";

        //    dataView.RowFilter = sqlSearch;

        //    DataListCateNews.DataSource = dataView;
        //    DataListCateNews.DataBind();

        //}

        private void ViewNewsResult(string keyword)
        {
            NewsGroupBSO newsBSO = new NewsGroupBSO();
            DataTable table = newsBSO.GetNewsGroupAll(Language.language);
            DataView dataView = new DataView(table);

            if (keyword.Trim() != "")
            {

                keyword = keyword.Replace("'", "");
                string[] _keyws = keyword.Split('_');
                if (_keyws != null)
                {
                    if (_keyws.Length > 0)
                    {
                        string _finter = "";
                        foreach (string _key in _keyws)
                        {
                            _finter += " AND (Title like N'%" + _key + "%'";
                            _finter += " or ShortDescribe like N'%" + _key + "%'" + ")";
                        }
                        _finter += " And Status =1 And IsApproval=1 " + " AND Language = '" + Language.language + "'";

                        DataTable _tb = newsBSO.NewsGroupSearch(_finter);
                        if (_tb != null)
                        {
                            if (_tb.Rows.Count > 0)
                            {
                                foreach (string _key1 in _keyws)
                                {

                                    foreach (DataRow _dr in _tb.Rows)
                                    {
                                        if (_dr["Title"].ToString().Contains(_key1))
                                        {
                                            _dr["Title"] = _dr["Title"].ToString().Replace(_key1, "<font color ='Red'>" + _key1 + "</font>");

                                        }
                                        if (_dr["ShortDescribe"] != null && _dr["ShortDescribe"] != DBNull.Value)
                                        {
                                            if (_dr["ShortDescribe"].ToString().Contains(_key1))
                                            {
                                                _dr["ShortDescribe"] = HtmlRemoval.StripTagsCharArray(HttpUtility.HtmlDecode(_dr["ShortDescribe"].ToString()));
                                                _dr["ShortDescribe"] = _dr["ShortDescribe"].ToString().Replace(_key1, "<font color ='Red'>" + _key1 + "</font>");
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        DataListCateNews.DataSource = _tb;
                        DataListCateNews.DataBind();
                    }
                }
            }


        }
Пример #4
0
        private void ViewNewsGroupDetail(int Id)
        {
            CateNewsGroupBSO cateNewsgroupBSO = new CateNewsGroupBSO();
            NewsGroupBSO newsgroupBSO = new NewsGroupBSO();
            NewsGroup newsgroup = newsgroupBSO.GetNewsGroupById(Id);
            if (newsgroup == null)
                Response.Redirect("~/Default.aspx");

            ltlTitle.Text = newsgroup.Title;
            LabelDate.Text = newsgroup.PostDate.ToString("dd/MM/yyyy");// Convert.ToString(newsgroup.PostDate);
            ltlDescribe.Text = newsgroup.ShortDescribe;
            FullDescirbe.Text = newsgroup.FullDescribe;
            LabelAuthor.Text = newsgroup.Author;
            txtNewsGroupID.Value = Convert.ToString(newsgroup.NewsGroupID);
            //if (newsgroup.ImageThumb != "")
            //    ltlImageThumb.Text = @"<img src='"+ResolveUrl("~/")+"Admin/Upload/NewsGroup/NewsGroupThumb/" + newsgroup.ImageThumb + "' align='left' class='border_image' width='250'  >";
            //Page.Title = newsgroup.Title;
            if (newsgroup.FileName != "")
                ltlFile.Text = @"<a href='" + ResolveUrl("~/") + "Admin/Upload/NewsGroup/Files/" + newsgroup.FileName + "'><img src='" + ResolveUrl("~/") + "images/icon_file.png' width='30' class='icon_bullet'/> Tải File đính kèm</a>";
            newsgroupBSO.NewsGroupClickUpdate(Id);
            NewsGroupFollow(newsgroup.NewsGroupID, newsgroup.CateNewsID);

            CateNewsBSO catenewsBSO = new CateNewsBSO();
            CateNews catenews = catenewsBSO.GetCateNewsById(newsgroup.CateNewsID);
            //HyperLinkCate.NavigateUrl = "~/Default.aspx?go=cate&Id=" + catenews.CateNewsID;
            title_name.Text = "<a href='" + ResolveUrl("~/") + "Category/" + catenews.GroupCate + "/" + catenews.CateNewsID + "/" + GetString(catenews.CateNewsName) + ".aspx'>" + catenews.CateNewsName + "</a>";

            string cate = "<a href='" + ResolveUrl("~/") + "FullNews/" + catenews.GroupCate + "/" + GetString(cateNewsgroupBSO.GetCateNewsGroupByGroupCate(catenews.GroupCate).CateNewsGroupName) + ".aspx' class='content_Text_Cat'>";
            string s1 = "";
            while (catenews.ParentNewsID != 0)
            {
                int pId = catenews.ParentNewsID;
                catenews = catenewsBSO.GetCateNewsById(pId);
                s1 = "<img src='" + ResolveUrl("~/") + "images/icon_arrows1.png'><a href='" + ResolveUrl("~/") + "Category/" + catenews.GroupCate + "/" + catenews.CateNewsID + "/" + GetString(catenews.CateNewsName) + ".aspx'' class='content_Text_Cat'>" + catenews.CateNewsName + "</a> &nbsp;<img src='" + ResolveUrl("~/") + "images/icon_arrows1.png'>&nbsp;" + s1;
            }
            cate += cateNewsgroupBSO.GetCateNewsGroupByGroupCate(catenews.GroupCate).CateNewsGroupName.ToUpper(); //Sửa lại
            cate += "</a> &nbsp;<img src='" + ResolveUrl("~/") + "images/icon_arrows1.png'>";
            cate += s1;
            title_cate.Text = "<a href='" + ResolveUrl("~/") + "Default.aspx' class='content_Text_Cat'>" + String.Format(Resources.resource.Home) + "</a> &nbsp;<img src='" + ResolveUrl("~/") + "images/icon_arrows1.png'>&nbsp; ";
            title_cate.Text += cate;

            if (!String.IsNullOrEmpty(Request["error"]))
                error.Text = "<div class='error_register_text'>" + String.Format(Resources.resource.ThanksComment) + "</div>";

            if (!newsgroup.IsComment)
            {
                CommentPanel.Visible = false;
            }
            else
            {
                CommentPanel.Visible = true;
                GetNewsCommentById(Id);
            }

            Page.Title = GetString(newsgroup.Title);
        }
Пример #5
0
 protected void LoadNews(string lang)
 {
     var newsBso = new NewsGroupBSO();
     var dt = newsBso.NewsGroupMainHomeModule(lang);
     //if (dt.Rows.Count % 3 == 0)
     //{
         rptNews.DataSource = dt;
         rptNews.DataBind();
     //}
 }
        private void ViewAnnounce()
        {
            string strCate = CateParentIDArray(0);

            NewsGroupBSO newsGroupBSO = new NewsGroupBSO();

            DataTable table = newsGroupBSO.GetNewsGroupByCateIsHomeAll(10, strCate, "1", 5);

            GridView1.DataSource = table;
            GridView1.DataBind();


        }
Пример #7
0
        private void ViewNewsHot(int groupcate)
        {
            NewsGroupBSO newsGroupBSO = new NewsGroupBSO();
            DataTable table = newsGroupBSO.GetNewsGroupHot(Language.lang, 5, "1", groupcate);


            DataListCateNews.DataSource = table;
            DataListCateNews.DataBind();

            DataListNewsHot.DataSource = table;
            DataListNewsHot.DataBind();



        }
Пример #8
0
        private void ViewNews(int Id)
        {
            NewsGroupBSO newsGroupBSO = new NewsGroupBSO();
            NewsGroup newsGroup = newsGroupBSO.GetNewsGroupById(Id);
            if (newsGroup != null)
            {
                ltlTitle.Text = newsGroup.Title;
                LabelDate.Text = newsGroup.PostDate.ToString("dd/MM/yyyy");// Convert.ToString(newsGroup.PostDate);
                ltlDescribe.Text = newsGroup.ShortDescribe;
                FullDescirbe.Text = newsGroup.FullDescribe;
                LabelAuthor.Text = newsGroup.Author;

                if (newsGroup.ImageThumb != "")
                    ltlImageThumb.Text = @"<img src='" + ResolveUrl("~/") + "Upload/NewsGroup/NewsGroupThumb/" + newsGroup.ImageThumb + "' align='left' class='border_image' width='250'  >";

            }
        }
Пример #9
0
        protected void DataList1_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            DataList dtl2 = (DataList)e.Item.FindControl("DataList2");

            int cateId;
            int.TryParse(DataBinder.Eval(e.Item.DataItem, "CateNewsID").ToString(), out cateId);
            //        int cateId =   ((int)e.Item).CateNewsID;

            string strCate = GetCateParentIDArrayByID(cateId, Convert.ToInt32(hddGroupCate.Value));

            NewsGroupBSO newsGroupBSO = new NewsGroupBSO();
            DataTable table = newsGroupBSO.GetNewsGroupByCateHomeList(strCate, 5, "1", Convert.ToInt32(hddGroupCate.Value));

            DataView view = new DataView(table);
            view.Sort = "PostDate Desc";
            table = view.ToTable();

            dtl2.DataSource = table;
            dtl2.DataBind();
        }
Пример #10
0
        private void ViewNewsGroup(int group)
        {
            var newsGroupBSO = new NewsGroupBSO();
            var table = new DataTable();

            if (!Session["Admin_UserName"].Equals("administrator"))
            {
                var strCate = GetCateParentIDArrayByID(group);
                if (strCate != "")
                    table = newsGroupBSO.GetNewsGroupAll(Language.language, group, strCate);
            }
            else
            {
                if (ddlCateNewsSearch.SelectedValue == "0")
                    table = newsGroupBSO.GetNewsGroupAll(Language.language, group);
                else
                {
                    var cId = Convert.ToInt32(ddlCateNewsSearch.SelectedValue);
                    table = newsGroupBSO.NewsGroupSearch(txtKeyword.Text, cId, Language.language);
                }
            }
            var commonBSO = new commonBSO();
            commonBSO.FillToGridView(grvNewsGroup, table);
        }
Пример #11
0
 protected void btn_disable_approval_Click(object sender, EventArgs e)
 {
     if (NewsGroupID() != "")
     {
         NewsGroupBSO newsGroupBSO = new NewsGroupBSO();
         newsGroupBSO.UpdateNewsGroupApproval(NewsGroupID(), "0", Session["Admin_UserName"].ToString(), DateTime.Now);
     }
     ViewNewsGroup(Convert.ToInt32(hddGroup.Value));
 }
Пример #12
0
 protected void btn_disable_Click(object sender, EventArgs e)
 {
     if (NewsGroupID() != "")
     {
         NewsGroupBSO newsGroupBSO = new NewsGroupBSO();
         newsGroupBSO.UpdateNewsGroup(NewsGroupID(), "0");
     }
     ViewNewsGroup(Convert.ToInt32(hddGroup.Value));
 }
Пример #13
0
        protected void grvNewsGroup_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            var id = Convert.ToInt32(e.CommandArgument.ToString());
            var nName = e.CommandName.ToLower();
            var adminBSO = new AdminBSO();
            var 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/editnewsgroup/" + hddGroup.Value + "/" + id + "/Default.aspx");

                    }
                    else
                    {
                        //  Response.Redirect("~/Homepage.aspx?dll=listnewsGroup");
                    }


                    break;

                case "_move":

                    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/editnewsgroupmove/" + hddGroup.Value + "/" + id + "/Default.aspx");

                    }
                    else
                    {
                        //  Response.Redirect("~/Homepage.aspx?dll=listnewsGroup");
                    }


                    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 newsGroupBSO = new NewsGroupBSO();
                        newsGroupBSO.DeleteNewsGroup(id);
                        ViewNewsGroup(Convert.ToInt32(hddGroup.Value));

                    }
                    else
                    {
                        //  Response.Redirect("~/Homepage.aspx?dll=listnewsGroup");
                    }

                    break;
            }
        }
 protected void btn_enable_Click(object sender, ImageClickEventArgs e)
 {
     if (NewsGroupID() != "")
     {
         var newsGroupBSO = new NewsGroupBSO();
         newsGroupBSO.UpdateNewsGroup(NewsGroupID(), "1");
     }
     ViewNewsGroup(Convert.ToInt32(hddGroup.Value));
 }
Пример #15
0
        private void GetNewsGroupByCate(int cId)
        {
            CateNewsGroupBSO cateNewsgroupBSO = new CateNewsGroupBSO();

            NewsGroupBSO newsGroupBSO = new NewsGroupBSO();
            DataTable table = newsGroupBSO.GetNewsGroupByCate(cId, Language.language, "1");

            DataView view = new DataView(table);
            view.Sort = "PostDate Desc";
            table = view.ToTable();

            DataTable tableClone = table.Clone();
            DataTable tblClone = table.Clone();

            for (int j = 0; j < table.Rows.Count; j++)
            {
                if (j < 10)
                    tableClone.ImportRow(table.Rows[j]);
                else if (j < 20)
                {
                    tblClone.ImportRow(table.Rows[j]);
                    Label1.Text = "<div class='gt_title'> <div class='title_article_top'>Các tin khác</div></div>";
                }
                else
                    break;

            }
            if (table.Rows.Count > 0)
            {
                DataListCateNews.Visible = true;
                DataListCateNews.DataSource = tableClone;
                DataListCateNews.DataBind();
                CateNewsPanel.Visible = true;
                Repeater1.DataSource = tblClone;
                Repeater1.DataBind();
            }
            else
            {
                DataListCateNews.Visible = false;
                CateNewsPanel.Visible = false;
            }


            CateNewsBSO catenewsBSO = new CateNewsBSO();
            CateNews catenews = catenewsBSO.GetCateNewsById(cId);
            //HyperLinkCate.NavigateUrl = "~/Default.aspx?go=cate&Id=" + catenews.CateNewsID;


            title_name.Text = catenews.CateNewsName;

            //    Label1.Text = "<div class='gt_title'> <div class='title_article_top'>" + Literal1.Text + "</div><div class='title_article_bg'></div></div>";

            string cate = "<a href='" + ResolveUrl("~/") + "FullNews/" + catenews.GroupCate + "/" + GetString(cateNewsgroupBSO.GetCateNewsGroupByGroupCate(catenews.GroupCate).CateNewsGroupName) + "/default.aspx' class='content_Text_Cat'>";
            string s1 = "";
            while (catenews.ParentNewsID != 0)
            {
                int pId = catenews.ParentNewsID;
                catenews = catenewsBSO.GetCateNewsById(pId);
                s1 = "<a href='" + ResolveUrl("~/") + "Category/" + catenews.GroupCate + "/" + catenews.CateNewsID + "/" + GetString(catenews.CateNewsName) + "/default.aspx' class='content_Text_Cat'>" + catenews.CateNewsName + "</a> &nbsp;<img src='" + ResolveUrl("~/") + "images/icon_arrows1.png'>&nbsp;" + s1;
            }

            cate += cateNewsgroupBSO.GetCateNewsGroupByGroupCate(catenews.GroupCate).CateNewsGroupName.ToUpper(); //Sửa lại
            cate += "</a> &nbsp;<img src='" + ResolveUrl("~/") + "images/icon_arrows1.png'>";
            cate += s1;
            title_cate.Text = "<a href='" + ResolveUrl("~/") + "Default.aspx' class='content_Text_Cat'>" + Resources.resource.Home + "</a> &nbsp;<img src='" + ResolveUrl("~/") + "images/icon_arrows1.png'>&nbsp;";
            title_cate.Text += cate;

            Page.Title = GetString(cateNewsgroupBSO.GetCateNewsGroupByGroupCate(catenews.GroupCate).CateNewsGroupName);

        }
Пример #16
0
        protected void Send_Click(object sender, EventArgs e)
        {
            ccJoin.ValidateCaptcha(txtCapcha.Text.Trim());

            if (!ccJoin.UserValidated)
            {
                ErrorMess.Visible = true;
                txtCapcha.Focus();
                lblError.Text = "Mã bảo mật chưa chính xác";
                return;
            }
            else
            {
                NewsComment newsComment = ReceiveHtml();
                NewsCommentBSO newsCommentBSO = new NewsCommentBSO();
                newsCommentBSO.CreateNewsComment(newsComment);

                ConfigBSO configBSO = new ConfigBSO();
                Config config = configBSO.GetAllConfig(Language.language);

                string strBody = "Thông tin nhận xét đánh giá về bài viết trên trang Website " + config.WebName + " (" + config.WebDomain + ") : <br>";
                strBody += "<b>Tiêu đề: </b> " + newsComment.Title + "<br>";
                strBody += "<b>Họ tên khách hàng : </b> " + newsComment.FullName + "<br>";

                strBody += "<b>Email : </b> " + newsComment.Email + "<br>";
                strBody += "<b>Mã bài viết : </b> " + newsComment.NewsID + "<br>";
                strBody += "<b>Nội dung : </b> <br>" + newsComment.Content + "<br>";

                NewsGroupBSO newsBSO = new NewsGroupBSO();
                NewsGroup news = newsBSO.GetNewsGroupById(newsComment.NewsID);

                strBody += "<b>Tiêu đề bài viết : </b>  <a href='" + config.WebDomain + "/newsg/" + hddGroupCate.Value + "/" + newsComment.NewsID + "/" + GetString(news.Title) + "/default.aspx'>" + news.Title + "</a><br>";

                MailBSO mailBSO = new MailBSO();
                mailBSO.EmailFrom = newsComment.Email;

                mailBSO.EmailFrom = config.Email_from;

                string strObj = "Thông tin nhận xét về bài viết trên trang Web " + config.WebName + " (" + config.WebDomain + ") - Ngày " + DateTime.Now.ToString("dd:MM:yyyy");
                mailBSO.SendMail(config.Email_to, strObj, strBody);

                int Id = Convert.ToInt32(txtNewsGroupID.Value);
                Response.Redirect("~/newsg/" + hddGroupCate.Value + "/" + Id + "/2//default.aspx");
            }
        }
Пример #17
0
        private void NewsGroupFollow(int Id, int cId)
        {
            NewsGroupBSO newsgroupBSO = new NewsGroupBSO();
            DataTable table = newsgroupBSO.NewsGroupFollow(Id, cId, 10, "1");
            if (table.Rows.Count > 0)
                Label1.Text = "<div class='title_article_top'>" + String.Format(Resources.Resource.OtherNews) + "</div>";
            else
                Label1.Text = "";

            DataView view = new DataView(table);
            view.Sort = "PostDate Desc";
            table = view.ToTable();

            DataListNews.DataSource = table;
            DataListNews.DataBind();
        }
Пример #18
0
        protected void Send_Click(object sender, EventArgs e)
        {

            NewsComment newsComment = ReceiveHtml();
            NewsCommentBSO newsCommentBSO = new NewsCommentBSO();
            newsCommentBSO.CreateNewsComment(newsComment);

            ConfigBSO configBSO = new ConfigBSO();
            Config config = configBSO.GetAllConfig(Language.language);

            string strBody = "Thông tin nhận xét đánh giá về bài viết trên trang Website " + config.WebName + " (" + config.WebDomain + ") : <br>";
            strBody += "<b>Tiêu đề: </b> " + newsComment.Title + "<br>";
            strBody += "<b>Họ tên khách hàng : </b> " + newsComment.FullName + "<br>";

            strBody += "<b>Email : </b> " + newsComment.Email + "<br>";
            strBody += "<b>Mã bài viết : </b> " + newsComment.NewsID + "<br>";
            strBody += "<b>Nội dung : </b> <br>" + newsComment.Content + "<br>";

            NewsGroupBSO newsBSO = new NewsGroupBSO();
            NewsGroup news = newsBSO.GetNewsGroupById(newsComment.NewsID);

            strBody += "<b>Tiêu đề bài viết : </b>  <a href='" + config.WebDomain + "/News/" + hddGroupCate.Value + "/" + newsComment.NewsID + "/" + GetString(news.Title) + ".aspx'>" + news.Title + "</a><br>";

            MailBSO mailBSO = new MailBSO();
            mailBSO.EmailFrom = newsComment.Email;




            mailBSO.EmailFrom = config.Email_from;

            string strObj = "Thông tin nhận xét về bài viết trên trang Web " + config.WebName + " (" + config.WebDomain + ") - Ngày " + DateTime.Now.ToString("dd:MM:yyyy");
            mailBSO.SendMail(config.Email_to, strObj, strBody);



            int Id = Convert.ToInt32(txtNewsGroupID.Value);
            Response.Redirect("~/News/" + hddGroupCate.Value + "/" + Id + "/2/Default.aspx");


        }
Пример #19
0
 protected void btn_delall_Click(object sender, EventArgs e)
 {
     if (NewsGroupID() != "")
     {
         NewsGroupBSO newsGroupBSO = new NewsGroupBSO();
         newsGroupBSO.DeleteNewsGroup(NewsGroupID());
     }
     ViewNewsGroup(Convert.ToInt32(hddGroup.Value));
 }
        //#region ViewCateNews
        //private void ViewCateNews(int group)
        //{

        //    ddlCateNews.Items.Clear();
        //    CateNewsBSO catenewsBSO = new CateNewsBSO();
        //    DataTable table = catenewsBSO.GetCateGroupRoles(Language.language, group, Session["Admin_UserName"].ToString());
        //    commonBSO commonBSO = new commonBSO();
        //    commonBSO.FillToDropDown(ddlCateNews, table, "", "", "CateNewsName", "CateNewsID", "");
        //}
        //#endregion

        #region initControl
        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
                {
                    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.Html = newsgroup.ShortDescribe;
                    txtRadFull.Html = newsgroup.FullDescribe;
                    hddImageThumb.Value = newsgroup.ImageThumb;
                    hddImageLarge.Value = newsgroup.ImageLarge;
                    hddFileName.Value = newsgroup.FileName;

                    txtAuthor.Text = newsgroup.Author;
                    txtRadDate.SelectedDate = newsgroup.PostDate;
                    hddRelationTotal.Value = Convert.ToString(newsgroup.RelationTotal);
                    rdbStatus.SelectedValue = Convert.ToString(newsgroup.Status);
                    rdbIshot.SelectedValue = Convert.ToString(newsgroup.Ishot);
                    rdbIshome.SelectedValue = Convert.ToString(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);


                    rdbComment.SelectedValue = Convert.ToString(newsgroup.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(newsgroup.IsApproval);
                        rdbApproval.Enabled = true;
                    }
                    else
                    {
                        rdbApproval.SelectedValue = Convert.ToString(newsgroup.IsApproval);
                        rdbApproval.Enabled = false;
                    }

                    hddGroup.Value = newsgroup.GroupCate.ToString();
                    BindToCateNews(newsgroup.GroupCate);
                    ddlCateNewsGroup.SelectedValue = hddGroup.Value;
                    ddlCateNews.SelectedValue = Convert.ToString(newsgroup.CateNewsID);

                    rdbTypeNews.SelectedValue = Convert.ToString(newsgroup.TypeNews);

                }
                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;
                }

            }
        }
Пример #21
0
 protected void btn_edit_Click(object sender, EventArgs e)
 {
     try
     {
         NewsGroup newsgroup = ReceiveHtml();
         NewsGroupBSO newsgroupBSO = new NewsGroupBSO();
         newsgroupBSO.UpdateNewsGroup(newsgroup);
         clientview.Text = String.Format(Resources.StringAdmin.UpdateSuccessful, "tin", newsgroup.Title);
         //ViewCateNews(Convert.ToInt32(hddGroup.Value));
     }
     catch (Exception ex)
     {
         clientview.Text = ex.Message.ToString();
     }
 }
 protected void btn_edit_Click(object sender, EventArgs e)
 {
     try
     {
         NewsGroup newsgroup = ReceiveHtml();
         NewsGroupBSO newsgroupBSO = new NewsGroupBSO();
         newsgroupBSO.UpdateNewsGroup(newsgroup);
         clientview.Text = String.Format(Resources.StringAdmin.UpdateSuccessful, "tin", newsgroup.Title);
         Response.Redirect("~/Admin/Group/listnewsgroup/" + hddGroup.Value + "/Default.aspx");
     }
     catch (Exception ex)
     {
         clientview.Text = ex.Message.ToString();
     }
 }
        private PageView BuildPageViewContents(int cId, int group)
        {
            PageView pageView = new PageView();

            string strCate = CateParentIDArray(cId);

            NewsGroupBSO newsGroupBSO = new NewsGroupBSO();
            DataTable table = newsGroupBSO.GetNewsGroupByCateAll(strCate, group);

            DataTable table1 = table.Clone();

            DataTable table2 = table.Clone();

            if (table.Rows.Count > 0)
            {

                for (int i = 0; i < table.Rows.Count; i++)
                {
                    if (i == 0)
                        table1.ImportRow(table.Rows[i]);
                    else if (i > 0 && i < 10)
                        table2.ImportRow(table.Rows[i]);
                    else
                        break;
                }
                DataRow dataRow = table1.Rows[0];
                //HtmlTable
                HtmlTable htmlTable = new HtmlTable();
                htmlTable.Style.Value = "tab_Border_doc";
                htmlTable.CellPadding = 5;


                //Khoi tao 1 hang
                HtmlTableRow htmlRow = new HtmlTableRow();
                //Them dieu khien vao Cot thu 1
                HtmlTableCell htmlCell = new HtmlTableCell();
                htmlCell.VAlign = "top";
                htmlCell.Width = "100%";
                htmlCell.Align = "justify";
                Literal lit_img = new Literal();
                if (dataRow["ImageThumb"].ToString() != "")
                    lit_img.Text = @"<a href='" + ResolveUrl("~/") + "News/" + Convert.ToString(group) + "/" + dataRow["NewsGroupID"].ToString() + "/Default.aspx'><img src='" + ResolveUrl("~/") + "Admin/Upload/NewsGroup/NewsGroupThumb/" + dataRow["ImageThumb"].ToString() + "' vspace='1'  align='left' border='1' style='border-color:#cdcdcd; margin-right:5px ' width='100'></a>";
                else
                    lit_img.Text = "";
                HyperLink hyp = new HyperLink();
                hyp.Text = dataRow["Title"].ToString();
                hyp.NavigateUrl = "~/News/" + Convert.ToString(group) + "/" + dataRow["NewsGroupID"].ToString() + "/Default.aspx";
                hyp.CssClass = "tab_title_news";
                //Literal liter_br = new Literal();
                //liter_br.Text = @"<br/>";
                Label liter = new Label();
                liter.Text = "<div style='text-align:justify;padding-top:5px;margin-bottom:0px;'>" + dataRow["ShortDescribe"].ToString() + "</div>";
                liter.CssClass = "tab_desc_news";
                htmlCell.Controls.Add(lit_img);
                htmlCell.Controls.Add(hyp);
                //     htmlCell.Controls.Add(liter_br);
                htmlCell.Controls.Add(liter);

                //Them cot1 vao hang
                htmlRow.Cells.Add(htmlCell);
                //Thêm dòng 1 vào bảng
                htmlTable.Rows.Add(htmlRow);

                //Them hàng 2
                htmlRow = new HtmlTableRow();
                //Them dieu khien vao cot 2
                htmlCell = new HtmlTableCell();
                htmlCell.VAlign = "top";
                BulletedList bullet = new BulletedList();
                bullet.CssClass = "tab_bullet_link";
                bullet.DisplayMode = BulletedListDisplayMode.HyperLink;
                bullet.BulletStyle = BulletStyle.NotSet;
                bullet.DataSource = table2;
                bullet.DataTextField = "Title";
                bullet.DataValueField = "NewsGroupID";
                bullet.DataBind();
                foreach (ListItem items in bullet.Items)
                {
                    items.Value = "~/News/" + Convert.ToString(group) + "/" + items.Value + "/Default.aspx";
                }
                htmlCell.Controls.Add(bullet);
                //Them cot 2 vao hang
                htmlRow.Cells.Add(htmlCell);
                //Them hang vao bang 
                htmlTable.Rows.Add(htmlRow);
                //Them bang vao pageview
                pageView.Controls.Add(htmlTable);
            }
            return pageView;
        }