Exemplo n.º 1
0
        protected void LoadBaiViet()
        {
            if (Request.QueryString["id"] == null)
            {
                Response.Redirect("default.aspx");
            }
            else
            {
                BUSBaiViet BaiVietBUS = new BUSBaiViet();
                int MaBaiViet = int.Parse(Request.QueryString["id"]);
                BAIVIET BaiViet = BaiVietBUS.TimKiem(MaBaiViet);
                lblNoiDungBaiViet.Text = BaiViet.NoiDung;
                lblTieuDe.Text = BaiViet.TieuDe;
                lblTieuDe.Font.Bold = true;
                lblTieuDe.Font.Size = 18;

                if (BaiViet.NgayDang != null)
                {
                    lblNgayDang.Text = "Ngày đăng: " + BaiViet.NgayDang.Value.Day + "/" + BaiViet.NgayDang.Value.Month + "/" + BaiViet.NgayDang.Value.Year;
                    lblNgayDang.Font.Italic = true;
                }
                else
                    lblNgayDang.Visible = false;

                BUSTapTinBaiViet busTapTinBaiViet = new BUSTapTinBaiViet();
                List<TAPTINBAIVIET> DStapTinBaiViet = busTapTinBaiViet.TimKiemMaBaiViet(MaBaiViet);
                if (DStapTinBaiViet != null)
                {
                    foreach(TAPTINBAIVIET ttbv in DStapTinBaiViet)
                    {
                        System.Web.UI.WebControls.MenuItem item = new System.Web.UI.WebControls.MenuItem("-" + ttbv.TenTapTin);
                        item.NavigateUrl = ttbv.DuongDan;
                        hplDownloadLink.Items.Add(item);
                    }
                }
            }
        }
        protected void load()
        {
            //Thong tin nguoi dung

            if (!IsPostBack)
            {
                if (Request.QueryString["id"] != null)
                {
                    //lay ma
                    int mabaiviet = int.Parse(Request.QueryString["id"]);
                    BUSBaiViet BUSBaiViet = new BUSBaiViet();
                    BAIVIET lpDTO = BUSBaiViet.TimKiem(mabaiviet);
                    BaiVietTemp = lpDTO;
                    Session.Add("BaiVietTemp", BaiVietTemp);
                    BUSChuyenMuc BUSChuyenMuc = new BUSChuyenMuc();
                    CHUYENMUC cmDTO = BUSChuyenMuc.LayChuyenMucTheoBaiViet((int)lpDTO.MaLoaiBaiViet);
                    //this.txtngaydang.Text = dt.ToString("dd/MM/yyyy");
                    this.txtnoidung.Value = lpDTO.NoiDung;
                    this.txtTomTat.Text = lpDTO.TomTat;
                    this.txttieude.Text = lpDTO.TieuDe;
                    this.lblNgayDang.Text = lpDTO.NgayDang.ToString();
                    this.lblNgayCapNhat.Text = lpDTO.CapNhat.ToString();
                    if (lpDTO.HinhAnh != "")
                    {
                        this.imgAnhDaiDien.ImageUrl = @"~\Uploads/" + lpDTO.HinhAnh;
                    }
                    // load ddl
                    load_ddlChuyenMuc();
                    ddlChuyenMuc.SelectedValue = cmDTO.MaChuyenMuc.ToString();
                    load_ddlLBV(cmDTO.MaChuyenMuc);
                    ddlLoaiBaiViet.SelectedValue = lpDTO.MaLoaiBaiViet.ToString();
                    int soDong = LoadTapTin();
                    FilterSTT(soDong, 0, 30);
                    PanelBtnUpload.Visible = true;
                }
                else
                {
                    load_ddlChuyenMuc();
                    ddlChuyenMuc.SelectedValue = "1";
                    load_ddlLBV(1);
                    PanelBtnUpload.Visible = false;
                }
            }
        }
Exemplo n.º 3
0
 protected void onchecked_changed(object sender, EventArgs e)
 {
     System.Web.UI.WebControls.CheckBox chkStatus = (System.Web.UI.WebControls.CheckBox)sender;
     GridViewRow row = (GridViewRow)chkStatus.NamingContainer;
     int id = Int32.Parse(row.Cells[1].Text) ;
     bool status = chkStatus.Checked;
     BUSBaiViet bus = new BUSBaiViet();
     BAIVIET bv = bus.TimKiem(id);
     bv.TinNoiBat = status;
     bus.CapNhat(bv);
 }