public bool ThemSach(SachDTO s)
 {
     if (sDAO.SelectTLByName(s.TenSach) == null)
     {
         sDAO.Insert(s);
         return(true);
     }
     else
     {
         return(false);
     }
 }
 public static bool CapNhatSach(SachDTO s)
 {
     if (SachDAO.SelectSachTheoMa(s.MaSach) != null)
     {
         SachDAO.Insert(s);
         return(true);
     }
     else
     {
         return(false);
     }
 }
Exemplo n.º 3
0
        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++)
            {
                SachDTO s = new SachDTO();
                s.TenSach    = dt.Rows[i].ItemArray[1].ToString();
                s.GiaBan     = int.Parse(dt.Rows[i].ItemArray[2].ToString());
                s.SoLuongTon = int.Parse(dt.Rows[i].ItemArray[3].ToString());
                s.TacGia     = dt.Rows[i].ItemArray[4].ToString();
                s.MaTheLoai  = int.Parse(dt.Rows[i].ItemArray[5].ToString());
                SachDAO.Insert(s);
            }
            MessageBox.Show("Import dữ liệu thành công ...", "Thông báo");
            HienThiDanhSach();
        }
Exemplo n.º 4
0
 public int Insert(Sach obj)
 {
     return(dao.Insert(obj));
 }
Exemplo n.º 5
0
        public void Insert(SachDTO sach)
        {
            SachDAO sd = new SachDAO();

            sd.Insert(sach);
        }
Exemplo n.º 6
0
 public void Insert(Sach info)
 {
     data.Insert(info);
 }
Exemplo n.º 7
0
 public static bool Insert(Sach a)
 {
     return(SachDAO.Insert(a) == 1?true:false);
 }