public static bool ThemTheLoai(TheLoaiDTO tl) { if (TheLoaiDAO.GetTheLoaiByName(tl.TenTheLoai) == null) { TheLoaiDAO.Insert(tl); return(true); } else { return(false); } }
private void btnimport_Click(object sender, EventArgs e) { string oldPath = Directory.GetCurrentDirectory(); OpenFileDialog of = new OpenFileDialog(); of.ShowDialog(); string strPathName = of.FileName; Directory.SetCurrentDirectory(oldPath); DataTable dt = ExcelRead.getSheet(strPathName, "sheet1"); for (int i = 0; i < dt.Rows.Count; i++) { TheLoaiDTO tl = new TheLoaiDTO(); tl.TenTheLoai = dt.Rows[i].ItemArray[1].ToString(); TheLoaiDAO.Insert(tl); } MessageBox.Show("Import dữ liệu thành công ...", "Thông báo"); HienThiDanhSach(); }
public static void Insert(TheLoaiDTO theLoai) { TheLoaiDAO.Insert(theLoai); }
public void Insert(TheLoai info) { data.Insert(info); }
public int Insert(TheLoai obj) { return(DAO.Insert(obj)); }