Exemplo n.º 1
0
    protected void btn_add_Click(object sender, EventArgs e)
    {
        NewsRelationBSO _newsRelationBSO = new NewsRelationBSO();
        NewsRelation    _newsRelation    = new NewsRelation();

        foreach (GridViewRow rows in grvNewsGroup.Rows)
        {
            CheckBox checkbox = (CheckBox)rows.Cells[0].FindControl("chkId");
            if (checkbox.Checked)
            {
                _newsRelation = _newsRelationBSO.GetNewsRelationByID(Convert.ToInt32(rows.Cells[0].Text), Convert.ToInt32(hddNewsID.Value));

                if (_newsRelation == null)
                {
                    _newsRelation             = new NewsRelation();
                    _newsRelation.NewsGroupID = Convert.ToInt32(rows.Cells[0].Text);
                    _newsRelation.NewsID      = Convert.ToInt32(hddNewsID.Value);

                    int i = _newsRelationBSO.CreateNewsRelationGet(_newsRelation);
                }
            }
        }

        ViewNewsReleation(Convert.ToInt32(hddNewsID.Value));
        clientview.Text = "<div class='alert alert-sm alert-danger bg-gradient'>Cập nhật thành công !</div>";
        AspNetCache.Reset();
    }
Exemplo n.º 2
0
    protected void grvRelation_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        int             Id = Convert.ToInt32(e.CommandArgument.ToString());
        NewsRelationBSO _newsRelationBSO = new NewsRelationBSO();
        NewsRelation    _newsRelation    = _newsRelationBSO.GetNewsRelationByID(Id, Convert.ToInt32(hddNewsID.Value));

        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 "_view":
            break;

        case "_edit":
            Response.Redirect("~/Admin/editnewsbyuser/" + newsgroup.GroupCate + "/" + Id + "/Default.aspx");
            break;

        case "_delete":
            _newsRelationBSO.DeleteNewsRelation(_newsRelation.Id);
            ViewNewsReleation(Convert.ToInt32(hddNewsID.Value));
            AspNetCache.Reset();

            break;
        }
    }
Exemplo n.º 3
0
 protected void btn_delall_Click(object sender, EventArgs e)
 {
     if (NewsGroupID_Relation() != "")
     {
         NewsRelationBSO _newsRelationBSO = new NewsRelationBSO();
         _newsRelationBSO.DeleteNewsRelation(NewsGroupID_Relation(), Convert.ToInt32(hddNewsID.Value));
     }
     ViewNewsReleation(Convert.ToInt32(hddNewsID.Value));
     AspNetCache.Reset();
 }
Exemplo n.º 4
0
    private string GetNewsID(int cID)
    {
        // string strArrayID = Convert.ToString(cID) + ",";
        string          strArrayID    = "";
        NewsRelationBSO _newsRelation = new NewsRelationBSO();
        DataTable       table1        = _newsRelation.GetNewsRelationByNewsID(cID);

        if (table1.Rows.Count > 0)
        {
            foreach (DataRow subrow in table1.Rows)
            {
                strArrayID += subrow["NewsGroupID"].ToString() + ",";
            }
        }

        return(strArrayID);
    }
Exemplo n.º 5
0
    private void ViewNewsReleation(int newsID)
    {
        commonBSO       commonBSO        = new commonBSO();
        NewsRelationBSO _newsRelationBSO = new NewsRelationBSO();
        DataTable       table            = new DataTable();


        _page2 = new PagingInfo(20, Convert.ToInt32(hdnPage2.Value), true);


        table = _newsRelationBSO.GetNewsRelationPaging(Language.language, newsID, _page2);


        if (table.Rows.Count > 0)
        {
            TotalRecord2 = Convert.ToInt32(table.Rows[0]["Total"].ToString());
            SetAttributeGvArticle2(Convert.ToInt32(table.Rows[0]["Total"].ToString()));
            commonBSO.FillToGridView(grvRelation, table);

            paging2.DataLoad();
            if (TotalPage2(Convert.ToInt32(table.Rows[0]["Total"].ToString())) <= 1)
            {
                paging2.Visible = false;
            }
            else
            {
                paging2.Visible = true;
            }
        }
        else
        {
            SetAttributeGvArticle2(0);
            grvRelation.DataSource = null;
            grvRelation.DataBind();
            paging2.Visible = false;
        }
    }