protected void btnThem_Click(object sender, EventArgs e)
        {
            try
            {
                //lay thong tin tu textbox
                TAPTINTHONGBAO lpDTO = new TAPTINTHONGBAO();
                lpDTO.MaTapTin = int.Parse(this.txtmataptin.Text);
                lpDTO.TenTapTin = this.txttentaptin.Text;
                lpDTO.MaThongBao = int.Parse(this.txtmabaiviet.Text);
                lpDTO.DuongDan = this.txtduongdan.Text;
                //Goi ham cap nhat
                BUSTapTinThongBao BUSTapTinThongBao = new BUSTapTinThongBao();
                if (BUSTapTinThongBao.Them(lpDTO) == 0)
                {
                    //Thong bao
                    lbThongBao.Text = "Thêm Thành Công";
                    lbThongBao.Visible = true;
                    //Response.Redirect("LoaiMatHang.aspx");
                }
                else
                {
                    lbThongBao.Text = "Thêm Không Thành Công";
                    lbThongBao.Visible = true;
                }
            }

            catch
            {
                lbThongBao.Text = "Thêm Không Thành Công";
                lbThongBao.Visible = true;
            }
        }
        public List<TAPTINTHONGBAO> SelectTAPTINTHONGBAOsAll()
        {
            List<TAPTINTHONGBAO> list = new List<TAPTINTHONGBAO>();
            using (LinQDataContext db = new LinQDataContext(global::DAOAuction.Properties.Settings.Default.webdoantruongConnectionString))
            {
                ISingleResult<TAPTINTHONGBAO_getallResult> lp = db.TAPTINTHONGBAO_getall();
                foreach (TAPTINTHONGBAO_getallResult TAPTINTHONGBAO in lp)
                {
                    TAPTINTHONGBAO var1 = new TAPTINTHONGBAO();
                    var1.MaTapTin  = TAPTINTHONGBAO.MaTapTin ;
                    var1.TenTapTin  = TAPTINTHONGBAO.TenTapTin ;
                    var1.DuongDan  = TAPTINTHONGBAO.DuongDan;
                    var1.MaThongBao  = TAPTINTHONGBAO.MaThongBao;

                    list.Add(var1);
                }
                try
                {
                    // Save the changes.
                    db.SubmitChanges();
                }
                // Detect concurrency conflicts.
                catch (ChangeConflictException)
                {
                    // Resolve conflicts.
                    db.ChangeConflicts.ResolveAll(RefreshMode.KeepChanges);
                }
            }

            return list;
        }
 public int Them(TAPTINTHONGBAO lpDTO)
 {
     try
     {
         LinQDataContext db = new LinQDataContext(global::DAOAuction.Properties.Settings.Default.webdoantruongConnectionString);
         db.TAPTINTHONGBAO_add(
             lpDTO.TenTapTin ,
             lpDTO.DuongDan ,
             lpDTO.MaThongBao
             );
         return 1;
     }
     catch
     {
         return 0;
     }
 }
 public int CapNhat(TAPTINTHONGBAO lpDTO)
 {
     try
     {
         LinQDataContext db = new LinQDataContext(global::DAOAuction.Properties.Settings.Default.webdoantruongConnectionString);
         return db.TAPTINTHONGBAO_update(
             lpDTO.MaTapTin ,
             lpDTO.TenTapTin ,
             lpDTO.DuongDan ,
             lpDTO.MaThongBao
             );
     }
     catch (Exception ex)
     {
         throw (ex);
     }
 }
 public int Them(TAPTINTHONGBAO lpDTO)
 {
     DAOTapTinThongBao TAPTINTHONGBAO = new DAOTapTinThongBao();
     return TAPTINTHONGBAO.Them(lpDTO);
 }
 public int CapNhat(TAPTINTHONGBAO lpDTO)
 {
     DAOTapTinThongBao TAPTINTHONGBAO = new DAOTapTinThongBao();
     return TAPTINTHONGBAO.CapNhat(lpDTO);
 }