Диплом: Автоматизация учёта арендованных средств на примере "KR PROPERTIES"

Внимание! Если размещение файла нарушает Ваши авторские права, то обязательно сообщите нам
temp.TypeRealEstate = reader.GetString(4);
temp.TypeId = reader.GetInt32(5);
RealEstateDataGrid.Items.Add(temp);
}
}
else
{
MessageBox.Show("Нет занятой недвижимости");
}
}
privatevoid RadioButtonFreeRealState_Click(object sender, RoutedEventArgs e)
{
RealEstateDataGrid.Items.Clear();
//загрузка RealEstate
sqlCommand = "SELECT [RealEstatewRequest].[Id],
[RealEstatewRequest].[address], [RealEstatewRequest].[area_cubic_meters],
[RealEstatewRequest].[square_meters], [RealEstatewRequest].[TypeName],
[RealEstatewRequest].[type_realestate] FROM [RealEstatewRequest] WHERE NOT EXISTS (SELECT
[Arenda].[realestate] FROM [Arenda] WHERE [Arenda].[realestate] = [RealEstate].[Id])";
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);
}
}
else
{
MessageBox.Show("Нет свободной недвижимости");
}
}
//Client buttons
privatevoid ButtonNewContract_Click(object sender, RoutedEventArgs e)
{
if (select_client != null)
{
NewContract newContract = newNewContract(this.select_client, connection);
if (newContract.ShowDialog() == true)
{
ArendaDataGrid.Items.Add(newContract.Return_obj);
}
else
{
MessageBox.Show("Запись не была добавлена");
}
}
else
{
MessageBox.Show("что бы создать новый контракт необходимо выбрать клиента
на вкладке 'клиенты'");
}
}
privatevoid ClientDataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
Client client = ClientDataGrid.SelectedItem as Client;
if (client != null)
{
this.select_client = client;
}
}
}
}
Приложение 6
Model модуля Documents
using System;
usingSystem.Collections.Generic;
usingSystem.Data.OleDb;
using System.Linq;
using System.Text;
usingSystem.Threading.Tasks;
using System.Windows;
usingSystem.Windows.Controls;
usingSystem.Windows.Data;
usingSystem.Windows.Documents;
usingSystem.Windows.Input;
usingSystem.Windows.Media;
usingSystem.Windows.Media.Imaging;
usingSystem.Windows.Shapes;
namespace Diplom
{
publicpartialclassDocuments : Window
{
OleDbConnection connection;
OleDbCommand command;
OleDbDataReader reader;
string sqlCommand;
Document select_document = null;
int IdArenda;
publicDocuments(int IdArenda, OleDbConnection connection)
{
InitializeComponent();
this.IdArenda = IdArenda;
this.connection = connection;
sqlCommand = "SELECT * FROM [DocumentsRequest] WHERE
[ArendaDocument].[arenda] = " + IdArenda;
command = newOleDbCommand(sqlCommand, connection);
reader = command.ExecuteReader();
if (reader.HasRows)
{
while (reader.Read())
{
Document temp = newDocument();
//0 - другоеполе
temp.Id = reader.GetInt32(1);
temp.Document_name = reader.GetString(2);
temp.TypeId = reader.GetInt32(3);
temp.TypeDocument = reader.GetString(4);
//temp.Description = reader.GetTextReader(5);
//temp.Link = reader.GetString(6);
DocumentsDataGrid.Items.Add(temp);
}
}
}
privatevoid DocumentsDataGrid_SelectionChanged(object sender, SelectionChangedEventArgs
e)
{
Document document = DocumentsDataGrid.SelectedItem as Document;
if (document != null)
{
this.select_document = document;
}
}
privatevoid ButtonOpen_Click(object sender, RoutedEventArgs e)
{
if (select_document != null)
{
//open link document
}
else
{
MessageBox.Show("Что бы открыть документ, сначала выбирите его из
представленной таблицы.");
}
}
privatevoid ButtonAddDocument_Click(object sender, RoutedEventArgs e)
{
NewDocument newDocument = newNewDocument(IdArenda, connection);
newDocument.ShowDialog();
}
privatevoid ButtonDeleteDocument_Click(object sender, RoutedEventArgs e)
{
MessageBoxResult rezultdialog =
MessageBox.Show("Выуверенычтохотитеудалитьдокумент ?", string.Empty,
MessageBoxButton.YesNo, MessageBoxImage.Exclamation);
if (rezultdialog == MessageBoxResult.Yes)
{
if (select_document != null)
{
try
{
sqlCommand = "DELETE FROM [ArendaDocument] WHERE
[ArendaDocument].[documnet] = " + select_document.Id + " AND [ArendaDocument].[arenda] =
" + IdArenda;
command = newOleDbCommand(sqlCommand, connection);
if (command.ExecuteNonQuery() != 1)
{
thrownewException("Ошибкаудаленияиз [ArendaDocument].
Обратитестькадминистраторуилиразработчику.");
}
sqlCommand = "DELETE FROM [Document] WHERE [Document].[Id] = " +
select_document.Id;
command = newOleDbCommand(sqlCommand, connection);
if (command.ExecuteNonQuery() == 1)
{
MessageBox.Show("Записьуспешноудалена");
DocumentsDataGrid.Items.Remove(select_document);
select_document = null;
}
else
{
thrownewException("Базаданныхвернула '1'");
}
}
catch (Exception ex)
{
MessageBox.Show("Ошибака: " + ex.Message, "Error",
MessageBoxButton.OK, MessageBoxImage.Error);
}
}
}
}
}
}
Приложение 7
Model модуля NewDocument
using Microsoft.Win32;
using System;
usingSystem.Collections.Generic;
usingSystem.Data.OleDb;
using System.Linq;
using System.Text;
usingSystem.Threading.Tasks;
using System.Windows;
usingSystem.Windows.Controls;
usingSystem.Windows.Data;
usingSystem.Windows.Documents;
usingSystem.Windows.Input;
usingSystem.Windows.Media;
usingSystem.Windows.Media.Imaging;
usingSystem.Windows.Shapes;
namespace Diplom
{
///<summary>
///Логикавзаимодействиядля NewDocument.xaml
///</summary>
publicpartialclassNewDocument : Window
{
OleDbConnection connection;
OleDbCommand command;
OleDbDataReader reader;
string sqlCommand;
int IdArenda;
TypeDocument selection_typedocument = null;
publicNewDocument(int IdArenda, OleDbConnection connection)
{
InitializeComponent();
this.IdArenda = IdArenda;
this.connection = connection;
//загрузкатипов
sqlCommand = "SELECT [Type_Document].[Id], [Type_Document].[typename] FROM
[Type_Document]";
command = newOleDbCommand(sqlCommand, connection);
reader = command.ExecuteReader();
if (reader.HasRows)
{
while (reader.Read())
{
TypeDocument temp = newTypeDocument();
temp.Id = reader.GetInt32(0);
temp.typename = reader.GetString(1);
TypeDocumentDataGrid.Items.Add(temp);
}
}
}
privatevoid TypeDocumentDataGrid_SelectionChanged(object sender,
SelectionChangedEventArgs e)
{
TypeDocument typeDocument = TypeDocumentDataGrid.SelectedItem as
TypeDocument;
if (typeDocument != null)
{
this.selection_typedocument = typeDocument;
}
}
privatevoid ButtonReview_Click(object sender, RoutedEventArgs e)
{
OpenFileDialog dialog = newOpenFileDialog();
if (dialog.ShowDialog().ToString() == "True")
{
LinkDocumentTB.Text = dialog.FileName;
}
}
privatevoid ButtonDone_Click(object sender, RoutedEventArgs e)
{
if (selection_typedocument != null)
{
if (NameDocumentTB.Text != string.Empty || LinkDocumentTB.Text != string.Empty)
{
sqlCommand = string.Format("INSERT INTO [Document] ([document_name],
[type_document], [link]) VALUES ('{0}', {1}, '{2}')", NameDocumentTB.Text,
selection_typedocument.Id, LinkDocumentTB.Text);
command = newOleDbCommand(sqlCommand, connection);
if (command.ExecuteNonQuery() == 1)
{
MessageBox.Show("Документуспешнодобавлен.");
sqlCommand = string.Format("SELECT [Document].[Id] FROM
[Document] WHERE [Document].[document_name] = '{0}' AND [Document].[type_document] = {1}
AND [Document].[link]", NameDocumentTB.Text, selection_typedocument.Id,
LinkDocumentTB.Text);
command = newOleDbCommand(sqlCommand, connection);
int IdDocument = (int)command.ExecuteScalar();
sqlCommand = string.Format("INSERT INTO [ArendaDocument]
([arenda], [documnet]) VALUES ({0}, {1})", IdArenda, IdDocument);
command = newOleDbCommand(sqlCommand, connection);
command.ExecuteNonQuery();
}
}
else
{
MessageBox.Show("Невведеноимядокументаилинеуказанпутьдонего.");
}
}
else
{
MessageBox.Show("Сначала выбирете тип документа.");
}
}
}
}
Приложение 8
Model модуля NewContract
using System;
usingSystem.Collections.Generic;
usingSystem.Data.OleDb;
using System.Linq;
using System.Text;
usingSystem.Threading.Tasks;
using System.Windows;
usingSystem.Windows.Controls;
usingSystem.Windows.Data;
usingSystem.Windows.Documents;
usingSystem.Windows.Input;
usingSystem.Windows.Media;
usingSystem.Windows.Media.Imaging;
usingSystem.Windows.Shapes;
namespace Diplom
{
publicpartialclassNewContract : Window
{
OleDbConnection connection;
OleDbCommand command;
OleDbDataReader reader;
string sqlCommand;
RealEstate selection_realestate = null;
Client selection_client = null;
public Arenda Return_obj { get; set; }
publicNewContract(Client selection_client, OleDbConnection connection)
{
InitializeComponent();
this.connection = connection;
this.selection_client = selection_client;
IdClientTB.Text = selection_client.Id.ToString();
FIOClientTB.Text = selection_client.FIO;
startArendaTB.SelectedDate = DateTime.Now;
//загрузка RealEstate
sqlCommand = "SELECT [RealEstatewRequest].[Id],
[RealEstatewRequest].[address], [RealEstatewRequest].[area_cubic_meters],
[RealEstatewRequest].[square_meters], [RealEstatewRequest].[TypeName],
[RealEstatewRequest].[type_realestate] FROM [RealEstatewRequest] WHERE NOT EXISTS (SELECT
* FROM [Arenda] WHERE [Arenda].[realestate] = [RealEstate].[Id])";
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);
}
}
else
{
MessageBox.Show("Нет свободной недвижимости");
}
}
privatevoid RealEstateDataGrid_SelectionChanged(object sender, SelectionChangedEventArgs
e)
{
RealEstate realEstate = RealEstateDataGrid.SelectedItem as RealEstate;
if (realEstate != null)
{
this.selection_realestate = realEstate;
}
}
privatevoid ButtonDone_Click(object sender, RoutedEventArgs e)
{
if (selection_realestate != null)
{
if (selection_client != null)
{
if (startArendaTB.SelectedDate == null || endArendaTB.SelectedDate == null ||
PriceArendaTB.Text == "" || PriceArendaTB.Text == "0")
{
MessageBox.Show("Не заданы даты или цена");
}
else
{
sqlCommand = string.Format("INSERT INTO [Arenda] ([realestate],
[client], [date_of_delivery], [сompletion_date], [price]) VALUES ({0}, {1}, '{2}', '{3}',
{4})", selection_realestate.Id, selection_client.Id, startArendaTB.SelectedDate,
endArendaTB.SelectedDate, PriceArendaTB.Text);
command = newOleDbCommand(sqlCommand, connection);
try
{
if (command.ExecuteNonQuery() == 1)
{
MessageBox.Show("Новаязаписьуспешнодобавлена");
//загрузка Arenda
sqlCommand = string.Format("SELECT * FROM [ArendaRequest]
WHERE [RealEstate].[Id] = {0}", selection_realestate.Id);
command = newOleDbCommand(sqlCommand, connection);
reader = command.ExecuteReader();
reader.Read();
Arenda temp = newArenda();
temp.Id = reader.GetInt32(0);
temp.date_of_delivery = reader.GetDateTime(1);
temp.сompletion_date = reader.GetDateTime(2);
temp.Price = reader.GetInt32(3);
temp.IdClient = reader.GetInt32(4);
temp.FIOClient = reader.GetString(5);
temp.IdRealEstate = reader.GetInt32(6);
temp.AddressRealEstate = reader.GetString(7);
Return_obj = temp;
this.DialogResult = true;
}
else
{
thrownewException("Базаданныхвернула '1'");
}
}
catch (Exception ex)
{
MessageBox.Show("Ошибака: " + ex.Message, "Error",
MessageBoxButton.OK, MessageBoxImage.Error);
}
}
}
else
{
MessageBox.Show("Ошибка!!! объект Client == null");
}
}
else
{
MessageBox.Show("Не выбрана недвижимость");
}
}
}
}

Смотрите также:

"Автоматизация обработки заявок ООО "Проектно-Строительная Компания"
"Автоматизация процесса аттестации персонала для ООО "Нэт Бай Нэт Холдинг"
"Анализ интернет-активности конкурентов ( на примере конкурентов "Газпром нефть")
"Бухгалтерский учёт и аудит расчётов с подотчётними лицами в организации на примере ООО "ЛОЦ 10""
«Психологическое сопровождение персонала в организации на примере ООО «Крокус»
«Управление ресурсами проекта» (на примере организации ООО «ЛАКОСТЭ»)
Agile-методология в управлении проектами на примере ООО «Ресурсный центр «Академия КлассИнфо»
Aвтoмaтизaция пpoцecca вeдeния инфopмaциoннoй бaзы o дoлжнocтяx и вaкaнcияx c укaзaниeм тpeбoвaний к уpoвню знaний и нaвыкoв кaндидaтoв для гpуппы кaдpoв вoйcкoвoй чacти 3474»
Cовершенствование деловой оценки персонала в организации (на примере ООО "Даймонд кейтеринг развитие")
Cовершенствование управления рентабельности предприятия (на примере гуипп «бендерская типография «полиграфист»)