public bool Suasanpham(DTO.Sanpham sp) { string sql = "UPDATE SANPHAM SET TENSP=@TENSP, MALOAI=@MALOAI, MANCC=@MANCC, SOLUONG=@SOLUONG, DONGIA=@DONGIA, HINHANH = @HINHANH, GIAMGIA = @GIAMGIA WHERE MASP=@MASP"; SqlConnection con = dc.getConnect(); try { cmd = new SqlCommand(sql, con); con.Open(); cmd.Parameters.Add("@MASP", SqlDbType.Int).Value = sp.MASP1; cmd.Parameters.Add("@TENSP", SqlDbType.NVarChar).Value = sp.TENSP1; cmd.Parameters.Add("@MALOAI", SqlDbType.Int).Value = sp.MALOAI1; cmd.Parameters.Add("@MANCC", SqlDbType.Int).Value = sp.MANCC1; cmd.Parameters.Add("@SOLUONG", SqlDbType.Int).Value = sp.SOLUONG1; cmd.Parameters.Add("@DONGIA", SqlDbType.Int).Value = sp.DONGIA1; cmd.Parameters.Add("@GIAMGIA", SqlDbType.Int).Value = sp.GIAMGIA1; cmd.Parameters.Add("@HINHANH", SqlDbType.NVarChar).Value = sp.HINHANH1; cmd.ExecuteNonQuery(); con.Close(); } catch (Exception e) { return(false); } return(true); }
public bool Xoasanpham(DTO.Sanpham sp) { string sql = "UPDATE SANPHAM SET XOA = 1 WHERE MASP=@MASP"; SqlConnection con = dc.getConnect(); try { cmd = new SqlCommand(sql, con); con.Open(); cmd.Parameters.Add("@MASP", SqlDbType.Int).Value = sp.MASP1; cmd.ExecuteNonQuery(); con.Close(); } catch (Exception e) { return(false); } return(true); }
public bool Themsanpham(DTO.Sanpham sp) { string sql = "INSERT INTO SANPHAM(TENSP,MALOAI,MANCC,SOLUONG,DONGIA,GIAMGIA,HINHANH)VALUES(@TENSP,@MALOAI,@MANCC,@SOLUONG,@DONGIA,@GIAMGIA,@HINHANH)"; SqlConnection con = dc.getConnect(); try { cmd = new SqlCommand(sql, con); con.Open(); cmd.Parameters.Add("@TENSP", SqlDbType.NVarChar).Value = sp.TENSP1; cmd.Parameters.Add("@MALOAI", SqlDbType.Int).Value = sp.MALOAI1; cmd.Parameters.Add("@MANCC", SqlDbType.Int).Value = sp.MANCC1; cmd.Parameters.Add("@SOLUONG", SqlDbType.Int).Value = sp.SOLUONG1; cmd.Parameters.Add("@DONGIA", SqlDbType.Int).Value = sp.DONGIA1; cmd.Parameters.Add("@GIAMGIA", SqlDbType.Int).Value = sp.GIAMGIA1; cmd.Parameters.Add("@HINHANH", SqlDbType.NVarChar).Value = sp.HINHANH1; cmd.ExecuteNonQuery(); con.Close(); }catch (Exception e) { return(false); } return(true); }
public bool Xoasanpham(DTO.Sanpham sp) { return(spd.Xoasanpham(sp)); }
public bool Suasanpham(DTO.Sanpham sp) { return(spd.Suasanpham(sp)); }
public bool Themsanpham(DTO.Sanpham sp) { return(spd.Themsanpham(sp)); }