diff --git a/Project1.dpr b/Project1.dpr new file mode 100644 index 0000000..242b2f2 --- /dev/null +++ b/Project1.dpr @@ -0,0 +1,19 @@ +program Project1; + +uses + Vcl.Forms, + Unit1 in 'Unit1.pas' {Form1}, + Unit2 in 'Unit2.pas' {Form2}, + Vcl.Themes, + Vcl.Styles; + +{$R *.res} + +begin + Application.Initialize; + Application.MainFormOnTaskbar := True; + TStyleManager.TrySetStyle('Windows10 Dark'); + Application.CreateForm(TForm1, Form1); + Application.CreateForm(TForm2, Form2); + Application.Run; +end. diff --git a/Project1.dproj b/Project1.dproj new file mode 100644 index 0000000..eeb8033 --- /dev/null +++ b/Project1.dproj @@ -0,0 +1,970 @@ + + + {7212967F-F9A3-440C-AA39-A53BDCA21669} + 19.4 + VCL + True + Debug + Win32 + 1 + Application + Project1.dpr + + + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Cfg_1 + true + true + + + true + Base + true + + + true + Cfg_2 + true + true + + + .\$(Platform)\$(Config) + .\$(Platform)\$(Config) + false + false + false + false + false + System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace) + $(BDS)\bin\delphi_PROJECTICON.ico + $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png + Project1 + "Windows10 Dark|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Windows10Dark.vsf" + + + vclwinx;DataSnapServer;fmx;emshosting;vclie;DbxCommonDriver;bindengine;IndyIPCommon;VCLRESTComponents;DBXMSSQLDriver;FireDACCommonODBC;emsclient;FireDACCommonDriver;appanalytics;IndyProtocols;vclx;IndyIPClient;dbxcds;vcledge;bindcompvclwinx;FmxTeeUI;emsedge;bindcompfmx;DBXFirebirdDriver;inetdb;ibmonitor;FireDACSqliteDriver;DbxClientDriver;FireDACASADriver;Tee;soapmidas;vclactnband;TeeUI;fmxFireDAC;dbexpress;FireDACInfxDriver;DBXMySQLDriver;VclSmp;inet;DataSnapCommon;vcltouch;fmxase;DBXOdbcDriver;dbrtl;FireDACDBXDriver;FireDACOracleDriver;fmxdae;TeeDB;FireDACMSAccDriver;CustomIPTransport;FireDACMSSQLDriver;DataSnapIndy10ServerTransport;DataSnapConnectors;vcldsnap;DBXInterBaseDriver;FireDACMongoDBDriver;IndySystem;FireDACTDataDriver;vcldb;ibxbindings;vclFireDAC;bindcomp;FireDACCommon;DataSnapServerMidas;FireDACODBCDriver;emsserverresource;IndyCore;RESTBackendComponents;bindcompdbx;rtl;FireDACMySQLDriver;FireDACADSDriver;RESTComponents;DBXSqliteDriver;vcl;IndyIPServer;dsnapxml;dsnapcon;DataSnapClient;DataSnapProviderClient;adortl;DBXSybaseASEDriver;DBXDb2Driver;vclimg;DataSnapFireDAC;emsclientfiredac;FireDACPgDriver;FireDAC;FireDACDSDriver;inetdbxpress;xmlrtl;tethering;ibxpress;bindcompvcl;dsnap;CloudService;DBXSybaseASADriver;DBXOracleDriver;FireDACDb2Driver;DBXInformixDriver;vclib;fmxobj;bindcompvclsmp;FMXTee;DataSnapNativeClient;DatasnapConnectorsFreePascal;soaprtl;soapserver;FireDACIBDriver;$(DCC_UsePackage) + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) + Debug + true + CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= + 1033 + $(BDS)\bin\default_app.manifest + true + + + vclwinx;DataSnapServer;fmx;emshosting;vclie;DbxCommonDriver;bindengine;IndyIPCommon;VCLRESTComponents;DBXMSSQLDriver;FireDACCommonODBC;emsclient;FireDACCommonDriver;appanalytics;IndyProtocols;vclx;IndyIPClient;dbxcds;vcledge;bindcompvclwinx;FmxTeeUI;emsedge;bindcompfmx;DBXFirebirdDriver;inetdb;ibmonitor;FireDACSqliteDriver;DbxClientDriver;FireDACASADriver;Tee;soapmidas;vclactnband;TeeUI;fmxFireDAC;dbexpress;FireDACInfxDriver;DBXMySQLDriver;VclSmp;inet;DataSnapCommon;vcltouch;fmxase;DBXOdbcDriver;dbrtl;FireDACDBXDriver;FireDACOracleDriver;fmxdae;TeeDB;FireDACMSAccDriver;CustomIPTransport;FireDACMSSQLDriver;DataSnapIndy10ServerTransport;DataSnapConnectors;vcldsnap;DBXInterBaseDriver;FireDACMongoDBDriver;IndySystem;FireDACTDataDriver;vcldb;ibxbindings;vclFireDAC;bindcomp;FireDACCommon;DataSnapServerMidas;FireDACODBCDriver;emsserverresource;IndyCore;RESTBackendComponents;bindcompdbx;rtl;FireDACMySQLDriver;FireDACADSDriver;RESTComponents;DBXSqliteDriver;vcl;IndyIPServer;dsnapxml;dsnapcon;DataSnapClient;DataSnapProviderClient;adortl;DBXSybaseASEDriver;DBXDb2Driver;vclimg;DataSnapFireDAC;emsclientfiredac;FireDACPgDriver;FireDAC;FireDACDSDriver;inetdbxpress;xmlrtl;tethering;ibxpress;bindcompvcl;dsnap;CloudService;DBXSybaseASADriver;DBXOracleDriver;FireDACDb2Driver;DBXInformixDriver;vclib;fmxobj;bindcompvclsmp;FMXTee;DataSnapNativeClient;DatasnapConnectorsFreePascal;soaprtl;soapserver;FireDACIBDriver;$(DCC_UsePackage) + + + DEBUG;$(DCC_Define) + true + false + true + true + true + true + true + + + false + true + PerMonitorV2 + true + 1033 + + + false + RELEASE;$(DCC_Define) + 0 + 0 + + + true + PerMonitorV2 + + + + MainSource + + +
Form1
+ dfm +
+ +
Form2
+ dfm +
+ + Base + + + Cfg_1 + Base + + + Cfg_2 + Base + +
+ + Delphi.Personality.12 + Application + + + + Project1.dpr + + + Embarcadero C++Builder Office 2000 Servers Package + Embarcadero C++Builder Office XP Servers Package + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components + + + + + + Project1.exe + true + + + + + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + classes + 64 + + + classes + 64 + + + + + res\xml + 1 + + + res\xml + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + library\lib\armeabi + 1 + + + library\lib\armeabi + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + library\lib\mips + 1 + + + library\lib\mips + 1 + + + + + library\lib\armeabi-v7a + 1 + + + library\lib\arm64-v8a + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\values-v21 + 1 + + + res\values-v21 + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-xxhdpi + 1 + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-xxxhdpi + 1 + + + res\drawable-xxxhdpi + 1 + + + + + res\drawable-ldpi + 1 + + + res\drawable-ldpi + 1 + + + + + res\drawable-mdpi + 1 + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + res\drawable-xhdpi + 1 + + + + + res\drawable-mdpi + 1 + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + res\drawable-xhdpi + 1 + + + + + res\drawable-xxhdpi + 1 + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-xxxhdpi + 1 + + + res\drawable-xxxhdpi + 1 + + + + + res\drawable-small + 1 + + + res\drawable-small + 1 + + + + + res\drawable-normal + 1 + + + res\drawable-normal + 1 + + + + + res\drawable-large + 1 + + + res\drawable-large + 1 + + + + + res\drawable-xlarge + 1 + + + res\drawable-xlarge + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + Contents\MacOS + 1 + .framework + + + Contents\MacOS + 1 + .framework + + + Contents\MacOS + 1 + .framework + + + 0 + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + 0 + .dll;.bpl + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + 0 + .bpl + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + Contents\Resources\StartUp\ + 0 + + + Contents\Resources\StartUp\ + 0 + + + Contents\Resources\StartUp\ + 0 + + + 0 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + + + ..\ + 1 + + + ..\ + 1 + + + + + 1 + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).launchscreen + 64 + + + ..\$(PROJECTNAME).launchscreen + 64 + + + + + 1 + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + + + ..\ + 1 + + + ..\ + 1 + + + ..\ + 1 + + + + + Contents + 1 + + + Contents + 1 + + + Contents + 1 + + + + + Contents\Resources + 1 + + + Contents\Resources + 1 + + + Contents\Resources + 1 + + + + + library\lib\armeabi-v7a + 1 + + + library\lib\arm64-v8a + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + Contents\MacOS + 1 + + + Contents\MacOS + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + library\lib\armeabi-v7a + 1 + + + + + 1 + + + 1 + + + + + Assets + 1 + + + Assets + 1 + + + + + Assets + 1 + + + Assets + 1 + + + + + + + + + + + + + + + + True + False + + + 12 + + + + +
diff --git a/Project1.dproj.local b/Project1.dproj.local new file mode 100644 index 0000000..3065863 --- /dev/null +++ b/Project1.dproj.local @@ -0,0 +1,12 @@ + + + + 1899-12-30 00:00:00.000.755,C:\Users\js22\Desktop\상훈\주차관리시스템\Unit2.dfm=C:\Users\js22\Documents\Embarcadero\Studio\Projects\Unit2.dfm + 1899-12-30 00:00:00.000.705,C:\Users\js22\Desktop\상훈\주차관리시스템\Project1.dproj=C:\Users\js22\Documents\Embarcadero\Studio\Projects\Project1.dproj + 1899-12-30 00:00:00.000.755,C:\Users\js22\Desktop\상훈\주차관리시스템\Unit2.pas=C:\Users\js22\Documents\Embarcadero\Studio\Projects\Unit2.pas + 1899-12-30 00:00:00.000.841,=C:\Users\js22\Documents\Embarcadero\Studio\Projects\Unit2.pas + 1899-12-30 00:00:00.000.194,=C:\Users\js22\Documents\Embarcadero\Studio\Projects\Unit1.pas + 1899-12-30 00:00:00.000.494,C:\Users\js22\Desktop\상훈\주차관리시스템\Unit1.dfm=C:\Users\js22\Documents\Embarcadero\Studio\Projects\Unit1.dfm + 1899-12-30 00:00:00.000.494,C:\Users\js22\Desktop\상훈\주차관리시스템\Unit1.pas=C:\Users\js22\Documents\Embarcadero\Studio\Projects\Unit1.pas + + diff --git a/Project1.identcache b/Project1.identcache new file mode 100644 index 0000000..cf6297b Binary files /dev/null and b/Project1.identcache differ diff --git a/Project1.res b/Project1.res new file mode 100644 index 0000000..e9bf374 Binary files /dev/null and b/Project1.res differ diff --git a/Unit1.dfm b/Unit1.dfm new file mode 100644 index 0000000..9a13fae --- /dev/null +++ b/Unit1.dfm @@ -0,0 +1,91 @@ +object Form1: TForm1 + Left = 654 + Top = 353 + BorderStyle = bsSingle + Caption = #51452#52264#44288#47532' '#49884#49828#53596' '#47196#44536#51064 + ClientHeight = 250 + ClientWidth = 352 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -12 + Font.Name = 'Segoe UI' + Font.Style = [] + Position = poDesigned + TextHeight = 15 + object GroupBox1: TGroupBox + Left = 8 + Top = 2 + Width = 286 + Height = 92 + Caption = #47196#44536#51064 + TabOrder = 0 + object editID: TEdit + Left = 16 + Top = 24 + Width = 161 + Height = 23 + ImeMode = imDisable + TabOrder = 0 + Text = 'ID' + end + object editPW: TEdit + Left = 16 + Top = 53 + Width = 161 + Height = 23 + ImeMode = imDisable + PasswordChar = '*' + TabOrder = 1 + Text = 'PW' + end + object btnLogin: TButton + Left = 183 + Top = 24 + Width = 75 + Height = 53 + Caption = #47196#44536#51064 + TabOrder = 2 + OnClick = btnLoginClick + end + end + object DBGrid1: TDBGrid + Left = 8 + Top = 120 + Width = 337 + Height = 120 + DataSource = DataSource1 + Options = [dgEditing, dgAlwaysShowEditor, dgTitles, dgIndicator, dgColumnResize, dgColLines, dgRowLines, dgTabs, dgConfirmDelete, dgCancelOnExit, dgTitleClick, dgTitleHotTrack] + TabOrder = 1 + TitleFont.Charset = DEFAULT_CHARSET + TitleFont.Color = clWindowText + TitleFont.Height = -12 + TitleFont.Name = 'Segoe UI' + TitleFont.Style = [] + end + object FDPhysMySQLDriverLink1: TFDPhysMySQLDriverLink + VendorLib = 'C:\Users\js22\Desktop\libmariadb.dll' + Left = 40 + Top = 280 + end + object FDQuery1: TFDQuery + Connection = FDConnection1 + Left = 120 + Top = 264 + end + object FDConnection1: TFDConnection + Params.Strings = ( + 'Database=parkinglot' + 'User_Name=root' + 'Password=root' + 'Server=127.0.0.1' + 'DriverID=MySQL') + Left = 192 + Top = 264 + end + object DataSource1: TDataSource + DataSet = FDQuery1 + Left = 264 + Top = 304 + end +end diff --git a/Unit1.pas b/Unit1.pas new file mode 100644 index 0000000..0580241 --- /dev/null +++ b/Unit1.pas @@ -0,0 +1,98 @@ +unit Unit1; + +interface + +uses + Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, + Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Data.DB, FireDAC.Phys.MySQLDef, + FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Param, + FireDAC.Stan.Error, FireDAC.DatS, FireDAC.Phys.Intf, FireDAC.DApt.Intf, + FireDAC.Stan.Async, FireDAC.DApt, FireDAC.UI.Intf, FireDAC.Stan.Def, + FireDAC.Stan.Pool, FireDAC.Phys, FireDAC.Phys.MySQL, FireDAC.VCLUI.Wait, + FireDAC.Comp.Client, FireDAC.Comp.DataSet, Vcl.Grids, Vcl.DBGrids, + Vcl.StdCtrls, system.Hash; + +type + TForm1 = class(TForm) + GroupBox1: TGroupBox; + editID: TEdit; + editPW: TEdit; + btnLogin: TButton; + DBGrid1: TDBGrid; + FDPhysMySQLDriverLink1: TFDPhysMySQLDriverLink; + FDQuery1: TFDQuery; + FDConnection1: TFDConnection; + DataSource1: TDataSource; + procedure btnLoginClick(Sender: TObject); + private + { Private declarations } + public + { Public declarations } + end; + +var + Form1: TForm1; + +implementation + +uses unit2; +{$R *.dfm} + +procedure TForm1.btnLoginClick(Sender: TObject); +var +afterID1, afterID2, afterPW1, afterPW2 : string; + +begin +afterID1 := StringReplace(editID.Text, '=', '',[rfReplaceAll, rfIgnoreCase]); +afterID2 := StringReplace(afterID1, '-', '',[rfReplaceAll, rfIgnoreCase]); +afterPW1 := StringReplace(editPW.Text, '=', '',[rfReplaceAll, rfIgnoreCase]); +afterPW2 := StringReplace(afterPW1, '-', '',[rfReplaceAll, rfIgnoreCase]); + +editID.Text := afterID2; +editPW.Text := afterPW2; + + + try + begin + with FDConnection1 do begin + Params.Clear; + Params.Add('DriverID=MySQL'); + Params.Add('Server=127.0.0.1'); + Params.Add('Port=3306'); + Params.Add('Database=parkinglot'); + Params.Add('User_Name=root'); + Params.Add('Password=root'); + + Params.Add('CharacterSet=utf8'); + + Open; + end; + with FDQuery1 do begin + SQL.Clear; + SQL.Add('select * from member'); + SQL.Add('where mbID =:ID and mbPW =:PW'); + Params.ParamByName('ID').AsString := afterID2; + Params.ParamByName('PW').AsString := afterPW2; + + + open; + end; + + if afterID2 = dbGrid1.Fields[1].AsString then + begin + if afterPW2 = dbGrid1.Fields[2].AsString then + begin + showMessage('Login successful'); + form1.Hide; + form2.show; + end + end + else + showmessage('Login Filed'); + end + except + ShowMessage('Server Login Error'); + end; +end; + +end. diff --git a/Unit2.dfm b/Unit2.dfm new file mode 100644 index 0000000..c2fe1c9 --- /dev/null +++ b/Unit2.dfm @@ -0,0 +1,178 @@ +object Form2: TForm2 + Left = 551 + Top = 353 + Caption = #51452#52264' '#52264#47049' '#44288#47532 + ClientHeight = 523 + ClientWidth = 876 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -12 + Font.Name = 'Segoe UI' + Font.Style = [] + Position = poDesigned + OnClose = FormClose + TextHeight = 15 + object lblKIND: TLabel + Left = 112 + Top = 480 + Width = 40 + Height = 15 + Caption = 'lblKIND' + end + object DBGrid1: TDBGrid + Left = 214 + Top = 8 + Width = 658 + Height = 451 + DataSource = DataSource1 + Options = [dgEditing, dgAlwaysShowEditor, dgTitles, dgIndicator, dgColumnResize, dgColLines, dgRowLines, dgTabs, dgConfirmDelete, dgCancelOnExit, dgTitleClick, dgTitleHotTrack] + TabOrder = 0 + TitleFont.Charset = DEFAULT_CHARSET + TitleFont.Color = clWindowText + TitleFont.Height = -12 + TitleFont.Name = 'Segoe UI' + TitleFont.Style = [] + end + object search: TButton + Left = 8 + Top = 175 + Width = 201 + Height = 41 + Caption = #51312#54924 + TabOrder = 1 + OnClick = searchClick + end + object GroupBox1: TGroupBox + Left = 8 + Top = 8 + Width = 201 + Height = 161 + Caption = #52264#47049#44288#47532 + TabOrder = 2 + object Label1: TLabel + Left = 14 + Top = 34 + Width = 48 + Height = 15 + Caption = #52264#47049#48264#54840 + end + object EditCarNum: TEdit + Left = 68 + Top = 31 + Width = 121 + Height = 23 + TabOrder = 0 + end + object Button1: TButton + Left = 11 + Top = 89 + Width = 178 + Height = 25 + Caption = #51077#52264 + TabOrder = 1 + OnClick = Button1Click + end + object Button2: TButton + Left = 11 + Top = 121 + Width = 178 + Height = 25 + Caption = #52636#52264 + TabOrder = 2 + OnClick = Button2Click + end + object ComboBox1: TComboBox + Left = 14 + Top = 60 + Width = 175 + Height = 23 + TabOrder = 3 + Text = #51452#52264#51333#47448 + Items.Strings = ( + #51068#48152#51452#52264 + #51068#51068#51452#52264) + end + end + object GroupBox2: TGroupBox + Left = 8 + Top = 271 + Width = 201 + Height = 186 + Caption = #44552#50529#49688#51221 + TabOrder = 3 + object Label2: TLabel + Left = 12 + Top = 20 + Width = 60 + Height = 15 + Caption = '10'#48516#45817#44032#44201 + end + object Label3: TLabel + Left = 12 + Top = 114 + Width = 69 + Height = 15 + Caption = '1'#51068' '#51452#52264#44032#44201 + end + object Label4: TLabel + Left = 11 + Top = 70 + Width = 96 + Height = 15 + Caption = #51068#48152#51452#52264#44592#48376#44552#50529 + end + object Editminpay: TEdit + Left = 11 + Top = 41 + Width = 177 + Height = 23 + TabOrder = 0 + Text = '400' + end + object Editdaypay: TEdit + Left = 12 + Top = 131 + Width = 177 + Height = 23 + TabOrder = 1 + Text = '20000' + end + object normalpay: TEdit + Left = 11 + Top = 86 + Width = 177 + Height = 23 + TabOrder = 2 + Text = '3000' + end + end + object DataSource1: TDataSource + DataSet = FDQuery1 + Left = 504 + Top = 192 + end + object FDQuery1: TFDQuery + Connection = FDConnection1 + SQL.Strings = ( + 'select * from ledger') + Left = 456 + Top = 192 + end + object FDPhysMySQLDriverLink1: TFDPhysMySQLDriverLink + VendorLib = 'C:\Users\js22\Desktop\libmariadb.dll' + Left = 456 + Top = 224 + end + object FDConnection1: TFDConnection + Params.Strings = ( + 'Database=parkinglot' + 'User_Name=root' + 'Password=root' + 'Server=127.0.0.1' + 'DriverID=MySQL') + Connected = True + Left = 504 + Top = 224 + end +end diff --git a/Unit2.pas b/Unit2.pas new file mode 100644 index 0000000..c72e1f4 --- /dev/null +++ b/Unit2.pas @@ -0,0 +1,257 @@ +unit Unit2; + +interface + +uses + Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, + Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Data.DB, Data.SqlExpr, Vcl.Grids, + Vcl.DBGrids, FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Param, + FireDAC.Stan.Error, FireDAC.DatS, FireDAC.Phys.Intf, FireDAC.DApt.Intf, + FireDAC.Stan.Async, FireDAC.DApt, FireDAC.Comp.DataSet, FireDAC.Comp.Client, + FireDAC.Phys.MySQLDef, FireDAC.Phys, FireDAC.Phys.MySQL, FireDAC.UI.Intf, + FireDAC.Stan.Def, FireDAC.Stan.Pool, FireDAC.VCLUI.Wait, Vcl.StdCtrls, + Vcl.Mask, Vcl.ExtCtrls, Vcl.DBCtrls; + +type + TForm2 = class(TForm) + DBGrid1: TDBGrid; + DataSource1: TDataSource; + FDQuery1: TFDQuery; + FDPhysMySQLDriverLink1: TFDPhysMySQLDriverLink; + FDConnection1: TFDConnection; + search: TButton; + GroupBox1: TGroupBox; + Label1: TLabel; + EditCarNum: TEdit; + Button1: TButton; + Button2: TButton; + GroupBox2: TGroupBox; + Label2: TLabel; + Editminpay: TEdit; + Label3: TLabel; + Editdaypay: TEdit; + ComboBox1: TComboBox; + lblKIND: TLabel; + Label4: TLabel; + normalpay: TEdit; + procedure FormClose(Sender: TObject; var Action: TCloseAction); + procedure searchClick(Sender: TObject); + procedure Button1Click(Sender: TObject); + procedure Button2Click(Sender: TObject); + private + { Private declarations } + public + { Public declarations } + end; + +var + Form2: TForm2; + +implementation + +{$R *.dfm} +uses unit1; + +procedure TForm2.searchClick(Sender: TObject); +begin + try + begin + with FDConnection1 do begin + Params.Clear; + Params.Add('DriverID=MySQL'); + Params.Add('Server=127.0.0.1'); + Params.Add('Port=3306'); + Params.Add('Database=parkinglot'); + Params.Add('User_Name=root'); + Params.Add('Password=root'); + + Params.Add('CharacterSet=utf8'); + + Open; + end; + with FDQuery1 do begin + SQL.Clear; + SQL.Add('set @cnt = 0;'); + SQL.Add('update ledger set ledger.num = @cnt := @cnt+1;'); // ȣи num + SQL.Add('select * from ledger'); + open; + end; +end; + finally + + + end; + end; + + + +procedure TForm2.Button1Click(Sender: TObject); + +begin + +if ComboBox1.Text = 'Ϲ' then +begin + try + + with FDConnection1 do begin + Params.Clear; + Params.Add('DriverID=MySQL'); + Params.Add('Server=127.0.0.1'); + Params.Add('Port=3306'); + Params.Add('Database=parkinglot'); + Params.Add('User_Name=root'); + Params.Add('Password=root'); + Params.Add('CharacterSet=utf8'); + Open; + end; + with FDQuery1 do begin + SQL.Clear; + SQL.Add('INSERT INTO ledger(carnum,startTIME,kind,pay)'); + SQL.Add('VALUE(:carN,:StartT,:kind,:pay);'); + Params.ParamByName('carN').AsString := EditCarNum.Text; + Params.ParamByName('StartT').AsString := formatDateTime('yyyy-mm-dd hh:mm:ss', now); + Params.ParamByName('kind').AsString := ComboBox1.Text; //޺ڽ ؽƮ + Params.ParamByName('pay').AsString := normalpay.Text; //Ϲ ⺻ݾ μ + execsql; + showMessage('߰Ϸ'); + SQL.Clear; + SQL.Add('select * from ledger'); + open; + end; + finally + + + + end; +end; + +if ComboBox1.Text = '' then +begin + try + + with FDConnection1 do begin + Params.Clear; + Params.Add('DriverID=MySQL'); + Params.Add('Server=127.0.0.1'); + Params.Add('Port=3306'); + Params.Add('Database=parkinglot'); + Params.Add('User_Name=root'); + Params.Add('Password=root'); + Params.Add('CharacterSet=utf8'); + Open; + end; + with FDQuery1 do begin + SQL.Clear; + SQL.Add('INSERT INTO ledger(carnum,startTIME,kind,pay)'); + SQL.Add('VALUE(:carN,:StartT,:kind,:pay);'); + Params.ParamByName('carN').AsString := EditCarNum.Text; + Params.ParamByName('StartT').AsString := formatDateTime('yyyy-mm-dd hh:mm:ss', now); + Params.ParamByName('kind').AsString := ComboBox1.Text; //޺ڽ ؽƮ + Params.ParamByName('pay').AsString := Editdaypay.Text; //ݾ + execsql; + showMessage('߰Ϸ'); + SQL.Clear; + SQL.Add('select * from ledger'); + open; + end; + finally + + + + end; +end; + +end; + +procedure TForm2.Button2Click(Sender: TObject); +var +startend:string; +start1,end1:string; +begin + try + + with FDConnection1 do begin + Params.Clear; + Params.Add('DriverID=MySQL'); + Params.Add('Server=127.0.0.1'); + Params.Add('Port=3306'); + Params.Add('Database=parkinglot'); + Params.Add('User_Name=root'); + Params.Add('Password=root'); + Params.Add('CharacterSet=utf8'); + Open; + end; + with FDQuery1 do begin + SQL.Clear; + SQL.Add('select * from ledger'); + SQL.Add('where carnum = :carN;'); //ȣ ˻ + Params.ParamByName('carN').AsString := EditCarNum.text; //ȣ EditCarNum.tEXT ´ + + + open; + end; + + //Ϲ + // Ϲ ((endTIME - startTIME))/60-30)/10*400 + lblKIND.Caption := dbGrid1.Fields[4].AsString; + if lblKIND.Caption = 'Ϲ' then + begin + try + with FDQuery1 do + begin + SQL.Clear; + SQL.Add('select * from ledger;'); + SQL.Add('UPDATE ledger SET endTIME = now() WHERE Carnum =:carT;'); // ȣ ޾ƿ endTIME Ʈش. + SQL.ADD('UPDATE ledger SET endstart = ROUND(((unix_timestamp(endTIME)-unix_timestamp(startTIME))/60-30)/10*400,-2) WHERE carnum =:carT;'); + {ROUND(xxx,-2) ̿ ʿ } + Params.ParamByName('carT').AsString := EditCarNum.text; //ȣ EditCarNum.tEXT ´ + showmessage('Ϸ ݾȮּ'); + open; + SQL.Add('select * from ledger'); + SQL.Add('where carnum = :carT;'); + open; + end; + + finally + + end; + end; //if Ϲ begin + + lblKIND.Caption := dbGrid1.Fields[4].AsString; + if lblKIND.Caption = '' then + begin + try + with FDQuery1 do + begin + SQL.Clear; + SQL.Add('select * from ledger;'); + SQL.Add('UPDATE ledger SET endTIME = now() WHERE Carnum =:carT;'); // ȣ ޾ƿ endTIME Ʈش. + SQL.ADD('UPDATE ledger SET endstart = ROUND(((unix_timestamp(endTIME)-unix_timestamp(startTIME))/60-30)/10*400,-2) WHERE carnum =:carT;'); + {ROUND(xxx,-2) ̿ ʿ } + Params.ParamByName('carT').AsString := EditCarNum.text; //ȣ EditCarNum.tEXT ´ + showmessage('Ϸ ݾȮּ'); + open; + SQL.Add('select * from ledger'); + SQL.Add('where carnum = :carT;'); + open; + end; + finally + + end; //if begin + + + + + end; + finally + + end; + end; + + +procedure TForm2.FormClose(Sender: TObject; var Action: TCloseAction); +begin +form1.close; +end; + +end. diff --git a/Win32/Debug/Project1.exe b/Win32/Debug/Project1.exe new file mode 100644 index 0000000..c1d7119 Binary files /dev/null and b/Win32/Debug/Project1.exe differ diff --git a/Win32/Debug/Unit1.dcu b/Win32/Debug/Unit1.dcu new file mode 100644 index 0000000..22e2770 Binary files /dev/null and b/Win32/Debug/Unit1.dcu differ diff --git a/Win32/Debug/Unit2.dcu b/Win32/Debug/Unit2.dcu new file mode 100644 index 0000000..924fd3a Binary files /dev/null and b/Win32/Debug/Unit2.dcu differ diff --git a/__history/Project1.dpr.~1~ b/__history/Project1.dpr.~1~ new file mode 100644 index 0000000..7e0f092 --- /dev/null +++ b/__history/Project1.dpr.~1~ @@ -0,0 +1,16 @@ +program Project1; + +uses + Vcl.Forms, + Unit1 in 'Unit1.pas' {Form1}, + Unit2 in 'Unit2.pas' {Form2}; + +{$R *.res} + +begin + Application.Initialize; + Application.MainFormOnTaskbar := True; + Application.CreateForm(TForm1, Form1); + Application.CreateForm(TForm2, Form2); + Application.Run; +end. diff --git a/__history/Unit1.dfm.~1~ b/__history/Unit1.dfm.~1~ new file mode 100644 index 0000000..d22c4b7 --- /dev/null +++ b/__history/Unit1.dfm.~1~ @@ -0,0 +1,90 @@ +object Form1: TForm1 + Left = 654 + Top = 353 + Caption = #51452#52264#44288#47532' '#49884#49828#53596' '#47196#44536#51064 + ClientHeight = 256 + ClientWidth = 350 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -12 + Font.Name = 'Segoe UI' + Font.Style = [] + Position = poDesigned + TextHeight = 15 + object GroupBox1: TGroupBox + Left = 8 + Top = 2 + Width = 257 + Height = 92 + Caption = #47196#44536#51064 + TabOrder = 0 + object editID: TEdit + Left = 16 + Top = 24 + Width = 137 + Height = 23 + ImeMode = imDisable + TabOrder = 0 + Text = 'ID' + end + object editPW: TEdit + Left = 16 + Top = 53 + Width = 137 + Height = 23 + ImeMode = imDisable + TabOrder = 1 + Text = 'PW' + end + object btnLogin: TButton + Left = 168 + Top = 23 + Width = 75 + Height = 53 + Caption = #47196#44536#51064 + TabOrder = 2 + OnClick = btnLoginClick + end + end + object DBGrid1: TDBGrid + Left = 8 + Top = 120 + Width = 337 + Height = 120 + DataSource = DataSource1 + Options = [dgEditing, dgAlwaysShowEditor, dgTitles, dgIndicator, dgColumnResize, dgColLines, dgRowLines, dgTabs, dgConfirmDelete, dgCancelOnExit, dgTitleClick, dgTitleHotTrack] + TabOrder = 1 + TitleFont.Charset = DEFAULT_CHARSET + TitleFont.Color = clWindowText + TitleFont.Height = -12 + TitleFont.Name = 'Segoe UI' + TitleFont.Style = [] + end + object FDPhysMySQLDriverLink1: TFDPhysMySQLDriverLink + VendorLib = 'C:\Users\js22\Desktop\libmariadb.dll' + Left = 16 + Top = 296 + end + object FDQuery1: TFDQuery + Connection = FDConnection1 + Left = 96 + Top = 296 + end + object FDConnection1: TFDConnection + Params.Strings = ( + 'Database=parkinglot' + 'User_Name=root' + 'Password=root' + 'Server=127.0.0.1' + 'DriverID=MySQL') + Connected = True + Left = 176 + Top = 296 + end + object DataSource1: TDataSource + DataSet = FDQuery1 + Left = 264 + Top = 304 + end +end diff --git a/__history/Unit1.dfm.~2~ b/__history/Unit1.dfm.~2~ new file mode 100644 index 0000000..267bf34 --- /dev/null +++ b/__history/Unit1.dfm.~2~ @@ -0,0 +1,100 @@ +object Form1: TForm1 + Left = 654 + Top = 353 + Caption = #51452#52264#44288#47532' '#49884#49828#53596' '#47196#44536#51064 + ClientHeight = 256 + ClientWidth = 350 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -12 + Font.Name = 'Segoe UI' + Font.Style = [] + Position = poDesigned + TextHeight = 15 + object GroupBox1: TGroupBox + Left = 8 + Top = 2 + Width = 257 + Height = 92 + Caption = #47196#44536#51064 + TabOrder = 0 + object editID: TEdit + Left = 16 + Top = 24 + Width = 137 + Height = 23 + ImeMode = imDisable + TabOrder = 0 + Text = 'ID' + OnKeyPress = editIDonkeypress + end + object editPW: TEdit + Left = 16 + Top = 53 + Width = 137 + Height = 23 + ImeMode = imDisable + TabOrder = 1 + Text = 'PW' + end + object btnLogin: TButton + Left = 168 + Top = 23 + Width = 75 + Height = 53 + Caption = #47196#44536#51064 + TabOrder = 2 + OnClick = btnLoginClick + end + end + object DBGrid1: TDBGrid + Left = 8 + Top = 120 + Width = 337 + Height = 120 + DataSource = DataSource1 + Options = [dgEditing, dgAlwaysShowEditor, dgTitles, dgIndicator, dgColumnResize, dgColLines, dgRowLines, dgTabs, dgConfirmDelete, dgCancelOnExit, dgTitleClick, dgTitleHotTrack] + TabOrder = 1 + TitleFont.Charset = DEFAULT_CHARSET + TitleFont.Color = clWindowText + TitleFont.Height = -12 + TitleFont.Name = 'Segoe UI' + TitleFont.Style = [] + end + object Button1: TButton + Left = 272 + Top = 48 + Width = 75 + Height = 25 + Caption = 'Button1' + TabOrder = 2 + OnClick = Button1Click + end + object FDPhysMySQLDriverLink1: TFDPhysMySQLDriverLink + VendorLib = 'C:\Users\js22\Desktop\libmariadb.dll' + Left = 16 + Top = 296 + end + object FDQuery1: TFDQuery + Connection = FDConnection1 + Left = 96 + Top = 296 + end + object FDConnection1: TFDConnection + Params.Strings = ( + 'Database=parkinglot' + 'User_Name=root' + 'Password=root' + 'Server=127.0.0.1' + 'DriverID=MySQL') + Connected = True + Left = 176 + Top = 296 + end + object DataSource1: TDataSource + DataSet = FDQuery1 + Left = 264 + Top = 304 + end +end diff --git a/__history/Unit1.dfm.~3~ b/__history/Unit1.dfm.~3~ new file mode 100644 index 0000000..8020512 --- /dev/null +++ b/__history/Unit1.dfm.~3~ @@ -0,0 +1,93 @@ +object Form1: TForm1 + Left = 654 + Top = 353 + BorderStyle = bsSingle + Caption = #51452#52264#44288#47532' '#49884#49828#53596' '#47196#44536#51064 + ClientHeight = 96 + ClientWidth = 302 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -12 + Font.Name = 'Segoe UI' + Font.Style = [] + Position = poDesigned + TextHeight = 15 + object GroupBox1: TGroupBox + Left = 8 + Top = 2 + Width = 286 + Height = 92 + Caption = #47196#44536#51064 + TabOrder = 0 + object editID: TEdit + Left = 16 + Top = 24 + Width = 161 + Height = 23 + ImeMode = imDisable + TabOrder = 0 + Text = 'ID' + OnKeyPress = editIDonkeypress + end + object editPW: TEdit + Left = 16 + Top = 53 + Width = 161 + Height = 23 + ImeMode = imDisable + PasswordChar = '*' + TabOrder = 1 + Text = 'PW' + end + object btnLogin: TButton + Left = 192 + Top = 24 + Width = 75 + Height = 53 + Caption = #47196#44536#51064 + TabOrder = 2 + OnClick = btnLoginClick + end + end + object DBGrid1: TDBGrid + Left = 8 + Top = 120 + Width = 337 + Height = 120 + DataSource = DataSource1 + Options = [dgEditing, dgAlwaysShowEditor, dgTitles, dgIndicator, dgColumnResize, dgColLines, dgRowLines, dgTabs, dgConfirmDelete, dgCancelOnExit, dgTitleClick, dgTitleHotTrack] + TabOrder = 1 + TitleFont.Charset = DEFAULT_CHARSET + TitleFont.Color = clWindowText + TitleFont.Height = -12 + TitleFont.Name = 'Segoe UI' + TitleFont.Style = [] + end + object FDPhysMySQLDriverLink1: TFDPhysMySQLDriverLink + VendorLib = 'C:\Users\js22\Desktop\libmariadb.dll' + Left = 16 + Top = 296 + end + object FDQuery1: TFDQuery + Connection = FDConnection1 + Left = 96 + Top = 296 + end + object FDConnection1: TFDConnection + Params.Strings = ( + 'Database=parkinglot' + 'User_Name=root' + 'Password=root' + 'Server=127.0.0.1' + 'DriverID=MySQL') + Connected = True + Left = 176 + Top = 296 + end + object DataSource1: TDataSource + DataSet = FDQuery1 + Left = 264 + Top = 304 + end +end diff --git a/__history/Unit1.dfm.~4~ b/__history/Unit1.dfm.~4~ new file mode 100644 index 0000000..a1b9464 --- /dev/null +++ b/__history/Unit1.dfm.~4~ @@ -0,0 +1,93 @@ +object Form1: TForm1 + Left = 654 + Top = 353 + BorderStyle = bsSingle + Caption = #51452#52264#44288#47532' '#49884#49828#53596' '#47196#44536#51064 + ClientHeight = 451 + ClientWidth = 473 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -12 + Font.Name = 'Segoe UI' + Font.Style = [] + Position = poDesigned + TextHeight = 15 + object GroupBox1: TGroupBox + Left = 8 + Top = 2 + Width = 286 + Height = 92 + Caption = #47196#44536#51064 + TabOrder = 0 + object editID: TEdit + Left = 16 + Top = 24 + Width = 161 + Height = 23 + ImeMode = imDisable + TabOrder = 0 + Text = 'ID' + OnKeyPress = editIDonkeypress + end + object editPW: TEdit + Left = 16 + Top = 53 + Width = 161 + Height = 23 + ImeMode = imDisable + PasswordChar = '*' + TabOrder = 1 + Text = 'PW' + end + object btnLogin: TButton + Left = 183 + Top = 24 + Width = 75 + Height = 53 + Caption = #47196#44536#51064 + TabOrder = 2 + OnClick = btnLoginClick + end + end + object DBGrid1: TDBGrid + Left = 8 + Top = 120 + Width = 337 + Height = 120 + DataSource = DataSource1 + Options = [dgEditing, dgAlwaysShowEditor, dgTitles, dgIndicator, dgColumnResize, dgColLines, dgRowLines, dgTabs, dgConfirmDelete, dgCancelOnExit, dgTitleClick, dgTitleHotTrack] + TabOrder = 1 + TitleFont.Charset = DEFAULT_CHARSET + TitleFont.Color = clWindowText + TitleFont.Height = -12 + TitleFont.Name = 'Segoe UI' + TitleFont.Style = [] + end + object FDPhysMySQLDriverLink1: TFDPhysMySQLDriverLink + VendorLib = 'C:\Users\js22\Desktop\libmariadb.dll' + Left = 16 + Top = 296 + end + object FDQuery1: TFDQuery + Connection = FDConnection1 + Left = 96 + Top = 296 + end + object FDConnection1: TFDConnection + Params.Strings = ( + 'Database=parkinglot' + 'User_Name=root' + 'Password=root' + 'Server=127.0.0.1' + 'DriverID=MySQL') + Connected = True + Left = 176 + Top = 296 + end + object DataSource1: TDataSource + DataSet = FDQuery1 + Left = 264 + Top = 304 + end +end diff --git a/__history/Unit1.dfm.~5~ b/__history/Unit1.dfm.~5~ new file mode 100644 index 0000000..570356b --- /dev/null +++ b/__history/Unit1.dfm.~5~ @@ -0,0 +1,92 @@ +object Form1: TForm1 + Left = 654 + Top = 353 + BorderStyle = bsSingle + Caption = #51452#52264#44288#47532' '#49884#49828#53596' '#47196#44536#51064 + ClientHeight = 101 + ClientWidth = 299 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -12 + Font.Name = 'Segoe UI' + Font.Style = [] + Position = poDesigned + TextHeight = 15 + object GroupBox1: TGroupBox + Left = 8 + Top = 2 + Width = 286 + Height = 92 + Caption = #47196#44536#51064 + TabOrder = 0 + object editID: TEdit + Left = 16 + Top = 24 + Width = 161 + Height = 23 + ImeMode = imDisable + TabOrder = 0 + Text = 'ID' + end + object editPW: TEdit + Left = 16 + Top = 53 + Width = 161 + Height = 23 + ImeMode = imDisable + PasswordChar = '*' + TabOrder = 1 + Text = 'PW' + end + object btnLogin: TButton + Left = 183 + Top = 24 + Width = 75 + Height = 53 + Caption = #47196#44536#51064 + TabOrder = 2 + OnClick = btnLoginClick + end + end + object DBGrid1: TDBGrid + Left = 8 + Top = 120 + Width = 337 + Height = 120 + DataSource = DataSource1 + Options = [dgEditing, dgAlwaysShowEditor, dgTitles, dgIndicator, dgColumnResize, dgColLines, dgRowLines, dgTabs, dgConfirmDelete, dgCancelOnExit, dgTitleClick, dgTitleHotTrack] + TabOrder = 1 + TitleFont.Charset = DEFAULT_CHARSET + TitleFont.Color = clWindowText + TitleFont.Height = -12 + TitleFont.Name = 'Segoe UI' + TitleFont.Style = [] + end + object FDPhysMySQLDriverLink1: TFDPhysMySQLDriverLink + VendorLib = 'C:\Users\js22\Desktop\libmariadb.dll' + Left = 16 + Top = 296 + end + object FDQuery1: TFDQuery + Connection = FDConnection1 + Left = 96 + Top = 296 + end + object FDConnection1: TFDConnection + Params.Strings = ( + 'Database=parkinglot' + 'User_Name=root' + 'Password=root' + 'Server=127.0.0.1' + 'DriverID=MySQL') + Connected = True + Left = 176 + Top = 296 + end + object DataSource1: TDataSource + DataSet = FDQuery1 + Left = 264 + Top = 304 + end +end diff --git a/__history/Unit1.dfm.~6~ b/__history/Unit1.dfm.~6~ new file mode 100644 index 0000000..10080c4 --- /dev/null +++ b/__history/Unit1.dfm.~6~ @@ -0,0 +1,91 @@ +object Form1: TForm1 + Left = 654 + Top = 353 + BorderStyle = bsSingle + Caption = #51452#52264#44288#47532' '#49884#49828#53596' '#47196#44536#51064 + ClientHeight = 380 + ClientWidth = 391 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -12 + Font.Name = 'Segoe UI' + Font.Style = [] + Position = poDesigned + TextHeight = 15 + object GroupBox1: TGroupBox + Left = 8 + Top = 2 + Width = 286 + Height = 92 + Caption = #47196#44536#51064 + TabOrder = 0 + object editID: TEdit + Left = 16 + Top = 24 + Width = 161 + Height = 23 + ImeMode = imDisable + TabOrder = 0 + Text = 'ID' + end + object editPW: TEdit + Left = 16 + Top = 53 + Width = 161 + Height = 23 + ImeMode = imDisable + PasswordChar = '*' + TabOrder = 1 + Text = 'PW' + end + object btnLogin: TButton + Left = 183 + Top = 24 + Width = 75 + Height = 53 + Caption = #47196#44536#51064 + TabOrder = 2 + OnClick = btnLoginClick + end + end + object DBGrid1: TDBGrid + Left = 8 + Top = 120 + Width = 337 + Height = 120 + DataSource = DataSource1 + Options = [dgEditing, dgAlwaysShowEditor, dgTitles, dgIndicator, dgColumnResize, dgColLines, dgRowLines, dgTabs, dgConfirmDelete, dgCancelOnExit, dgTitleClick, dgTitleHotTrack] + TabOrder = 1 + TitleFont.Charset = DEFAULT_CHARSET + TitleFont.Color = clWindowText + TitleFont.Height = -12 + TitleFont.Name = 'Segoe UI' + TitleFont.Style = [] + end + object FDPhysMySQLDriverLink1: TFDPhysMySQLDriverLink + VendorLib = 'C:\Users\js22\Desktop\libmariadb.dll' + Left = 40 + Top = 280 + end + object FDQuery1: TFDQuery + Connection = FDConnection1 + Left = 120 + Top = 264 + end + object FDConnection1: TFDConnection + Params.Strings = ( + 'Database=parkinglot' + 'User_Name=root' + 'Password=root' + 'Server=127.0.0.1' + 'DriverID=MySQL') + Left = 192 + Top = 264 + end + object DataSource1: TDataSource + DataSet = FDQuery1 + Left = 264 + Top = 304 + end +end diff --git a/__history/Unit1.pas.~1~ b/__history/Unit1.pas.~1~ new file mode 100644 index 0000000..7e20dd2 --- /dev/null +++ b/__history/Unit1.pas.~1~ @@ -0,0 +1,82 @@ +unit Unit1; + +interface + +uses + Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, + Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Data.DB, FireDAC.Phys.MySQLDef, + FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Param, + FireDAC.Stan.Error, FireDAC.DatS, FireDAC.Phys.Intf, FireDAC.DApt.Intf, + FireDAC.Stan.Async, FireDAC.DApt, FireDAC.UI.Intf, FireDAC.Stan.Def, + FireDAC.Stan.Pool, FireDAC.Phys, FireDAC.Phys.MySQL, FireDAC.VCLUI.Wait, + FireDAC.Comp.Client, FireDAC.Comp.DataSet, Vcl.Grids, Vcl.DBGrids, + Vcl.StdCtrls; + +type + TForm1 = class(TForm) + GroupBox1: TGroupBox; + editID: TEdit; + editPW: TEdit; + btnLogin: TButton; + DBGrid1: TDBGrid; + FDPhysMySQLDriverLink1: TFDPhysMySQLDriverLink; + FDQuery1: TFDQuery; + FDConnection1: TFDConnection; + DataSource1: TDataSource; + procedure btnLoginClick(Sender: TObject); + private + { Private declarations } + public + { Public declarations } + end; + +var + Form1: TForm1; + +implementation + +uses unit2; +{$R *.dfm} + +procedure TForm1.btnLoginClick(Sender: TObject); +begin + try + begin + with FDConnection1 do begin + Params.Clear; + Params.Add('DriverID=MySQL'); + Params.Add('Server=127.0.0.1'); + Params.Add('Port=3306'); + Params.Add('Database=parkinglot'); + Params.Add('User_Name=root'); + Params.Add('Password=root'); + + Params.Add('CharacterSet=utf8'); + + Open; + end; + + with FDQuery1 do begin + SQL.Clear; + SQL.Add('select * from member'); + SQL.Add('where mbID ="' + Form1.editID.Text + '" and mbPW ="' + Form1.editPW.Text + '"'); + + open; + end; + + if editID.Text = dbGrid1.Fields[1].AsString then + showMessage('Login successful'); + form1.Hide; + if editPW.Text = dbGrid1.Fields[2].AsString then + form2.show + else + ShowMessage('Login failed'); + form1.Show; + end + except + ShowMessage('Login failed'); + end; +end; + + +end. diff --git a/__history/Unit1.pas.~2~ b/__history/Unit1.pas.~2~ new file mode 100644 index 0000000..873cad1 --- /dev/null +++ b/__history/Unit1.pas.~2~ @@ -0,0 +1,119 @@ +unit Unit1; + +interface + +uses + Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, + Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Data.DB, FireDAC.Phys.MySQLDef, + FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Param, + FireDAC.Stan.Error, FireDAC.DatS, FireDAC.Phys.Intf, FireDAC.DApt.Intf, + FireDAC.Stan.Async, FireDAC.DApt, FireDAC.UI.Intf, FireDAC.Stan.Def, + FireDAC.Stan.Pool, FireDAC.Phys, FireDAC.Phys.MySQL, FireDAC.VCLUI.Wait, + FireDAC.Comp.Client, FireDAC.Comp.DataSet, Vcl.Grids, Vcl.DBGrids, + Vcl.StdCtrls; + +type + TForm1 = class(TForm) + GroupBox1: TGroupBox; + editID: TEdit; + editPW: TEdit; + btnLogin: TButton; + DBGrid1: TDBGrid; + FDPhysMySQLDriverLink1: TFDPhysMySQLDriverLink; + FDQuery1: TFDQuery; + FDConnection1: TFDConnection; + DataSource1: TDataSource; + Button1: TButton; + procedure btnLoginClick(Sender: TObject); + procedure editIDonkeypress(Sender: TObject; var Key: Char); + procedure Button1Click(Sender: TObject); + private + { Private declarations } + public + { Public declarations } + end; + +var + Form1: TForm1; + +implementation + +uses unit2; +{$R *.dfm} + +procedure TForm1.btnLoginClick(Sender: TObject); +var +afterID1, afterID2, afterPW1, afterPW2 : string; + +begin +afterID1 := StringReplace(editID.Text, '=', '',[rfReplaceAll, rfIgnoreCase]); +afterID2 := StringReplace(afterID1, '-', '',[rfReplaceAll, rfIgnoreCase]); +afterPW1 := StringReplace(editID.Text, '=', '',[rfReplaceAll, rfIgnoreCase]); +afterPW2 := StringReplace(afterID1, '-', '',[rfReplaceAll, rfIgnoreCase]); + +editID.Text := afterID2; +editPW.Text := afterPW2; + + try + begin + with FDConnection1 do begin + Params.Clear; + Params.Add('DriverID=MySQL'); + Params.Add('Server=127.0.0.1'); + Params.Add('Port=3306'); + Params.Add('Database=parkinglot'); + Params.Add('User_Name=root'); + Params.Add('Password=root'); + + Params.Add('CharacterSet=utf8'); + + Open; + end; + with FDQuery1 do begin + SQL.Clear; + SQL.Add('select * from member'); + SQL.Add('where mbID =:ID and mbPW =:PW'); + Params.ParamByName('ID').AsString := editID.Text; + Params.ParamByName('PW').AsString := editPW.Text; + + + open; + end; + + if editID.Text = dbGrid1.Fields[1].AsString then + showMessage('Login successful'); + form1.Hide; + if editPW.Text = dbGrid1.Fields[2].AsString then + form2.show + else + ShowMessage('Login failed'); + form1.Show; + end + except + ShowMessage('Login failed'); + end; +end; + + + + +procedure TForm1.Button1Click(Sender: TObject); +var +afterID1, afterID2, afterPW1, afterPW2 : string; + +begin +afterID1 := StringReplace(editID.Text, '=', '',[rfReplaceAll, rfIgnoreCase]); +afterID2 := StringReplace(afterID1, '-', '',[rfReplaceAll, rfIgnoreCase]); +afterPW1 := StringReplace(editID.Text, '=', '',[rfReplaceAll, rfIgnoreCase]); +afterPW2 := StringReplace(afterID1, '-', '',[rfReplaceAll, rfIgnoreCase]); + +editID.Text := afterID2; +end; + +procedure TForm1.editIDonkeypress(Sender: TObject; var Key: Char); +begin +if key in [ '\','/',':','*','?','"','<','>','|','-','='] then + Key := #0; +end; + +end. diff --git a/__history/Unit1.pas.~3~ b/__history/Unit1.pas.~3~ new file mode 100644 index 0000000..e9d1895 --- /dev/null +++ b/__history/Unit1.pas.~3~ @@ -0,0 +1,116 @@ +unit Unit1; + +interface + +uses + Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, + Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Data.DB, FireDAC.Phys.MySQLDef, + FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Param, + FireDAC.Stan.Error, FireDAC.DatS, FireDAC.Phys.Intf, FireDAC.DApt.Intf, + FireDAC.Stan.Async, FireDAC.DApt, FireDAC.UI.Intf, FireDAC.Stan.Def, + FireDAC.Stan.Pool, FireDAC.Phys, FireDAC.Phys.MySQL, FireDAC.VCLUI.Wait, + FireDAC.Comp.Client, FireDAC.Comp.DataSet, Vcl.Grids, Vcl.DBGrids, + Vcl.StdCtrls; + +type + TForm1 = class(TForm) + GroupBox1: TGroupBox; + editID: TEdit; + editPW: TEdit; + btnLogin: TButton; + DBGrid1: TDBGrid; + FDPhysMySQLDriverLink1: TFDPhysMySQLDriverLink; + FDQuery1: TFDQuery; + FDConnection1: TFDConnection; + DataSource1: TDataSource; + procedure btnLoginClick(Sender: TObject); + procedure editIDonkeypress(Sender: TObject; var Key: Char); + procedure Button1Click(Sender: TObject); + private + { Private declarations } + public + { Public declarations } + end; + +var + Form1: TForm1; + +implementation + +uses unit2; +{$R *.dfm} + +procedure TForm1.btnLoginClick(Sender: TObject); +var +afterID1, afterID2, afterPW1, afterPW2 : string; + +begin +afterID1 := StringReplace(editID.Text, '=', '',[rfReplaceAll, rfIgnoreCase]); +afterID2 := StringReplace(afterID1, '-', '',[rfReplaceAll, rfIgnoreCase]); +afterPW1 := StringReplace(editPW.Text, '=', '',[rfReplaceAll, rfIgnoreCase]); +afterPW2 := StringReplace(afterPW1, '-', '',[rfReplaceAll, rfIgnoreCase]); + +editID.Text := afterID2; +editPW.Text := afterPW2; + + try + begin + with FDConnection1 do begin + Params.Clear; + Params.Add('DriverID=MySQL'); + Params.Add('Server=127.0.0.1'); + Params.Add('Port=3306'); + Params.Add('Database=parkinglot'); + Params.Add('User_Name=root'); + Params.Add('Password=root'); + + Params.Add('CharacterSet=utf8'); + + Open; + end; + with FDQuery1 do begin + SQL.Clear; + SQL.Add('select * from member'); + SQL.Add('where mbID =:ID and mbPW =:PW'); + Params.ParamByName('ID').AsString := editID.Text; + Params.ParamByName('PW').AsString := editPW.Text; + + + open; + end; + + if editID.Text = dbGrid1.Fields[1].AsString then + form1.Hide; + showMessage('Login successful'); + + if editPW.Text = dbGrid1.Fields[2].AsString then + form2.show + end + except + ShowMessage('Login failed'); + end; +end; + + + + +procedure TForm1.Button1Click(Sender: TObject); +var +afterID1, afterID2, afterPW1, afterPW2 : string; + +begin +afterID1 := StringReplace(editID.Text, '=', '',[rfReplaceAll, rfIgnoreCase]); +afterID2 := StringReplace(afterID1, '-', '',[rfReplaceAll, rfIgnoreCase]); +afterPW1 := StringReplace(editID.Text, '=', '',[rfReplaceAll, rfIgnoreCase]); +afterPW2 := StringReplace(afterID1, '-', '',[rfReplaceAll, rfIgnoreCase]); + +editID.Text := afterID2; +end; + +procedure TForm1.editIDonkeypress(Sender: TObject; var Key: Char); +begin +if key in [ '\','/',':','*','?','"','<','>','|','-','='] then + Key := #0; +end; + +end. diff --git a/__history/Unit1.pas.~4~ b/__history/Unit1.pas.~4~ new file mode 100644 index 0000000..35f99e7 --- /dev/null +++ b/__history/Unit1.pas.~4~ @@ -0,0 +1,121 @@ +unit Unit1; + +interface + +uses + Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, + Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Data.DB, FireDAC.Phys.MySQLDef, + FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Param, + FireDAC.Stan.Error, FireDAC.DatS, FireDAC.Phys.Intf, FireDAC.DApt.Intf, + FireDAC.Stan.Async, FireDAC.DApt, FireDAC.UI.Intf, FireDAC.Stan.Def, + FireDAC.Stan.Pool, FireDAC.Phys, FireDAC.Phys.MySQL, FireDAC.VCLUI.Wait, + FireDAC.Comp.Client, FireDAC.Comp.DataSet, Vcl.Grids, Vcl.DBGrids, + Vcl.StdCtrls; + +type + TForm1 = class(TForm) + GroupBox1: TGroupBox; + editID: TEdit; + editPW: TEdit; + btnLogin: TButton; + DBGrid1: TDBGrid; + FDPhysMySQLDriverLink1: TFDPhysMySQLDriverLink; + FDQuery1: TFDQuery; + FDConnection1: TFDConnection; + DataSource1: TDataSource; + procedure btnLoginClick(Sender: TObject); + procedure editIDonkeypress(Sender: TObject; var Key: Char); + procedure Button1Click(Sender: TObject); + private + { Private declarations } + public + { Public declarations } + end; + +var + Form1: TForm1; + +implementation + +uses unit2; +{$R *.dfm} + +procedure TForm1.btnLoginClick(Sender: TObject); +var +afterID1, afterID2, afterPW1, afterPW2 : string; + +begin +afterID1 := StringReplace(editID.Text, '=', '',[rfReplaceAll, rfIgnoreCase]); +afterID2 := StringReplace(afterID1, '-', '',[rfReplaceAll, rfIgnoreCase]); +afterPW1 := StringReplace(editPW.Text, '=', '',[rfReplaceAll, rfIgnoreCase]); +afterPW2 := StringReplace(afterPW1, '-', '',[rfReplaceAll, rfIgnoreCase]); + +editID.Text := afterID2; +editPW.Text := afterPW2; + + try + begin + with FDConnection1 do begin + Params.Clear; + Params.Add('DriverID=MySQL'); + Params.Add('Server=127.0.0.1'); + Params.Add('Port=3306'); + Params.Add('Database=parkinglot'); + Params.Add('User_Name=root'); + Params.Add('Password=root'); + + Params.Add('CharacterSet=utf8'); + + Open; + end; + with FDQuery1 do begin + SQL.Clear; + SQL.Add('select * from member'); + SQL.Add('where mbID =:ID and mbPW =:PW'); + Params.ParamByName('ID').AsString := afterID2; + Params.ParamByName('PW').AsString := afterPW2; + + + open; + end; + + if afterID2 = dbGrid1.Fields[1].AsString then + begin + if afterPW2 = dbGrid1.Fields[2].AsString then + begin + showMessage('Login successful'); + form1.Hide; + form2.show; + end + end + else + showmessage('Login Filed'); + end + except + ShowMessage('Login failed'); + end; +end; + + + + +procedure TForm1.Button1Click(Sender: TObject); +var +afterID1, afterID2, afterPW1, afterPW2 : string; + +begin +afterID1 := StringReplace(editID.Text, '=', '',[rfReplaceAll, rfIgnoreCase]); +afterID2 := StringReplace(afterID1, '-', '',[rfReplaceAll, rfIgnoreCase]); +afterPW1 := StringReplace(editID.Text, '=', '',[rfReplaceAll, rfIgnoreCase]); +afterPW2 := StringReplace(afterID1, '-', '',[rfReplaceAll, rfIgnoreCase]); + +editID.Text := afterID2; +end; + +procedure TForm1.editIDonkeypress(Sender: TObject; var Key: Char); +begin +if key in [ '\','/',':','*','?','"','<','>','|','-','='] then + Key := #0; +end; + +end. diff --git a/__history/Unit1.pas.~5~ b/__history/Unit1.pas.~5~ new file mode 100644 index 0000000..b4afa78 --- /dev/null +++ b/__history/Unit1.pas.~5~ @@ -0,0 +1,122 @@ +unit Unit1; + +interface + +uses + Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, + Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Data.DB, FireDAC.Phys.MySQLDef, + FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Param, + FireDAC.Stan.Error, FireDAC.DatS, FireDAC.Phys.Intf, FireDAC.DApt.Intf, + FireDAC.Stan.Async, FireDAC.DApt, FireDAC.UI.Intf, FireDAC.Stan.Def, + FireDAC.Stan.Pool, FireDAC.Phys, FireDAC.Phys.MySQL, FireDAC.VCLUI.Wait, + FireDAC.Comp.Client, FireDAC.Comp.DataSet, Vcl.Grids, Vcl.DBGrids, + Vcl.StdCtrls, system.Hash; + +type + TForm1 = class(TForm) + GroupBox1: TGroupBox; + editID: TEdit; + editPW: TEdit; + btnLogin: TButton; + DBGrid1: TDBGrid; + FDPhysMySQLDriverLink1: TFDPhysMySQLDriverLink; + FDQuery1: TFDQuery; + FDConnection1: TFDConnection; + DataSource1: TDataSource; + procedure btnLoginClick(Sender: TObject); + procedure editIDonkeypress(Sender: TObject; var Key: Char); + procedure Button1Click(Sender: TObject); + private + { Private declarations } + public + { Public declarations } + end; + +var + Form1: TForm1; + +implementation + +uses unit2; +{$R *.dfm} + +procedure TForm1.btnLoginClick(Sender: TObject); +var +afterID1, afterID2, afterPW1, afterPW2 : string; + +begin +afterID1 := StringReplace(editID.Text, '=', '',[rfReplaceAll, rfIgnoreCase]); +afterID2 := StringReplace(afterID1, '-', '',[rfReplaceAll, rfIgnoreCase]); +afterPW1 := StringReplace(editPW.Text, '=', '',[rfReplaceAll, rfIgnoreCase]); +afterPW2 := StringReplace(afterPW1, '-', '',[rfReplaceAll, rfIgnoreCase]); + +editID.Text := afterID2; +editPW.Text := afterPW2; + + + try + begin + with FDConnection1 do begin + Params.Clear; + Params.Add('DriverID=MySQL'); + Params.Add('Server=127.0.0.1'); + Params.Add('Port=3306'); + Params.Add('Database=parkinglot'); + Params.Add('User_Name=root'); + Params.Add('Password=root'); + + Params.Add('CharacterSet=utf8'); + + Open; + end; + with FDQuery1 do begin + SQL.Clear; + SQL.Add('select * from member'); + SQL.Add('where mbID =:ID and mbPW =:PW'); + Params.ParamByName('ID').AsString := afterID2; + Params.ParamByName('PW').AsString := afterPW2; + + + open; + end; + + if afterID2 = dbGrid1.Fields[1].AsString then + begin + if afterPW2 = dbGrid1.Fields[2].AsString then + begin + showMessage('Login successful'); + form1.Hide; + form2.show; + end + end + else + showmessage('Login Filed'); + end + except + ShowMessage('Login failed'); + end; +end; + + + + +procedure TForm1.Button1Click(Sender: TObject); +var +afterID1, afterID2, afterPW1, afterPW2 : string; + +begin +afterID1 := StringReplace(editID.Text, '=', '',[rfReplaceAll, rfIgnoreCase]); +afterID2 := StringReplace(afterID1, '-', '',[rfReplaceAll, rfIgnoreCase]); +afterPW1 := StringReplace(editID.Text, '=', '',[rfReplaceAll, rfIgnoreCase]); +afterPW2 := StringReplace(afterID1, '-', '',[rfReplaceAll, rfIgnoreCase]); + +editID.Text := afterID2; +end; + +procedure TForm1.editIDonkeypress(Sender: TObject; var Key: Char); +begin +if key in [ '\','/',':','*','?','"','<','>','|','-','='] then + Key := #0; +end; + +end. diff --git a/__history/Unit1.pas.~6~ b/__history/Unit1.pas.~6~ new file mode 100644 index 0000000..960742a --- /dev/null +++ b/__history/Unit1.pas.~6~ @@ -0,0 +1,115 @@ +unit Unit1; + +interface + +uses + Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, + Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Data.DB, FireDAC.Phys.MySQLDef, + FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Param, + FireDAC.Stan.Error, FireDAC.DatS, FireDAC.Phys.Intf, FireDAC.DApt.Intf, + FireDAC.Stan.Async, FireDAC.DApt, FireDAC.UI.Intf, FireDAC.Stan.Def, + FireDAC.Stan.Pool, FireDAC.Phys, FireDAC.Phys.MySQL, FireDAC.VCLUI.Wait, + FireDAC.Comp.Client, FireDAC.Comp.DataSet, Vcl.Grids, Vcl.DBGrids, + Vcl.StdCtrls, system.Hash; + +type + TForm1 = class(TForm) + GroupBox1: TGroupBox; + editID: TEdit; + editPW: TEdit; + btnLogin: TButton; + DBGrid1: TDBGrid; + FDPhysMySQLDriverLink1: TFDPhysMySQLDriverLink; + FDQuery1: TFDQuery; + FDConnection1: TFDConnection; + DataSource1: TDataSource; + procedure btnLoginClick(Sender: TObject); + procedure Button1Click(Sender: TObject); + private + { Private declarations } + public + { Public declarations } + end; + +var + Form1: TForm1; + +implementation + +uses unit2; +{$R *.dfm} + +procedure TForm1.btnLoginClick(Sender: TObject); +var +afterID1, afterID2, afterPW1, afterPW2 : string; + +begin +afterID1 := StringReplace(editID.Text, '=', '',[rfReplaceAll, rfIgnoreCase]); +afterID2 := StringReplace(afterID1, '-', '',[rfReplaceAll, rfIgnoreCase]); +afterPW1 := StringReplace(editPW.Text, '=', '',[rfReplaceAll, rfIgnoreCase]); +afterPW2 := StringReplace(afterPW1, '-', '',[rfReplaceAll, rfIgnoreCase]); + +editID.Text := afterID2; +editPW.Text := afterPW2; + + + try + begin + with FDConnection1 do begin + Params.Clear; + Params.Add('DriverID=MySQL'); + Params.Add('Server=127.0.0.1'); + Params.Add('Port=3306'); + Params.Add('Database=parkinglot'); + Params.Add('User_Name=root'); + Params.Add('Password=root'); + + Params.Add('CharacterSet=utf8'); + + Open; + end; + with FDQuery1 do begin + SQL.Clear; + SQL.Add('select * from member'); + SQL.Add('where mbID =:ID and mbPW =:PW'); + Params.ParamByName('ID').AsString := afterID2; + Params.ParamByName('PW').AsString := afterPW2; + + + open; + end; + + if afterID2 = dbGrid1.Fields[1].AsString then + begin + if afterPW2 = dbGrid1.Fields[2].AsString then + begin + showMessage('Login successful'); + form1.Hide; + form2.show; + end + end + else + showmessage('Login Filed'); + end + except + ShowMessage('Login failed'); + end; +end; + + + + +procedure TForm1.Button1Click(Sender: TObject); +var +afterID1, afterID2, afterPW1, afterPW2 : string; + +begin +afterID1 := StringReplace(editID.Text, '=', '',[rfReplaceAll, rfIgnoreCase]); +afterID2 := StringReplace(afterID1, '-', '',[rfReplaceAll, rfIgnoreCase]); +afterPW1 := StringReplace(editID.Text, '=', '',[rfReplaceAll, rfIgnoreCase]); +afterPW2 := StringReplace(afterID1, '-', '',[rfReplaceAll, rfIgnoreCase]); + +editID.Text := afterID2; +end; + +end. diff --git a/__history/Unit2.dfm.~1~ b/__history/Unit2.dfm.~1~ new file mode 100644 index 0000000..0255780 --- /dev/null +++ b/__history/Unit2.dfm.~1~ @@ -0,0 +1,14 @@ +object Form2: TForm2 + Left = 0 + Top = 0 + Caption = 'Form2' + ClientHeight = 441 + ClientWidth = 624 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -12 + Font.Name = 'Segoe UI' + Font.Style = [] + TextHeight = 15 +end diff --git a/__history/Unit2.dfm.~2~ b/__history/Unit2.dfm.~2~ new file mode 100644 index 0000000..e98f67b --- /dev/null +++ b/__history/Unit2.dfm.~2~ @@ -0,0 +1,15 @@ +object Form2: TForm2 + Left = 0 + Top = 0 + Caption = 'Form2' + ClientHeight = 441 + ClientWidth = 624 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -12 + Font.Name = 'Segoe UI' + Font.Style = [] + OnClose = FormClose + TextHeight = 15 +end diff --git a/__history/Unit2.dfm.~3~ b/__history/Unit2.dfm.~3~ new file mode 100644 index 0000000..350a75b --- /dev/null +++ b/__history/Unit2.dfm.~3~ @@ -0,0 +1,171 @@ +object Form2: TForm2 + Left = 551 + Top = 353 + Caption = 'Form2' + ClientHeight = 636 + ClientWidth = 760 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -12 + Font.Name = 'Segoe UI' + Font.Style = [] + Position = poDesigned + OnClose = FormClose + TextHeight = 15 + object DBGrid1: TDBGrid + Left = 215 + Top = 8 + Width = 530 + Height = 451 + DataSource = DataSource1 + Options = [dgEditing, dgAlwaysShowEditor, dgTitles, dgIndicator, dgColumnResize, dgColLines, dgRowLines, dgTabs, dgConfirmDelete, dgCancelOnExit, dgTitleClick, dgTitleHotTrack] + TabOrder = 0 + TitleFont.Charset = DEFAULT_CHARSET + TitleFont.Color = clWindowText + TitleFont.Height = -12 + TitleFont.Name = 'Segoe UI' + TitleFont.Style = [] + end + object 조회: TButton + Left = 8 + Top = 168 + Width = 201 + Height = 41 + Caption = #51312#54924 + TabOrder = 1 + OnClick = 조회Click + end + object GroupBox1: TGroupBox + Left = 8 + Top = 8 + Width = 201 + Height = 154 + Caption = #52264#47049#44288#47532 + TabOrder = 2 + object Label1: TLabel + Left = 14 + Top = 34 + Width = 48 + Height = 15 + Caption = #52264#47049#48264#54840 + end + object EditCarNum: TEdit + Left = 68 + Top = 31 + Width = 121 + Height = 23 + TabOrder = 0 + end + object Button1: TButton + Left = 11 + Top = 89 + Width = 178 + Height = 25 + Caption = #51077#52264 + TabOrder = 1 + OnClick = Button1Click + end + object Button2: TButton + Left = 11 + Top = 122 + Width = 178 + Height = 25 + Caption = #52636#52264 + TabOrder = 2 + end + object ComboBox1: TComboBox + Left = 14 + Top = 60 + Width = 175 + Height = 23 + TabOrder = 3 + Text = #51452#52264#51333#47448 + Items.Strings = ( + #51068#48152#51452#52264 + #51068#51068#51452#52264) + end + end + object Button3: TButton + Left = 8 + Top = 224 + Width = 201 + Height = 41 + Caption = #50641#49472#47196' '#45236#48372#45236#44592 + TabOrder = 3 + OnClick = 조회Click + end + object GroupBox2: TGroupBox + Left = 8 + Top = 271 + Width = 201 + Height = 186 + Caption = #44552#50529#49688#51221 + TabOrder = 4 + object Label2: TLabel + Left = 12 + Top = 20 + Width = 60 + Height = 15 + Caption = '10'#48516#45817#44032#44201 + end + object Label3: TLabel + Left = 12 + Top = 70 + Width = 69 + Height = 15 + Caption = '1'#51068' '#51452#52264#44032#44201 + end + object Label4: TLabel + Left = 68 + Top = 136 + Width = 34 + Height = 15 + Caption = 'Label4' + end + object Editminpay: TEdit + Left = 12 + Top = 41 + Width = 177 + Height = 23 + TabOrder = 0 + Text = '400' + end + object Editdaypay: TEdit + Left = 12 + Top = 91 + Width = 177 + Height = 23 + TabOrder = 1 + Text = '20000' + end + end + object DataSource1: TDataSource + DataSet = FDQuery1 + Left = 504 + Top = 192 + end + object FDQuery1: TFDQuery + Connection = FDConnection1 + SQL.Strings = ( + 'select * from ledger') + Left = 456 + Top = 192 + end + object FDPhysMySQLDriverLink1: TFDPhysMySQLDriverLink + VendorLib = 'C:\Users\js22\Desktop\libmariadb.dll' + Left = 456 + Top = 224 + end + object FDConnection1: TFDConnection + Params.Strings = ( + 'Database=parkinglot' + 'User_Name=root' + 'Password=root' + 'Server=127.0.0.1' + 'DriverID=MySQL') + Connected = True + Left = 504 + Top = 224 + end +end diff --git a/__history/Unit2.dfm.~4~ b/__history/Unit2.dfm.~4~ new file mode 100644 index 0000000..d29146f --- /dev/null +++ b/__history/Unit2.dfm.~4~ @@ -0,0 +1,185 @@ +object Form2: TForm2 + Left = 551 + Top = 353 + Caption = #51452#52264' '#52264#47049' '#44288#47532 + ClientHeight = 550 + ClientWidth = 747 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -12 + Font.Name = 'Segoe UI' + Font.Style = [] + Position = poDesigned + OnClose = FormClose + TextHeight = 15 + object lblKIND: TLabel + Left = 112 + Top = 480 + Width = 40 + Height = 15 + Caption = 'lblKIND' + end + object lblENDTIME: TLabel + Left = 175 + Top = 480 + Width = 34 + Height = 15 + Caption = 'Label4' + end + object lblSTARTTIME: TLabel + Left = 175 + Top = 496 + Width = 34 + Height = 15 + Caption = 'Label4' + end + object DBGrid1: TDBGrid + Left = 215 + Top = 8 + Width = 530 + Height = 451 + DataSource = DataSource1 + Options = [dgEditing, dgAlwaysShowEditor, dgTitles, dgIndicator, dgColumnResize, dgColLines, dgRowLines, dgTabs, dgConfirmDelete, dgCancelOnExit, dgTitleClick, dgTitleHotTrack] + TabOrder = 0 + TitleFont.Charset = DEFAULT_CHARSET + TitleFont.Color = clWindowText + TitleFont.Height = -12 + TitleFont.Name = 'Segoe UI' + TitleFont.Style = [] + end + object search: TButton + Left = 8 + Top = 168 + Width = 201 + Height = 41 + Caption = #51312#54924 + TabOrder = 1 + OnClick = searchClick + end + object GroupBox1: TGroupBox + Left = 8 + Top = 8 + Width = 201 + Height = 154 + Caption = #52264#47049#44288#47532 + TabOrder = 2 + object Label1: TLabel + Left = 14 + Top = 34 + Width = 48 + Height = 15 + Caption = #52264#47049#48264#54840 + end + object EditCarNum: TEdit + Left = 68 + Top = 31 + Width = 121 + Height = 23 + TabOrder = 0 + end + object Button1: TButton + Left = 11 + Top = 89 + Width = 178 + Height = 25 + Caption = #51077#52264 + TabOrder = 1 + OnClick = Button1Click + end + object Button2: TButton + Left = 11 + Top = 122 + Width = 178 + Height = 25 + Caption = #52636#52264 + TabOrder = 2 + OnClick = Button2Click + end + object ComboBox1: TComboBox + Left = 14 + Top = 60 + Width = 175 + Height = 23 + TabOrder = 3 + Text = #51452#52264#51333#47448 + Items.Strings = ( + #51068#48152#51452#52264 + #51068#51068#51452#52264) + end + end + object GroupBox2: TGroupBox + Left = 8 + Top = 271 + Width = 201 + Height = 186 + Caption = #44552#50529#49688#51221 + TabOrder = 3 + object Label2: TLabel + Left = 12 + Top = 20 + Width = 60 + Height = 15 + Caption = '10'#48516#45817#44032#44201 + end + object Label3: TLabel + Left = 12 + Top = 70 + Width = 69 + Height = 15 + Caption = '1'#51068' '#51452#52264#44032#44201 + end + object Editminpay: TEdit + Left = 11 + Top = 41 + Width = 177 + Height = 23 + TabOrder = 0 + Text = '400' + end + object Editdaypay: TEdit + Left = 12 + Top = 91 + Width = 177 + Height = 23 + TabOrder = 1 + Text = '20000' + end + end + object Edit1: TEdit + Left = 175 + Top = 519 + Width = 121 + Height = 23 + TabOrder = 4 + Text = 'Edit1' + end + object DataSource1: TDataSource + DataSet = FDQuery1 + Left = 504 + Top = 192 + end + object FDQuery1: TFDQuery + Connection = FDConnection1 + SQL.Strings = ( + 'select * from ledger') + Left = 456 + Top = 192 + end + object FDPhysMySQLDriverLink1: TFDPhysMySQLDriverLink + VendorLib = 'C:\Users\js22\Desktop\libmariadb.dll' + Left = 456 + Top = 224 + end + object FDConnection1: TFDConnection + Params.Strings = ( + 'Database=parkinglot' + 'User_Name=root' + 'Password=root' + 'Server=127.0.0.1' + 'DriverID=MySQL') + Connected = True + Left = 504 + Top = 224 + end +end diff --git a/__history/Unit2.dfm.~5~ b/__history/Unit2.dfm.~5~ new file mode 100644 index 0000000..e38e367 --- /dev/null +++ b/__history/Unit2.dfm.~5~ @@ -0,0 +1,193 @@ +object Form2: TForm2 + Left = 551 + Top = 353 + Caption = #51452#52264' '#52264#47049' '#44288#47532 + ClientHeight = 565 + ClientWidth = 789 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -12 + Font.Name = 'Segoe UI' + Font.Style = [] + Position = poDesigned + OnClose = FormClose + TextHeight = 15 + object lblKIND: TLabel + Left = 112 + Top = 480 + Width = 40 + Height = 15 + Caption = 'lblKIND' + end + object lblENDTIME: TLabel + Left = 175 + Top = 480 + Width = 34 + Height = 15 + Caption = 'Label4' + end + object lblSTARTTIME: TLabel + Left = 175 + Top = 496 + Width = 34 + Height = 15 + Caption = 'Label4' + end + object DBGrid1: TDBGrid + Left = 215 + Top = 8 + Width = 566 + Height = 451 + DataSource = DataSource1 + Options = [dgEditing, dgAlwaysShowEditor, dgTitles, dgIndicator, dgColumnResize, dgColLines, dgRowLines, dgTabs, dgConfirmDelete, dgCancelOnExit, dgTitleClick, dgTitleHotTrack] + TabOrder = 0 + TitleFont.Charset = DEFAULT_CHARSET + TitleFont.Color = clWindowText + TitleFont.Height = -12 + TitleFont.Name = 'Segoe UI' + TitleFont.Style = [] + end + object search: TButton + Left = 8 + Top = 168 + Width = 201 + Height = 41 + Caption = #51312#54924 + TabOrder = 1 + OnClick = searchClick + end + object GroupBox1: TGroupBox + Left = 8 + Top = 8 + Width = 201 + Height = 154 + Caption = #52264#47049#44288#47532 + TabOrder = 2 + object Label1: TLabel + Left = 14 + Top = 34 + Width = 48 + Height = 15 + Caption = #52264#47049#48264#54840 + end + object EditCarNum: TEdit + Left = 68 + Top = 31 + Width = 121 + Height = 23 + TabOrder = 0 + end + object Button1: TButton + Left = 11 + Top = 89 + Width = 178 + Height = 25 + Caption = #51077#52264 + TabOrder = 1 + OnClick = Button1Click + end + object Button2: TButton + Left = 11 + Top = 122 + Width = 178 + Height = 25 + Caption = #52636#52264 + TabOrder = 2 + OnClick = Button2Click + end + object ComboBox1: TComboBox + Left = 14 + Top = 60 + Width = 175 + Height = 23 + TabOrder = 3 + Text = #51452#52264#51333#47448 + Items.Strings = ( + #51068#48152#51452#52264 + #51068#51068#51452#52264) + end + end + object GroupBox2: TGroupBox + Left = 8 + Top = 271 + Width = 201 + Height = 186 + Caption = #44552#50529#49688#51221 + TabOrder = 3 + object Label2: TLabel + Left = 12 + Top = 20 + Width = 60 + Height = 15 + Caption = '10'#48516#45817#44032#44201 + end + object Label3: TLabel + Left = 12 + Top = 70 + Width = 69 + Height = 15 + Caption = '1'#51068' '#51452#52264#44032#44201 + end + object Editminpay: TEdit + Left = 11 + Top = 41 + Width = 177 + Height = 23 + TabOrder = 0 + Text = '400' + end + object Editdaypay: TEdit + Left = 12 + Top = 91 + Width = 177 + Height = 23 + TabOrder = 1 + Text = '20000' + end + end + object Edit1: TEdit + Left = 175 + Top = 519 + Width = 121 + Height = 23 + TabOrder = 4 + Text = 'Edit1' + end + object StartT: TEdit + Left = 432 + Top = 519 + Width = 121 + Height = 23 + TabOrder = 5 + Text = 'date_format(NOW(), '#39'%Y-%m-%d %T'#39' )' + end + object DataSource1: TDataSource + DataSet = FDQuery1 + Left = 504 + Top = 192 + end + object FDQuery1: TFDQuery + Connection = FDConnection1 + SQL.Strings = ( + 'select * from ledger') + Left = 456 + Top = 192 + end + object FDPhysMySQLDriverLink1: TFDPhysMySQLDriverLink + VendorLib = 'C:\Users\js22\Desktop\libmariadb.dll' + Left = 456 + Top = 224 + end + object FDConnection1: TFDConnection + Params.Strings = ( + 'Database=parkinglot' + 'User_Name=root' + 'Password=root' + 'Server=127.0.0.1' + 'DriverID=MySQL') + Connected = True + Left = 504 + Top = 224 + end +end diff --git a/__history/Unit2.dfm.~6~ b/__history/Unit2.dfm.~6~ new file mode 100644 index 0000000..9e4c773 --- /dev/null +++ b/__history/Unit2.dfm.~6~ @@ -0,0 +1,193 @@ +object Form2: TForm2 + Left = 551 + Top = 353 + Caption = #51452#52264' '#52264#47049' '#44288#47532 + ClientHeight = 465 + ClientWidth = 876 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -12 + Font.Name = 'Segoe UI' + Font.Style = [] + Position = poDesigned + OnClose = FormClose + TextHeight = 15 + object lblKIND: TLabel + Left = 112 + Top = 480 + Width = 40 + Height = 15 + Caption = 'lblKIND' + end + object lblENDTIME: TLabel + Left = 175 + Top = 480 + Width = 34 + Height = 15 + Caption = 'Label4' + end + object lblSTARTTIME: TLabel + Left = 175 + Top = 496 + Width = 34 + Height = 15 + Caption = 'Label4' + end + object DBGrid1: TDBGrid + Left = 215 + Top = 8 + Width = 658 + Height = 451 + DataSource = DataSource1 + Options = [dgEditing, dgAlwaysShowEditor, dgTitles, dgIndicator, dgColumnResize, dgColLines, dgRowLines, dgTabs, dgConfirmDelete, dgCancelOnExit, dgTitleClick, dgTitleHotTrack] + TabOrder = 0 + TitleFont.Charset = DEFAULT_CHARSET + TitleFont.Color = clWindowText + TitleFont.Height = -12 + TitleFont.Name = 'Segoe UI' + TitleFont.Style = [] + end + object search: TButton + Left = 8 + Top = 168 + Width = 201 + Height = 41 + Caption = #51312#54924 + TabOrder = 1 + OnClick = searchClick + end + object GroupBox1: TGroupBox + Left = 8 + Top = 8 + Width = 201 + Height = 154 + Caption = #52264#47049#44288#47532 + TabOrder = 2 + object Label1: TLabel + Left = 14 + Top = 34 + Width = 48 + Height = 15 + Caption = #52264#47049#48264#54840 + end + object EditCarNum: TEdit + Left = 68 + Top = 31 + Width = 121 + Height = 23 + TabOrder = 0 + end + object Button1: TButton + Left = 11 + Top = 89 + Width = 178 + Height = 25 + Caption = #51077#52264 + TabOrder = 1 + OnClick = Button1Click + end + object Button2: TButton + Left = 11 + Top = 122 + Width = 178 + Height = 25 + Caption = #52636#52264 + TabOrder = 2 + OnClick = Button2Click + end + object ComboBox1: TComboBox + Left = 14 + Top = 60 + Width = 175 + Height = 23 + TabOrder = 3 + Text = #51452#52264#51333#47448 + Items.Strings = ( + #51068#48152#51452#52264 + #51068#51068#51452#52264) + end + end + object GroupBox2: TGroupBox + Left = 8 + Top = 271 + Width = 201 + Height = 186 + Caption = #44552#50529#49688#51221 + TabOrder = 3 + object Label2: TLabel + Left = 12 + Top = 20 + Width = 60 + Height = 15 + Caption = '10'#48516#45817#44032#44201 + end + object Label3: TLabel + Left = 12 + Top = 70 + Width = 69 + Height = 15 + Caption = '1'#51068' '#51452#52264#44032#44201 + end + object Editminpay: TEdit + Left = 11 + Top = 41 + Width = 177 + Height = 23 + TabOrder = 0 + Text = '400' + end + object Editdaypay: TEdit + Left = 12 + Top = 91 + Width = 177 + Height = 23 + TabOrder = 1 + Text = '20000' + end + end + object Edit1: TEdit + Left = 175 + Top = 519 + Width = 121 + Height = 23 + TabOrder = 4 + Text = 'Edit1' + end + object StartT: TEdit + Left = 432 + Top = 519 + Width = 121 + Height = 23 + TabOrder = 5 + Text = 'date_format(NOW(), '#39'%Y-%m-%d %T'#39' )' + end + object DataSource1: TDataSource + DataSet = FDQuery1 + Left = 504 + Top = 192 + end + object FDQuery1: TFDQuery + Connection = FDConnection1 + SQL.Strings = ( + 'select * from ledger') + Left = 456 + Top = 192 + end + object FDPhysMySQLDriverLink1: TFDPhysMySQLDriverLink + VendorLib = 'C:\Users\js22\Desktop\libmariadb.dll' + Left = 456 + Top = 224 + end + object FDConnection1: TFDConnection + Params.Strings = ( + 'Database=parkinglot' + 'User_Name=root' + 'Password=root' + 'Server=127.0.0.1' + 'DriverID=MySQL') + Connected = True + Left = 504 + Top = 224 + end +end diff --git a/__history/Unit2.dfm.~7~ b/__history/Unit2.dfm.~7~ new file mode 100644 index 0000000..c2fe1c9 --- /dev/null +++ b/__history/Unit2.dfm.~7~ @@ -0,0 +1,178 @@ +object Form2: TForm2 + Left = 551 + Top = 353 + Caption = #51452#52264' '#52264#47049' '#44288#47532 + ClientHeight = 523 + ClientWidth = 876 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -12 + Font.Name = 'Segoe UI' + Font.Style = [] + Position = poDesigned + OnClose = FormClose + TextHeight = 15 + object lblKIND: TLabel + Left = 112 + Top = 480 + Width = 40 + Height = 15 + Caption = 'lblKIND' + end + object DBGrid1: TDBGrid + Left = 214 + Top = 8 + Width = 658 + Height = 451 + DataSource = DataSource1 + Options = [dgEditing, dgAlwaysShowEditor, dgTitles, dgIndicator, dgColumnResize, dgColLines, dgRowLines, dgTabs, dgConfirmDelete, dgCancelOnExit, dgTitleClick, dgTitleHotTrack] + TabOrder = 0 + TitleFont.Charset = DEFAULT_CHARSET + TitleFont.Color = clWindowText + TitleFont.Height = -12 + TitleFont.Name = 'Segoe UI' + TitleFont.Style = [] + end + object search: TButton + Left = 8 + Top = 175 + Width = 201 + Height = 41 + Caption = #51312#54924 + TabOrder = 1 + OnClick = searchClick + end + object GroupBox1: TGroupBox + Left = 8 + Top = 8 + Width = 201 + Height = 161 + Caption = #52264#47049#44288#47532 + TabOrder = 2 + object Label1: TLabel + Left = 14 + Top = 34 + Width = 48 + Height = 15 + Caption = #52264#47049#48264#54840 + end + object EditCarNum: TEdit + Left = 68 + Top = 31 + Width = 121 + Height = 23 + TabOrder = 0 + end + object Button1: TButton + Left = 11 + Top = 89 + Width = 178 + Height = 25 + Caption = #51077#52264 + TabOrder = 1 + OnClick = Button1Click + end + object Button2: TButton + Left = 11 + Top = 121 + Width = 178 + Height = 25 + Caption = #52636#52264 + TabOrder = 2 + OnClick = Button2Click + end + object ComboBox1: TComboBox + Left = 14 + Top = 60 + Width = 175 + Height = 23 + TabOrder = 3 + Text = #51452#52264#51333#47448 + Items.Strings = ( + #51068#48152#51452#52264 + #51068#51068#51452#52264) + end + end + object GroupBox2: TGroupBox + Left = 8 + Top = 271 + Width = 201 + Height = 186 + Caption = #44552#50529#49688#51221 + TabOrder = 3 + object Label2: TLabel + Left = 12 + Top = 20 + Width = 60 + Height = 15 + Caption = '10'#48516#45817#44032#44201 + end + object Label3: TLabel + Left = 12 + Top = 114 + Width = 69 + Height = 15 + Caption = '1'#51068' '#51452#52264#44032#44201 + end + object Label4: TLabel + Left = 11 + Top = 70 + Width = 96 + Height = 15 + Caption = #51068#48152#51452#52264#44592#48376#44552#50529 + end + object Editminpay: TEdit + Left = 11 + Top = 41 + Width = 177 + Height = 23 + TabOrder = 0 + Text = '400' + end + object Editdaypay: TEdit + Left = 12 + Top = 131 + Width = 177 + Height = 23 + TabOrder = 1 + Text = '20000' + end + object normalpay: TEdit + Left = 11 + Top = 86 + Width = 177 + Height = 23 + TabOrder = 2 + Text = '3000' + end + end + object DataSource1: TDataSource + DataSet = FDQuery1 + Left = 504 + Top = 192 + end + object FDQuery1: TFDQuery + Connection = FDConnection1 + SQL.Strings = ( + 'select * from ledger') + Left = 456 + Top = 192 + end + object FDPhysMySQLDriverLink1: TFDPhysMySQLDriverLink + VendorLib = 'C:\Users\js22\Desktop\libmariadb.dll' + Left = 456 + Top = 224 + end + object FDConnection1: TFDConnection + Params.Strings = ( + 'Database=parkinglot' + 'User_Name=root' + 'Password=root' + 'Server=127.0.0.1' + 'DriverID=MySQL') + Connected = True + Left = 504 + Top = 224 + end +end diff --git a/__history/Unit2.pas.~1~ b/__history/Unit2.pas.~1~ new file mode 100644 index 0000000..1b4a8db --- /dev/null +++ b/__history/Unit2.pas.~1~ @@ -0,0 +1,24 @@ +unit Unit2; + +interface + +uses + Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, + Vcl.Controls, Vcl.Forms, Vcl.Dialogs; + +type + TForm2 = class(TForm) + private + { Private declarations } + public + { Public declarations } + end; + +var + Form2: TForm2; + +implementation + +{$R *.dfm} + +end. diff --git a/__history/Unit2.pas.~2~ b/__history/Unit2.pas.~2~ new file mode 100644 index 0000000..006167c --- /dev/null +++ b/__history/Unit2.pas.~2~ @@ -0,0 +1,31 @@ +unit Unit2; + +interface + +uses + Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, + Vcl.Controls, Vcl.Forms, Vcl.Dialogs; + +type + TForm2 = class(TForm) + procedure FormClose(Sender: TObject; var Action: TCloseAction); + private + { Private declarations } + public + { Public declarations } + end; + +var + Form2: TForm2; + +implementation + +{$R *.dfm} +uses unit1; + +procedure TForm2.FormClose(Sender: TObject; var Action: TCloseAction); +begin +form1.close; +end; + +end. diff --git a/__history/Unit2.pas.~3~ b/__history/Unit2.pas.~3~ new file mode 100644 index 0000000..799dc65 --- /dev/null +++ b/__history/Unit2.pas.~3~ @@ -0,0 +1,136 @@ +unit Unit2; + +interface + +uses + Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, + Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Data.DB, Data.SqlExpr, Vcl.Grids, + Vcl.DBGrids, FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Param, + FireDAC.Stan.Error, FireDAC.DatS, FireDAC.Phys.Intf, FireDAC.DApt.Intf, + FireDAC.Stan.Async, FireDAC.DApt, FireDAC.Comp.DataSet, FireDAC.Comp.Client, + FireDAC.Phys.MySQLDef, FireDAC.Phys, FireDAC.Phys.MySQL, FireDAC.UI.Intf, + FireDAC.Stan.Def, FireDAC.Stan.Pool, FireDAC.VCLUI.Wait, Vcl.StdCtrls; + +type + TForm2 = class(TForm) + DBGrid1: TDBGrid; + DataSource1: TDataSource; + FDQuery1: TFDQuery; + FDPhysMySQLDriverLink1: TFDPhysMySQLDriverLink; + FDConnection1: TFDConnection; + ȸ: TButton; + GroupBox1: TGroupBox; + Label1: TLabel; + EditCarNum: TEdit; + Button1: TButton; + Button2: TButton; + Button3: TButton; + GroupBox2: TGroupBox; + Label2: TLabel; + Editminpay: TEdit; + Label3: TLabel; + Editdaypay: TEdit; + ComboBox1: TComboBox; + Label4: TLabel; + procedure FormClose(Sender: TObject; var Action: TCloseAction); + procedure ȸClick(Sender: TObject); + procedure Button1Click(Sender: TObject); + private + { Private declarations } + public + { Public declarations } + end; + +var + Form2: TForm2; + +implementation + +{$R *.dfm} +uses unit1; + +procedure TForm2.ȸClick(Sender: TObject); +begin + try + begin + with FDConnection1 do begin + Params.Clear; + Params.Add('DriverID=MySQL'); + Params.Add('Server=127.0.0.1'); + Params.Add('Port=3306'); + Params.Add('Database=parkinglot'); + Params.Add('User_Name=root'); + Params.Add('Password=root'); + + Params.Add('CharacterSet=utf8'); + + Open; + end; + with FDQuery1 do begin + SQL.Clear; + SQL.Add('select * from ledger'); + open; + end; +end; + finally + + + end; + end; + +procedure TForm2.Button1Click(Sender: TObject); +var +parking, editCar:string; +minpay, daypay: integer; + +begin +parking := ComboBox1.Text; +editCar := EditCarNum.Text; + + +if parking = 'Ϲ' then +begin +try + +with FDConnection1 do begin + Params.Clear; + Params.Add('DriverID=MySQL'); + Params.Add('Server=127.0.0.1'); + Params.Add('Port=3306'); + Params.Add('Database=parkinglot'); + Params.Add('User_Name=root'); + Params.Add('Password=root'); + + Params.Add('CharacterSet=utf8'); + + Open; + end; + with FDQuery1 do begin + SQL.Clear; + SQL.Add('INSERT INTO ledger(carnum,startTIME,kind,pay)'); + SQL.Add('VALUE(:carN, :StartT, :kind, :pay)'); + Params.ParamByName('carN').AsString := editCar; + Params.ParamByName('StartT').AsString := formatDateTime('yyyy-mm-dd hh:mm:ss', now); + Params.ParamByName('kind').AsString := parking; + Params.ParamByName('pay').AsString := '3000'; + execsql; + showMessage('߰Ϸ'); + SQL.Clear; + SQL.Add('select * from ledger'); + open; + end; +finally + +end; + + +end; + +end; + +procedure TForm2.FormClose(Sender: TObject; var Action: TCloseAction); +begin +form1.close; +end; + +end. diff --git a/__history/Unit2.pas.~4~ b/__history/Unit2.pas.~4~ new file mode 100644 index 0000000..a6184b4 --- /dev/null +++ b/__history/Unit2.pas.~4~ @@ -0,0 +1,132 @@ +unit Unit2; + +interface + +uses + Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, + Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Data.DB, Data.SqlExpr, Vcl.Grids, + Vcl.DBGrids, FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Param, + FireDAC.Stan.Error, FireDAC.DatS, FireDAC.Phys.Intf, FireDAC.DApt.Intf, + FireDAC.Stan.Async, FireDAC.DApt, FireDAC.Comp.DataSet, FireDAC.Comp.Client, + FireDAC.Phys.MySQLDef, FireDAC.Phys, FireDAC.Phys.MySQL, FireDAC.UI.Intf, + FireDAC.Stan.Def, FireDAC.Stan.Pool, FireDAC.VCLUI.Wait, Vcl.StdCtrls; + +type + TForm2 = class(TForm) + DBGrid1: TDBGrid; + DataSource1: TDataSource; + FDQuery1: TFDQuery; + FDPhysMySQLDriverLink1: TFDPhysMySQLDriverLink; + FDConnection1: TFDConnection; + 조회: TButton; + GroupBox1: TGroupBox; + Label1: TLabel; + EditCarNum: TEdit; + Button1: TButton; + Button2: TButton; + Button3: TButton; + GroupBox2: TGroupBox; + Label2: TLabel; + Editminpay: TEdit; + Label3: TLabel; + Editdaypay: TEdit; + ComboBox1: TComboBox; + Label4: TLabel; + procedure FormClose(Sender: TObject; var Action: TCloseAction); + procedure 조회Click(Sender: TObject); + procedure Button1Click(Sender: TObject); + private + { Private declarations } + public + { Public declarations } + end; + +var + Form2: TForm2; + +implementation + +{$R *.dfm} +uses unit1; + +procedure TForm2.조회Click(Sender: TObject); +begin + try + begin + with FDConnection1 do begin + Params.Clear; + Params.Add('DriverID=MySQL'); + Params.Add('Server=127.0.0.1'); + Params.Add('Port=3306'); + Params.Add('Database=parkinglot'); + Params.Add('User_Name=root'); + Params.Add('Password=root'); + + Params.Add('CharacterSet=utf8'); + + Open; + end; + with FDQuery1 do begin + SQL.Clear; + SQL.Add('select * from ledger'); + open; + end; +end; + finally + + + end; + end; + +procedure TForm2.Button1Click(Sender: TObject); +var +minpay, daypay: integer; + +begin + +if ComboBox1.Text = '일반주차' then +begin +try + +with FDConnection1 do begin + Params.Clear; + Params.Add('DriverID=MySQL'); + Params.Add('Server=127.0.0.1'); + Params.Add('Port=3306'); + Params.Add('Database=parkinglot'); + Params.Add('User_Name=root'); + Params.Add('Password=root'); + + Params.Add('CharacterSet=utf8'); + + Open; + end; + with FDQuery1 do begin + SQL.Clear; + SQL.Add('INSERT INTO ledger(carnum,startTIME,kind,pay)'); + SQL.Add('VALUE(:carN, :StartT, :kind, :pay)'); + Params.ParamByName('carN').AsString := EditCarNum.Text; + Params.ParamByName('StartT').AsString := formatDateTime('yyyy-mm-dd hh:mm:ss', now); + Params.ParamByName('kind').AsString := ComboBox1.Text; + Params.ParamByName('pay').AsString := '3000'; + execsql; + showMessage('추가완료'); + SQL.Clear; + SQL.Add('select * from ledger'); + open; + end; +finally + +end; + + +end; + +end; + +procedure TForm2.FormClose(Sender: TObject; var Action: TCloseAction); +begin +form1.close; +end; + +end. diff --git a/__history/Unit2.pas.~5~ b/__history/Unit2.pas.~5~ new file mode 100644 index 0000000..3c645f4 --- /dev/null +++ b/__history/Unit2.pas.~5~ @@ -0,0 +1,222 @@ +unit Unit2; + +interface + +uses + Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, + Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Data.DB, Data.SqlExpr, Vcl.Grids, + Vcl.DBGrids, FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Param, + FireDAC.Stan.Error, FireDAC.DatS, FireDAC.Phys.Intf, FireDAC.DApt.Intf, + FireDAC.Stan.Async, FireDAC.DApt, FireDAC.Comp.DataSet, FireDAC.Comp.Client, + FireDAC.Phys.MySQLDef, FireDAC.Phys, FireDAC.Phys.MySQL, FireDAC.UI.Intf, + FireDAC.Stan.Def, FireDAC.Stan.Pool, FireDAC.VCLUI.Wait, Vcl.StdCtrls, + Vcl.Mask, Vcl.ExtCtrls, Vcl.DBCtrls; + +type + TForm2 = class(TForm) + DBGrid1: TDBGrid; + DataSource1: TDataSource; + FDQuery1: TFDQuery; + FDPhysMySQLDriverLink1: TFDPhysMySQLDriverLink; + FDConnection1: TFDConnection; + search: TButton; + GroupBox1: TGroupBox; + Label1: TLabel; + EditCarNum: TEdit; + Button1: TButton; + Button2: TButton; + GroupBox2: TGroupBox; + Label2: TLabel; + Editminpay: TEdit; + Label3: TLabel; + Editdaypay: TEdit; + ComboBox1: TComboBox; + lblKIND: TLabel; + lblENDTIME: TLabel; + lblSTARTTIME: TLabel; + Edit1: TEdit; + procedure FormClose(Sender: TObject; var Action: TCloseAction); + procedure searchClick(Sender: TObject); + procedure Button1Click(Sender: TObject); + procedure Button2Click(Sender: TObject); + private + { Private declarations } + public + { Public declarations } + end; + +var + Form2: TForm2; + +implementation + +{$R *.dfm} +uses unit1; + +procedure TForm2.searchClick(Sender: TObject); +begin + try + begin + with FDConnection1 do begin + Params.Clear; + Params.Add('DriverID=MySQL'); + Params.Add('Server=127.0.0.1'); + Params.Add('Port=3306'); + Params.Add('Database=parkinglot'); + Params.Add('User_Name=root'); + Params.Add('Password=root'); + + Params.Add('CharacterSet=utf8'); + + Open; + end; + with FDQuery1 do begin + SQL.Clear; + SQL.Add('select * from ledger'); + open; + end; +end; + finally + + + end; + end; + +procedure TForm2.Button1Click(Sender: TObject); + +begin + + if ComboBox1.Text = '일반주차' then + begin + try + + with FDConnection1 do begin + Params.Clear; + Params.Add('DriverID=MySQL'); + Params.Add('Server=127.0.0.1'); + Params.Add('Port=3306'); + Params.Add('Database=parkinglot'); + Params.Add('User_Name=root'); + Params.Add('Password=root'); + Params.Add('CharacterSet=utf8'); + Open; + end; + with FDQuery1 do begin + SQL.Clear; + SQL.Add('INSERT INTO ledger(carnum,startTIME,kind,pay)'); + SQL.Add('VALUE(:carN,:StartT,:kind,:pay);'); + Params.ParamByName('carN').AsString := EditCarNum.Text; + Params.ParamByName('StartT').AsString := formatDateTime('yyyy-mm-dd hh:mm:ss', now); + Params.ParamByName('kind').AsString := ComboBox1.Text; + Params.ParamByName('pay').AsString := '3000'; + execsql; + showMessage('추가완료'); + SQL.Clear; + SQL.Add('select * from ledger'); + open; + end; + finally + + + + end; + end; + + if ComboBox1.Text = '일일주차' then + begin + try + + with FDConnection1 do begin + Params.Clear; + Params.Add('DriverID=MySQL'); + Params.Add('Server=127.0.0.1'); + Params.Add('Port=3306'); + Params.Add('Database=parkinglot'); + Params.Add('User_Name=root'); + Params.Add('Password=root'); + Params.Add('CharacterSet=utf8'); + Open; + end; + with FDQuery1 do begin + SQL.Clear; + SQL.Add('INSERT INTO ledger(carnum,startTIME,endTIME,kind,pay)'); + SQL.Add('VALUE(:carN,:StartT,:EndT,:kind,:pay);'); + Params.ParamByName('carN').AsString := EditCarNum.Text; + Params.ParamByName('StartT').AsString := formatDateTime('yyyy-mm-dd hh:mm:ss', now); + Params.ParamByName('EndT').AsString := formatDateTime('yyyy-mm-dd hh:mm:ss', now+ 1); + Params.ParamByName('kind').AsString := ComboBox1.Text; + Params.ParamByName('pay').AsString := '20000'; + execsql; + showMessage('추가완료'); + SQL.Clear; + SQL.Add('select * from ledger'); + open; + end; + finally + + + + end; + end; + + end; + +procedure TForm2.Button2Click(Sender: TObject); +var +startend:string; +start1,end1:string; +begin + try + + with FDConnection1 do begin + Params.Clear; + Params.Add('DriverID=MySQL'); + Params.Add('Server=127.0.0.1'); + Params.Add('Port=3306'); + Params.Add('Database=parkinglot'); + Params.Add('User_Name=root'); + Params.Add('Password=root'); + Params.Add('CharacterSet=utf8'); + Open; + end; + with FDQuery1 do begin + SQL.Clear; + SQL.Add('select * from ledger'); + SQL.Add('where carnum =:carN;'); + Params.ParamByName('carN').AsString := EditCarNum.text; + + open; + end; + //일반주차계산식 + lblKIND.Caption := dbGrid1.Fields[4].AsString; + if lblKIND.Caption = '일반주차' then + begin + lblENDTIME.Caption := formatDateTime('yyyy-mm-dd hh:mm:ss', now); + lblSTARTTIME.Caption := dbGrid1.Fields[2].AsString; + end1 := lblENDTIME.Caption; //변수에 endTIME 넣기 + start1 := lblSTARTTIME.Caption; //변수에 STARTIME 넣기 + //변수에 ENDTIME - STARTTIME 결과값넣은후 일 또는 시간까지 모두 분으로 바꾸어 10분으로 나눈다 + //나눈값 * editMinPay.Text 값을 넣고 기존데이터 + 변수값을한후 메세지박스또는 라벨에 넣어준다 + + //일일주차 계산식 + + {1.endTIME 값 불러오기 + 2.endTIME 값보다 nowTIME 값이 낮을경우 기존pay데이터만 출력 + 3.nowTIME 값이 더 많은경우 오바된값을 분당으로 바꾸어 10분당가격을 추가해서 보여준다.} + + + end; + + finally + + + end; +end; + + +procedure TForm2.FormClose(Sender: TObject; var Action: TCloseAction); +begin +form1.close; +end; + +end. diff --git a/__history/Unit2.pas.~6~ b/__history/Unit2.pas.~6~ new file mode 100644 index 0000000..923ee25 --- /dev/null +++ b/__history/Unit2.pas.~6~ @@ -0,0 +1,223 @@ +unit Unit2; + +interface + +uses + Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, + Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Data.DB, Data.SqlExpr, Vcl.Grids, + Vcl.DBGrids, FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Param, + FireDAC.Stan.Error, FireDAC.DatS, FireDAC.Phys.Intf, FireDAC.DApt.Intf, + FireDAC.Stan.Async, FireDAC.DApt, FireDAC.Comp.DataSet, FireDAC.Comp.Client, + FireDAC.Phys.MySQLDef, FireDAC.Phys, FireDAC.Phys.MySQL, FireDAC.UI.Intf, + FireDAC.Stan.Def, FireDAC.Stan.Pool, FireDAC.VCLUI.Wait, Vcl.StdCtrls, + Vcl.Mask, Vcl.ExtCtrls, Vcl.DBCtrls; + +type + TForm2 = class(TForm) + DBGrid1: TDBGrid; + DataSource1: TDataSource; + FDQuery1: TFDQuery; + FDPhysMySQLDriverLink1: TFDPhysMySQLDriverLink; + FDConnection1: TFDConnection; + search: TButton; + GroupBox1: TGroupBox; + Label1: TLabel; + EditCarNum: TEdit; + Button1: TButton; + Button2: TButton; + GroupBox2: TGroupBox; + Label2: TLabel; + Editminpay: TEdit; + Label3: TLabel; + Editdaypay: TEdit; + ComboBox1: TComboBox; + lblKIND: TLabel; + lblENDTIME: TLabel; + lblSTARTTIME: TLabel; + Edit1: TEdit; + StartT: TEdit; + procedure FormClose(Sender: TObject; var Action: TCloseAction); + procedure searchClick(Sender: TObject); + procedure Button1Click(Sender: TObject); + procedure Button2Click(Sender: TObject); + private + { Private declarations } + public + { Public declarations } + end; + +var + Form2: TForm2; + +implementation + +{$R *.dfm} +uses unit1; + +procedure TForm2.searchClick(Sender: TObject); +begin + try + begin + with FDConnection1 do begin + Params.Clear; + Params.Add('DriverID=MySQL'); + Params.Add('Server=127.0.0.1'); + Params.Add('Port=3306'); + Params.Add('Database=parkinglot'); + Params.Add('User_Name=root'); + Params.Add('Password=root'); + + Params.Add('CharacterSet=utf8'); + + Open; + end; + with FDQuery1 do begin + SQL.Clear; + SQL.Add('select * from ledger'); + open; + end; +end; + finally + + + end; + end; + +procedure TForm2.Button1Click(Sender: TObject); + +begin + + if ComboBox1.Text = 'Ϲ' then + begin + try + + with FDConnection1 do begin + Params.Clear; + Params.Add('DriverID=MySQL'); + Params.Add('Server=127.0.0.1'); + Params.Add('Port=3306'); + Params.Add('Database=parkinglot'); + Params.Add('User_Name=root'); + Params.Add('Password=root'); + Params.Add('CharacterSet=utf8'); + Open; + end; + with FDQuery1 do begin + SQL.Clear; + SQL.Add('INSERT INTO ledger(carnum,startTIME,kind,pay)'); + SQL.Add('VALUE(:carN,:StartT,:kind,:pay);'); + Params.ParamByName('carN').AsString := EditCarNum.Text; + Params.ParamByName('StartT').AsString := formatDateTime('yyyy-mm-dd hh:mm:ss', now); + Params.ParamByName('kind').AsString := ComboBox1.Text; + Params.ParamByName('pay').AsString := '3000'; + execsql; + showMessage('߰Ϸ'); + SQL.Clear; + SQL.Add('select * from ledger'); + open; + end; + finally + + + + end; + end; + + if ComboBox1.Text = '' then + begin + try + + with FDConnection1 do begin + Params.Clear; + Params.Add('DriverID=MySQL'); + Params.Add('Server=127.0.0.1'); + Params.Add('Port=3306'); + Params.Add('Database=parkinglot'); + Params.Add('User_Name=root'); + Params.Add('Password=root'); + Params.Add('CharacterSet=utf8'); + Open; + end; + with FDQuery1 do begin + SQL.Clear; + SQL.Add('INSERT INTO ledger(carnum,startTIME,endTIME,kind,pay)'); + SQL.Add('VALUE(:carN,getdate(),DATE_ADD(NOW(), INTERVAL 1 DAY),:kind,:pay);'); + Params.ParamByName('carN').AsString := EditCarNum.Text; + Params.ParamByName('kind').AsString := ComboBox1.Text; + Params.ParamByName('pay').AsString := '20000'; + execsql; + showMessage('߰Ϸ'); + SQL.Clear; + SQL.Add('select * from ledger'); + open; + end; + finally + + + + end; + end; + + end; + +procedure TForm2.Button2Click(Sender: TObject); +var +startend:string; +start1,end1:string; +begin + try + + with FDConnection1 do begin + Params.Clear; + Params.Add('DriverID=MySQL'); + Params.Add('Server=127.0.0.1'); + Params.Add('Port=3306'); + Params.Add('Database=parkinglot'); + Params.Add('User_Name=root'); + Params.Add('Password=root'); + Params.Add('CharacterSet=utf8'); + Open; + end; + with FDQuery1 do begin + SQL.Clear; + SQL.Add('select * from ledger'); + SQL.Add('where carnum = :carN;'); //ȣ ˻ + Params.ParamByName('carN').AsString := EditCarNum.text; //ȣ EditCarNum.tEXT ´ + + open; + end; + //Ϲ + lblKIND.Caption := dbGrid1.Fields[4].AsString; + if lblKIND.Caption = 'Ϲ' then + begin + try + with FDQuery1 do + begin + SQL.Clear; + SQL.Add('select * from ledger;'); + SQL.Add('UPDATE ledger SET endTIME = now() WHERE Carnum =:carT;'); // ȣ ޾ƿ endTIME Ʈش. + Params.ParamByName('carT').AsString := EditCarNum.text; //ȣ EditCarNum.tEXT ´ + + open; + end; + finally + + end; + // Ϲ (endTIME - startTIME)/60/10*400 + + + end; + + finally + + + end; +end; + + +procedure TForm2.FormClose(Sender: TObject; var Action: TCloseAction); +begin +form1.close; +end; + +end. diff --git a/__history/Unit2.pas.~7~ b/__history/Unit2.pas.~7~ new file mode 100644 index 0000000..82ef217 --- /dev/null +++ b/__history/Unit2.pas.~7~ @@ -0,0 +1,230 @@ +unit Unit2; + +interface + +uses + Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, + Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Data.DB, Data.SqlExpr, Vcl.Grids, + Vcl.DBGrids, FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Param, + FireDAC.Stan.Error, FireDAC.DatS, FireDAC.Phys.Intf, FireDAC.DApt.Intf, + FireDAC.Stan.Async, FireDAC.DApt, FireDAC.Comp.DataSet, FireDAC.Comp.Client, + FireDAC.Phys.MySQLDef, FireDAC.Phys, FireDAC.Phys.MySQL, FireDAC.UI.Intf, + FireDAC.Stan.Def, FireDAC.Stan.Pool, FireDAC.VCLUI.Wait, Vcl.StdCtrls, + Vcl.Mask, Vcl.ExtCtrls, Vcl.DBCtrls; + +type + TForm2 = class(TForm) + DBGrid1: TDBGrid; + DataSource1: TDataSource; + FDQuery1: TFDQuery; + FDPhysMySQLDriverLink1: TFDPhysMySQLDriverLink; + FDConnection1: TFDConnection; + search: TButton; + GroupBox1: TGroupBox; + Label1: TLabel; + EditCarNum: TEdit; + Button1: TButton; + Button2: TButton; + GroupBox2: TGroupBox; + Label2: TLabel; + Editminpay: TEdit; + Label3: TLabel; + Editdaypay: TEdit; + ComboBox1: TComboBox; + lblKIND: TLabel; + lblENDTIME: TLabel; + lblSTARTTIME: TLabel; + Edit1: TEdit; + StartT: TEdit; + procedure FormClose(Sender: TObject; var Action: TCloseAction); + procedure searchClick(Sender: TObject); + procedure Button1Click(Sender: TObject); + procedure Button2Click(Sender: TObject); + private + { Private declarations } + public + { Public declarations } + end; + +var + Form2: TForm2; + +implementation + +{$R *.dfm} +uses unit1; + +procedure TForm2.searchClick(Sender: TObject); +begin + try + begin + with FDConnection1 do begin + Params.Clear; + Params.Add('DriverID=MySQL'); + Params.Add('Server=127.0.0.1'); + Params.Add('Port=3306'); + Params.Add('Database=parkinglot'); + Params.Add('User_Name=root'); + Params.Add('Password=root'); + + Params.Add('CharacterSet=utf8'); + + Open; + end; + with FDQuery1 do begin + SQL.Clear; + SQL.Add('select * from ledger'); + open; + end; +end; + finally + + + end; + end; + +procedure TForm2.Button1Click(Sender: TObject); + +begin + + if ComboBox1.Text = 'Ϲ' then + begin + try + + with FDConnection1 do begin + Params.Clear; + Params.Add('DriverID=MySQL'); + Params.Add('Server=127.0.0.1'); + Params.Add('Port=3306'); + Params.Add('Database=parkinglot'); + Params.Add('User_Name=root'); + Params.Add('Password=root'); + Params.Add('CharacterSet=utf8'); + Open; + end; + with FDQuery1 do begin + SQL.Clear; + SQL.Add('INSERT INTO ledger(carnum,startTIME,kind,pay)'); + SQL.Add('VALUE(:carN,:StartT,:kind,:pay);'); + Params.ParamByName('carN').AsString := EditCarNum.Text; + Params.ParamByName('StartT').AsString := formatDateTime('yyyy-mm-dd hh:mm:ss', now); + Params.ParamByName('kind').AsString := ComboBox1.Text; + Params.ParamByName('pay').AsString := '3000'; + execsql; + showMessage('߰Ϸ'); + SQL.Clear; + SQL.Add('select * from ledger'); + open; + end; + finally + + + + end; + end; + + if ComboBox1.Text = '' then + begin + try + + with FDConnection1 do begin + Params.Clear; + Params.Add('DriverID=MySQL'); + Params.Add('Server=127.0.0.1'); + Params.Add('Port=3306'); + Params.Add('Database=parkinglot'); + Params.Add('User_Name=root'); + Params.Add('Password=root'); + Params.Add('CharacterSet=utf8'); + Open; + end; + with FDQuery1 do begin + SQL.Clear; + SQL.Add('INSERT INTO ledger(carnum,startTIME,endTIME,kind,pay)'); + SQL.Add('VALUE(:carN,getdate(),DATE_ADD(NOW(), INTERVAL 1 DAY),:kind,:pay);'); + Params.ParamByName('carN').AsString := EditCarNum.Text; + Params.ParamByName('kind').AsString := ComboBox1.Text; + Params.ParamByName('pay').AsString := '20000'; + execsql; + showMessage('߰Ϸ'); + SQL.Clear; + SQL.Add('select * from ledger'); + open; + end; + finally + + + + end; + end; + + end; + +procedure TForm2.Button2Click(Sender: TObject); +var +startend:string; +start1,end1:string; +begin + try + + with FDConnection1 do begin + Params.Clear; + Params.Add('DriverID=MySQL'); + Params.Add('Server=127.0.0.1'); + Params.Add('Port=3306'); + Params.Add('Database=parkinglot'); + Params.Add('User_Name=root'); + Params.Add('Password=root'); + Params.Add('CharacterSet=utf8'); + Open; + end; + with FDQuery1 do begin + SQL.Clear; + SQL.Add('select * from ledger'); + SQL.Add('where carnum = :carN;'); //ȣ ˻ + Params.ParamByName('carN').AsString := EditCarNum.text; //ȣ EditCarNum.tEXT ´ + + + open; + end; + + //Ϲ + // Ϲ ((endTIME - startTIME))/60-30)/10*400 + lblKIND.Caption := dbGrid1.Fields[4].AsString; + if lblKIND.Caption = 'Ϲ' then + begin + try + with FDQuery1 do + begin + SQL.Clear; + SQL.Add('select * from ledger;'); + SQL.Add('UPDATE ledger SET endTIME = now() WHERE Carnum =:carT;'); // ȣ ޾ƿ endTIME Ʈش. + SQL.ADD('UPDATE ledger SET endstart = ROUND(((unix_timestamp(endTIME)-unix_timestamp(startTIME))/60-30)/10*400) WHERE carnum =:carT;'); + Params.ParamByName('carT').AsString := EditCarNum.text; //ȣ EditCarNum.tEXT ´ + showmessage('Ϸ ݾȮּ'); + open; + SQL.Add('select * from ledger'); + SQL.Add('where carnum = :carT;'); + open; + end; + finally + + end; + + + + end; + + finally + + + end; +end; + + +procedure TForm2.FormClose(Sender: TObject; var Action: TCloseAction); +begin +form1.close; +end; + +end. diff --git a/__history/Unit2.pas.~8~ b/__history/Unit2.pas.~8~ new file mode 100644 index 0000000..fa1f208 --- /dev/null +++ b/__history/Unit2.pas.~8~ @@ -0,0 +1,249 @@ +unit Unit2; + +interface + +uses + Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, + Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Data.DB, Data.SqlExpr, Vcl.Grids, + Vcl.DBGrids, FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Param, + FireDAC.Stan.Error, FireDAC.DatS, FireDAC.Phys.Intf, FireDAC.DApt.Intf, + FireDAC.Stan.Async, FireDAC.DApt, FireDAC.Comp.DataSet, FireDAC.Comp.Client, + FireDAC.Phys.MySQLDef, FireDAC.Phys, FireDAC.Phys.MySQL, FireDAC.UI.Intf, + FireDAC.Stan.Def, FireDAC.Stan.Pool, FireDAC.VCLUI.Wait, Vcl.StdCtrls, + Vcl.Mask, Vcl.ExtCtrls, Vcl.DBCtrls; + +type + TForm2 = class(TForm) + DBGrid1: TDBGrid; + DataSource1: TDataSource; + FDQuery1: TFDQuery; + FDPhysMySQLDriverLink1: TFDPhysMySQLDriverLink; + FDConnection1: TFDConnection; + search: TButton; + GroupBox1: TGroupBox; + Label1: TLabel; + EditCarNum: TEdit; + Button1: TButton; + Button2: TButton; + GroupBox2: TGroupBox; + Label2: TLabel; + Editminpay: TEdit; + Label3: TLabel; + Editdaypay: TEdit; + ComboBox1: TComboBox; + lblKIND: TLabel; + lblENDTIME: TLabel; + lblSTARTTIME: TLabel; + Edit1: TEdit; + StartT: TEdit; + procedure FormClose(Sender: TObject; var Action: TCloseAction); + procedure searchClick(Sender: TObject); + procedure Button1Click(Sender: TObject); + procedure Button2Click(Sender: TObject); + private + { Private declarations } + public + { Public declarations } + end; + +var + Form2: TForm2; + +implementation + +{$R *.dfm} +uses unit1; + +procedure TForm2.searchClick(Sender: TObject); +begin + try + begin + with FDConnection1 do begin + Params.Clear; + Params.Add('DriverID=MySQL'); + Params.Add('Server=127.0.0.1'); + Params.Add('Port=3306'); + Params.Add('Database=parkinglot'); + Params.Add('User_Name=root'); + Params.Add('Password=root'); + + Params.Add('CharacterSet=utf8'); + + Open; + end; + with FDQuery1 do begin + SQL.Clear; + SQL.Add('select * from ledger'); + open; + end; +end; + finally + + + end; + end; + +procedure TForm2.Button1Click(Sender: TObject); + +begin + + if ComboBox1.Text = 'Ϲ' then + begin + try + + with FDConnection1 do begin + Params.Clear; + Params.Add('DriverID=MySQL'); + Params.Add('Server=127.0.0.1'); + Params.Add('Port=3306'); + Params.Add('Database=parkinglot'); + Params.Add('User_Name=root'); + Params.Add('Password=root'); + Params.Add('CharacterSet=utf8'); + Open; + end; + with FDQuery1 do begin + SQL.Clear; + SQL.Add('INSERT INTO ledger(carnum,startTIME,kind,pay)'); + SQL.Add('VALUE(:carN,:StartT,:kind,:pay);'); + Params.ParamByName('carN').AsString := EditCarNum.Text; + Params.ParamByName('StartT').AsString := formatDateTime('yyyy-mm-dd hh:mm:ss', now); + Params.ParamByName('kind').AsString := ComboBox1.Text; + Params.ParamByName('pay').AsString := '3000'; + execsql; + showMessage('߰Ϸ'); + SQL.Clear; + SQL.Add('select * from ledger'); + open; + end; + finally + + + + end; + end; + + if ComboBox1.Text = '' then + begin + try + + with FDConnection1 do begin + Params.Clear; + Params.Add('DriverID=MySQL'); + Params.Add('Server=127.0.0.1'); + Params.Add('Port=3306'); + Params.Add('Database=parkinglot'); + Params.Add('User_Name=root'); + Params.Add('Password=root'); + Params.Add('CharacterSet=utf8'); + Open; + end; + with FDQuery1 do begin + SQL.Clear; + SQL.Add('INSERT INTO ledger(carnum,startTIME,endTIME,kind,pay)'); + SQL.Add('VALUE(:carN,getdate(),DATE_ADD(NOW(), INTERVAL 1 DAY),:kind,:pay);'); + Params.ParamByName('carN').AsString := EditCarNum.Text; + Params.ParamByName('kind').AsString := ComboBox1.Text; + Params.ParamByName('pay').AsString := '20000'; + execsql; + showMessage('߰Ϸ'); + SQL.Clear; + SQL.Add('select * from ledger'); + open; + end; + finally + + + + end; + end; + + end; + +procedure TForm2.Button2Click(Sender: TObject); +var +startend:string; +start1,end1:string; +begin + try + + with FDConnection1 do begin + Params.Clear; + Params.Add('DriverID=MySQL'); + Params.Add('Server=127.0.0.1'); + Params.Add('Port=3306'); + Params.Add('Database=parkinglot'); + Params.Add('User_Name=root'); + Params.Add('Password=root'); + Params.Add('CharacterSet=utf8'); + Open; + end; + with FDQuery1 do begin + SQL.Clear; + SQL.Add('select * from ledger'); + SQL.Add('where carnum = :carN;'); //ȣ ˻ + Params.ParamByName('carN').AsString := EditCarNum.text; //ȣ EditCarNum.tEXT ´ + + + open; + end; + + //Ϲ + // Ϲ ((endTIME - startTIME))/60-30)/10*400 + lblKIND.Caption := dbGrid1.Fields[4].AsString; + if lblKIND.Caption = 'Ϲ' then + begin + try + with FDQuery1 do + begin + SQL.Clear; + SQL.Add('select * from ledger;'); + SQL.Add('UPDATE ledger SET endTIME = now() WHERE Carnum =:carT;'); // ȣ ޾ƿ endTIME Ʈش. + SQL.ADD('UPDATE ledger SET endstart = ROUND(((unix_timestamp(endTIME)-unix_timestamp(startTIME))/60-30)/10*400) WHERE carnum =:carT;'); + Params.ParamByName('carT').AsString := EditCarNum.text; //ȣ EditCarNum.tEXT ´ + showmessage('Ϸ ݾȮּ'); + open; + SQL.Add('select * from ledger'); + SQL.Add('where carnum = :carT;'); + open; + end; + finally + + end; + + if lblKIND.Caption = '' then + begin + try + with FDQuery1 do + begin + SQL.Clear; + SQL.Add('select * from ledger;'); + SQL.ADD('UPDATE ledger SET endstart = ROUND(((unix_timestamp(endTIME)-unix_timestamp(startTIME))/60-30)/10*400) WHERE carnum =:carT;'); + Params.ParamByName('carT').AsString := EditCarNum.text; //ȣ EditCarNum.tEXT ´ + showmessage('Ϸ ݾȮּ'); + open; + SQL.Add('select * from ledger'); + SQL.Add('where carnum = :carT;'); + open; + end; + finally + + end; + + + + + end; +end; + finally + + end; + end; + + +procedure TForm2.FormClose(Sender: TObject; var Action: TCloseAction); +begin +form1.close; +end; + +end. diff --git a/__history/Unit2.pas.~9~ b/__history/Unit2.pas.~9~ new file mode 100644 index 0000000..8632655 --- /dev/null +++ b/__history/Unit2.pas.~9~ @@ -0,0 +1,257 @@ +unit Unit2; + +interface + +uses + Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, + Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Data.DB, Data.SqlExpr, Vcl.Grids, + Vcl.DBGrids, FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Param, + FireDAC.Stan.Error, FireDAC.DatS, FireDAC.Phys.Intf, FireDAC.DApt.Intf, + FireDAC.Stan.Async, FireDAC.DApt, FireDAC.Comp.DataSet, FireDAC.Comp.Client, + FireDAC.Phys.MySQLDef, FireDAC.Phys, FireDAC.Phys.MySQL, FireDAC.UI.Intf, + FireDAC.Stan.Def, FireDAC.Stan.Pool, FireDAC.VCLUI.Wait, Vcl.StdCtrls, + Vcl.Mask, Vcl.ExtCtrls, Vcl.DBCtrls; + +type + TForm2 = class(TForm) + DBGrid1: TDBGrid; + DataSource1: TDataSource; + FDQuery1: TFDQuery; + FDPhysMySQLDriverLink1: TFDPhysMySQLDriverLink; + FDConnection1: TFDConnection; + search: TButton; + GroupBox1: TGroupBox; + Label1: TLabel; + EditCarNum: TEdit; + Button1: TButton; + Button2: TButton; + GroupBox2: TGroupBox; + Label2: TLabel; + Editminpay: TEdit; + Label3: TLabel; + Editdaypay: TEdit; + ComboBox1: TComboBox; + lblKIND: TLabel; + Label4: TLabel; + normalpay: TEdit; + procedure FormClose(Sender: TObject; var Action: TCloseAction); + procedure searchClick(Sender: TObject); + procedure Button1Click(Sender: TObject); + procedure Button2Click(Sender: TObject); + private + { Private declarations } + public + { Public declarations } + end; + +var + Form2: TForm2; + +implementation + +{$R *.dfm} +uses unit1; + +procedure TForm2.searchClick(Sender: TObject); +begin + try + begin + with FDConnection1 do begin + Params.Clear; + Params.Add('DriverID=MySQL'); + Params.Add('Server=127.0.0.1'); + Params.Add('Port=3306'); + Params.Add('Database=parkinglot'); + Params.Add('User_Name=root'); + Params.Add('Password=root'); + + Params.Add('CharacterSet=utf8'); + + Open; + end; + with FDQuery1 do begin + SQL.Clear; + SQL.Add('set @cnt = 0;'); + SQL.Add('update ledger set ledger.num = @cnt := @cnt+1;'); // ȣи num + SQL.Add('select * from ledger'); + open; + end; +end; + finally + + + end; + end; + + + +procedure TForm2.Button1Click(Sender: TObject); + +begin + + if ComboBox1.Text = 'Ϲ' then + begin + try + + with FDConnection1 do begin + Params.Clear; + Params.Add('DriverID=MySQL'); + Params.Add('Server=127.0.0.1'); + Params.Add('Port=3306'); + Params.Add('Database=parkinglot'); + Params.Add('User_Name=root'); + Params.Add('Password=root'); + Params.Add('CharacterSet=utf8'); + Open; + end; + with FDQuery1 do begin + SQL.Clear; + SQL.Add('INSERT INTO ledger(carnum,startTIME,kind,pay)'); + SQL.Add('VALUE(:carN,:StartT,:kind,:pay);'); + Params.ParamByName('carN').AsString := EditCarNum.Text; + Params.ParamByName('StartT').AsString := formatDateTime('yyyy-mm-dd hh:mm:ss', now); + Params.ParamByName('kind').AsString := ComboBox1.Text; //޺ڽ ؽƮ + Params.ParamByName('pay').AsString := normalpay.Text; //Ϲ ⺻ݾ μ + execsql; + showMessage('߰Ϸ'); + SQL.Clear; + SQL.Add('select * from ledger'); + open; + end; + finally + + + + end; + end; + + if ComboBox1.Text = '' then + begin + try + + with FDConnection1 do begin + Params.Clear; + Params.Add('DriverID=MySQL'); + Params.Add('Server=127.0.0.1'); + Params.Add('Port=3306'); + Params.Add('Database=parkinglot'); + Params.Add('User_Name=root'); + Params.Add('Password=root'); + Params.Add('CharacterSet=utf8'); + Open; + end; + with FDQuery1 do begin + SQL.Clear; + SQL.Add('INSERT INTO ledger(carnum,startTIME,kind,pay)'); + SQL.Add('VALUE(:carN,:StartT,:kind,:pay);'); + Params.ParamByName('carN').AsString := EditCarNum.Text; + Params.ParamByName('StartT').AsString := formatDateTime('yyyy-mm-dd hh:mm:ss', now); + Params.ParamByName('kind').AsString := ComboBox1.Text; //޺ڽ ؽƮ + Params.ParamByName('pay').AsString := Editdaypay.Text; //ݾ + execsql; + showMessage('߰Ϸ'); + SQL.Clear; + SQL.Add('select * from ledger'); + open; + end; + finally + + + + end; + end; + + end; + +procedure TForm2.Button2Click(Sender: TObject); +var +startend:string; +start1,end1:string; +begin + try + + with FDConnection1 do begin + Params.Clear; + Params.Add('DriverID=MySQL'); + Params.Add('Server=127.0.0.1'); + Params.Add('Port=3306'); + Params.Add('Database=parkinglot'); + Params.Add('User_Name=root'); + Params.Add('Password=root'); + Params.Add('CharacterSet=utf8'); + Open; + end; + with FDQuery1 do begin + SQL.Clear; + SQL.Add('select * from ledger'); + SQL.Add('where carnum = :carN;'); //ȣ ˻ + Params.ParamByName('carN').AsString := EditCarNum.text; //ȣ EditCarNum.tEXT ´ + + + open; + end; + + //Ϲ + // Ϲ ((endTIME - startTIME))/60-30)/10*400 + lblKIND.Caption := dbGrid1.Fields[4].AsString; + if lblKIND.Caption = 'Ϲ' then + begin + try + with FDQuery1 do + begin + SQL.Clear; + SQL.Add('select * from ledger;'); + SQL.Add('UPDATE ledger SET endTIME = now() WHERE Carnum =:carT;'); // ȣ ޾ƿ endTIME Ʈش. + SQL.ADD('UPDATE ledger SET endstart = ROUND(((unix_timestamp(endTIME)-unix_timestamp(startTIME))/60-30)/10*400,-2) WHERE carnum =:carT;'); + {ROUND(xxx,-2) ̿ ʿ } + Params.ParamByName('carT').AsString := EditCarNum.text; //ȣ EditCarNum.tEXT ´ + showmessage('Ϸ ݾȮּ'); + open; + SQL.Add('select * from ledger'); + SQL.Add('where carnum = :carT;'); + open; + end; + + finally + + end; + end; //if Ϲ begin + + lblKIND.Caption := dbGrid1.Fields[4].AsString; + if lblKIND.Caption = '' then + begin + try + with FDQuery1 do + begin + SQL.Clear; + SQL.Add('select * from ledger;'); + SQL.Add('UPDATE ledger SET endTIME = now() WHERE Carnum =:carT;'); // ȣ ޾ƿ endTIME Ʈش. + SQL.ADD('UPDATE ledger SET endstart = ROUND(((unix_timestamp(endTIME)-unix_timestamp(startTIME))/60-30)/10*400,-2) WHERE carnum =:carT;'); + {ROUND(xxx,-2) ̿ ʿ } + Params.ParamByName('carT').AsString := EditCarNum.text; //ȣ EditCarNum.tEXT ´ + showmessage('Ϸ ݾȮּ'); + open; + SQL.Add('select * from ledger'); + SQL.Add('where carnum = :carT;'); + open; + end; + finally + + end; //if begin + + + + + end; + finally + + end; + end; + + +procedure TForm2.FormClose(Sender: TObject; var Action: TCloseAction); +begin +form1.close; +end; + +end. diff --git a/libmariadb.dll b/libmariadb.dll new file mode 100644 index 0000000..9b088d3 Binary files /dev/null and b/libmariadb.dll differ