public void SetNumbers(string selection) { List <Numbers> rooms = new List <Numbers>(); DataTable dt = SqlDB.Select(selection); if (dt.Rows.Count <= 0) { MessageBox.Show("Таких номеров нет"); Table.ItemsSource = rooms; return; } foreach (DataRow dr in dt.Rows) { rooms.Add(new Numbers() { Number = Convert.ToInt32(dr["number"].ToString()), Price = Convert.ToDouble(dr["price"].ToString()) }); } Table.ItemsSource = rooms; }
public void SetPersons() { rooms = new List <Persons>(); DataTable dt = SqlDB.Select("SELECT full_name, passport_number, telephone_number, number, price, food, [services], Rooms.amount FROM Rooms join RoomCard on Rooms.id = RoomCard.id_room join ClientCard on ClientCard.id = id_client_card; "); foreach (DataRow dr in dt.Rows) { rooms.Add(new Persons() { Full_Name = dr["full_name"].ToString(), PassportNumber = dr["passport_number"].ToString(), TelephoneNumber = dr["telephone_number"].ToString(), Food = CheckFoodAndServices(dr["food"].ToString()), Services = CheckFoodAndServices(dr["services"].ToString()), Amount = Convert.ToInt32(dr["amount"]), Number = Convert.ToInt32(dr["number"].ToString()), Price = Convert.ToDouble(dr["price"].ToString()) }); } Table.ItemsSource = rooms; }
public void GetRoomsNumber() { Rooms.ItemsSource = SqlDB.GetDataOneAttribute("SELECT * FROM Rooms WHERE NOT EXISTS " + "(SELECT * FROM RoomCard WHERE Rooms.id=RoomCard.id_room);", "number"); }