public void themoitv(EC_tb_Tivi tv)
 {
     if (!tvsql.kiemtraTV(tv.MATIVI))
     {
         tvsql.themmoiTV(tv);
     }
     else
     {
         MessageBox.Show("Mã này đã tồn tại,xin chọn Mã khác", "Chú Ý", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
        public void suatv(EC_tb_Tivi tv)
        {
            SqlConnection con = cn.getcon();

            try
            {
                con.Open();
                string     sql = @"UPDATE    tb_Tivi SET tentivi =N'" + tv.TENTIVI + "', mahangsx =N'" + tv.MAHANGSX + "', makieu =N'" + tv.MAKIEU + "', mamau =N'" + tv.MAMAU + "', mamanhinh =N'" + tv.MAMANHINH + "', maco =N'" + tv.MACO + "', manoisx =N'" + tv.MANOISX + "', dongianhap =N'" + tv.DONGIANHAP + "', dongiaban =N'" + tv.DONGIABAN + "', anh =@hinhanh, ghichu =N'" + tv.GHICHU + "', soluong =N'" + tv.SOLUONG + "', thoigianbaohanh =N'" + tv.THOIGIANBAOHANH + "' where mativi=N'" + tv.MATIVI + "'";
                SqlCommand cmd = new SqlCommand(sql, con);
                cmd.Parameters.Add(new SqlParameter("@hinhanh", (object)tv.ANH));
                cmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                con.Close();
            }
        }
        public void themmoiTV(EC_tb_Tivi tv)
        {
            SqlConnection con = cn.getcon();

            try
            {
                con.Open();
                string     sql = @"INSERT INTO tb_Tivi (mativi, tentivi, mahangsx, makieu, mamau, mamanhinh, maco, manoisx, dongianhap, dongiaban, anh, ghichu, soluong, thoigianbaohanh)
							 VALUES (N'"                             + tv.MATIVI + "',N'" + tv.TENTIVI + "',N'" + tv.MAHANGSX + "',N'" + tv.MAKIEU + "',N'" + tv.MAMAU + "',N'" + tv.MAMANHINH + "',N'" + tv.MACO + "',N'" + tv.MANOISX + "',N'" + tv.DONGIANHAP + "',N'" + tv.DONGIABAN + "',@hinhanh,N'" + tv.GHICHU + "',N'" + tv.SOLUONG + "',N'" + tv.THOIGIANBAOHANH + "')";
                SqlCommand cmd = new SqlCommand(sql, con);
                cmd.Parameters.Add(new SqlParameter("@hinhanh", (object)tv.ANH));
                cmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                con.Close();
            }
        }
 public void xoatv(EC_tb_Tivi tv)
 {
     tvsql.xoaTV(tv);
 }
 public void suatv(EC_tb_Tivi tv)
 {
     tvsql.suatv(tv);
 }
 public void xoaTV(EC_tb_Tivi tv)
 {
     cn.ExcuteNonQuery("DELETE FROM [tb_Tivi] WHERE  mativi=N'" + tv.MATIVI + "'");
 }