毕业论文论文范文课程设计实践报告法律论文英语论文教学论文医学论文农学论文艺术论文行政论文管理论文计算机安全
您现在的位置: 毕业论文 >> 论文 >> 正文

Delphi学生学籍管理系统 第9页

更新时间:2008-7-30:  来源:毕业论文

Delphi学生学籍管理系统 第9页

frm_loginU登录界面
var
  frm_login: Tfrm_login;
  inputNum:integer; //记录用户输入次数
implementation
uses Control_OperatorU,Config, frm_mainU;
{$R *.dfm}

procedure Tfrm_login.btn_cancelClick(Sender: TObject);
begin
Application.Terminate;
end;

procedure Tfrm_login.btn_okClick(Sender: TObject);
var
  OpID,OpPwd:string;
  Op:TOperator;
begin
Config.ADOCon:=TADOConnection.Create(nil);
Config.ADOCon.LoginPrompt:=false;
Config.ADOCon.KeepConnection:=true;
  begin
    Config.ADOCon.ConnectionString:=Config.connectionStr;
    Config.ADOCon.Open;
  end;
OpID:=self.edt_name.Text;
OpPwd:=self.edt_pwd.Text;
Op:=TOperator.Create;
Op:=Control_OperatorU.CheckOperator(OpID,OpPwd);
if (Op=nil) then
  begin
    MessageBox(Handle, '用户名或密码错误!', '信息', MB_ICONEXCLAMATION);
    inc(inputNum);
    if(inputNum>2)then
      begin
        MessageBox(Handle, '输入错误次数超过3次!', '信息', MB_ICONEXCLAMATION);
        Application.Terminate;
      end;
       frm_login:=Tfrm_login.Create(self);
       frm_login.ShowModal;
  end
else
  begin
    frm_main.Visible:=true;
    frm_main.CurrentUser:=Op;//保存当前用户
    //根据用户权限设置菜单
    if(Op.privilege='操作员') then
      begin
        frm_main.Nclass.Enabled:=false;
        frm_main.Noperator.Enabled:=false;
      end;
    self.Close;
  end;
end;

procedure Tfrm_login.FormCreate(Sender: TObject);
begin
inputNum:=0;//初始化记录用户输入次数
end;
frm_mainU主界面
uses frm_loginU,frm_StudentU,frm_operatorU,
frm_changePwdU,frm_classU,frm_statusU,frm_evaluationU,
frm_experienceU;
{$R *.dfm}

procedure TFrm_main.FormCreate(Sender: TObject);
var
  frm_login:Tfrm_login;
begin
  frm_login:=Tfrm_login.Create(self);
  frm_login.ShowModal;
end;

procedure TFrm_main.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Config.ADOCon.Close;
end;

procedure TFrm_main.NOperatorClick(Sender: TObject);
var
  frm_operator:Tfrm_operator;
begin
frm_operator:=Tfrm_operator.Create(self);
frm_operator.ShowModal;
end;

procedure TFrm_main.NStudentInfoClick(Sender: TObject);
var
  frm_Student:Tfrm_Student;
begin
  frm_Student:=Tfrm_Student.Create(self);
  frm_Student.ShowModal;
end;

procedure TFrm_main.NCloseClick(Sender: TObject);
begin
  close;
end;

procedure TFrm_main.NChangePwdClick(Sender: TObject);
var
  frm_changePwd:Tfrm_changePwd;
begin
  frm_changePwd:=Tfrm_changePwd.Create(self);
  frm_changePwd.currentUser:=self.CurrentUser;
  frm_changePwd.ShowModal;
end;

procedure TFrm_main.NclassClick(Sender: TObject);
var
  frm_class:Tfrm_class;
begin
  frm_class:=Tfrm_class.Create(self);
  frm_class.ShowModal;
end;

procedure TFrm_main.NoutClick(Sender: TObject);
var
  frm_status:Tfrm_status;
begin
  frm_status:=Tfrm_status.Create(self);
  frm_status.ShowModal;
end;

procedure TFrm_main.NevaluationClick(Sender: TObject);
var
  frm_evaluation:Tfrm_evaluation;
begin
  frm_evaluation:=Tfrm_evaluation.Create(self);
  frm_evaluation.ShowModal;
end;

procedure TFrm_main.NexperienceClick(Sender: TObject);
var
  frm_experience:Tfrm_experience;
begin
  frm_experience:=Tfrm_experience.Create(self);
  frm_experience.ShowModal;
end;
frm_operatorU操作员管理界面
public
    procedure FillData;override;
end;


procedure Tfrm_operator.FillData;
begin
  DataSource_info.DataSet:=Control_OperatorU.GetOperatorArray;
  self.DBGrid_info.Columns[0].Visible  :=false;
  self.DBGrid_info.Columns[3].Visible  :=false; //让密码不可见
end;
procedure Tfrm_operator.DBGrid_infoCellClick(Column: TColumn);
begin
  inherited;
