private void LC(object sender, MouseEventArgs e) { ListBook G1 = new ListBook(list.OneTypeBooks(onlineGenre)); if (BBook.Count < 5) { BBook.Add(G1.Lista[(FromFourth(((Rectangle)sender).Name))]); } else { MessageBox.Show("Корзина повна"); } Repaing(BBook.Count); Releaze1(); }
public void RReleaze(int ir) { string b; if (sort == 1) { b = "SELECT * FROM Books order by Price"; } else { b = "SELECT * FROM Books order by Name"; } using (SqlConnection connection = new SqlConnection(connectionString)) { connection.Open(); SqlCommand command = new SqlCommand(b, connection); SqlDataReader CC = command.ExecuteReader(); if (CC.HasRows) { while (CC.Read()) { object x1 = CC.GetValue(0); object x2 = CC.GetValue(1); object x3 = CC.GetValue(2); object x4 = CC.GetValue(3); object x5 = CC.GetValue(4); list.Lista.Add(new Book(Convert.ToString(x1), Convert.ToString(x2), Convert.ToDouble(x3), Convert.ToString(x4), Convert.ToInt32(x5))); } } } ListBook G1 = new ListBook(list.OneTypeBooks(onlineGenre)); int i = 1; I1.Content = G1.Lista[i * 5 + ir].Name; I2.Content = G1.Lista[i * 5 + ir].Author; I3.Content = G1.Lista[i * 5 + ir].price + "₴"; I4.Content = G1.Lista[i * 5 + ir].About; I5.Content = GenreStr(G1.Lista[i * 5 + ir].Genre); }
public void Releaze() { Tovari.Children.Clear(); list.Lista.Clear(); string b; if (sort == 1) { b = "SELECT * FROM Books order by Price"; } else { b = "SELECT * FROM Books order by Name"; } using (SqlConnection connection = new SqlConnection(connectionString)) { connection.Open(); SqlCommand command = new SqlCommand(b, connection); SqlDataReader CC = command.ExecuteReader(); if (CC.HasRows) { while (CC.Read()) { object x1 = CC.GetValue(0); object x2 = CC.GetValue(1); object x3 = CC.GetValue(2); object x4 = CC.GetValue(3); object x5 = CC.GetValue(4); list.Lista.Add(new Book(Convert.ToString(x1), Convert.ToString(x2), Convert.ToDouble(x3), Convert.ToString(x4), Convert.ToInt32(x5))); } } } ListBook G1 = new ListBook(list.OneTypeBooks(onlineGenre)); foreach (var j in G1.Lista) { AddBooks(j); } }