Выбор материала и расчет параметров обделок вертикальных стволов метрополитенов
Рефераты >> Технология >> Выбор материала и расчет параметров обделок вертикальных стволов метрополитенов

procedure FormStorageSavePlacement(Sender: TObject);

function DBSecurity1CheckUser(UsersTable: TTable;

const

Password: String): Boolean;

procedure UserMenuItemClick(Sender: TObject);

procedure FormCreate(Sender: TObject);

procedure FormDestroy(Sender: TObject);

procedure InsuranceMenuItemClick(Sender: TObject);

procedure ShowHint(Sender: TObject);

procedure EditItemClick(Sender: TObject);

private

procedure SetUserLevel;

procedure UpdateMenuItems(Sender: TObject);

function ShowForm(FormClass: TFormClass): TForm;

end;

var

StaftForm: TStaftForm;

implementation

uses

About, rxIni, VCLUtils, Global, AppUtils, EditUser, UserList,

EditTub, Calc1;

{$R *.DFM}

const

siMDIChilds = 'OpenMDIChilds';

procedure TStaftForm.SetUserLevel;

begin

case glUserLevel of

ulOperator:

begin

DictSetupMenu.Visible := False;

DictSetupMenu.Enabled := False;

UserMenuItem.Visible := False;

UserMenuItem.Enabled := False;

end;

ulManager:

begin

DictSetupMenu.Visible := True;

DictSetupMenu.Enabled := True;

UserMenuItem.Visible := False;

UserMenuItem.Enabled := False;

end;

ulAdministrator:

begin

DictSetupMenu.Visible := True;

DictSetupMenu.Enabled := True;

UserMenuItem.Visible := True;

UserMenuItem.Enabled := True;

end;

end;

end;

procedure TStaftForm.TileMenuItemClick(Sender: TObject);

begin

Tile;

end;

procedure TStaftForm.CascadeMenuItemClick(Sender: TObject);

begin

Cascade;

end;

procedure TStaftForm.MinimizeAllMenuItemClick(Sender: TObject);

var

I: Integer;

begin

for I := MDIChildCount - 1 downto 0 do

MDIChildren[I].WindowState := wsMinimized;

end;

procedure TStaftForm.ArrangeAllMenuItemClick(Sender: TObject);

begin

ArrangeIcons;

end;

procedure TStaftForm.AboutMenuItemClick(Sender: TObject);

begin

ShowAboutDialog('Расчет тюбинговой обделки', 'Королев А.В.',

'МГГУ', nil, 1, 0, 1996);

end;

procedure TStaftForm.PrinterSetupMenuItemClick(Sender: TObject);

begin

PrinterSetup.Execute;

end;

procedure TStaftForm.ExitMenuItemClick(Sender: TObject);

begin

Close;

end;

function TStaftForm.ShowForm(FormClass: TFormClass): TForm;

var

Form: TForm;

begin

Result := nil;

StartWait;

try

Form := FindForm(FormClass);

if Form = nil then

Application.CreateForm(FormClass, Form);

with Form do begin

if WindowState = wsMinimized then WindowState := wsNormal;

Show;

end;

Result := Form;

finally

StopWait;

end;

end;

procedure TStaftForm.FormStorageRestorePlacement(Sender: TObject);

var

IniFile: TrxIniFile;

List: TStrings;

I: Integer;

FormClass: TFormClass;

Form: TForm;

begin

StartWait;

try

SpeedBar.Visible := True;

IniFile := TrxIniFile.Create(FormPlacement.IniFileName);

try

if (glUserLevel in [ulManager, ulAdministrator]) then begin

List := TStringList.Create;

try

IniFile.ReadList(siMDIChilds, List);

for I := 0 to List.Count - 1 do begin

FormClass := TFormClass(GetClass(List[I]));

if FormClass <> nil then ShowForm(FormClass);

end;

finally

List.Free;

end;

end;

finally

IniFile.Free;

end;

finally

StopWait;

end;

end;

procedure TStaftForm.FormStorageSavePlacement(Sender: TObject);

var

IniFile: TrxIniFile;

List: TStrings;

I: Integer;

begin

IniFile := TrxIniFile.Create(FormPlacement.IniFileName);

try

IniFile.EraseSection(siMDIChilds);

List := TStringList.Create;

try

for I := MDIChildCount - 1 downto 0 do

List.Add(MDIChildren[I].ClassName);

if List.Count > 0 then

IniFile.WriteList(siMDIChilds, List);

finally

List.Free;

end;

finally

IniFile.Free;

end;

end;

function TStaftForm.DBSecurity1CheckUser(UsersTable: TTable;

const

Password: String): Boolean;

begin

Result := (Password = UsersTable.FieldByName('Password').AsString);

if Result then begin

glUserName := UsersTable.FieldByName('UserName').AsString;

glUserID := UsersTable.FieldByName('ID').AsInteger;

glUserLevel := cUserLevel(UsersTable.FieldByName('UserLevel')

.AsInteger);

Result := (glUserLevel <> ulInvalid);

end;

if Result then SetUserLevel;

end;

procedure TStaftForm.UserMenuItemClick(Sender: TObject);

begin

ShowForm(TUserListForm);

end;

procedure TStaftForm.ShowHint(Sender: TObject);

begin

HintPanel.Caption := Application.Hint;

end;

procedure TStaftForm.UpdateMenuItems(Sender: TObject);

begin

{ Enable or disable menu items and buttons }

CascadeMenuItem.Enabled := MDIChildCount > 0;

TileMenuItem.Enabled := MDIChildCount > 0;

ArrangeAllMenuItem.Enabled := MDIChildCount > 0;

MinimizeAllMenuItem.Enabled := MDIChildCount > 0;

TileWindowsItem.Enabled := MDIChildCount > 0;

CascadeWindowsItem.Enabled := MDIChildCount > 0;

end;

procedure TStaftForm.FormCreate(Sender: TObject);

begin

Application.OnHint := ShowHint;

Screen.OnActiveFormChange := UpdateMenuItems;

SetAutoSubClass(True);

{ set wait cursor to SQL }

WaitCursor := crSQLWait;

{ register classes of MDI-child forms }

{RegisterClasses([TDictForm, TRatesForm, TItemReportForm]);}

end;

procedure TStaftForm.FormDestroy(Sender: TObject);

begin

Screen.OnActiveFormChange := nil;

Application.HelpCommand(HELP_QUIT,0);

end;

procedure TStaftForm.InsuranceMenuItemClick(Sender: TObject);

begin

Form1.ShowModal;

end;

procedure TStaftForm.EditItemClick(Sender: TObject);

begin

EditDataForm.Show;

end;

end.

unit UserList;


Страница: