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

📄 unitbasic3.pas

📁 远程抄表系统的客户端程序 安徽六安项目-客户端程序 0 开发环境 Delphi 7.0 所需控件 mxOutlookBar 数 据 库 Sybase 11.5 1 04-12-
💻 PAS
字号:
unit UnitBasic3;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Mask, ImgList, Menus, ComCtrls, ToolWin, ExtCtrls;

type
  TFormBasic3 = class(TForm)
    ListView: TListView;
    CoolBar: TCoolBar;
    ToolBar: TToolBar;
    BtnAdd: TToolButton;
    BtnModify: TToolButton;
    BtnDel: TToolButton;
    BtnSeek: TToolButton;
    BtnRefresh: TToolButton;
    BtnExit: TToolButton;
    PopupMenu: TPopupMenu;
    MenuAdd: TMenuItem;
    MenuModify: TMenuItem;
    MenuDelete: TMenuItem;
    MenuExit: TMenuItem;
    ImageList: TImageList;
    Panel1: TPanel;
    GroupBox1: TGroupBox;
    EditID: TMaskEdit;
    EditName: TMaskEdit;
    EditPwd: TMaskEdit;
    GroupBox2: TGroupBox;
    CheckBox_Basic1: TCheckBox;
    CheckBox_Basic2: TCheckBox;
    CheckBox_Basic3: TCheckBox;
    CheckBox_Order1: TCheckBox;
    CheckBox_Order2: TCheckBox;
    CheckBox_Order3: TCheckBox;
    CheckBox_Order4: TCheckBox;
    CheckBox_Basic0: TCheckBox;
    PanelUserID: TPanel;
    PanelName: TPanel;
    PanelPwd: TPanel;
    PanelMemo: TPanel;
    EditMemo: TEdit;
    procedure FormCreate(Sender: TObject);
    procedure BtnAddClick(Sender: TObject);
    Function  GetQXInfo() : string;
    procedure SetQXInfo( QX : string );
    procedure BtnModifyClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FormBasic3: TFormBasic3;

implementation

uses UnitMain, UnitMyModule, UnitBianDianZ, UnitBasic0;

{$R *.dfm}

procedure TFormBasic3.FormCreate(Sender: TObject);
begin
  ListView.Columns.Add();
  ListView.Columns.Items[0].Caption := '用户编号';
  ListView.Columns.Items[0].Width   := 120;

  ListView.Columns.Add();
  ListView.Columns.Items[1].Caption := '用户名称';
  ListView.Columns.Items[1].Width   := 120;

  ListView.Columns.Add();
  ListView.Columns.Items[2].Caption := '备注信息';
  ListView.Columns.Items[2].Width   := (FormMain.Width - FormMain.mxOutlookBarPro1.Width) - 275;

  self.Caption := ' 人员基本信息';
end;

Function TFormBasic3.GetQXInfo() : string;
var
  QX : string;
begin
  /////////////////////////////////////////////////////////
  QX := '';
  //变 电 站
  if self.CheckBox_Basic0.Checked = True then
    QX := QX + '1'
  else
    QX := QX + '0';
  //线路信息
  if self.CheckBox_Basic1.Checked = True then
    QX := QX + '1'
  else
    QX := QX + '0';
  //变台信息
  if self.CheckBox_Basic2.Checked = True then
    QX := QX + '1'
  else
    QX := QX + '0';
  //人员管理
  if self.CheckBox_Basic3.Checked = True then
    QX := QX + '1'
  else
    QX := QX + '0';
  //参数设置
  if self.CheckBox_Order1.Checked = True then
    QX := QX + '1'
  else
    QX := QX + '0';
  //数据抄收
  if self.CheckBox_Order2.Checked = True then
    QX := QX + '1'
  else
    QX := QX + '0';
  //处理结果
  if self.CheckBox_Order3.Checked = True then
    QX := QX + '1'
  else
    QX := QX + '0';
  //历史指令
  if self.CheckBox_Order4.Checked = True then
    QX := QX + '1'
  else
    QX := QX + '0';

  result := QX;
