Exemplo n.º 1
0
    private void initControl(int Id)
    {
        if (Id > 0)
        {
            btn_add.Visible  = false;
            btn_edit.Visible = true;

            btn_add1.Visible  = false;
            btn_edit1.Visible = true;
            try
            {
                NewsGroupFileBSO newsgroupFileBSO = new NewsGroupFileBSO();
                NewsGroupFile    newsgroupFile    = newsgroupFileBSO.GetNewsGroupFileByID(Id);


                hddNewsGroupFileID.Value = Convert.ToString(newsgroupFile.NewsGroupFileID);
                hddNewsGroupID.Value     = Convert.ToString(newsgroupFile.NewsGroupID);
                hddFileName.Value        = newsgroupFile.FileName;
                txtFileName.Text         = newsgroupFile.FileName;
                txtTitle.Text            = newsgroupFile.Title;
            }
            catch (Exception ex)
            {
                clientview.Text = ex.Message.ToString();
            }
        }
        else
        {
            btn_edit.Visible = false;
            btn_add.Visible  = true;

            btn_edit1.Visible = false;
            btn_add1.Visible  = true;
        }
    }
Exemplo n.º 2
0
    protected void btn_add_Click(object sender, EventArgs e)
    {
        try
        {
            if (txtFileName.Text == "")
            {
                ViewFiles(Convert.ToInt32(hddNewsGroupID.Value));
                clientview.Text = "Chưa có file đính kèm";
            }
            else
            {
                NewsGroupFile file = new NewsGroupFile();
                file = ReceiveHtml();


                NewsGroupFileBSO filesBSO = new NewsGroupFileBSO();
                filesBSO.CreateNewsGroupFile(file);


                ViewFiles(Convert.ToInt32(hddNewsGroupID.Value));
                clientview.Text = "<div class='alert alert-sm alert-danger bg-gradient'>Thêm mới thành công !</div>";
            }
        }
        catch (Exception ex)
        {
            clientview.Text = ex.Message.ToString();
        }
    }
Exemplo n.º 3
0
 protected void btn_delall_Click(object sender, EventArgs e)
 {
     if (FilesID() != "")
     {
         NewsGroupFileBSO fileBSO = new NewsGroupFileBSO();
         fileBSO.DeleteNewsGroupFile(FilesID());
     }
     ViewFiles(Convert.ToInt32(hddNewsGroupID.Value));
 }
Exemplo n.º 4
0
    private void ViewFiles(int cId)
    {
        NewsGroupFileBSO newsgroupFileBSO = new NewsGroupFileBSO();
        DataTable        table            = new DataTable();

        if (cId != 0)
        {
            table = newsgroupFileBSO.GetNewsGroupFileByNewsGroup(cId);
        }
        else
        {
            table = newsgroupFileBSO.GetNewsGroupFileAll();
        }

        commonBSO commonBSO = new commonBSO();

        commonBSO.FillToGridView(grvFiles, table);
    }
Exemplo n.º 5
0
    protected void grvFiles_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        int    Id    = Convert.ToInt32(e.CommandArgument.ToString());
        string nName = e.CommandName.ToLower();

        switch (nName)
        {
        case "_edit":
            Response.Redirect("~/Admin/editnewsfiles/" + hddNewsGroupID.Value + "/" + Id + "/Default.aspx");
            break;

        case "_delete":
            NewsGroupFileBSO fileBSO = new NewsGroupFileBSO();
            fileBSO.DeleteNewsGroupFile(Id);

            ViewFiles(Convert.ToInt32(hddNewsGroupID.Value));
            break;
        }
    }
Exemplo n.º 6
0
    protected void btn_edit_Click(object sender, EventArgs e)
    {
        try
        {
            NewsGroupFile file = new NewsGroupFile();
            file = ReceiveHtml();


            NewsGroupFileBSO filesBSO = new NewsGroupFileBSO();
            filesBSO.UpdateNewsGroupFile(file);


            ViewFiles(Convert.ToInt32(hddNewsGroupID.Value));
            clientview.Text = "<div class='alert alert-sm alert-danger bg-gradient'>Cập nhật thành công !</div>";
        }
        catch (Exception ex)
        {
            clientview.Text = ex.Message.ToString();
        }
    }