Кинопрокат

Автор работы: Пользователь скрыл имя, 31 Января 2013 в 20:38, курсовая работа

Описание

Задачей данного проекта является разработка программного обеспечения в среде визуального программирования Delphi для информационной системы в конкретной предметной области. В данном курсовом проекте велась работа над созданием базы данных для кинопроката.

Содержание

1. Постановка задачи …………………………………………………………….3
2. Описание предметной области…………………………………………...….4
3. Проектирование интерфейса
3.1. Выбор и назначение визуальных компонентов…………………...…5
3.2. Формы проекта ..…………………………………………….…....……7
4. Разработка программного обеспечения
4.1. Процедуры, функции проекта и их назначение………………….…9
4.2. Текст программы………………………………………………….….11
5. Визуальное представление результатов………………………………...…27
6. Список литературы…………………………………………………………...29

Работа состоит из  1 файл

ПЗ.doc

— 1.73 Мб (Скачать документ)

if MessageDlg ('Удалить  запись?', mtConfirmation, [mbYes, mbNo], 0)

= mrNO then Abort;

Form2.ADOTable1.Delete;

end;

 

procedure TForm2.SpeedButton1Click(Sender: TObject);

begin

Form2.Hide;

Form3.show;

end;

 

procedure TForm2.SpeedButton2Click(Sender: TObject);

begin

Form2.Hide;

Form4.show;

end;

 

procedure TForm2.SpeedButton3Click(Sender: TObject);

begin

  close;

end;

 

procedure TForm2.N1Click(Sender: TObject);

begin

Form2.ADOTable1.Insert;

  Form2.ADOTable1.FieldByName(DBGrid1.Columns.Items[0].DisplayName)

   .AsString := Self.Edit1.Text;

  Form2.ADOTable1.FieldByName(DBGrid1.Columns.Items[1].DisplayName)

   .AsString := Self.Edit2.Text;

  Form2.ADOTable1.FieldByName(DBGrid1.Columns.Items[2].DisplayName)

   .AsString := Self.Edit3.Text;

  Form2.ADOTable1.FieldByName(DBGrid1.Columns.Items[3].DisplayName)

   .AsString := Self.Edit4.Text;

  Form2.ADOTable1.FieldByName(DBGrid1.Columns.Items[4].DisplayName)

   .AsString := Self.Edit5.Text;

     Form2.ADOTable1.FieldByName(DBGrid1.Columns.Items[5].DisplayName)

   .AsString := Self.Edit6.Text;

     Form2.ADOTable1.FieldByName(DBGrid1.Columns.Items[6].DisplayName)

   .AsString := Self.Edit7.Text;

  Form2.ADOTable1.Post;

  Form2.Edit1.Clear;

  Form2.Edit2.Clear;

  Form2.Edit3.Clear;

  Form2.Edit4.Clear;

  Form2.Edit5.Clear;

  Form2.Edit6.Clear;

  Form2.Edit7.Clear;

end;

procedure TForm2.N2Click(Sender: TObject);

begin

  if MessageDlg ('Удалить  запись?', mtConfirmation, [mbYes, mbNo], 0)

= mrNO then Abort;

Form2.ADOTable1.Delete;

end;

 

procedure TForm2.N3Click(Sender: TObject);

begin

  if MessageDlg ('Сохранить изменения?', mtConfirmation, [mbYes, mbNo], 0)

  = mrNO then Abort;

if Form2.ADOTable1.Modified then

Form2.ADOTable1.Post;

end;

 

end.

 

unit Unit3;

 

interface

 

uses

  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

  Dialogs, Buttons, StdCtrls, DB, ADODB, Grids, DBGrids, Menus, jpeg,

  ExtCtrls;

 

type

  TForm3 = class(TForm)

    DataSource1: TDataSource;

    DBGrid1: TDBGrid;

    ADOConnection1: TADOConnection;

    ADOTable1: TADOTable;

    ADOTable1DSDesigner: TAutoIncField;

    ADOTable1DSDesigner2: TWideStringField;

    ADOTable1_: TIntegerField;

    ADOTable1DSDesigner3: TWideStringField;

    ADOTable1DSDesigner4: TWideStringField;

    ADOTable1DSDesigner5: TWideStringField;

    ADOTable1DSDesigner6: TWideStringField;

    ADOTable1DSDesigner7: TIntegerField;

    Label1: TLabel;

    Edit1: TEdit;

    Label2: TLabel;

    SpeedButton1: TSpeedButton;

    RadioButton1: TRadioButton;

    RadioButton2: TRadioButton;

    RadioButton3: TRadioButton;

    Image1: TImage;

    Image2: TImage;

    Image3: TImage;

    Image4: TImage;

    Image5: TImage;

    Image6: TImage;

    Image7: TImage;

    Image8: TImage;

    SpeedButton2: TSpeedButton;

    SpeedButton3: TSpeedButton;

    procedure SpeedButton1Click(Sender: TObject);

    procedure SpeedButton3Click(Sender: TObject);

    procedure SpeedButton2Click(Sender: TObject);

  private

    { Private declarations }

  public

    { Public declarations }

  end;

 

