Технология строительства метрополитена

:= 3*C2*C2+1+D2+F*((C1*C1+3)*C1*C1*C1*C1-D1);

    K4 := (ALFA2*DELTA1-ALFA1*DELTA2)/(ALFA2*BETA1-ALFA1*BETA2);

    K3 := (ALFA1*GAMMA2-ALFA2*GAMMA1)/(ALFA2*BETA1-ALFA1*BETA2);

    K2 := (BETA2*DELTA1-BETA1*DELTA2)/(ALFA2*BETA1-ALFA1*BETA2);

    K1 := (BETA1*GAMMA2-BETA2*GAMMA1)/(ALFA2*BETA1-ALFA1*BETA2);

    L1 := 4*C2*C2*(C2*C2+1-BETA)-(K1+BETA*K2)*((C1*C1+1)*(C1*C1+1)

          +4*C2*C2)+2*(K3+BETA*K4)*((C2*C2+1)*(C2*C2+1)-2);

    L := (K1+BETA*K2)*(C1*C1+1)-(K3+BETA*K4);

    K0 := 3*C2*C2/((1+B/A)*(C2*C2-1)/(C1*C1-1)*(2+C1*C1)+2*C2*C2+1);

  end;

begin

  with TableDATA do begin

    Mass := FieldByName('Mass').AsFloat;

    R_press := FieldByName('R_press').AsFloat;

    R_stretch := FieldByName('R_stretch').AsFloat;

    Puasson := FieldByName('Puasson').AsFloat;

    R1 := FieldByName('R1').AsFloat;

    Rb := FieldByName('Rb').AsFloat;

    R := FieldByName('R').AsFloat;

    A := FieldByName('A').AsFloat;

    B := FieldByName('B').AsFloat;

  end;

  if RadioButton1.Checked then begin

    Calc;

    if TableDATA.FieldByName('Stuff').AsInteger = 0 {Железо-бетон} then begin

      PLines[isP0,1] := (C1*C1-1)*Mass*R_press/2*C1*C1*K0*(1+B/A);

      PLines[isP2,1] := (C1*C1-1)*(C1*C1-1)*

                        Mass*R_press/4*C1*C1*K0*(1+B/A);

      PLines[isP0,2] := -(C1*C1-1)*Mass*R_stretch/2*C1*C1*K0*(1+B/A);

      PLines[isP2,2] := (C1*C1-1)*(C1*C1-1)*

                        Mass*R_stretch/4*C1*C1*K0*(1+B/A);

      PLines[isP0,4] := (C2*C2-1)*Mass*R_press/(2*C2*C2-K0*

                        (C2*C2+1));

      PLines[isP2,4] := (C2*C2-1)*(C2*C2-1)*Mass*R_press/L1;

      PLines[isP0,5] := -(C2*C2-1)*

                        Mass*R_stretch/(2*C2*C2-K0*(C2*C2+1));

      PLines[isP2,5] := (C2*C2-1)*(C2*C2-1)*Mass*R_stretch/L1;

    end

    else begin         {Чугун}

      PLines[isP0,1] := (C1*C1-1)*Mass*R_press/2*C1*K0*(1+B/A);

      PLines[isP2,1] := (C2*C2-1)*(C2*C2-1)*

                        Mass*R_press/4*C1*C1*K0*(1+B/A);

      PLines[isP0,2] := -(C2*C2-1)*Mass*R_stretch/2*C1*K0*(1+B/A);

      PLines[isP2,2] := (C1*C1-1)*(C1*C1-1)*

                        Mass*R_stretch/4*C1*C1*K0*(1+B/A);

      PLines[isP0,4] := (C2*C2-1)*Mass*R_press/(2*C2*C2-K0*

                        (C2*C2+1));

      PLines[isP2,4] := (C2*C2-1)*(C2*C2-1)*Mass*R_press/L1;

      PLines[isP0,5] := -(C2*C2-1)*Mass*R_stretch/(2*C2*C2-K0*

                        (C2*C2+1));

      PLines[isP2,5] := (C2*C2-1)*(C2*C2-1)*Mass*R_stretch/L1;

    end;

    DrawForm.ShowModal;

  end

  else if RadioButton2.Checked then begin

    Calc;

    P0 := StrToFloat(Edit1.Text);

    P2 := StrToFloat(Edit2.Text);

    SIGMARS := ABS(2*C1*C1/(C1*C1-1)*(1+B/A)*(P0*K0+2*P2*L/

                  (C1*C1-1)));

    SIGMARR := ABS(2*C1*C1/(C1*C1-1)*(1+B/A)*(P0*K0-2*P2*L/

                  (C1*C1-1)));

    SIGMASS := ABS(P0/(C2*C2-1)*(2*C2*C2-K0*(C2*C2+1))+P2*L1/

                  (C2*C2-1)*(C2*C2-1));

    SIGMASR := ABS(P0/(C2*C2-1)*(2*C2*C2-K0*(C2*C2+1))-P2*L1/

                  (C2*C2-1)*(C2*C2-1));

    if (SIGMARS>Mass*R_press) or (SIGMARR>Mass*R_stretch) or

       (SIGMASS>Mass*R_press) or (SIGMASR>Mass*R_stretch)

    then

      MessageDlg('Несущая способность не

                  обеспечена',mtInformation,[mbOk],0)

    else

      MessageDlg('Несущая способность

                  обеспечена',mtInformation,[mbOk],0);

  end

  else begin

    i:=1;

    PkrOld :=0;

    repeat

      i := i+1;

      Pkr := (i*i-1)*Eo*J/((1-Puasson)*(1-Puasson)*R*R*R)+Ep/(2*

             (1+PuassonP))*((i+1)*(i+1)/(i*i*(i-1))+(i-1)*

             (i-1)/(i*i*(i+1)*(3-4*PuassonP)));

      if Pkr < PkrOld then PkrOld := Pkr else i:=0;

    until i = 0;

    P0 := StrToFloat(Edit1.Text);

    if P0 MaxY then MaxY := PLines[isP2,i];

    if PLines[isP0,i] < MinX then MinX := PLines[isP0,i];

    if PLines[isP2,i] < MinY then MinY := PLines[isP2,i];

  end;

  if MaxX > 200 then Nx := 100 else Nx := 10;

   MaxX := Round(MaxX/Nx)*Nx+Nx;

  if MaxY > 200 then Ny := 100 else Ny := 10;

  MaxY := Round(MaxY/Ny)*Ny+Ny;

  with DrawForm do begin

    Canvas.Pen.Color := clBlack;

    R.Left := 10;

    R.Top := 10;

    R.Right := Width - 15;

    R.Bottom := Height - 70;

    Canvas.FrameRect(R);

    Canvas.Brush.Color := clBtnFace;

    Kx := (R.Right - R.Left - 80)/MaxX;

    Ky := (R.Bottom - R.Top - 80)/MaxY;

    {Ось Po}

    Canvas.MoveTo(R.Left+10,R.Bottom-30);

    Canvas.LineTo(R.Right-10,R.Bottom-30);

    {Ось P2}

    Canvas.MoveTo(R.Left+60,R.Top+30);

    Canvas.LineTo(R.Left+60,R.Bottom-30);

    i := 0;

    while i*Nx PLines[isP0,5] then

      PointMin := PLines[isP0,2]

    else PointMin := PLines[isP0,5];

    if PointMin < 0 then PointMin := 0.0;

    DrawLine(PLines[isP0,1],

             -(PLines[isP2,1]/PLines[isP0,1]),PLines[isP2,1]);

    DrawLine(PLines[isP0,2],

             -(PLines[isP2,2]/PLines[isP0,2]),PLines[isP2,2]);

    DrawLine(0,1,0);

    DrawLine(PLines[isP0,4],

             -(PLines[isP2,4]/PLines[isP0,4]),PLines[isP2,4]);

    DrawLine(PLines[isP0,5],

             -(PLines[isP2,5]/PLines[isP0,5]),PLines[isP2,5]);

    Canvas.Brush.Color := clGreen;

    Canvas.FloodFill(Round((((PointMax-PointMin)/2)*Kx)+R.Left+60),

                     R.Bottom-55, clBlack, fsBorder);

    Canvas.Brush.Color := clBtnFace;

    Canvas.TextOut(R.Right-80, R.Bottom-50, 'P0, TC/M*2');

    Canvas.TextOut(R.Left+20, R.Top+10, 'P2, TC/M*2');

  end;

end;

end.

unit Edittub;

interface

uses

  SysUtils, WinTypes, WinProcs, Messages,>

  Controls,Forms, Dialogs, DBFilter, DB, DBTables, Grids, DBGrids, 

  RXLookup, ExtCtrls, DBCtrls;

type

    TEditDataForm =>

    Panel1: TPanel;

    rxDBLookupCombo1: TrxDBLookupCombo;

    TableSTUFF: TTable;

    DataSourceSTUFF: TDataSource;

    DBGrid1: TDBGrid;

    DataSourceDATA: TDataSource;

    TableDATA: TTable;

    TableDATAMass: TFloatField;

    TableDATAR_press: TFloatField;

    TableDATAR_stretch: TFloatField;

    TableDATAPuasson: TFloatField;

    TableDATAR1: TFloatField;

    TableDATARb: TFloatField;

    TableDATAR: TFloatField;

    TableDATAA: TFloatField;

    TableDATAB: TFloatField;

    rxDBFilter1: TrxDBFilter;

    TableDATAStuff: TSmallintField;

    DBNavigator1: TDBNavigator;

   procedure rxDBLookupCombo1Change(Sender: TObject);

   procedure DBNavigator1Click(Sender: TObject; Button:

                               TNavigateBtn);

   procedure DBGrid1DblClick(Sender: TObject);

private

    { Private declarations }

public

    { Public declarations }

end;

var

  EditDataForm: TEditDataForm;

implementation

{$R *.DFM}

uses

   EditForm;

procedure TEditDataForm.rxDBLookupCombo1Change(Sender: TObject);

var

  S: String;

begin

  rxDBFilter1.Deactivate;

  rxDBFilter1.Filter.Clear;

  s:='Stuff = '+TableSTUFF.FieldByName('Code').AsString;

  rxDBFilter1.Filter.Add(S);

  rxDBFilter1.Activate;

end;

procedure TEditDataForm.DBNavigator1Click(Sender: TObject; Button:

                                          TNavigateBtn);

begin

  case Button of

    nbInsert:

      begin

        EditDataTub(TableDATA, True,

                    TableSTUFF.FieldByName('Code').AsInteger);

      end;

    nbEdit:

      begin

        EditDataTub(TableDATA, False,

                    TableSTUFF.FieldByName('Code').AsInteger);

      end;

  end;

end;

procedure TEditDataForm.DBGrid1DblClick(Sender: TObject);

begin

  EditDataTub(TableDATA, False,

              TableSTUFF.FieldByName('Code').AsInteger);

end;

end.

unit Editform;

interface

uses

  SysUtils, WinTypes, WinProcs, Messages,>

  Controls, Forms, Dialogs, StdCtrls, Mask, DBCtrls, ExtCtrls, DB,  

  DBTables, Buttons;

type

    TEdTubForm =>

    DataSource1: TDataSource;

    Panel1: TPanel;

    DBEdit1: TDBEdit;

    Label1: TLabel;

    Label2: TLabel;

    Label3: TLabel;

    DBEdit2: TDBEdit;

    DBEdit3: TDBEdit;

    Label4: TLabel;

    Label5: TLabel;

    Label6: TLabel;

    DBEdit4: TDBEdit;

    DBEdit5: TDBEdit;

    DBEdit6: TDBEdit;

    Label7: TLabel;

    DBEdit7: TDBEdit;

    Label8: TLabel;

    Label9: TLabel;

    Panel2: TPanel;

    Panel3: TPanel;

    DBEdit8: TDBEdit;

    DBEdit9: TDBEdit;

    BitBtn1: TBitBtn;

    BitBtn2: TBitBtn;

    Table1: TTable;

    Label10: TLabel;

    DBText1: TDBText;

    DataSource2: TDataSource;

    Query1: TQuery;

    Query1Material: TStringField;

procedure FormCreate(Sender: TObject);

public

    FCode: Integer;

    function EditTub( Table: TTable; IsNew: Boolean; Code: Integer):

                      Boolean;

  end;

var

  EdTubForm: TEdTubForm;

function EditDataTub(Table: TTable; IsNew: Boolean; Code: Integer):

                     Boolean;

implementation

{$R *.DFM}

function EditDataTub(Table: TTable; IsNew: Boolean; Code: Integer):

                     Boolean;

begin

  Result := False;

  with TEdTubForm.Create(Application) do

  try

    FCode := Code;

    Result := EditTub(Table, IsNew, Code);

  finally

    Free;

  end;

end;

function TEdTubForm.EditTub(Table: TTable; IsNew: Boolean; Code:

                            Integer): Boolean;

begin

  if Table nil then

    DataSource1.DataSet := Table

  else begin

    Table1.Open;

    DataSource1.DataSet := Table1;

  end;

  if IsNew then begin

    DataSource1.DataSet.Append;

    DataSource1.DataSet.FieldByName('Stuff').AsInteger := Code;

  end

    else DataSource1.DataSet.Edit;

  Result := ShowModal = mrOk;

  if Result then

    DataSource1.DataSet.Post

  else

    DataSource1.DataSet.Cancel;

end;

procedure TEdTubForm.FormCreate(Sender: TObject);

begin

  Query1.Active := False;

  Query1.ParamByName('St').AsInteger := FCode;

  Query1.Active := True;

end;

end.

unit EditUser;

interface

uses

  SysUtils, WinTypes, WinProcs,>

  Buttons, StdCtrls, ExtCtrls, DBCtrls, Mask, DB, DBTables;

type

    TEditUserDialog =>

    OKBtn: TBitBtn;

    CancelBtn: TBitBtn;

    UsersTable: TTable;

    dsUsers: TDataSource;

    NameEdit: TDBEdit;

    FullNameEdit: TDBEdit;

    GroupBox: TGroupBox;

    PasswordEdit: TDBEdit;

    ConfirmPassword: TEdit;

    Label1: TLabel;

    Label2: TLabel;

    LevelGroup: TDBRadioGroup;

    procedure OKBtnClick(Sender: TObject);

    procedure CancelBtnClick(Sender: TObject);

    procedure FormHide(Sender: TObject);

private

    { Private declarations }

public

    { Public declarations }

    function EditUser(const UserName: string; Table: TTable; IsNew:

                      Boolean): Boolean;

end;

var

  EditUserDialog: TEditUserDialog;

function EditUserData(const UserName: string; Table: TTable;

                      IsNew: Boolean): Boolean;

implementation

uses

  Global, Crypt;

{$R *.DFM}

const

  SNotFound = 'Записей не обнаружено';

  SNoConfirmPassword = 'Вы ввели разные пароли. Проверьте  

                        правильность ввода';

 

function EditUserData(const UserName: string; Table: TTable;

                      IsNew: Boolean): Boolean;

var

  SUName: string;

begin

  Result := False;

  SUName := UserName;

  if glUserLevel ulAdministrator then begin

    Table := nil;

    SUName := glUserName;

  end;

  with TEditUserDialog.Create(Application) do

  try

    Result := EditUser(SUName, Table, IsNew);

  finally

    Free;

  end;

end;

{ TEditUserDialog }

function TEditUserDialog.EditUser(const UserName: string; Table:

                                  Ttable; IsNew: Boolean): Boolean;

begin

  NameEdit.Enabled := (glUserLevel = ulAdministrator);

  LevelGroup.Enabled := (glUserLevel = ulAdministrator);

  if Table nil then begin

    dsUsers.DataSet := Table;

    UsersTable.Close;

  end

  else begin

    UsersTable.Open;

    if UserName '' then begin

      if not UsersTable.FindKey([UserName]) then

        raise Exception.Create(SNotFound);

    end;

    dsUsers.DataSet := UsersTable;

  end;

  if IsNew then dsUsers.DataSet.Append

  else dsUsers.DataSet.Edit;

  ConfirmPassword.Text := PasswordEdit.Text;

  Result := ShowModal = mrOk;

end;

procedure TEditUserDialog.OKBtnClick(Sender: TObject);

begin

  if PasswordEdit.Text ConfirmPassword.Text then

    raise Exception.Create(SNoConfirmPassword);

  dsUsers.DataSet.Post;

  ModalResult := mrOk;

end;

procedure TEditUserDialog.CancelBtnClick(Sender: TObject);

begin

  dsUsers.DataSet.Cancel;

  ModalResult := mrCancel;

end;

procedure TEditUserDialog.FormHide(Sender: TObject);

begin

  dsUsers.DataSet.Cancel;

  UsersTable.Close;

end;

end.

unit Global;

interface

type

  TUserLevel = (ulInvalid, ulOperator, ulManager, ulAdministrator);

const

  InvalidID = 0;

  glUserLevel: TUserLevel = ulInvalid;

  glUserName: string = '';

  glUserID: Longint = InvalidID;

function cUserLevel(Code: Longint): TUserLevel;

implementation

function cUserLevel(Code: Longint): TUserLevel;

begin

  Result := ulInvalid;

  if (Code in [Integer(Low(TUserLevel))..Integer(High(TUserLevel))]) then

    Result := TUserLevel(Code);

end;

end.

 

unit Global;

interface

type

  TUserLevel = (ulInvalid, ulOperator, ulManager, ulAdministrator);

const

  InvalidID = 0;

  glUserLevel: TUserLevel = ulInvalid;

  glUserName: string = '';

  glUserID: Longint = InvalidID;

function cUserLevel(Code: Longint): TUserLevel;

implementation

function cUserLevel(Code: Longint): TUserLevel;

begin

  Result := ulInvalid;

  if (Code in [Integer(Low(TUserLevel))..Integer(High(TUserLevel))]) then

    Result := TUserLevel(Code);

end;

end.

 

unit Main;

interface

uses

  SysUtils, WinTypes, WinProcs, Messages,>

  Controls, Forms, Dialogs, SpeedBar, Menus, ExtCtrls, Placemnt, DB, 

  DBSecur, DBTables;

type

    TStaftForm =>

    SpeedBar: TSpeedBar;

    ExitItem: TSpeedItem;

    MainMenu: TMainMenu;

    FileMenu: TMenuItem;

    InsuranceMenuItem: TMenuItem;

    FileMenuSeperator: TMenuItem;

    PrinterSetupMenuItem: TMenuItem;

    ExitMenuItem: TMenuItem;

    DictSetupMenu: TMenuItem;

    UserMenuItem: TMenuItem;

    WindowMenu: TMenuItem;

    TileMenuItem: TMenuItem;

    CascadeMenuItem: TMenuItem;

    MinimizeAllMenuItem: TMenuItem;

    ArrangeAllMenuItem: TMenuItem;

    HelpMenu: TMenuItem;

    HelpContentsMenuItem: TMenuItem;

    HelpMenuSeparator: TMenuItem;

    AboutMenuItem: TMenuItem;

    ChangePasswordItem: TSpeedItem;

    PrintSetupItem: TSpeedItem;

    CalcItem: TSpeedItem;

    PrinterSetup: TPrinterSetupDialog;

    TileWindowsItem: TSpeedItem;

    CascadeWindowsItem: TSpeedItem;

    HintPanel: TPanel;

    DBSecurity1: TDBSecurity;

    Database1: TDatabase;

    EditItem: TMenuItem;

    FormPlacement: TFormPlacement;

    procedure ArrangeAllMenuItemClick(Sender: TObject);

    procedure TileMenuItemClick(Sender: TObject);

    procedure CascadeMenuItemClick(Sender: TObject);

    procedure MinimizeAllMenuItemClick(Sender: TObject);

    procedure AboutMenuItemClick(Sender: TObject);

    procedure PrinterSetupMenuItemClick(Sender: TObject);

    procedure ExitMenuItemClick(Sender: TObject);

    procedure FormStorageRestorePlacement(Sender: TObject);

    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>

  {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;

interface

uses

  SysUtils, WinTypes, WinProcs, Messages,>

  Controls, Forms, Dialogs, DBCtrls, ExtCtrls, DBTables, DB, Grids,

  DBGrids, RXDBCtrl, Placemnt, StdCtrls, Buttons;

type

    TUserListForm =>

    UsersTable: TTable;

    dsUsers: TDataSource;

    UsersGrid: TrxDBGrid;

    UsersTablePassword: TStringField;

    Panel1: TPanel;

    DBNavigator: TDBNavigator;

    FormPlacement: TFormPlacement;

    UsersTableID: TFloatField;

    UsersTableUserName: TStringField;

    UsersTableFullName: TStringField;

    UsersTableUserLevel: TFloatField;

    BitBtn1: TBitBtn;

    procedure DBNavigatorClick(Sender: TObject; Button:

                               TNavigateBtn);

    procedure UsersGridDblClick(Sender: TObject);

    procedure FormPlacementSavePlacement(Sender: TObject);

    procedure FormPlacementRestorePlacement(Sender: TObject);

    procedure FormCreate(Sender: TObject);

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

end;

var

  UserListForm: TUserListForm;

implementation

uses

   EditUser, IniFiles, Global;

const

  SAccessDenied = 'Недостаточно прав. Доступ запрещен';

{$R *.DFM}

procedure TUserListForm.DBNavigatorClick(Sender: TObject;

                                         Button: TNavigateBtn);

begin

  case Button of

    nbInsert:

      begin

        EditUserData('', UsersTable, True);

      end;

    nbEdit:

      begin

        EditUserData('', UsersTable, False);

      end;

  end;

end;

procedure TUserListForm.UsersGridDblClick(Sender: TObject);

begin

  EditUserData('', UsersTable, False);

end;

procedure TUserListForm.FormPlacementSavePlacement(Sender: TObject);

var

  IniFile: TIniFile;

  I: Integer;

begin

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

  try

    for I := 0 to ComponentCount - 1 do begin

      if Components[I] is TrxDBGrid then

        TrxDBGrid(Components[I]).SaveLayout(IniFile);

    end;

  finally

    IniFile.Free;

  end;

end;

procedure TUserListForm.FormPlacementRestorePlacement(Sender:

                                                      TObject);

var

  IniFile: TIniFile;

  I: Integer;

begin

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

  try

    for I := 0 to ComponentCount - 1 do begin

      if Components[I] is TrxDBGrid then

        TrxDBGrid(Components[I]).RestoreLayout(IniFile);

    end;

  finally

    IniFile.Free;

  end;

end;

procedure TUserListForm.FormCreate(Sender: TObject);

begin

  if not (glUserLevel in [ulAdministrator]) then begin

    raise Exception.Create(SAccessDenied);

  end;

  UsersTable.Open;

end;

procedure TUserListForm.FormClose(Sender: TObject;

var

  Action: TCloseAction);

begin

  Action := caFree;

end;

end.

program Shaft;

uses

  Forms,

  Main in 'MAIN.PAS' {StaftForm},

  Global in 'GLOBAL.PAS',

  EditUser in 'EDITUSER.PAS',

  UserList in 'USERLIST.PAS' {UserListForm},

  Edittub in 'EDITTUB.PAS' {EditDataForm},

  Editform in 'EDITFORM.PAS' {EdTubForm},

  Calc1 in 'CALC1.PAS' {Form1},

  Draw in 'DRAW.PAS' {DrawForm};

{$R *.RES}

begin

  Application.CreateForm(TStaftForm, StaftForm);

  Application.CreateForm(TEditDataForm, EditDataForm);

  Application.CreateForm(TEdTubForm, EdTubForm);

  Application.CreateForm(TForm1, Form1);

  Application.CreateForm(TDrawForm, DrawForm);

  Application.Run;

end.

5. Список использованной литературы.

1. Баклашов И.В., Картозия Б.А. “Механика подземных сооружений и конструкций крепей” - М., Недра, 1992, 543 с.

2. Насонов И.Д., Федюкин В.А., Шуплик М.Н., “Технология строительства подземных сооружений” - М., Недра, 1992, 285 с.

3. Насонов И.Д., Шуплик М.Н. “Закономерности формирования ледопородных ограждений при сооружении стволов шахт” - М., Недра, 1976, 237 с.

4. Храпов В.Г. “Тоннели и метрополитены” - М., Транспорт, 1989, 383 с.

5. Белый В.В. “Справочник инженера шахтостроителя” в 2-х томах - М., 1983

6. Туренский Н.Г., Ледяев А.П. “Строительство тоннелей и метрополитенов” - М., Транспорт, 1992, 264 с.

7. Богомолов Г.М., Голицынский Д.М. Сеславинский С.И. “Справочник инженера тоннельщика” - М., Транспорт, 1993, 389 с.