end;

procedure TFormBasic3.SetQXInfo( QX : string );
var
  s : string;
begin
  /////////////////////////////////////////////////////////
  //变 电 站
  s   := Copy(QX, 0, 1);
  if s = '1' then
    self.CheckBox_Basic0.Checked := true
  else
    self.CheckBox_Basic0.Checked := False;
  //线路信息
  s   := Copy(QX, 1, 1);
  if s = '1' then
    self.CheckBox_Basic1.Checked := true
  else
    self.CheckBox_Basic1.Checked := False;
  //变台信息
  s   := Copy(QX, 2, 1);
  if s = '1' then
    self.CheckBox_Basic2.Checked := true
  else
    self.CheckBox_Basic2.Checked := False;
  //人员管理
  s   := Copy(QX, 3, 1);
  if s = '1' then
    self.CheckBox_Basic3.Checked := true
  else
    self.CheckBox_Basic3.Checked := False;
  //参数设置
  s   := Copy(QX, 4, 1);
  if s = '1' then
    self.CheckBox_Order1.Checked := true
  else
    self.CheckBox_Order1.Checked := False;
  //数据抄收
  s   := Copy(QX, 5, 1);
  if s = '1' then
    self.CheckBox_Order2.Checked := true
  else
    self.CheckBox_Order2.Checked := False;
  //处理结果
  s   := Copy(QX, 6, 1);
  if s = '1' then
    self.CheckBox_Order3.Checked := true
  else
    self.CheckBox_Order3.Checked := False;
  //历史指令
  s   := Copy(QX, 7, 1);
  if s = '1' then
    self.CheckBox_Order4.Checked := true
  else
    self.CheckBox_Order4.Checked := False;
end;

procedure TFormBasic3.BtnAddClick(Sender: TObject);
var
  bInputOK : boolean;
  i        : Integer;
  ListItem : TListItem;
begin
  bInputOK  := True;

  if EditID.Text = '' then
    begin
      MessageBox(self.Handle, '【用户序号】不能为空', '录入错误', MB_ICONSTOP);
      bInputOK  := False;
    end //if

  else
    begin
      for i:=0 to ListView.Items.Count-1 do
      begin
        if StrToInt(EditID.Text) = StrToInt(ListView.Items[i].SubItems[0]) then
        begin
          MessageBox(self.Handle, '【用户序号】不能重复', '录入错误', MB_ICONSTOP);
          bInputOK  := False;
          break;
        end; //if  (=)
      end;   //for (i)
    end;     //else

  //if EditName.Text = '' then
  //  begin
  //    MessageBox(self.Handle, '【用户名称】不能为空', '录入错误', MB_ICONSTOP);
  //    bInputOK  := False;
  //  end; //if

  if bInputOK  = True then
  begin // if  bInputOK  = True
    with MyModule.AdoQuery do
    begin//with
        SQL.Clear();
        SQL.Add('INSERT INTO tx_User(fd_UserID, fd_Name, fd_Pwd, fd_Qx, fd_Memo)VALUES(');
        SQL.Add(EditID.Text);
        SQL.Add(',''');
        SQL.Add(EditName.Text);
        SQL.Add(''',''');
        SQL.Add(EditPwd.Text);
        SQL.Add(''',''');
        SQL.Add(GetQxInfo());
        SQL.Add(''',''');
        SQL.Add(EditMemo.Text);
        SQL.Add(''')');

        //ShowMessage(SQL.Text);
        try
          ExecSQL();

          ListItem := ListView.Items.Add();
          ListItem.Caption   := EditID.Text;
          ListItem.SubItems.Add(EditName.Text);
          ListItem.SubItems.Add(EditMemo.Text);

        Finally
        end; //finally
    end;     //with
  end;       //bInputOK  = True

end;

procedure TFormBasic3.BtnModifyClick(Sender: TObject);
begin
//////////////////////////////////////////////////////
end;

end.

⌨️ 快捷键说明

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