if self.DBGrid_info.Fields[0].IsNull then
    exit;
  self.edt_OperatorID.Tag:=self.DBGrid_info.Fields[0].Value;//保存id
  self.edt_OperatorID.Text:=self.DBGrid_info.Fields[1].Value;
  self.edt_name.Text :=self.DBGrid_info.Fields[2].Value;
  self.edt_pwd.Text:=self.DBGrid_info.Fields[3].Value;
  self.cbx_privilege.Text:=self.DBGrid_info.Fields[4].Value;
  self.Memo_remark.Text:=self.DBGrid_info.Fields[5].Value;
end;

procedure Tfrm_operator.btn_addClick(Sender: TObject);
var
  Operator:TOperator;
begin
  inherited;
 if((edt_OperatorID.Text='') or (edt_Name.Text='')
        or (edt_pwd.Text='') or (self.cbx_privilege.Text='')
        ) then
        begin
           MessageBox(Handle, '内容填写不正确!', '信息', MB_ICONEXCLAMATION);
           exit;
        end;
       //查找是否存在重复
      if (GetOperatorByOperatorID(trim(edt_OperatorID.Text)))<>nil then
        begin
          MessageBox(Handle, '操作员ID已经存在,请重新设置!', '信息', MB_ICONEXCLAMATION);
          exit;
        end;
      Operator:=TOperator.Create;
      Operator.id:=edt_OperatorID.Tag;
      Operator.Operid:=trim(self.edt_OperatorID.Text);
      Operator.OperName:=trim(self.edt_name.Text);
      Operator.pwd:=trim(self.edt_pwd.Text);
      Operator.privilege:=trim(self.cbx_privilege.Text);
      Operator.remark:=self.Memo_remark.Text;
     
      if(Control_OperatorU.AddOperator(Operator)) then
        begin
          MessageBox(Handle, '添加成功!', '信息', MB_ICONASTERISK);
         
          //刷新内容
          FillData;
        end
      else
        begin
          MessageBox(Handle, '添加失败!', '信息', MB_ICONEXCLAMATION);
          exit;
        end;
end;

procedure Tfrm_operator.btn_editClick(Sender: TObject);
var
  Operator:TOperator;
begin
inherited;
  if edt_OperatorID.Text ='' then
    begin
       MessageBox(Handle, '没有可以修改的数据!', '信息', MB_ICONEXCLAMATION);
      exit;
    end
  else
    begin
      if((edt_OperatorID.Text='') or (edt_Name.Text='')
    or (edt_pwd.Text='') or (self.cbx_privilege.Text='')
    ) then
    begin
       MessageBox(Handle, '内容填写不正确!', '信息', MB_ICONEXCLAMATION);
       exit;
    end;
  //查找是否存在重复
  Operator:=TOperator.Create;
  Operator:=GetOperatorByOperatorID(trim(edt_OperatorID.Text));
  if(Operator<>nil) then
    begin
      if(Operator.id<>edt_OperatorID.Tag) then
        begin
          MessageBox(Handle, '操作员ID已经存在,请重新设置!', '信息', MB_ICONEXCLAMATION);
          exit;
        end;
    end;
  Operator:=TOperator.Create;
  Operator.id:=edt_OperatorID.Tag;
  Operator.Operid:=trim(self.edt_OperatorID.Text);
  Operator.OperName:=trim(self.edt_name.Text);
  Operator.pwd:=trim(self.edt_pwd.Text);
  Operator.privilege:=trim(self.cbx_privilege.Text);
  Operator.remark:=self.Memo_remark.Text;
  if(Control_OperatorU.EditOperator(Operator)) then
    begin
      MessageBox(Handle, '修改成功!', '信息', MB_ICONASTERISK);
      //刷新内容
      FillData;
    end
  else
     begin
      MessageBox(Handle, '修改失败!', '信息', MB_ICONEXCLAMATION);
      exit;
     end;
      self.edt_OperatorID.SetFocus;
end;


end;

procedure Tfrm_operator.btn_delClick(Sender: TObject);
var
  Operator:TOperator;
begin
  inherited;
  if MessageBox(Handle, '您确定要删除该操作员信息', '信息',
     MB_ICONQUESTION or MB_OKCANCEL) = IDOK then
    begin
      Control_OperatorU.DelOperator(self.edt_OperatorID.Tag);
      FillData;
      if self.DBGrid_info.Fields[0].IsNull then
        exit;
      self.edt_OperatorID.Tag:=self.DBGrid_info.Fields[0].Value;//保存id
      self.edt_OperatorID.Text:=self.DBGrid_info.Fields[1].Value;
      self.edt_name.Text :=self.DBGrid_info.Fields[2].Value;
      self.edt_pwd.Text:=self.DBGrid_info.Fields[3].Value;
      self.cbx_privilege.Text:=self.DBGrid_info.Fields[4].Value;
      self.Memo_remark.Text:=self.DBGrid_info.Fields[5].Value;
    end;
end;

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] 下一页

Delphi学生学籍管理系统 第9页下载如图片无法显示或论文不完整,请联系qq752018766
设为首页 | 联系站长 | 友情链接 | 网站地图 |

copyright©751com.cn 辣文论文网 严禁转载
如果本毕业论文网损害了您的利益或者侵犯了您的权利,请及时联系,我们一定会及时改正。