public List<TaiKhoanThuongDTO> SelectAllTaiKhoanThuong() { List<TaiKhoanThuongDTO> listTKDTO = new List<TaiKhoanThuongDTO>(); List<TaiKhoanThuong> listTKT = (List<TaiKhoanThuong>)data.sp_TaiKhoanThuongXem(); foreach (TaiKhoanThuong dh in listTKT) { TaiKhoanThuongDTO dhdto = new TaiKhoanThuongDTO(dh); listTKDTO.Add(dhdto); } return listTKDTO; }
public int InsertTaiKhoanThuong(TaiKhoanThuongDTO tk) { int kq = 0; try { data.sp_ins_taikhoanthuong(tk.MAKH1, tk.DIACHI1, tk.EMAIL1, tk.SDT1); data.SubmitChanges(); kq = 1; } catch (Exception ex) { } return kq; }
protected void ButtonThemKH_Click(object sender, EventArgs e) { TaiKhoanThuongDTO tk = new TaiKhoanThuongDTO(); tk.MAKH1 = int.Parse(txtMaKH.Text); tk.DIACHI1 = txtDC.Text; tk.EMAIL1 = txtEmail.Text; tk.SDT1 = txtSDT.Text; TaiKhoanThuongDAO tkDAO = new TaiKhoanThuongDAO(); tkDAO.InsertTaiKhoanThuong(tk); txtMaKH.Text = ""; txtDC.Text = ""; txtEmail.Text = ""; txtSDT.Text = ""; }