var

  Form3: TForm3;

 

implementation

 

uses Unit2;

 

{$R *.dfm}

 

procedure TForm3.SpeedButton1Click(Sender: TObject);

begin

 

 

if RadioButton1.Checked then

begin

if Edit1.Text='' then exit;

  Form3.ADOTable1.Filtered := false;

  Form3.ADOTable1.Filter := 'Назваие LIKE ''*' + Edit1.Text + '*''';

  Form3.ADOTable1.Filtered := true;

end;

 

if RadioButton2.Checked then

begin

if Edit1.Text='' then exit;

  Form3.ADOTable1.Filtered := false;

Form3.ADOTable1.Filter := 'страна LIKE ''*' + Edit1.Text + '*''';

  Form3.ADOTable1.Filtered := true;

end;

 

if RadioButton3.Checked then

begin

if Edit1.Text='' then exit;

  Form3.ADOTable1.Filtered := false;

  Form3.ADOTable1.Filter := 'Формат LIKE ''*' + Edit1.Text + '*''';

  Form3.ADOTable1.Filtered := true;

end;

end;

 

procedure TForm3.SpeedButton3Click(Sender: TObject);

begin

Form3.Hide;

Form2.show;

end;

 

procedure TForm3.SpeedButton2Click(Sender: TObject);

begin

close;

end;

 

end.

 

 

unit Unit4;

 

unit Unit4;

 

interface

 

uses

  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

  Dialogs, jpeg, ExtCtrls, Buttons, Series, TeEngine, TeeProcs, Chart, DB,

  ADODB, Grids, DBGrids;

 

type

  TForm4 = class(TForm)

    DBGrid1: TDBGrid;

    DataSource1: TDataSource;

    ADOConnection1: TADOConnection;

    ADOTable1: TADOTable;

    Chart1: TChart;

    Chart2: TChart;

    Chart3: TChart;

    Series1: TBarSeries;

    Series2: THorizBarSeries;

    Series3: TPieSeries;

    SpeedButton1: TSpeedButton;

    SpeedButton2: TSpeedButton;

    SpeedButton3: TSpeedButton;

    SpeedButton4: TSpeedButton;

    SpeedButton5: TSpeedButton;

    Image1: TImage;

    procedure SpeedButton1Click(Sender: TObject);

    procedure SpeedButton2Click(Sender: TObject);

    procedure SpeedButton3Click(Sender: TObject);

    procedure SpeedButton4Click(Sender: TObject);

    procedure SpeedButton5Click(Sender: TObject);

  private

    { Private declarations }

  public

    { Public declarations }

  end;

 

var

  Form4: TForm4;

 

implementation

 

uses Unit2;

 

{$R *.dfm}

 

procedure TForm4.SpeedButton1Click(Sender: TObject);

var

  kat: array of string;

  kol: array of integer;

  I,f: integer;

  n:boolean;

begin

   chart3.hide;

   chart2.hide;

   chart1.show;

  Chart1.Series[0].Clear;

   SetLength(kat, Form4.ADOTable1.RecordCount);

   SetLength(kol, Form4.ADOTable1.RecordCount);

 

  for I := 0 to length(kat)-1 do

  begin

    kat[I] := '';

    kol[I] := 0;

  end;

 

  Form4.ADOTable1.First;

   I := 0;

  while not  Form4.ADOTable1.Eof do

  begin

    if Form4.ADOTable1.FieldByName('режиссер').AsString <> '' then

    begin

      n:=false;

      for f := 0 to length(kat)-1 do

      if kat[f] = Form4.ADOTable1.FieldByName

        ('режиссер').AsString then

        begin

        n:=true;

        end;

        if n=false then

        begin

      kat[I] := Form4.ADOTable1.FieldByName('режиссер').AsString;

      kol[I] := 0;

        end;

 

      I := I + 1;

    end;

     Form4.ADOTable1.Next;

  end;

  Form4.ADOTable1.First;

  I := 0;

  Form4.ADOTable1.First;

  while not Form4.ADOTable1.Eof do

  begin

    for I := 0 to length(kat)-1 do

          if kat[I] = Form4.ADOTable1.FieldByName

        ('режиссер').AsString then

       kol[I] := kol[I] + Form4.ADOTable1.FieldByName

          (Form4.DBGrid1.Columns.Items[7].DisplayName).AsInteger;

    Form4.ADOTable1.Next;

  end;

  Form4.ADOTable1.First;

  for I := 0 to length(kat)-1 do

    if kat[I] <> '' then

    begin

      Chart1.Series[0].Add(kol[I], kat[I], clTeeColor);

    end;

 

    end;

 

