private void ViewDetailOfficial(int Id)
        {
            OfficialBSO officialBSO = new OfficialBSO();
            ETO.Official official = officialBSO.GetOfficialById(Id);
            litNoCode.Text = official.NoCode;
            litOfficialName.Text = official.OfficialName;
            litDatePublic.Text = official.DatePublic.ToString("dd/MM/yyyy");// Convert.ToString(official.DatePublic);
            litCompany.Text = official.Company;
            litClassify.Text = official.Classify;
            litWriter.Text = official.Writer;
            litQuote.Text = official.Quote;
            litKeyShort.Text = official.KeyShort;
            if (official.Attached != "")
            {
                litAttached.Text = "<a href='" + ResolveUrl("~/") + "Admin/Upload/Files/" + official.Attached + "'>Tải về</a>";
            }

            OfficialFileBSO officialFileBSO = new OfficialFileBSO();
            DataTable tableFile = officialFileBSO.GetOfficialFileByOfficial(official.OfficialID);
            if (tableFile.Rows.Count > 0)
            {
                Repeater1.DataSource = tableFile;
                Repeater1.DataBind();
            }


            OfficialFollow(official.OfficialID, official.CateOfficialID);
            //Page.Title = "Thủy điện Sơn La : " + GetString(official.OfficialName);
            Page.Title = GetString(official.OfficialName);
        }
 private void FullNewsGet(string lang)
 {
     OfficialBSO officialBSO = new OfficialBSO();
     DataTable table = officialBSO.GetOfficialNews(10);
     GridView1.DataSource = table;
     GridView1.DataBind();
 }
        private void ViewNavigator(int Id)
        {
            CateNewsGroupBSO cateNewsgroupBSO = new CateNewsGroupBSO();
            OfficialBSO officialBSO = new OfficialBSO();
            ETO.Official official = officialBSO.GetOfficialById(Id);

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

            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;
        }
 private void GetOfficialByCate(int Id)
 {
     OfficialBSO officialBSO = new OfficialBSO();
     DataTable table = officialBSO.GetOfficialByCate(Id, "1");
     GridView1.DataSource = table;
     GridView1.DataBind();
 }
        private void GetOfficial(int groupcate)
        {
            OfficialBSO officialBSO = new OfficialBSO();
            DataTable table = officialBSO.GetOfficialNews(groupcate, "1");
            GridView1.DataSource = table;
            GridView1.DataBind();

            CateNewsBSO cateNewsBSO = new CateNewsBSO();
            DataTable table1 = cateNewsBSO.getCateClientGroup(0, Language.language, Convert.ToInt32(hddValue.Value), 3);


            rptCateNews.DataSource = table1;
            rptCateNews.DataBind();
        }
        protected void DataList1_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            GridView dtl2 = (GridView)e.Item.FindControl("GridView1");

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

            string strCate = GetCateParentIDArrayByID(cateId);

            OfficialBSO officeBSO = new OfficialBSO();
            DataTable table = officeBSO.GetOfficialByCateHomeList(strCate, 5, "1");

            dtl2.DataSource = table;
            dtl2.DataBind();
        }
        private void ViewOfficial()
        {
            int group = 4;
            OfficialBSO officialBSO = new OfficialBSO();
            DataTable table = new DataTable();

            if (!Session["Admin_UserName"].Equals("administrator"))
            {
                string strCate = GetCateParentIDArrayByID(group);
                if (strCate != "")
                    table = officialBSO.GetOfficialByCateHomeList(strCate);
            }
            else
            {
                table = officialBSO.GetOfficialAll();
            }

            commonBSO commonBSO = new commonBSO();
            commonBSO.FillToGridView(grvOfficial, table);
            BindCateSearch(group);
        }
        private void initControl(int Id)
        {
            if (Id > 0)
            {
                btn_add.Visible = false;
                btn_edit.Visible = true;
                try
                {
                    OfficialBSO officialBSO = new OfficialBSO();
                    Official official = officialBSO.GetOfficialById(Id);
                    hddOfficialID.Value = Convert.ToString(official.OfficialID);
                    hddfile_attached.Value = official.Attached;
                    ddlCateNews.SelectedValue = Convert.ToString(official.CateOfficialID);
                    txtNoCode.Text = official.NoCode;
                    txtOfficialName.Text = official.OfficialName;
                    txtRadDate.SelectedDate = official.DatePublic;
                    txtCompany.Text = official.Company;
                    txtClassify.Text = official.Classify;
                    txtAuthor.Text = official.Writer;
                    txtQuote.Html = official.Quote;
                    txtKeyShort.Text = official.KeyShort;
                    rdbStatus.SelectedValue = Convert.ToString(official.Status);

                }
                catch (Exception ex)
                {
                    clientview.Text = ex.Message.ToString();
                }

            }
            else
            {
                txtRadDate.SelectedDate = DateTime.Now;
                btn_add.Visible = true;
                btn_edit.Visible = false;
            }
        }
 protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
 {
     GridView1.PageIndex = e.NewPageIndex;
     OfficialBSO officialBSO = new OfficialBSO();
     ETO.Official official = officialBSO.GetOfficialById(Convert.ToInt32(hddID.Value));
     OfficialFollow(official.OfficialID, official.CateOfficialID);
 }
 protected void btn_search_Click(object sender, EventArgs e)
 {
     if (txtKeyword.Text != "")
     {
         int cId = Convert.ToInt32(ddlCateNewsSearch.SelectedValue);
         OfficialBSO officialBSO = new OfficialBSO();
         DataTable table = officialBSO.OfficialSearch(txtKeyword.Text, cId, Language.language);
         commonBSO commonBSO = new commonBSO();
         commonBSO.FillToGridView(grvOfficial, table);
         BindCateSearch(4);
     }
 }
 protected void btn_delall_Click(object sender, EventArgs e)
 {
     if (OfficialID() != "")
     {
         OfficialBSO officialBSO = new OfficialBSO();
         officialBSO.DeleteOfficial(OfficialID());
     }
     ViewOfficial();
 }
 protected void btn_disable_approval_Click(object sender, EventArgs e)
 {
     if (OfficialID() != "")
     {
         OfficialBSO officialBSO = new OfficialBSO();
         officialBSO.UpdateOfficial(OfficialID(), "0", Session["Admin_UserName"].ToString(), DateTime.Now);
     }
     ViewOfficial();
 }
        protected void grvOfficial_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 "_listfiles":
                    Response.Redirect("~/Admin/listofficialfiles/" + Id + "/Default.aspx");
                    break;

                case "_addfiles":
                    Response.Redirect("~/Admin/editofficialfiles/" + Id + "/0/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/editofficial/" + Id + "/Default.aspx");

                    }
                    else
                    {
                        //  Response.Redirect("~/Admin/Default.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"))
                    {
                        OfficialBSO officialBSO = new OfficialBSO();
                        officialBSO.DeleteOfficial(Id);
                        ViewOfficial(); ;

                    }
                    else
                    {
                        //  Response.Redirect("~/Admin/Default.aspx?dll=listnews");
                    }

                    break;
            }
        }
