temp.BirthDay = reader.GetDateTime(3);
temp.sex = reader.GetBoolean(4);
ClientDataGrid.Items.Add(temp);
}
}
//загрузка RealEstate
sqlCommand = "SELECT * FROM [RealEstatewRequest]";
command = newOleDbCommand(sqlCommand, connection);
reader = command.ExecuteReader();
if (reader.HasRows)
{
while (reader.Read())
{
RealEstate temp = newRealEstate();
temp.Id = reader.GetInt32(0);
temp.Address = reader.GetString(1);
temp.Area_cubic_meters = reader.GetInt32(2);
temp.square_meters = reader.GetInt32(3);
temp.TypeRealEstate = reader.GetString(4);
temp.TypeId = reader.GetInt32(5);
RealEstateDataGrid.Items.Add(temp);
}
}
}
//topmenu buttons
privatevoid ButtonHelp_Click(object sender, RoutedEventArgs e)
{
Helpwindow helpwindow = newHelpwindow();
helpwindow.ShowDialog();
}
privatevoid ButtonDB_property_Click(object sender, RoutedEventArgs e)
{
MessageBox.Show(
"Подключение к БД успешно открыто.\r\n" +
" Параметры подключениея к базе данных: " + "\r\n" +
" |базаданных: ---------- " + connection.Database + "\r\n" +
" |сервер: --------------- " + connection.DataSource + "\r\n" +
" |версиясервера: ------- " + connection.ServerVersion + "\r\n" +
" |состояние: ------------ " + connection.State);
}
privatevoid ButtonReport_Click(object sender, RoutedEventArgs e)
{
sqlCommand = "SELECT COUNT(*) FROM [RealEstate]";
command = newOleDbCommand(sqlCommand, connection);
int AllRealEstate = (int)command.ExecuteScalar();
sqlCommand = "SELECT COUNT(*) FROM [RealEstate] WHERE NOT EXISTS (SELECT *
FROM [Arenda] WHERE [Arenda].[realestate] = [RealEstate].[Id])";
command = newOleDbCommand(sqlCommand, connection);
int FreeRealEstate = (int)command.ExecuteScalar();
sqlCommand = "SELECT SUM(price) FROM [Arenda] WHERE
((([Arenda].[сompletion_date]) > #" + string.Format("{0}/{1}/{2}", DateTime.Now.Month -
3, DateTime.Now.Day, DateTime.Now.Year) + "#));";
command = newOleDbCommand(sqlCommand, connection);
object MoneyArenda = command.ExecuteScalar();