procedure TForm4.SpeedButton2Click(Sender: TObject);

  var

  kat: array of string;

  kol: array of integer;

  I,f: integer;

  n:boolean;

begin

   chart3.hide;

   chart1.hide;

   chart2.show;

  Chart2.Series[0].Clear;

   SetLength(kat, Form4.ADOTable1.RecordCount);

   SetLength(kol, Form4.ADOTable1.RecordCount);

 

  for I := 0 to length(kat)-1 do

  begin

    kat[I] := '';

    kol[I] := 0;

  end;

 

  Form4.ADOTable1.First;

   I := 0;

  while not  Form4.ADOTable1.Eof do

  begin

    if Form4.ADOTable1.FieldByName('страна').AsString <> '' then

    begin

      n:=false;

      for f := 0 to length(kat)-1 do

      if kat[f] = Form4.ADOTable1.FieldByName

        ('страна').AsString then

        begin

        n:=true;

        end;

        if n=false then

        begin

      kat[I] := Form4.ADOTable1.FieldByName('страна').AsString;

      kol[I] := 0;

        end;

 

      I := I + 1;

    end;

     Form4.ADOTable1.Next;

  end;

  Form4.ADOTable1.First;

  I := 0;

  Form4.ADOTable1.First;

  while not Form4.ADOTable1.Eof do

  begin

    for I := 0 to length(kat)-1 do

          if kat[I] = Form4.ADOTable1.FieldByName

        ('страна').AsString then

       kol[I] := kol[I] + Form4.ADOTable1.FieldByName

          (Form4.DBGrid1.Columns.Items[7].DisplayName).AsInteger;

    Form4.ADOTable1.Next;

  end;

  Form4.ADOTable1.First;

  for I := 0 to length(kat)-1 do

    if kat[I] <> '' then

    begin

      Chart2.Series[0].Add(kol[I], kat[I], clTeeColor);

    end;

 

end;

 

procedure TForm4.SpeedButton3Click(Sender: TObject);

 

var

  kat: array of string;

  kol: array of integer;

  I,f: integer;

  n:boolean;

begin

   chart1.hide;

   chart2.hide;

   chart3.show;

  Chart3.Series[0].Clear;

   SetLength(kat, Form4.ADOTable1.RecordCount);

   SetLength(kol, Form4.ADOTable1.RecordCount);

 

  for I := 0 to length(kat)-1 do

  begin

    kat[I] := '';

    kol[I] := 0;

  end;

 

  Form4.ADOTable1.First;

   I := 0;

  while not  Form4.ADOTable1.Eof do

  begin

    if Form4.ADOTable1.FieldByName(' жанр ').AsString <> '' then

    begin

      n:=false;

      for f := 0 to length(kat)-1 do

      if kat[f] = Form4.ADOTable1.FieldByName

        ('жанр').AsString then

        begin

        n:=true;

        end;

        if n=false then

        begin

      kat[I] := Form4.ADOTable1.FieldByName('жанр').AsString;

      kol[I] := 0;

        end;

 

      I := I + 1;

    end;

     Form4.ADOTable1.Next;

  end;

  Form4.ADOTable1.First;

  I := 0;

  Form4.ADOTable1.First;

  while not Form4.ADOTable1.Eof do

  begin

    for I := 0 to length(kat)-1 do

          if kat[I] = Form4.ADOTable1.FieldByName

        ('жанр').AsString then

       kol[I] := kol[I] + Form4.ADOTable1.FieldByName

          (Form4.DBGrid1.Columns.Items[7].DisplayName).AsInteger;

    Form4.ADOTable1.Next;

  end;

  Form4.ADOTable1.First;

  for I := 0 to length(kat)-1 do

    if kat[I] <> '' then

    begin

      Chart3.Series[0].Add(kol[I], kat[I], clTeeColor);

    end;

end;

 

procedure TForm4.SpeedButton4Click(Sender: TObject);

begin

form4.hide;

form2.show;

end;

 

procedure TForm4.SpeedButton5Click(Sender: TObject);

begin

close;

end;

 

end.  
5. Визуальное представление результатов

 

Рис.5 Диаграмма по названию

 

Рис.6 Диаграмма по стране

 

Рис.7 Диаграмма по жанру

 

 

 

 

 

 

 

 

 

 

 

 

 

Информация о работе Кинопрокат