protected void btnCapNhat_Click(object sender, EventArgs e) { try { //lay thong tin tu textbox LOAIVAITRO lpDTO = new LOAIVAITRO(); lpDTO.MaLoaiVaiTro = int.Parse(txtmaloaivaitro.Text); lpDTO.TenLoaiVaiTro = txttenloaivaitro.Text; //Goi ham cap nhat BUSLoaiVaiTro BUSLoaiVaiTro = new BUSLoaiVaiTro(); if (BUSLoaiVaiTro.CapNhat(lpDTO) == 0) { //Thong bao lbThongBao.Text = "Cập Nhật Thành Công"; lbThongBao.Visible = true; Response.Redirect("LoaiVaiTro.aspx?id=" + txtmaloaivaitro.Text); } else { lbThongBao.Text = "Cập Nhật Không Thành Công"; lbThongBao.Visible = true; } } catch { lbThongBao.Text = "Cập nhật Không Thành Công"; lbThongBao.Visible = true; } }
protected void btnThem_Click(object sender, EventArgs e) { try { //lay thong tin tu textbox LOAIVAITRO lpDTO = new LOAIVAITRO(); lpDTO.MaLoaiVaiTro = 0; lpDTO.TenLoaiVaiTro = txttenloaivaitro.Text; //Goi ham cap nhat BUSLoaiVaiTro BUSLoaiVaiTro = new BUSLoaiVaiTro(); if (BUSLoaiVaiTro.Them(lpDTO) == 1) { //Thong bao lbThongBao.Text = "Thêm Thành Công"; lbThongBao.Visible = true; Response.Redirect("LoaiVaiTro.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<LOAIVAITRO> SelectLOAIVAITROsAll() { List<LOAIVAITRO> list = new List<LOAIVAITRO>(); using (LinQDataContext db = new LinQDataContext(global::DAOAuction.Properties.Settings.Default.webdoantruongConnectionString)) { ISingleResult<LOAIVAITRO_getallResult> lp = db.LOAIVAITRO_getall(); foreach (LOAIVAITRO_getallResult LOAIVAITRO in lp) { LOAIVAITRO var1 = new LOAIVAITRO(); var1.MaLoaiVaiTro = LOAIVAITRO.MaLoaiVaiTro ; var1.TenLoaiVaiTro = LOAIVAITRO.TenLoaiVaiTro ; 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(LOAIVAITRO lpDTO) { try { LinQDataContext db = new LinQDataContext(global::DAOAuction.Properties.Settings.Default.webdoantruongConnectionString); db.LOAIVAITRO_add( lpDTO.TenLoaiVaiTro ); return 1; } catch { return 0; } }
public int CapNhat(LOAIVAITRO lpDTO) { try { LinQDataContext db = new LinQDataContext(global::DAOAuction.Properties.Settings.Default.webdoantruongConnectionString); return db.LOAIVAITRO_update( lpDTO.MaLoaiVaiTro, lpDTO.TenLoaiVaiTro ); } catch (Exception ex) { throw (ex); } }
public int Them(LOAIVAITRO lpDTO) { DAOLoaiVaiTro LOAIVAITRO = new DAOLoaiVaiTro(); return LOAIVAITRO.Them(lpDTO); }
public int CapNhat(LOAIVAITRO lpDTO) { DAOLoaiVaiTro LOAIVAITRO = new DAOLoaiVaiTro(); return LOAIVAITRO.CapNhat(lpDTO); }