Changeset 142


Ignore:
Timestamp:
Jan 22, 2009, 9:20:15 AM (15 years ago)
Author:
george
Message:
  • Přidáno: Jednotka pro správu finančních dokladů.
Location:
devel/web
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • devel/web/.htaccess

    r137 r142  
    22Options +ExecCGI
    33DirectoryIndex index.cgi
     4
     5<FilesMatch "\.(pas|o|ppu|lpi|a)$">
     6  Deny from all
     7</FilesMatch>
  • devel/web/UDatabase.pas

    r139 r142  
    99
    1010type
     11  TDatabase = class;
    1112
    1213  { TDbObject }
     
    1415  TDbObject = class
    1516    Id: Integer;
     17    Loaded: Boolean;
     18    Database: TDatabase;
    1619    procedure Store; virtual;
     20    procedure Load; virtual;
    1721    procedure Delete;
     22    constructor Create;
     23    destructor Destroy; override;
    1824  end;
     25
     26  TDbObjectClass = class of TDbObject;
    1927
    2028  { TDbList }
    2129
    2230  TDbList = class
     31    Id: Integer;
     32    Database: TDatabase;
     33    ItemClassType: TDbObjectClass;
    2334    Items: TList;
    2435    constructor Create;
    2536    destructor Destroy; override;
     37    function Add: TDbObject;
     38    procedure Store;
     39    procedure Load;
    2640  end;
    2741
     
    3549  { TDatabase }
    3650
    37   TDatabase = class
    38     SqlDatabase: TSqlDatabase;
    39     procedure Open;
    40     procedure Close;
     51  TDatabase = class(TSqlDatabase)
     52    BaseObject: TDbObject;
     53    constructor Create;
     54    destructor Destroy; override;
     55    procedure Init;
    4156  end;
    4257
     
    4863end;
    4964
     65procedure TDbObject.Load;
     66begin
     67
     68end;
     69
    5070procedure TDbObject.Delete;
    5171begin
    5272
     73end;
     74
     75constructor TDbObject.Create;
     76begin
     77end;
     78
     79destructor TDbObject.Destroy;
     80begin
     81  inherited Destroy;
    5382end;
    5483
     
    7099end;
    71100
     101function TDbList.Add: TDbObject;
     102var
     103  Data: TAssocArray;
     104begin
     105  Result := ItemClassType.Create;
     106  Data := TAssocArray.Create;
     107  Data.AddKeyValue('id', '');
     108  Database.Insert(ClassName, Data);
     109  Result.Id := Database.LastInsertId;;
     110  Items.Add(Result);
     111end;
     112
     113procedure TDbList.Store;
     114var
     115  I: Integer;
     116  Data: TAssocArray;
     117begin
     118  Data := TAssocArray.Create;
     119  Database.Insert(ClassName, Data);
     120  for I := 0 to Items.Count - 1 do begin
     121    Database.Insert(ClassName, Data);
     122  end;
     123end;
     124
     125procedure TDbList.Load;
     126begin
     127
     128end;
     129
    72130{ TDbResultSet }
    73131
     
    83141{ TDatabase }
    84142
    85 procedure TDatabase.Open;
     143constructor TDatabase.Create;
    86144begin
    87 
     145  BaseObject := TDbObject.Create;;
    88146end;
    89147
    90 procedure TDatabase.Close;
     148destructor TDatabase.Destroy;
    91149begin
     150  BaseObject.Free;
     151end;
    92152
     153procedure TDatabase.Init;
     154begin
     155  BaseObject.Id := 1;
     156  BaseObject.Database := Self;
     157  BaseObject.Load;
    93158end;
    94159
  • devel/web/USqlDatabase.pas

    r134 r142  
    153153  I: Integer;
    154154  Value: string;
     155  DbRows: TDbRows;
    155156begin
    156157  Table := ATable;
     
    166167  System.Delete(DbNames, 1, 1);
    167168  System.Delete(DbValues, 1, 1);
    168   Query('INSERT INTO `' + Table + '` (' + DbNames + ') VALUES (' + DbValues + ')');
     169  DbRows := Query('INSERT INTO `' + Table + '` (' + DbNames + ') VALUES (' + DbValues + ')');
     170  DbRows.Free;
    169171end;
    170172
     
    219221  Value: string;
    220222  I: Integer;
     223  DbRows: TDbRows;
    221224begin
    222225  Table := ATable;
     
    232235  System.Delete(DbNames, 1, 1);
    233236  System.Delete(DbValues, 1, 1);
    234   Query('REPLACE INTO `' + Table + '` (' + DbNames + ') VALUES (' + DbValues + ')');
     237  DbRows := Query('REPLACE INTO `' + Table + '` (' + DbNames + ') VALUES (' + DbValues + ')');
     238  DbRows.Free;
    235239end;
    236240
     
    246250  Value: string;
    247251  I: Integer;
     252  DbRows: TDbRows;
    248253begin
    249254  Table := ATable;
     
    256261  end;
    257262  System.Delete(DbValues, 1, 1);
    258   Query('UPDATE `' + Table + '` SET (' + DbValues + ') WHERE ' + Condition);
     263  DbRows := Query('UPDATE `' + Table + '` SET (' + DbValues + ') WHERE ' + Condition);
     264  DBRows.Free;
    259265end;
    260266
     
    302308
    303309procedure TSqlDatabase.Delete(ATable: string; Condition: string = '1');
     310var
     311  DbRows: TDbRows;
    304312begin
    305313  Table := ATable;
    306   Query('DELETE FROM `' + Table + '` WHERE ' + Condition);
     314  DbRows := Query('DELETE FROM `' + Table + '` WHERE ' + Condition);
     315  DbRows.Free;
    307316end;
    308317
  • devel/web/UUser.pas

    r139 r142  
    1313
    1414  TUser = class(TDbObject)
     15    SubjectName: string;
    1516    FirstName: string;
    1617    SecondName: string;
     
    1920    Password: string;
    2021    UserName: string;
     22    Town: string;
     23    Street: string;
     24    PSC: string;
     25    IC: Integer;
     26    DIC: string;
    2127    procedure LoadFromDbRecord(DbRow: TAssocArray);
    2228    procedure Store; override;
  • devel/web/index.lpi

    r139 r142  
    1212      <MainUnit Value="0"/>
    1313      <TargetFileExt Value=".exe"/>
    14       <ActiveEditorIndexAtStart Value="2"/>
     14      <ActiveEditorIndexAtStart Value="3"/>
    1515    </General>
    1616    <VersionInfo>
     
    2929      </local>
    3030    </RunParams>
    31     <Units Count="23">
     31    <Units Count="24">
    3232      <Unit0>
    3333        <Filename Value="index.pas"/>
    3434        <IsPartOfProject Value="True"/>
    3535        <UnitName Value="Index"/>
    36         <CursorPos X="37" Y="7"/>
    37         <TopLine Value="1"/>
    38         <EditorIndex Value="3"/>
    39         <UsageCount Value="57"/>
     36        <CursorPos X="44" Y="7"/>
     37        <TopLine Value="1"/>
     38        <EditorIndex Value="4"/>
     39        <UsageCount Value="90"/>
    4040        <Loaded Value="True"/>
    4141      </Unit0>
     
    4646        <CursorPos X="80" Y="21"/>
    4747        <TopLine Value="1"/>
    48         <EditorIndex Value="5"/>
    49         <UsageCount Value="57"/>
     48        <EditorIndex Value="6"/>
     49        <UsageCount Value="90"/>
    5050        <Loaded Value="True"/>
    5151      </Unit1>
     
    5454        <IsPartOfProject Value="True"/>
    5555        <UnitName Value="USqlDatabase"/>
    56         <CursorPos X="74" Y="69"/>
    57         <TopLine Value="45"/>
     56        <CursorPos X="3" Y="111"/>
     57        <TopLine Value="197"/>
    5858        <EditorIndex Value="0"/>
    59         <UsageCount Value="57"/>
     59        <UsageCount Value="90"/>
    6060        <Loaded Value="True"/>
    6161      </Unit2>
     
    6363        <Filename Value="UXmlClasses.pas"/>
    6464        <IsPartOfProject Value="True"/>
    65         <UsageCount Value="57"/>
     65        <UsageCount Value="90"/>
    6666      </Unit3>
    6767      <Unit4>
     
    6969        <IsPartOfProject Value="True"/>
    7070        <UnitName Value="UCore"/>
    71         <CursorPos X="21" Y="33"/>
    72         <TopLine Value="15"/>
    73         <EditorIndex Value="8"/>
    74         <UsageCount Value="57"/>
     71        <CursorPos X="10" Y="96"/>
     72        <TopLine Value="76"/>
     73        <EditorIndex Value="9"/>
     74        <UsageCount Value="90"/>
    7575        <Loaded Value="True"/>
    7676      </Unit4>
     
    8181        <CursorPos X="1" Y="1"/>
    8282        <TopLine Value="81"/>
    83         <UsageCount Value="57"/>
     83        <UsageCount Value="90"/>
    8484      </Unit5>
    8585      <Unit6>
     
    8989        <CursorPos X="31" Y="19"/>
    9090        <TopLine Value="11"/>
    91         <EditorIndex Value="10"/>
    92         <UsageCount Value="57"/>
     91        <EditorIndex Value="11"/>
     92        <UsageCount Value="90"/>
    9393        <Loaded Value="True"/>
    9494      </Unit6>
     
    9999        <CursorPos X="34" Y="30"/>
    100100        <TopLine Value="17"/>
    101         <UsageCount Value="57"/>
     101        <UsageCount Value="90"/>
    102102      </Unit7>
    103103      <Unit8>
     
    105105        <IsPartOfProject Value="True"/>
    106106        <UnitName Value="UNews"/>
    107         <CursorPos X="17" Y="232"/>
    108         <TopLine Value="1"/>
    109         <EditorIndex Value="9"/>
    110         <UsageCount Value="57"/>
     107        <CursorPos X="15" Y="49"/>
     108        <TopLine Value="34"/>
     109        <EditorIndex Value="10"/>
     110        <UsageCount Value="90"/>
    111111        <Loaded Value="True"/>
    112112      </Unit8>
     
    115115        <IsPartOfProject Value="True"/>
    116116        <UnitName Value="UNewsPage"/>
    117         <CursorPos X="81" Y="123"/>
    118         <TopLine Value="96"/>
    119         <EditorIndex Value="7"/>
    120         <UsageCount Value="57"/>
     117        <CursorPos X="28" Y="149"/>
     118        <TopLine Value="109"/>
     119        <EditorIndex Value="8"/>
     120        <UsageCount Value="90"/>
    121121        <Loaded Value="True"/>
    122122      </Unit9>
     
    126126        <CursorPos X="10" Y="94"/>
    127127        <TopLine Value="81"/>
    128         <UsageCount Value="6"/>
     128        <UsageCount Value="4"/>
    129129      </Unit10>
    130130      <Unit11>
     
    132132        <CursorPos X="26" Y="17"/>
    133133        <TopLine Value="121"/>
    134         <UsageCount Value="6"/>
     134        <UsageCount Value="4"/>
    135135      </Unit11>
    136136      <Unit12>
     
    138138        <CursorPos X="4" Y="33"/>
    139139        <TopLine Value="18"/>
    140         <UsageCount Value="6"/>
     140        <UsageCount Value="4"/>
    141141      </Unit12>
    142142      <Unit13>
     
    145145        <CursorPos X="24" Y="364"/>
    146146        <TopLine Value="351"/>
    147         <UsageCount Value="21"/>
     147        <UsageCount Value="19"/>
    148148      </Unit13>
    149149      <Unit14>
    150         <Filename Value="urss.pas"/>
     150        <Filename Value="URSS.pas"/>
    151151        <IsPartOfProject Value="True"/>
    152152        <UnitName Value="URSS"/>
    153         <CursorPos X="56" Y="86"/>
    154         <TopLine Value="42"/>
    155         <EditorIndex Value="11"/>
    156         <UsageCount Value="45"/>
     153        <CursorPos X="56" Y="16"/>
     154        <TopLine Value="1"/>
     155        <EditorIndex Value="12"/>
     156        <UsageCount Value="78"/>
    157157        <Loaded Value="True"/>
    158158      </Unit14>
     
    161161        <CursorPos X="10" Y="117"/>
    162162        <TopLine Value="115"/>
    163         <UsageCount Value="8"/>
     163        <UsageCount Value="6"/>
    164164      </Unit15>
    165165      <Unit16>
     
    167167        <CursorPos X="3" Y="624"/>
    168168        <TopLine Value="34"/>
    169         <UsageCount Value="8"/>
     169        <UsageCount Value="6"/>
    170170      </Unit16>
    171171      <Unit17>
    172         <Filename Value="uconfig.pas"/>
     172        <Filename Value="UConfig.pas"/>
    173173        <IsPartOfProject Value="True"/>
    174174        <UnitName Value="UConfig"/>
    175175        <CursorPos X="28" Y="14"/>
    176176        <TopLine Value="1"/>
    177         <EditorIndex Value="4"/>
    178         <UsageCount Value="32"/>
     177        <EditorIndex Value="5"/>
     178        <UsageCount Value="65"/>
    179179        <Loaded Value="True"/>
    180180      </Unit17>
     
    184184        <CursorPos X="1" Y="134"/>
    185185        <TopLine Value="108"/>
    186         <UsageCount Value="32"/>
     186        <UsageCount Value="65"/>
    187187        <SyntaxHighlighter Value="None"/>
    188188      </Unit18>
     
    192192        <CursorPos X="1" Y="1"/>
    193193        <TopLine Value="1"/>
    194         <UsageCount Value="32"/>
     194        <UsageCount Value="65"/>
    195195        <SyntaxHighlighter Value="JScript"/>
    196196      </Unit19>
    197197      <Unit20>
    198         <Filename Value="udatabase.pas"/>
     198        <Filename Value="UDatabase.pas"/>
    199199        <IsPartOfProject Value="True"/>
    200200        <UnitName Value="UDatabase"/>
    201         <CursorPos X="3" Y="52"/>
    202         <TopLine Value="50"/>
     201        <CursorPos X="26" Y="52"/>
     202        <TopLine Value="23"/>
    203203        <EditorIndex Value="1"/>
    204         <UsageCount Value="26"/>
     204        <UsageCount Value="59"/>
    205205        <Loaded Value="True"/>
    206206      </Unit20>
    207207      <Unit21>
    208         <Filename Value="uuser.pas"/>
     208        <Filename Value="UUser.pas"/>
    209209        <IsPartOfProject Value="True"/>
    210210        <UnitName Value="UUser"/>
    211         <CursorPos X="47" Y="52"/>
    212         <TopLine Value="34"/>
    213         <EditorIndex Value="6"/>
    214         <UsageCount Value="26"/>
     211        <CursorPos X="41" Y="34"/>
     212        <TopLine Value="16"/>
     213        <EditorIndex Value="7"/>
     214        <UsageCount Value="59"/>
    215215        <Loaded Value="True"/>
    216216      </Unit21>
    217217      <Unit22>
    218         <Filename Value="uuserpage.pas"/>
     218        <Filename Value="UUserPage.pas"/>
    219219        <IsPartOfProject Value="True"/>
    220220        <UnitName Value="UUserPage"/>
    221         <CursorPos X="69" Y="18"/>
    222         <TopLine Value="5"/>
     221        <CursorPos X="55" Y="23"/>
     222        <TopLine Value="1"/>
    223223        <EditorIndex Value="2"/>
    224         <UsageCount Value="22"/>
     224        <UsageCount Value="55"/>
    225225        <Loaded Value="True"/>
    226226      </Unit22>
     227      <Unit23>
     228        <Filename Value="UBill.pas"/>
     229        <IsPartOfProject Value="True"/>
     230        <UnitName Value="UBill"/>
     231        <CursorPos X="25" Y="156"/>
     232        <TopLine Value="136"/>
     233        <EditorIndex Value="3"/>
     234        <UsageCount Value="52"/>
     235        <Loaded Value="True"/>
     236      </Unit23>
    227237    </Units>
    228238    <JumpHistory Count="30" HistoryIndex="29">
    229239      <Position1>
    230         <Filename Value="UMainPage.pas"/>
    231         <Caret Line="138" Column="17" TopLine="111"/>
     240        <Filename Value="UDatabase.pas"/>
     241        <Caret Line="28" Column="1" TopLine="1"/>
    232242      </Position1>
    233243      <Position2>
    234         <Filename Value="index.pas"/>
    235         <Caret Line="7" Column="33" TopLine="1"/>
     244        <Filename Value="UDatabase.pas"/>
     245        <Caret Line="63" Column="1" TopLine="27"/>
    236246      </Position2>
    237247      <Position3>
    238         <Filename Value="uuser.pas"/>
    239         <Caret Line="14" Column="3" TopLine="1"/>
     248        <Filename Value="UDatabase.pas"/>
     249        <Caret Line="97" Column="34" TopLine="79"/>
    240250      </Position3>
    241251      <Position4>
    242         <Filename Value="udatabase.pas"/>
    243         <Caret Line="19" Column="3" TopLine="9"/>
     252        <Filename Value="UDatabase.pas"/>
     253        <Caret Line="32" Column="23" TopLine="14"/>
    244254      </Position4>
    245255      <Position5>
    246         <Filename Value="uuser.pas"/>
    247         <Caret Line="43" Column="5" TopLine="7"/>
     256        <Filename Value="UDatabase.pas"/>
     257        <Caret Line="12" Column="14" TopLine="1"/>
    248258      </Position5>
    249259      <Position6>
    250         <Filename Value="uuser.pas"/>
    251         <Caret Line="42" Column="12" TopLine="11"/>
     260        <Filename Value="UDatabase.pas"/>
     261        <Caret Line="98" Column="35" TopLine="80"/>
    252262      </Position6>
    253263      <Position7>
    254         <Filename Value="udatabase.pas"/>
    255         <Caret Line="13" Column="31" TopLine="1"/>
     264        <Filename Value="UUser.pas"/>
     265        <Caret Line="16" Column="1" TopLine="1"/>
    256266      </Position7>
    257267      <Position8>
    258         <Filename Value="UNews.pas"/>
    259         <Caret Line="173" Column="5" TopLine="137"/>
     268        <Filename Value="UBill.pas"/>
     269        <Caret Line="151" Column="57" TopLine="141"/>
    260270      </Position8>
    261271      <Position9>
    262         <Filename Value="UNews.pas"/>
    263         <Caret Line="178" Column="8" TopLine="171"/>
     272        <Filename Value="UDatabase.pas"/>
     273        <Caret Line="117" Column="25" TopLine="96"/>
    264274      </Position9>
    265275      <Position10>
    266         <Filename Value="UCore.pas"/>
    267         <Caret Line="33" Column="21" TopLine="15"/>
     276        <Filename Value="UDatabase.pas"/>
     277        <Caret Line="83" Column="5" TopLine="47"/>
    268278      </Position10>
    269279      <Position11>
    270         <Filename Value="UNews.pas"/>
    271         <Caret Line="23" Column="3" TopLine="21"/>
     280        <Filename Value="UDatabase.pas"/>
     281        <Caret Line="138" Column="20" TopLine="108"/>
    272282      </Position11>
    273283      <Position12>
    274         <Filename Value="UNews.pas"/>
    275         <Caret Line="65" Column="1" TopLine="64"/>
     284        <Filename Value="UDatabase.pas"/>
     285        <Caret Line="139" Column="18" TopLine="108"/>
    276286      </Position12>
    277287      <Position13>
    278         <Filename Value="UNews.pas"/>
    279         <Caret Line="72" Column="50" TopLine="64"/>
     288        <Filename Value="UDatabase.pas"/>
     289        <Caret Line="49" Column="27" TopLine="36"/>
    280290      </Position13>
    281291      <Position14>
    282         <Filename Value="UNews.pas"/>
    283         <Caret Line="74" Column="45" TopLine="53"/>
     292        <Filename Value="UDatabase.pas"/>
     293        <Caret Line="105" Column="8" TopLine="87"/>
    284294      </Position14>
    285295      <Position15>
    286         <Filename Value="UNews.pas"/>
    287         <Caret Line="73" Column="61" TopLine="55"/>
     296        <Filename Value="UDatabase.pas"/>
     297        <Caret Line="48" Column="34" TopLine="35"/>
    288298      </Position15>
    289299      <Position16>
    290         <Filename Value="uuser.pas"/>
    291         <Caret Line="27" Column="3" TopLine="25"/>
     300        <Filename Value="UDatabase.pas"/>
     301        <Caret Line="106" Column="24" TopLine="88"/>
    292302      </Position16>
    293303      <Position17>
    294         <Filename Value="udatabase.pas"/>
    295         <Caret Line="14" Column="3" TopLine="2"/>
     304        <Filename Value="UDatabase.pas"/>
     305        <Caret Line="137" Column="1" TopLine="105"/>
    296306      </Position17>
    297307      <Position18>
    298         <Filename Value="udatabase.pas"/>
    299         <Caret Line="28" Column="3" TopLine="25"/>
     308        <Filename Value="UDatabase.pas"/>
     309        <Caret Line="133" Column="17" TopLine="105"/>
    300310      </Position18>
    301311      <Position19>
    302         <Filename Value="udatabase.pas"/>
    303         <Caret Line="36" Column="3" TopLine="34"/>
     312        <Filename Value="UDatabase.pas"/>
     313        <Caret Line="48" Column="27" TopLine="30"/>
    304314      </Position19>
    305315      <Position20>
    306         <Filename Value="uuserpage.pas"/>
    307         <Caret Line="17" Column="5" TopLine="1"/>
     316        <Filename Value="UBill.pas"/>
     317        <Caret Line="292" Column="26" TopLine="265"/>
    308318      </Position20>
    309319      <Position21>
    310         <Filename Value="udatabase.pas"/>
    311         <Caret Line="37" Column="31" TopLine="11"/>
     320        <Filename Value="UBill.pas"/>
     321        <Caret Line="304" Column="5" TopLine="268"/>
    312322      </Position21>
    313323      <Position22>
    314         <Filename Value="udatabase.pas"/>
    315         <Caret Line="31" Column="18" TopLine="13"/>
     324        <Filename Value="UBill.pas"/>
     325        <Caret Line="312" Column="44" TopLine="278"/>
    316326      </Position22>
    317327      <Position23>
    318         <Filename Value="udatabase.pas"/>
    319         <Caret Line="75" Column="14" TopLine="54"/>
     328        <Filename Value="UBill.pas"/>
     329        <Caret Line="72" Column="3" TopLine="54"/>
    320330      </Position23>
    321331      <Position24>
    322         <Filename Value="udatabase.pas"/>
    323         <Caret Line="53" Column="5" TopLine="17"/>
     332        <Filename Value="UBill.pas"/>
     333        <Caret Line="310" Column="49" TopLine="282"/>
    324334      </Position24>
    325335      <Position25>
    326         <Filename Value="uuser.pas"/>
    327         <Caret Line="29" Column="23" TopLine="1"/>
     336        <Filename Value="UBill.pas"/>
     337        <Caret Line="313" Column="15" TopLine="281"/>
    328338      </Position25>
    329339      <Position26>
    330         <Filename Value="uuser.pas"/>
    331         <Caret Line="73" Column="5" TopLine="37"/>
     340        <Filename Value="USqlDatabase.pas"/>
     341        <Caret Line="369" Column="15" TopLine="337"/>
    332342      </Position26>
    333343      <Position27>
    334         <Filename Value="uuser.pas"/>
    335         <Caret Line="72" Column="3" TopLine="40"/>
     344        <Filename Value="UDatabase.pas"/>
     345        <Caret Line="114" Column="5" TopLine="78"/>
    336346      </Position27>
    337347      <Position28>
    338         <Filename Value="uuser.pas"/>
    339         <Caret Line="44" Column="39" TopLine="26"/>
     348        <Filename Value="UDatabase.pas"/>
     349        <Caret Line="124" Column="5" TopLine="88"/>
    340350      </Position28>
    341351      <Position29>
    342         <Filename Value="uuserpage.pas"/>
    343         <Caret Line="29" Column="33" TopLine="3"/>
     352        <Filename Value="UBill.pas"/>
     353        <Caret Line="133" Column="21" TopLine="97"/>
    344354      </Position29>
    345355      <Position30>
    346         <Filename Value="uuserpage.pas"/>
    347         <Caret Line="23" Column="48" TopLine="1"/>
     356        <Filename Value="UDatabase.pas"/>
     357        <Caret Line="38" Column="17" TopLine="27"/>
    348358      </Position30>
    349359    </JumpHistory>
  • devel/web/index.pas

    r139 r142  
    55uses
    66  UCore, USqlDatabase, SysUtils, UMainPage, pwinit, pwmain,
    7   UFinancePage, UNewsPage, UUserPage;
     7  UFinancePage, UNewsPage, UUserPage, UBill;
    88
    99var
Note: See TracChangeset for help on using the changeset viewer.