Процесс информирования родителей об успеваемости учеников

Рассмотрение этапов автоматизации процесса информирования родителей об успеваемости учеников: реализация преобразования школьного журнала в электронный вид, формирование и администрирование баз данных школьников, создание множества SMS сообщений.

Рубрика Программирование, компьютеры и кибернетика
Вид дипломная работа
Язык русский
Дата добавления 12.05.2010
Размер файла 572,7 K

Отправить свою хорошую работу в базу знаний просто. Используйте форму, расположенную ниже

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

ADOTable1.UpdateRecord;

ADOTable1.Post;

end;

Inc(Start);

end;

ADOTable1.Next;

end;

//конец Цикл1

ADOTable1.Close;

ADOConnection1.CommitTrans;

ADOConnection1.Close;

//N сообщений отправлено

MessageDlg('Отправлено сообщений:'+IntToStr(start)+'.',mtInformation,[mbOK],0);

end;

procedure TMainForm.FormShow(Sender: TObject);

begin

Form1.ShowModal;

OpenHideBtn.Caption:=#134;

end;

procedure TMainForm.OpenHideBtnClick(Sender: TObject);

var

i:integer;

begin

i:=Width;

if OpenHideBtn.Left=320 then

begin

Constraints.MaxWidth:=474;

Width:=i+100;

OpenHideBtn.Left:=420;

OpenHideBtn.Layout:=blGlyphRight;

OpenHideBtn.Caption:=#133;

PupilsBtn.Visible:=true;

MsgBtn.Visible:=true;

end

else

begin

Constraints.MaxWidth:=374;

OpenHideBtn.Left:=320;

OpenHideBtn.Top:=0;

Width:=i-100;

OpenHideBtn.Layout:=blGlyphLeft;

OpenHideBtn.Caption:=#134;

PupilsBtn.Visible:=false;

MsgBtn.Visible:=false;

end;

end;

procedure TMainForm.PupilsBtnClick(Sender: TObject);

var

i,j:integer;

Exist:boolean;

begin

DBForm.Caption:='База данных Ученики';

DBForm.HeaderLbl.Caption:='Введите необходимую информацию';

DBForm.HeaderLbl.Visible:=true;

DBForm.YearEdit.Visible:=true;

DBForm.YearLbl.Visible:=true;

DBForm.TermEdit.Visible:=true;

DBForm.TermLbl.Visible:=true;

DBForm.SchoolCBox.Visible:=true;

DBForm.SchoolLbl.Visible:=true;

DBForm.FormCBox.Visible:=true;

DBForm.FormLbl.Visible:=true;

DBForm.PupilCBox.Visible:=true;

DBForm.PupilLbl.Visible:=true;

DBForm.TermEdit.Enabled:=false;

DBForm.SchoolCBox.Enabled:=false;

DBForm.FormCBox.Enabled:=false;

DBForm.PupilCBox.Enabled:=false;

DBForm.YearEdit.Text:='';

DBForm.TermEdit.Text:='';

DBForm.SchoolCBox.Clear;

DBForm.FormCBox.Clear;

DBForm.PupilCBox.Clear;

DBForm.Width:=672;

DBForm.Constraints.MaxWidth:=672;

DBForm.TextMsg.Visible:=false;

ADOConnection1.ConnectionString:='Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+GetCurrentDir+'\DataBases\MainDB.mdb;Persist Security Info=False';

ADOTable1.TableName:='Школы';

SetLength(SchoolList,0);

SetLength(FormList,0,0);

ADOTable1.Open;

ADOTable1.First;

While not ADOTable1.Eof do

begin

SetLength(SchoolList,Length(SchoolList)+1);

SetLength(FormList,Length(FormList)+1);

SchoolList[High(SchoolList)]:=ADOTable1.FieldByName('Школа').AsString;

While (ADOTable1.FieldByName('Школа').AsString=SchoolList[High(SchoolList)])and(not ADOTable1.Eof) do

begin SetLength(FormList[High(FormList)],Length(FormList[High(FormList)])+1); FormList[High(FormList),High(FormList[High(FormList)])]:=ADOTable1.FieldByName('Класс').AsString;

ADOTable1.Next;

end;

end;

ADOTable1.Close;

DBForm.SchoolCBox.Clear;

for i:=0 to High(SchoolList)do

DBForm.SchoolCBox.Items.Add(SchoolList[i]);

DBForm.DBGrid1.ReadOnly:=true;

DBForm.DBGrid1.OnDrawDataCell:=DBForm.DBGrid1DrawDataCell1;

