public bool ThemLoai(clsLoai_DTO loai) { string strMaLoai = "LSP" + (ThaoTacDuLieu.DemSoDongCuaBang("LoaiSanPham") + 1); string query = string.Format("insert into LoaiSanPham values('{0}',N'{1}',N'{2}','{3}')", strMaLoai, loai.TenLoaiSanPham, loai.GhiChu, 1); return(ThaoTacDuLieu.ThucThi(query)); }
private void XuLiSuaLoai(clsLoai_DTO loai) { if (_LoaiBUS.SuaLoai(loai)) { FormMessage.Show("Sửa loại sản phẩm thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); TaiDuLieu(); } else { FormMessage.Show("Sửa loại sản phẩm không thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void ThemLoai() { if (txtTenLoai.Text == "") { FormMessage.Show("Bạn chưa nhập tên!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (_LoaiBUS.KiemTraTen(txtTenLoai.Text).Rows.Count > 0) { FormMessage.Show("Tên này đã tồn tại, vui lòng chọn 1 tên khác!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { clsLoai_DTO loai = new clsLoai_DTO(); loai.TenLoaiSanPham = txtTenLoai.Text; loai.GhiChu = txtGhiChu.Text; themLoai(loai); this.Close(); } }
public bool SuaLoai(clsLoai_DTO loai) { return(dao.SuaLoai(loai)); }
public bool ThemLoai(clsLoai_DTO loai) { return(dao.ThemLoai(loai)); }
public bool SuaLoai(clsLoai_DTO loai) { string query = string.Format("update LoaiSanPham set TenLoaiSanPham=N'{0}',GhiChu=N'{1}',TrangThai=1 where MaLoaiSanPham='{2}'", loai.TenLoaiSanPham, loai.GhiChu, loai.MaLoaiSanPham); return(ThaoTacDuLieu.ThucThi(query)); }