Файл: Проектирование и внедрение базы данных агентства по аренде квартир.docx

ВУЗ: Не указан

Категория: Курсовая работа

Дисциплина: Не указана

Добавлен: 11.12.2023

Просмотров: 349

Скачиваний: 5

ВНИМАНИЕ! Если данный файл нарушает Ваши авторские права, то обязательно сообщите нам.


В результате выполнения курсовой работы была разработана программа на языке Си#, позволяющая арендовать квартиру.

В курсовой работе, основываясь на теоретической базе, практически показали на примере “ Агентства по аренде квартир”, как осуществляется процесс внедрения БД ИС. В теоретическом блоке данной работы рассмотрены вопросы общей характеристики баз данных, информационных систем и СУБД, а также методы разработки и внедрения БД ИС.

Список литературы


  1. Петцольд, Ч. Программирование для Microsoft Windows 8. Разработка приложений для Windows Store на С# и XAML / Ч. Петцольд. - СПб.: Питер, 2015. - 352 c.

  2. Аллен, Г. Тейлор SQL для чайников / Аллен Г. Тейлор. - М.: Диалектика, Вильямс, 2015. - 416 c.

  3. Проектирование и реализация баз данных Microsoft SQL Server 2000. Учебный курс MCSE (+ CD-ROM). - М.: Русская Редакция, 2017. - 664 c.

  4. Дунаев, В. В. Базы данных. Язык SQL для студента / В.В. Дунаев. - М.: БХВ-Петербург, 2017. - 288 c.

  5. Рихтер, Дж. CLR via C#. Программирование на платформе Microsoft .NET Framework 4.5 на языке C# / Дж. Рихтер. - СПб.: Питер, 2019. - 896 c.

  6. Гриффитс, И. Программирование на C# 5.0 / И. Гриффитс. - М.: ЭКСМО, 2016. - 208 c.

  7. Васильев, А.Н. Программирование на C# для начинающих. Особенности языка / А.Н. Васильев. - М.: ЭКСМО, 2017. - 128 c.

  8. Диго С.М. БАЗЫ ДАННЫХ. ПРОЕКТИРОВАНИЕ И СОЗДАНИЕ: Учебно- методический комплекс. – М.: Изд. центр ЕАОИ. 2008. – 171 с.

  9. Дунаев В. В. Базы данных. Язык SQL для студента; БХВ -Петербург - Москва, 2013. - 288 c.

  10. Боб Уорд (Bob Ward) Инновации SQL Server 2019. Использование технологий больших данных и машинного обучения / пер. с англ. Желновой Н. Б. – М.: ДМК Пресс, 2020. – 408 с.


Приложение 1


Скрипт Базы Данных

USE [Kursov]

GO
SET ANSI_NULLS ON

GO
SET QUOTED_IDENTIFIER ON

GO
CREATE TABLE [dbo].[Apartment](

[ID] [int] NOT NULL,

[Titles] [nvarchar](500) NULL,

[Descriptions] [nvarchar](500) NULL,

[Price] [int] NULL,

[Photo] [nvarchar](500) NULL,

[IDOwner] [int] NOT NULL,

[Room] [int] NULL,

[Square] [int] NULL,

[Floor] [int] NULL,

[Address] [nvarchar](100) NULL,

[NumberFloors] [int] NULL,

[IDContract] [int] NOT NULL,

[IDMicrodistrict] [int] NOT NULL

) ON [PRIMARY]

GO
CREATE TABLE [dbo].[Owner](

[ID] [int] NOT NULL,

[FullName] [nvarchar](100) NOT NULL,

[Series] [int] NULL,

[Room] [int] NULL,

[Address] [nvarchar](100) NULL,

[Phone] [varchar](50) NULL,

[Email] [nvarchar](100) NOT NULL,

[DataBirth] [datetime] NULL,

[IssuedBy] [nvarchar](100) NULL,

[DataIssue] [datetime] NULL,

[DataRegistr] [datetime] NULL,

CONSTRAINT [PK_Owner] PRIMARY KEY CLUSTERED

(

[ID] ASC

)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]


) ON [PRIMARY]

GO
CREATE TABLE [dbo].[Microdistrict](

[ID] [int] NOT NULL,

[Microdistrict] [nvarchar](50) NULL,

[IDCity] [int] NULL,

CONSTRAINT [PK_Microdistrict] PRIMARY KEY CLUSTERED

(

[ID] ASC

)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]

) ON [PRIMARY]

GO
CREATE TABLE [dbo].[City](

[ID] [int] NOT NULL,

[CityNames] [nvarchar](50) NOT NULL,

CONSTRAINT [PK_City] PRIMARY KEY CLUSTERED

(

[ID] ASC

)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]

) ON [PRIMARY]

GO
CREATE TABLE [dbo].[Employee](

[ID] [int] NOT NULL,

[FullName] [nvarchar](100) NULL,

[Position] [nvarchar](50) NULL,

CONSTRAINT [PK_Employee] PRIMARY KEY CLUSTERED

(

[ID] ASC

)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]

) ON [PRIMARY]

GO
CREATE TABLE [dbo].[Contract](

[ID] [int] NOT NULL,

[Data] [datetime] NULL,

[IDEmployee] [int] NULL,

[IDClient] [int] NULL,

[AddInformation] [nvarchar](100) NULL,

CONSTRAINT [PK_Contract_1] PRIMARY KEY CLUSTERED

(

[ID] ASC

)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]

) ON [PRIMARY]