DBForm.ShowModal;

end;

procedure TMainForm.MsgBtnClick(Sender: TObject);

begin

DBForm.Caption:='База данных Сообщения';

DBForm.HeaderLbl.Caption:='Нажмите сообщение, текст которого хотите посмотреть';

DBForm.YearEdit.Visible:=false;

DBForm.YearLbl.Visible:=false;

DBForm.TermEdit.Visible:=false;

DBForm.TermLbl.Visible:=false;

DBForm.SchoolCBox.Visible:=false;

DBForm.SchoolLbl.Visible:=false;

DBForm.FormCBox.Visible:=false;

DBForm.FormLbl.Visible:=false;

DBForm.PupilCBox.Visible:=false;

DBForm.PupilLbl.Visible:=false;

DBForm.Width:=672;

DBForm.Constraints.MaxWidth:=672;

DBForm.TextMsg.Visible:=false;

ADOConnection1.ConnectionString:='Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+GetCurrentDir+'\DataBases\MainDB.mdb;Persist Security Info=False';

ADOTable1.TableName:='Сообщения';

ADOTable1.Active:=true;

DBForm.DBGrid1.ReadOnly:=false;

DBForm.DBGrid1.OnDrawDataCell:=DBForm.DBGrid1DrawDataCell;

DBForm.ShowModal;

end;

end.

Окно отображения БД (листинг)

unit DBWindow;

interface

uses

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

Dialogs, MainWindow, Grids, DBGrids, DB, DBTables, StdCtrls;

type

TDBForm = class(TForm)

DBGrid1: TDBGrid;

DataSource1: TDataSource;

YearEdit: TEdit;

TermEdit: TEdit;

SchoolCBox: TComboBox;

FormCBox: TComboBox;

PupilCBox: TComboBox;

TextMsg: TMemo;

YearLbl: TLabel;

TermLbl: TLabel;

SchoolLbl: TLabel;

FormLbl: TLabel;

PupilLbl: TLabel;

HeaderLbl: TLabel;

procedure FormClose(Sender: TObject; var Action: TCloseAction);

procedure DBGrid1DrawDataCell(Sender: TObject; const Rect: TRect;

Field: TField; State: TGridDrawState);

procedure DBGrid1DrawDataCell1(Sender: TObject; const Rect: TRect;

Field: TField; State: TGridDrawState);

procedure SchoolCBoxChange(Sender: TObject);

procedure FormCBoxChange(Sender: TObject);

procedure PupilCBoxChange(Sender: TObject);

procedure YearEditChange(Sender: TObject);

procedure TermEditChange(Sender: TObject);

procedure DBGrid1CellClick(Column: TColumn);

procedure FormCreate(Sender: TObject);

procedure DBGrid1KeyUp(Sender: TObject; var Key: Word;

Shift: TShiftState);

private

{ Private declarations }

public

{ Public declarations }

end;

var

DBForm: TDBForm;

implementation

{$R *.dfm}

procedure TDBForm.FormClose(Sender: TObject; var Action: TCloseAction);

begin

MainForm.ADOTable1.Active:=false;

MainForm.ADOConnection1.Close;

FormCBox.Enabled:=false;

PupilCBox.Enabled:=false;

//MainForm.ADOTable1.Close;

end;

procedure TDBForm.DBGrid1DrawDataCell(Sender: TObject; const Rect: TRect;

Field: TField; State: TGridDrawState);

var

S: string;

begin

if Field is TMemoField then

with (Sender as TDBGrid).Canvas do

begin

S := MainForm.ADOTable1.FieldValues['Текст сообщения'];

{ remove carriage returns & line feeds }