Exemple #14
0
 public DataTable OfficialSearch(string keyword, int cId, string lang)
 {
     OfficialBSO officialDAO = new OfficialBSO();
     return officialDAO.OfficialSearch(keyword, cId, lang);
 }
        protected void btn_add_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                Official official = ReceiveHtml();
                OfficialBSO officialBSO = new OfficialBSO();
                officialBSO.CreateOfficial(official);
                clientview.Text = String.Format(Resources.StringAdmin.AddNewsSuccessful);

            }
            catch (Exception ex)
            {
                clientview.Text = ex.Message.ToString();
            }
        }
        protected void btn_edit_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                Official official = ReceiveHtml();
                OfficialBSO officialBSO = new OfficialBSO();
                officialBSO.UpdateOfficial(official);
                clientview.Text = String.Format(Resources.StringAdmin.UpdateSuccessful, "Van ban", official.OfficialName);

            }
            catch (Exception ex)
            {
                clientview.Text = ex.Message.ToString();
            }
        }
        private void OfficialFollow(int Id, int cId)
        {
            OfficialBSO officialBSO = new OfficialBSO();
            DataTable table = officialBSO.OfficialFollow(Id, cId, "1");
            if (table.Rows.Count > 0)
                Label1.Text = "<div class='gt_title'> <div class='title_article_top'>Các văn bản khác</div></div>";
            else
                Label1.Text = "";

            GridView1.DataSource = table;
            GridView1.DataBind();
        }
 protected void btn_disable_Click(object sender, EventArgs e)
 {
     if (OfficialID() != "")
     {
         OfficialBSO officialBSO = new OfficialBSO();
         officialBSO.UpdateOfficial(OfficialID(), "0");
     }
     ViewOfficial();
 }