GO
CREATE TABLE [dbo].[Client](

[ID] [int] NOT NULL,

[FullName] [nvarchar](50) NOT NULL,

[Series] [int] NULL,

[Number] [int] NULL,

[Address] [nvarchar](100) NOT NULL,

[DataRegistr] [datetime] NULL,

[Phone] [int] NULL,

[Email] [nvarchar](100) NOT NULL,

[DataBirth] [datetime] NULL,

[IssuedBy] [nvarchar](100) NULL,

[DataIssue] [datetime] NULL,

CONSTRAINT [PK_Client] PRIMARY KEY CLUSTERED

(

[ID] ASC

)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]

) ON [PRIMARY]

GO
ALTER TABLE [dbo].[Contract] WITH CHECK ADD CONSTRAINT [FK_Contract_Client1] FOREIGN KEY([IDClient])

REFERENCES [dbo].[Client] ([ID])

GO
ALTER TABLE [dbo].[Contract] CHECK CONSTRAINT [FK_Contract_Client1]

GO
ALTER TABLE [dbo].[Contract] WITH CHECK ADD CONSTRAINT [FK_Contract_Employee] FOREIGN KEY([IDEmployee])

REFERENCES [dbo].[Employee] ([ID])

GO
ALTER TABLE [dbo].[Contract] CHECK CONSTRAINT [FK_Contract_Employee]

GO
ALTER TABLE [dbo].[Microdistrict] WITH CHECK ADD CONSTRAINT [FK_Microdistrict_City1] FOREIGN KEY([IDCity])

REFERENCES [dbo].[City] ([ID])

GO
ALTER TABLE [dbo].[Microdistrict] CHECK CONSTRAINT [FK_Microdistrict_City1]

GO
ALTER TABLE [dbo].[Apartment] WITH CHECK ADD CONSTRAINT [FK_Apartment_Contract] FOREIGN KEY([IDContract])

REFERENCES [dbo].[Contract] ([ID])

GO
ALTER TABLE [dbo].[Apartment] CHECK CONSTRAINT [FK_Apartment_Contract]

GO
ALTER TABLE [dbo].[Apartment] WITH CHECK ADD CONSTRAINT [FK_Apartment_Microdistrict] FOREIGN KEY([IDMicrodistrict])

REFERENCES [dbo].[Microdistrict] ([ID])

GO
ALTER TABLE [dbo].[Apartment] CHECK CONSTRAINT [FK_Apartment_Microdistrict]

GO
ALTER TABLE [dbo].[Apartment] WITH CHECK ADD CONSTRAINT [FK_Apartment_Owner] FOREIGN KEY([IDOwner])

REFERENCES [dbo].[Owner] ([ID])

GO
ALTER TABLE [dbo].[Apartment] CHECK CONSTRAINT [FK_Apartment_Owner]

GO

Приложение 2


Листинг программы

Окно в WPF “MainWindow.xaml”.


xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

xmlns:local="clr-namespace:Kursov"

mc:Ignorable="d"

Title="MainWindow" Height="450" Width="800">
























Margin="10,0,0,10" Name="tbLog"/>


Content="Логин"/>

Margin="10,0,0,10" Name="tbPass"/>

Content="Пароль"/>



x:Name="btIn" Click="btIn_Click"/>









Окно в WPF кода “MainWindow.xaml.cs”.

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using System.Windows;

using System.Windows.Controls;

using System.Windows.Data;

using System.Windows.Documents;

using System.Windows.Input;

using System.Windows.Media;

using System.Windows.Media.Imaging;

using System.Windows.Navigation;

using System.Windows.Shapes;
namespace Kursov

{

///

/// Логика взаимодействия для MainWindow.xaml

///


public partial class MainWindow : Window

{

public MainWindow()

{

InitializeComponent();

tbPass.Password = "admin";

tbPass.PasswordChar = '*';

tbLog.Text = "admin";
}
private void btIn_Click(object sender, RoutedEventArgs e)

{

if (tbPass.Password == "admin" && tbLog.Text == "admin")

{

Forms.Apartment menuForm = new Forms.Apartment();

menuForm.Show();

this.Close();

}

}


}

}

“Apartment.xaml”.


xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

xmlns:local="clr-namespace:Kursov.Forms"

mc:Ignorable="d"

Title="Apartment" Height="450" Width="800">























RenderTransformOrigin="0.5,0.5"

Click="btHome_Click"

>

















































Width="100" Grid.Row="0" Grid.Column="0" Grid.RowSpan="4"

>






Text="{Binding Address}" />

































Apartment.xaml.cs”.

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using System.Windows;

using System.Windows.Controls;

using System.Windows.Data;

using System.Windows.Documents;

using System.Windows.Input;

using System.Windows.Media;

using System.Windows.Media.Imaging;

using System.Windows.Shapes;
namespace Kursov.Forms

{

///

/// Логика взаимодействия для Apartment.xaml

///


public partial class Apartment: Window

{

public Apartment ()

{

InitializeComponent();

bv.KursovEntities entities = new bv.KursovEntities();

lbServis.ItemsSource = entities.Apartment.ToList();

}
private void btHome_Click(object sender, RoutedEventArgs e)

{

MainWindow menuFotr = new MainWindow();

menuFotr.Show();

this.Close();

}

}

}

Apartment.cs”.

namespace Kursov.bv







{




using System;




using System.Collections.Generic;









public partial class Apartment




{




public int ID { get; set; }




public string Titles { get; set; }




public string Descriptions { get; set; }




public Nullable Price { get; set; }




public string Photo { get; set; }




public int IDOwner { get; set; }




public Nullable Room { get; set; }




public Nullable Square { get; set; }




public Nullable Floor { get; set; }




public string Address { get; set; }




public int NumberFloors { get; set; }




public Nullable IDContract { get; set; }




public int IDMicrodistrict { get; set; }









public virtual Contract Contract { get; set; }




public virtual Microdistrict Microdistrict { get; set; }




public virtual Owner Owner { get; set; }




}




}