// выводит список товаров в корзине static public Product ViewToBasket(int click) { string sql = $"SELECT * FROM Products P JOIN Basket B ON P.Id = B.ProductId WHERE (SELECT DeviceId FROM Device WHERE DeviceId = N'{deviceId}') = N'{deviceId}'"; bool check = true; SqlCommand sqlCommand = new SqlCommand(sql, connection); SqlDataReader reader = sqlCommand.ExecuteReader(); Product p = new Product(); while (reader.Read()) { p.productPhoto = reader.GetString(reader.GetOrdinal("Photo")); p.productName = reader.GetString(reader.GetOrdinal("Title")); p.productCharacter = reader.GetString(reader.GetOrdinal("Description")); p.productAmount = reader.GetString(reader.GetOrdinal("ProductAmount")); p.productPrice = reader.GetInt32(reader.GetOrdinal("Price")); p.basketAmount = 0 + reader.GetInt32(reader.GetOrdinal("BasketAmount")); p.productId = reader.GetInt32(reader.GetOrdinal("Id")); p.basketPrice = 1; if (click == 1) { BasketList.listPoducts(p); } else { ProductBasket.Prod(p); } check = false; } reader.Close(); if (check) { p = null; } return(p); }