⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 systemset.pas

📁 软件类别: 数据库 软件大小: 2.60M 运行环境: Win9xNT/2000/XP 一套车辆管理系统,此版本为商业版,大家一定用的着。
💻 PAS
📖 第 1 页 / 共 2 页
字号:
unit SystemSet;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, ComCtrls, Buttons, ToolWin, DBCtrls,{ XPMenu,}StdCtrls,
  Grids, ChildFrm,DBGrids, ImgList,IniFiles;

type
  Tfrm_SystemSet = {class(TChildForm)//}class(TForm)
    P_Main: TPanel;
    Panel2: TPanel;
    Panel3: TPanel;
    PageControl1: TPageControl;
    TabSheet1: TTabSheet;
    Panel1: TPanel;
    Panel4: TPanel;
    Label2: TLabel;
    TreeView1: TTreeView;
    Panel5: TPanel;
    ToolBar1: TToolBar;
    Cmd_Add: TSpeedButton;
    Cmd_Delete: TSpeedButton;
    Cmd_Edit: TSpeedButton;
    Cmd_Save: TSpeedButton;
    Cmd_Rush: TSpeedButton;
    Panel6: TPanel;
    Edit1: TLabeledEdit;
    Edit2: TLabeledEdit;
    Editprop: TLabeledEdit;
    Edit4: TLabeledEdit;
    CheckBox1: TCheckBox;
    Edit5: TLabeledEdit;
    Edit6: TLabeledEdit;
    Edit7: TLabeledEdit;
    CheckBox2: TCheckBox;
    Edit8: TLabeledEdit;
    Edit9: TLabeledEdit;
    Edit10: TLabeledEdit;
    DBGrid1: TDBGrid;
    Edit_ID: TEdit;
    SpeedButton1: TSpeedButton;
    Cmd_Create: TSpeedButton;
    Edit3: TComboBox;
    TabSheet2: TTabSheet;
    TabSheet3: TTabSheet;
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure PageControl1Change(Sender: TObject);
    procedure Cmd_AddClick(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure Cmd_RushClick(Sender: TObject);
    procedure CheckBox1Click(Sender: TObject);
    procedure CheckBox2Click(Sender: TObject);
    procedure Cmd_SaveClick(Sender: TObject);
    procedure DBGrid1CellClick(Column: TColumn);
    procedure SpeedButton1Click(Sender: TObject);
    procedure Cmd_EditClick(Sender: TObject);
    procedure Cmd_DeleteClick(Sender: TObject);
    procedure Cmd_CreateClick(Sender: TObject);
    procedure Edit3Change(Sender: TObject);
    procedure TreeView1Change(Sender: TObject; Node: TTreeNode);
  private
    { Private declarations }
    
  public
    { Public declarations }
  end;

var
  frm_SystemSet: Tfrm_SystemSet;
  f:TIniFile;
  tempupstr,tempdownstr:string;

  Node1,Node2,Node3,Node4:TTreeNode;
  NodeText1,NodeText2,NodeText3,NodeText4:String;
implementation

uses Data, func, Mond_Select;

{$R *.dfm}

procedure Tfrm_SystemSet.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
   Action:=cafree;
end;

procedure Tfrm_SystemSet.PageControl1Change(Sender: TObject);
begin
    case PageControl1.PageCount of
    0:
    begin
        frm_data.ADOQuery_InForMation.Active:=True;
    end;
    end;
end;

procedure Tfrm_SystemSet.Cmd_AddClick(Sender: TObject);
begin
    {f:=TIniFile.Create(ExtractFileDir(application.Exename)+'\DWXX.ini');
    f.WriteString('NetSetting','GSMC',trim(LabeledEdit1.Text));
    f.WriteString('NetSetting','DWDZ',trim(LabeledEdit2.Text));
    f.WriteString('NetSetting','LXDH',trim(LabeledEdit3.Text));
    f.WriteString('NetSetting','LXRY',trim(LabeledEdit4.Text));
    Application.MessageBox('[单位信息]设置成功,请确认!','[GPS定位车辆管理系统],'mb_ok);
    f.Free;}
    Cmd_Add.Enabled:=False;
    Cmd_Delete.Enabled:=False;
    Cmd_Edit.Enabled:=False;
    Cmd_Save.Enabled:=True;
    Cmd_Rush.Caption:='取消';
    Edit1.Text:='';
    Edit2.Text:='';
    Edit3.Text:='';
    Edit_Id.Text:='';
end;

procedure Tfrm_SystemSet.FormShow(Sender: TObject);
begin
    {if System_Flag='01' then
    begin
        TabSheet2.TabVisible:=False;
    end;
    f:=TIniFile.Create(ExtractFileDir(application.Exename)+'\DWXX.ini');
    LabeledEdit1.Text:=f.ReadString('NetSetting','GSMC','');
    LabeledEdit2.Text:=f.ReadString('NetSetting','DWDZ','');
    LabeledEdit3.Text:=f.ReadString('NetSetting','LXDH','');
    LabeledEdit4.Text:=f.ReadString('NetSetting','LXRY','');
    if Trim(LabeledEdit1.Text)='' then
    begin
        Application.MessageBox('[单位信息]还没有设置,请确认!','[GPS定位车辆管理系统],'mb_ok);
        f.Free;
    end; }
end;
procedure Tfrm_SystemSet.Cmd_RushClick(Sender: TObject);

begin
    with frm_data.Query_Mond_Information do
    begin
        Close;
        Sql.Clear;
        Sql.Add('Select * from [Mond_Information]');
        try
            Prepared;
            Open;
            if frm_data.Query_Mond_Information.RecordCount>0 then
            begin
                Last;
                Edit1.Text:=frm_data.Query_Mond_Information.FieldByName('Mond_Name').AsString;
                Edit2.Text:=frm_data.Query_Mond_Information.FieldByName('Mond_Code').AsString;
                Edit3.Text:=frm_data.Query_Mond_Information.FieldByName('Mond_Prop').AsString;
                Edit4.Text:=frm_data.Query_Mond_Information.FieldByName('UpMond_Name').AsString;
                Edit5.Text:=frm_data.Query_Mond_Information.FieldByName('Address').AsString;
                Edit6.Text:=frm_data.Query_Mond_Information.FieldByName('ZIP').AsString;
                Edit7.Text:=frm_data.Query_Mond_Information.FieldByName('Email').AsString;
                Edit8.Text:=frm_data.Query_Mond_Information.FieldByName('WWW').AsString;
                Edit9.Text:=frm_data.Query_Mond_Information.FieldByName('Telphone').AsString;
                Edit10.Text:=frm_data.Query_Mond_Information.FieldByName('Charager').AsString;
                tempupstr:=frm_data.Query_Mond_Information.FieldByName('Mond_UpFlag').AsString;
                tempdownstr:=frm_data.Query_Mond_Information.FieldByName('Mond_DownFlag').AsString;
                Edit_ID.Text:=frm_data.Query_Mond_Information.FieldByName('ID').AsString;
                if Trim(tempupstr)='有' then
                begin
                    CheckBox1.Checked:=True;
                end
                else
                begin
                    CheckBox1.Checked:=False;
                end;
                if Trim(tempdownstr)='有' then
                begin
                    CheckBox2.Checked:=True;
                end
                else
                begin
                    CheckBox2.Checked:=False;
                end;
            end
            else
            begin
                Edit1.Text:='';  Edit2.Text:='';  Edit3.Text:=''; Edit4.Text:='';
                Edit5.Text:='';  Edit6.Text:='';  Edit7.Text:=''; Edit8.Text:='';
                Edit9.Text:='';  Edit10.Text:=''; tempupstr:='';  tempdownstr:='';
                Edit_ID.Text:=''; CheckBox1.Checked:=False; CheckBox2.Checked:=False;
            end;
        except
            Application.MessageBox('系统错误!系统在打开数据表时与远程服务器连接错误!',Pchar(Application.Title),MB_ICONWARNING);
            EXIT;
        end;
    end;
    if Cmd_Rush.Caption='取消' then
    begin
        Cmd_Add.Enabled:=True;
        Cmd_Delete.Enabled:=True;
        Cmd_Edit.Enabled:=True;
        Cmd_Save.Enabled:=False;
        Cmd_Rush.Caption:='刷新'
    end;
end;

procedure Tfrm_SystemSet.CheckBox1Click(Sender: TObject);
begin
    if CheckBox1.Checked=True then
    begin
        tempupstr:='有';
        Edit4.Enabled:=True;
    end
    else
    begin
        tempupstr:='无';
        Edit4.Text:='';
        Edit4.Enabled:=False;
    end;
end;

procedure Tfrm_SystemSet.CheckBox2Click(Sender: TObject);
begin
    if CheckBox2.Checked=True then
    begin
        tempdownstr:='有';
    end
    else
    begin
        tempdownstr:='无';
    end;
end;

procedure Tfrm_SystemSet.Cmd_SaveClick(Sender: TObject);
begin
    if Trim(Edit1.Text)='' then
    begin
        Application.MessageBox('操作错误,【单位名称】不能为空,请确认!',Pchar(Application.Title),MB_ICONWARNING);
        Edit1.SetFocus;
        Exit;
    end;
    if Trim(Edit2.Text)='' then
    begin
        Application.MessageBox('操作错误,【单位代码】不能为空,请确认!',Pchar(Application.Title),MB_ICONWARNING);
        Edit2.SetFocus;
        Exit;
    end;
    if Trim(Edit3.Text)='' then
    begin
        Application.MessageBox('操作错误,【单位属性】不能为空,请确认!',Pchar(Application.Title),MB_ICONWARNING);
        Edit3.SetFocus;
        Exit;
    end;
    with frm_data.Query_Mond_Information do
    begin
        Close;
        Sql.Clear;
        Sql.Add('Select * from [Mond_Information] where Mond_Code='''+Trim(Edit2.Text)+''' and Mond_Name='''+Trim(Edit1.Text)+'''');
        try
            Prepared;
            Open;
            if frm_data.Query_Mond_Information.RecordCount>0 then
            begin
                Application.MessageBox('操作错误,该单位信息已经存在,请确认!',Pchar(Application.Title),MB_ICONWARNING);
                Exit;
            end
            else
            begin
                with frm_data.Query_Mond_Information do
                begin
                    Close;
                    Sql.Clear;
                    Sql.Add('INSERT INTO [Mond_Information] (Mond_Name,Mond_Code,Mond_Prop,UpMond_Name,Address,ZIP,Email,WWW,Telphone,Charager,Mond_UpFlag,Mond_DownFlag) values (:u1,:u2,:u3,:u4,:u5,:u6,:u7,:u8,:u9,:u10,:u11,:u12)');
                    frm_data.Query_Mond_Information.Parameters[0].Value:=Trim(Edit1.Text);
                    frm_data.Query_Mond_Information.Parameters[1].Value:=Trim(Edit2.Text);
                    frm_data.Query_Mond_Information.Parameters[2].Value:=Trim(Edit3.Text);
                    frm_data.Query_Mond_Information.Parameters[3].Value:=Trim(Edit4.Text);
                    frm_data.Query_Mond_Information.Parameters[4].Value:=Trim(Edit5.Text);
                    frm_data.Query_Mond_Information.Parameters[5].Value:=Trim(Edit6.Text);
                    frm_data.Query_Mond_Information.Parameters[6].Value:=Trim(Edit7.Text);
                    frm_data.Query_Mond_Information.Parameters[7].Value:=Trim(Edit8.Text);
                    frm_data.Query_Mond_Information.Parameters[8].Value:=Trim(Edit9.Text);
                    frm_data.Query_Mond_Information.Parameters[9].Value:=Trim(Edit10.Text);
                    frm_data.Query_Mond_Information.Parameters[10].Value:=Trim(tempupstr);
                    frm_data.Query_Mond_Information.Parameters[11].Value:=Trim(tempdownstr);
                    try
                        Prepared;
                        ExecSql;
                        Application.MessageBox('单位设置【增加】操作成功,请确认!',Pchar(Application.Title),MB_ICONWARNING);
                        Cmd_Rush.Click;//调用刷新数据库的过程
                    except
                        Application.MessageBox('系统错误!系统在保存数据表时与远程服务器连接错误!',Pchar(Application.Title),MB_ICONWARNING);
                        Exit;
                    end;
                end;
            end;
        except
            Application.MessageBox('系统错误!系统在打开数据表时与远程服务器连接错误!',Pchar(Application.Title),MB_ICONWARNING);
            EXIT;
        end;
    end;
end;

procedure Tfrm_SystemSet.DBGrid1CellClick(Column: TColumn);
begin
    Edit1.Text:=frm_data.Query_Mond_Information.FieldByName('Mond_Name').AsString;
    Edit2.Text:=frm_data.Query_Mond_Information.FieldByName('Mond_Code').AsString;
    Edit3.Text:=frm_data.Query_Mond_Information.FieldByName('Mond_Prop').AsString;
    Edit4.Text:=frm_data.Query_Mond_Information.FieldByName('UpMond_Name').AsString;
    Edit5.Text:=frm_data.Query_Mond_Information.FieldByName('Address').AsString;
    Edit6.Text:=frm_data.Query_Mond_Information.FieldByName('ZIP').AsString;
    Edit7.Text:=frm_data.Query_Mond_Information.FieldByName('Email').AsString;
    Edit8.Text:=frm_data.Query_Mond_Information.FieldByName('WWW').AsString;
    Edit9.Text:=frm_data.Query_Mond_Information.FieldByName('Telphone').AsString;
    Edit10.Text:=frm_data.Query_Mond_Information.FieldByName('Charager').AsString;
    tempupstr:=frm_data.Query_Mond_Information.FieldByName('Mond_UpFlag').AsString;
    tempdownstr:=frm_data.Query_Mond_Information.FieldByName('Mond_DownFlag').AsString;
    Edit_ID.Text:=frm_data.Query_Mond_Information.FieldByName('ID').AsString;
    if Trim(tempupstr)='有' then
    begin
        CheckBox1.Checked:=True;
    end
    else
    begin
        CheckBox1.Checked:=False;
    end;
    if Trim(tempdownstr)='有' then
    begin
        CheckBox2.Checked:=True;
    end
    else
    begin

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -