Пример #1
0
        public bool ThichVatPham(ThichVatPham temp)
        {
            OpenConnection();
            SqlCommand command = new SqlCommand();

            command.CommandType = CommandType.Text;
            command.CommandText = "insert into YeuThich(SDT,MaVP) values (@sdt,@mavp)";
            command.Parameters.Add("@sdt", SqlDbType.NChar).Value = temp.SDT;
            command.Parameters.Add("@mavp", SqlDbType.Int).Value  = Int32.Parse(temp.MaVP);
            command.Connection = conn;
            int ret = command.ExecuteNonQuery();

            SqlCommand comm = new SqlCommand();

            comm.CommandType = CommandType.StoredProcedure;
            comm.CommandText = "ThongBaoTaiKhoan";
            comm.Connection  = conn;
            comm.Parameters.Add("@sdt", SqlDbType.NChar).Value          = temp.SDT;
            comm.Parameters.Add("@mavp", SqlDbType.Int).Value           = Int32.Parse(temp.MaVP);
            comm.Parameters.Add("@noidungtb", SqlDbType.NVarChar).Value = "Có người thích sản phẩm của bạn";
            comm.Parameters.Add("@src", SqlDbType.NVarChar).Value       = "/ChiTietVatPham/" + temp.MaVP;
            int ret2 = comm.ExecuteNonQuery();

            if (ret > 0 && ret2 > 0)
            {
                return(true);
            }

            return(false);
        }
Пример #2
0
        public bool BoThich(ThichVatPham temp)
        {
            OpenConnection();
            SqlCommand command = new SqlCommand();

            command.CommandType = CommandType.Text;
            command.CommandText = "delete from YeuThich where MaVP = @mavp and SDT= @sdt";
            command.Parameters.Add("@sdt", SqlDbType.NChar).Value = temp.SDT;
            command.Parameters.Add("@mavp", SqlDbType.Int).Value  = Int32.Parse(temp.MaVP);
            command.Connection = conn;
            int ret = command.ExecuteNonQuery();

            if (ret > 0)
            {
                return(true);
            }
            return(false);
        }