public DataTable CreateTbNH(EC_NhomHang _nh) { string sqlquery = "SELECT * FROM tb_Nhomhang where manhom like N'%{0}%' and tennhom like N'%{1}%'"; sqlquery = string.Format(sqlquery, _nh.MaNhomHang, _nh.TenNhomHang); return(Connect.CreateTable(sqlquery)); }
public void AddNhomHang(EC_NhomHang _nhomhang) { if (!sqlnhomhang.CheckNhomHang(_nhomhang.MaNhomHang)) { sqlnhomhang.AddNhomHang(_nhomhang); } else { MessageBox.Show("Mã này đã tồn tại,xin chọn Mã khác", "Chú Ý", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
public void AddNhomHang(EC_NhomHang _newnhomhang) { try { Connect.SqlConnect.Open(); string sqlquery = @"INSERT INTO tb_Nhomhang (manhom, tennhom) VALUES (N'{0}',N'{1}')" ; sqlquery = string.Format(sqlquery, _newnhomhang.MaNhomHang, _newnhomhang.TenNhomHang); SqlCommand cmd = new SqlCommand(sqlquery, Connect.SqlConnect); cmd.ExecuteNonQuery(); Connect.SqlConnect.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void UpdateNhomHang(EC_NhomHang _nhomhang) { try { Connect.SqlConnect.Open(); string sqlquery = @"UPDATE tb_Nhomhang SET tennhom =N'{0}' where manhom =N'{1}'" ; string.Format(sqlquery, _nhomhang.TenNhomHang, _nhomhang.MaNhomHang); SqlCommand cmd = new SqlCommand(sqlquery, Connect.SqlConnect); cmd.ExecuteNonQuery(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { Connect.SqlConnect.Close(); } }
public void XoaDuLieu(EC_NhomHang et) { cn.ThucThiSQL("DELETE FROM NhomHang where MaNhom =" + et.MaNhom); }
public void SuaDuLieu(EC_NhomHang et) { cn.ThucThiSQL("UPDATE NhomHang SET TenNhom=N'" + et.TenNhom + "',MaNhom ='" + et.MaNhom + "' where MaNhom=" + et.MaNhom); }
public void ThemDuLieu(EC_NhomHang et) { cn.ThucThiSQL("INSERT INTO NhomHang (MaNhom,TenNhom) VALUES (N'" + et.MaNhom + "',N'" + et.TenNhom + "')"); }
// delete data public void XoaDuLieu(EC_NhomHang et) { SQL.XoaDuLieu(et); }
//-------- update data public void SuaDuLieu(EC_NhomHang et) { SQL.SuaDuLieu(et); }
// in ssert dữ liệu --------------- public void ThemDuLieu(EC_NhomHang et) { SQL.ThemDuLieu(et); }
public void DeleteNhomHang(EC_NhomHang _nhomhang) { sqlnhomhang.DeleteNhomHang(_nhomhang); }
public void UpdateNhomHang(EC_NhomHang _nhomhang) { sqlnhomhang.UpdateNhomHang(_nhomhang); }
public DataTable CreateTbNH(EC_NhomHang _nh) { return(sqlnhomhang.CreateTbNH(_nh)); }
public void DeleteNhomHang(EC_NhomHang _nhomhang) { Connect.ExcuteNonQuery("DELETE FROM [tb_Nhomhang] WHERE manhom=N'" + _nhomhang.MaNhomHang + "'"); }