while Pos(#13, S) > 0 do S[Pos(#13, S)] := ' ';

while Pos(#10, S) > 0 do S[Pos(#10, S)] := ' ';

{ clear the cell }

FillRect(Rect);

{ fill cell with memo data }

TextOut(Rect.Left, Rect.Top, S);

end;

end;

procedure TDBForm.SchoolCBoxChange(Sender: TObject);

var

i:integer;

begin

FormCBox.Enabled:=true;

PupilCBox.Enabled:=false;

FormCBox.Clear;

for i:=0 to High(FormList[SchoolCBox.ItemIndex])do

DBForm.FormCBox.Items.Add(FormList[SchoolCBox.ItemIndex,i]);

end;

procedure TDBForm.FormCBoxChange(Sender: TObject);

begin

PupilCBox.Enabled:=true;

PupilCBox.Clear;

if FileExists(GetCurrentDir+'\DataBases\'+SchoolCBox.Items.Strings[SchoolCBox.ItemIndex]+'\'+FormCBox.Items.Strings[FormCBox.ItemIndex]+'\'+'DB_'+TermEdit.Text+'_'+YearEdit.Text+'.mdb')

then

begin

MainForm.ADOConnection1.Close;

MainForm.ADOConnection1.ConnectionString:='Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+GetCurrentDir+'\DataBases\'+SchoolCBox.Items.Strings[SchoolCBox.ItemIndex]+'\'+FormCBox.Items.Strings[FormCBox.ItemIndex]+'\'+'DB_'+TermEdit.Text+'_'+YearEdit.Text+'.mdb;Persist Security Info=False';

MainForm.ADOTable1.TableName:='Ученики';

MainForm.ADOTable1.Open;

MainForm.ADOTable1.First;

While not MainForm.ADOTable1.Eof do

begin

PupilCBox.Items.Add(MainForm.ADOTable1.FieldValues['Фамилия']+' '+MainForm.ADOTable1.FieldValues['Имя']+' - '+MainForm.ADOTable1.FieldValues['Телефон']);

MainForm.ADOTable1.Next;

end;

MainForm.ADOTable1.Close;

end

else

begin

PupilCBox.Items.Add('Нет такой БД');

PupilCBox.ItemIndex:=0;

PupilCBox.Enabled:=false;

end;

end;

procedure TDBForm.PupilCBoxChange(Sender: TObject);

begin

MainForm.ADOConnection1.Close; MainForm.ADOConnection1.ConnectionString:='Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+GetCurrentDir+'\DataBases\'+SchoolCBox.Items.Strings[SchoolCBox.ItemIndex]+'\'+FormCBox.Items.Strings[FormCBox.ItemIndex]+'\'+'DB_'+TermEdit.Text+'_'+YearEdit.Text+'.mdb;Persist Security Info=False';

MainForm.ADOTable1.TableName:=PupilCBox.Items.Strings[PupilCBox.ItemIndex];

MainForm.ADOTable1.Active:=true;

end;

procedure TDBForm.YearEditChange(Sender: TObject);

begin

MainForm.ADOTable1.Active:=false;

MainForm.ADOConnection1.Close;

TermEdit.Text:='';

SchoolCBox.ItemIndex:=-1;

FormCBox.ItemIndex:=-1;

PupilCBox.ItemIndex:=-1;

TermEdit.Enabled:=true;

SchoolCBox.Enabled:=false;

FormCBox.Enabled:=false;

PupilCBox.Enabled:=false;

end;

procedure TDBForm.TermEditChange(Sender: TObject);

begin

MainForm.ADOTable1.Active:=false;

MainForm.ADOConnection1.Close;

SchoolCBox.ItemIndex:=-1;

FormCBox.ItemIndex:=-1;

PupilCBox.ItemIndex:=-1;

SchoolCBox.Enabled:=true;

FormCBox.Enabled:=false;

PupilCBox.Enabled:=false;

end;

procedure TDBForm.DBGrid1CellClick(Column: TColumn);

var

S1,S2:string;

begin

TextMsg.Clear;

if Column.FieldName='Текст сообщения'

then

begin

Constraints.MaxWidth:=856;

Width:=856;

TextMsg.Visible:=true;

S1:=DBGrid1.SelectedField.AsString;

while pos(#10,S1)>1 do

begin

S2:=copy(S1,1,pos(#10,S1)-1);

S1:=copy(S1,pos(#10,S1)+1,Length(S1)-pos(#10,S1));

TextMsg.Lines.Add(S2);

end;

end

else

begin

Width:=672;

Constraints.MaxWidth:=672;

TextMsg.Visible:=false;

end;

end;

procedure TDBForm.FormCreate(Sender: TObject);

begin

YearEdit.Text:='';

TermEdit.Text:='';

SchoolCBox.Clear;

FormCBox.Clear;

PupilCBox.Clear;

end;

procedure TDBForm.DBGrid1KeyUp(Sender: TObject; var Key: Word;

Shift: TShiftState);

begin

if (key=vk_left)or(key=vk_up)or(key=vk_right)or(key=vk_down)

then

DBGrid1CellClick(DBGrid1.Columns.Items[DBGrid1.SelectedIndex]);

end;

end.


Подобные документы

Работы в архивах красиво оформлены согласно требованиям ВУЗов и содержат рисунки, диаграммы, формулы и т.д.
PPT, PPTX и PDF-файлы представлены только в архивах.
Рекомендуем скачать работу.