Автор: Пользователь скрыл имя, 04 Июня 2012 в 20:33, курсовая работа
Целью курсовой работы является создание программного продукта по представлению данных о происшествиях на железной дороге в определенный период времени.
Важно, чтобы конечное приложение обладало удобным, легко воспринимаемым интерфейсом, который предоставляет пользователю доступ ко всем необходимым для работы функциям.
DM.DataSetOtkazyVid_Otkaza.
If Trim(DescRefusalEdit.Text)=''
DM.DataSetOtkazyOpisanie_
else
DM.DataSetOtkazyOpisanie_
DM.DataSetOtkazy.Post;
DM.DataSetOtkazy.Refresh;
end;
procedure TEditTypeRefusal.
begin
If Application.MessageBox(pchar('
'Внимание!',MB_OKCANCEL + MB_DEFBUTTON1) <> IDOK then
exit;
ComDel.Parameters.ParamByName(
DM.DataSetOtkazy.Close;
ComDel.Execute;
DM.DataSetOtkazy.Active:=true;
end;
procedure TEditTypeRefusal.FormShow(
var i: byte;
begin
for i:=0 to DBGridOtkazy.Columns.Count-1
do wCol3[i]:=DBGridOtkazy.
end;
procedure TEditTypeRefusal.FormResize(
var i: word;
p:real;
begin
p:=EditTypeRefusal.Width/745;
For i:=0 to DBGridOtkazy.Columns.Count-1 do
DBGridOtkazy.Columns.Items[i].
end;
end.
unit OtchetUnit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, ADODB,
Grids, DBGrids, ExtCtrls, StdCtrls;
type
TReportForm = class(TForm)
DataSource1: TDataSource;
DSrep1: TADODataSet;
Panel1: TPanel;
Grid: TDBGrid;
Label1: TLabel;
DSrep2: TADODataSet;
DSrep1DSDesigner: TWideStringField;
DSrep2DSDesigner: TWideStringField;
DSrep2DSDesigner1800: TIntegerField;
DSrep2DSDesigner1900: TIntegerField;
DSrep2DSDesigner1991: TIntegerField;
DSrep2DSDesigner1998: TIntegerField;
DSrep2DSDesigner2005: TIntegerField;
DSrep2DSDesigner2007: TIntegerField;
DSrep2DSDesigner2008: TIntegerField;
DSrep2DSDesigner2010: TIntegerField;
procedure FormShow(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;
var
ReportForm: TReportForm;
implementation
uses DMunit;
{$R *.dfm}
procedure TReportForm.FormShow(Sender: TObject);
var i: word;
begin
DataSource1.DataSet:=DSrep2;
DSrep2.Active:=true;
Grid.Columns.Items[0].Width:=
end;
procedure TReportForm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
DSrep1.Active:=false;
DSrep2.Active:=false;
end;
end.
unit PassUnit;
interface
uses Windows, SysUtils, Classes, Graphics, Forms, Controls, StdCtrls,
Buttons, Dialogs,registry;
type
TPasswordDlg = class(TForm)
Label1: TLabel;
Password: TEdit;
OKBtn: TButton;
CancelBtn: TButton;
user: TEdit;
Label2: TLabel;
Button1: TButton;
OpenDialog1: TOpenDialog;
procedure CancelBtnClick(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure OKBtnClick(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;
var
PasswordDlg: TPasswordDlg;
passID, userID, pathID: string;
connect: boolean;
implementation
uses MainUnit, DMunit;
{$R *.dfm}
procedure TPasswordDlg.CancelBtnClick(
begin
MainForm.close;
end;
procedure TPasswordDlg.Button1Click(
begin
if OpenDialog1.Execute then pathID:=OpenDialog1.FileName;
end;
procedure TPasswordDlg.FormCreate(
var
FIniFile: TRegIniFile;
begin
FIniFile := TRegIniFile.Create('Software')
FIniFile.OpenKey('dror',true);
pathID:=FiniFile.ReadString('
connect:=false;
end;
procedure TPasswordDlg.OKBtnClick(
begin
userID:=user.Text;
passID:=password.Text;
try
MainForm.Show;
MainForm.Connect;
except
Application.MessageBox(pchar('
' Не верно задано имя пользователя или пароль;'+#13+
' Не верно задан путь к базе данных.'),'Ошибка подключения к базе данных.',MB_OK);
exit;
end;
Connect:=true;
close;
end;
procedure TPasswordDlg.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
if NOT Connect then
MainForm.close;
end;
end.
DataSetMain:
Select *
From Main_Table;
DataSetOtkazy:
Select ID_Otkaz, Vid_Otkaza, Opisanie_Otkaza
From Otkazy;
DataSetSobytia:
SELECT *
From Sobytia
MainForm.ComDel:
DELETE FROM Main_Table
WHERE ID_Sob= :KE;
MainForm.ComDel2;
DELETE FROM Sobytia
WHERE ID_Sob= :KE;
MainForm.SobNew;
INSERT INTO Sobytia ( ID_Sob, ID_Otkaz )
SELECT Distinct Main_Table.ID_Sob, Otkazy.ID_Otkaz
FROM Main_Table INNER JOIN
Otkazy ON Main_Table.Vid_Otkaza = Otkazy.Vid_Otkaza;
MainForm.Udal;
Delete *
From Sobytia
EditOtkazy.ComNew:
INSERT INTO Otkazy(Vid_Otkaza, Opisanie_Otkaza)
VALUES(:NR, :DS)
EditOtkazy.ComEdit:
UPDATE Otkazy SET
Vid_Otkaza= :NR, ID_Otkaz=:KTR, Opisanie_Otkaza=:DS
Where ID_Otkaz=:KR
EditOtkazy.ComDel:
DELETE FROM Otkazy
WHERE ID_Otkaz= :KR;
MainRecordForm.ComNew:
INSERT INTO
Main_Table(Vid_Otkaza, Data_Otkaza, Pogiblo, Raneno, Finansy, Data_Vosstanov, Opisanie_Sobitia)
VALUES(:VE, :DE, :DD, :WD,
:LS, :DR, :DS);
MainRecordForm.ComEdit:
UPDATE Main_Table SET
Vid_Otkaza=:VE, Data_Otkaza=:DE, Pogiblo=:DD, Raneno=:WD, Finansy=:LS, Data_Vosstanov=:DR, Opisanie_Sobitia=:DS
WHERE ID_Sob=:KE;
RefusalForm.ComNew:
INSERT INTO Otkazy(Vid_Otkaza, Opisanie_Otkaza)
VALUES(:NR, :DS)
RefusalForm.ComEdit:
UPDATE Otkazy SET
Vid_Otkaza= :NR, ID_Otkaz=:KTR, Opisanie_Otkaza=:DS
Where ID_Otkaz=:KR
RefusalForm.ComDel:
DELETE FROM Otkazy
WHERE ID_Otkaz= :KR;
ReportForm.DSrep2:
TRANSFORM Count(A.ID_Sob) AS [CountKE]
SELECT A.Vid_Otkaza AS [Âèä îòêàçà]
FROM (
SELECT DISTINCT Sobytia.ID_Sob, Main_Table.Data_Otkaza, Otkazy.Vid_Otkaza
FROM Sobytia, Main_Table, Otkazy
WHERE Sobytia.ID_Sob= Main_Table.ID_Sob and Otkazy.ID_Otkaz= Sobytia.ID_Otkaz) AS A
GROUP BY A.Vid_Otkaza
PIVOT Format([Data_Otkaza],"yyyy");
Информация о работе Разработка информационной системы учёта отказов на железнодорожном транспорте