Delphi学生学籍管理系统 第5页
uses DAHelper,ClassesU,ADODB,SysUtils;
//添加奖惩信息
function AddEvaluation(Evaluation:TEvaluation):boolean;
//修改奖惩信息
function EditEvaluation(Evaluation:TEvaluation):boolean;
//删除奖惩信息
function DelEvaluation(EvaluationID:integer):boolean;
//得到奖惩信息
function GetEvaluationArray:TADOQuery;
//查找奖惩信息,如果没有查找到该奖惩信息,返回空值
function GetEvaluation(OpID:integer):TEvaluation;
//查找奖惩信息by学号
function GetEvaluationByStdNO(StdNO:string):TADOQuery;
implementation
function GetEvaluationByStdNO(StdNO:string):TADOQuery;
var
sql:string;
begin
sql:='select id,学生证号,奖惩日期,奖惩类型,isnull(奖惩说明,'''') 奖惩说明 from 奖惩信息';
if StdNO<>'' then
sql:=sql+' where 学生证号='+''''+StdNO+'''';
result:=DAHelper.ExeSqlQuery(sql);
end;
function GetEvaluation(OpID:integer):TEvaluation;
var
Evaluation:TEvaluation;
sql:string;
Adoquery:TADOQuery;
begin
sql:='select id,学生证号,奖惩日期,奖惩类型,isnull(奖惩说明,'''') 奖惩说明 from 奖惩信息'+
' where ID='+inttostr(OpID);
Adoquery:=DAHelper.ExeSqlQuery(sql);
if Adoquery.RecordCount<1 then
begin
result:=nil;
end
else
begin
Evaluation:=TEvaluation.Create;
Evaluation.id:=ADOQuery.Fields[0].Value;
Evaluation.stdNo:=ADOQuery.Fields[1].Value;
Evaluation.Edate:=DateToStr(ADOQuery.Fields[2].Value);
Evaluation.Etype:=ADOQuery.Fields[3].Value;
Evaluation.remark:=ADOQuery.Fields[4].Value;
result:=Evaluation;
end;
end;
function GetEvaluationArray:TADOQuery;
var
sql:string;
begin
sql:='select id,学生证号,奖惩日期,奖惩类型,isnull(奖惩说明,'''') 奖惩说明 from 奖惩信息';
result:=DAHelper.ExeSqlQuery(sql);
end;
function DelEvaluation(EvaluationID:integer):boolean;
var
sql:string;
begin
sql:='delete from 奖惩信息 where id='+inttostr(EvaluationID);
result:=DAHelper.ExeSqlNoQuery(sql);
end;
function EditEvaluation(Evaluation:TEvaluation):boolean;
var
sql:string;
begin
sql:='update 奖惩信息 set 学生证号='+''''+Evaluation.stdNo+''''+
',奖惩日期='+''''+Evaluation.Edate +''''+
',奖惩类型='+''''+Evaluation.Etype +''''+
',奖惩说明='+''''+Evaluation.remark+''''+
' where id='+inttostr(Evaluation.id);
result:=DAHelper.ExeSqlNoQuery(sql);
end;
function AddEvaluation(Evaluation:TEvaluation):boolean;
var
sql:string;
begin
sql:='insert into 奖惩信息(学生证号,奖惩日期,奖惩类型'+
',奖惩说明)'+' values('+''''+Evaluation.stdNo+''''+
','+''''+Evaluation.Edate+''''+
','+''''+Evaluation.Etype+''''+
','+''''+Evaluation.remark+''''+')';
result:=DAHelper.ExeSqlNoQuery(sql);
end;Control_evaluationU奖惩信息单元代码
Control_experienceU教育经历单元代码
uses DAHelper,ClassesU,ADODB,SysUtils;
//添加教育经历
function AddExperience(Experience:TExperience):boolean;
//修改教育经历
function EditExperience(Experience:TExperience):boolean;
//删除教育经历
function DelExperience(ExperienceID:integer):boolean;
//得到教育经历
function GetExperienceArray:TADOQuery;
//查找教育经历,如果没有查找到该教育经历,返回空值
function GetExperience(OpID:integer):TExperience;
//根据学号查找教育经历
function GetExperienceByStdNO(StdNO:string):TADOQuery;
implementation
function GetExperienceByStdNO(StdNO:string):TADOQuery;
var
sql:string;
begin
sql:='select id,学生证号,开始日期,终止日期,学校名称,isnull(职务,'''') 职务 from 教育经历';
if StdNO<>'' then
sql:=sql+' where 学生证号='+''''+StdNO+'''';
result:=DAHelper.ExeSqlQuery(sql);
end;
function GetExperience(OpID:integer):TExperience;
var
Experience:TExperience;
sql:string;
Adoquery:TADOQuery;
begin
sql:='select id,学生证号,开始日期,终止日期,学校名称,isnull(职务,'''') 职务 from 教育经历'+
' where ID='+inttostr(OpID);
Adoquery:=DAHelper.ExeSqlQuery(sql);
if Adoquery.RecordCount<1 then
begin
result:=nil;
end
else
begin
Experience:=TExperience.Create;
Experience.id:=ADOQuery.Fields[0].Value;
Experience.stdNo:=ADOQuery.Fields[1].Value;
Experience.beginDate:=DateToStr(ADOQuery.Fields[2].Value);
Experience.endDate:=DateToStr(ADOQuery.Fields[3].Value);
Experience.school:=ADOQuery.Fields[4].Value;
Experience.duty:=ADOQuery.Fields[5].Value;
result:=Experience;
end;
end;
function GetExperienceArray:TADOQuery;
var
sql:string;
begin
sql:='select id,学生证号,开始日期,终止日期,学校名称,isnull(职务,'''') 职务 from 教育经历';
result:=DAHelper.ExeSqlQuery(sql);
end;
function DelExperience(ExperienceID:integer):boolean;
var
sql:string;
begin
sql:='delete from 教育经历 where id='+inttostr(ExperienceID);
result:=DAHelper.ExeSqlNoQuery(sql);
end;
function EditExperience(Experience:TExperience):boolean;
var
sql:string;
begin
sql:='update 教育经历 set 学生证号='+''''+Experience.stdNo+''''+
',开始日期='+''''+Experience.beginDate+''''+
',终止日期='+''''+Experience.endDate+''''+
',学校名称='+''''+Experience.school+''''+
',职务='+''''+Experience.duty+''''+
' where id='+inttostr(Experience.id);
result:=DAHelper.ExeSqlNoQuery(sql);
end;
function AddExperience(Experience:TExperience):boolean;
var
sql:string;
begin
sql:='insert into 教育经历(学生证号,开始日期,终止日期'+
',学校名称,职务)'+' values('+''''+Experience.stdNo+''''+
','+''''+Experience.beginDate+''''+
','+''''+Experience.endDate+''''+
','+''''+Experience.school+''''+
','+''''+Experience.duty+''''+')';
result:=DAHelper.ExeSqlNoQuery(sql);
end;Control_OperatorU系统管理单元代码
uses DAHelper,ClassesU,ADODB,SysUtils;
//添加操作员信息
function AddOperator(Operator:TOperator):boolean;
//修改操作员信息
function EditOperator(Operator:TOperator):boolean;
//删除操作员信息
function DelOperator(OperatorID:integer):boolean;
//得到操作员信息
function GetOperatorArray:TADOQuery;
//判断用户,如果没有查找到该用户,返回空值
function CheckOperator(OpID,OpPwd:string):TOperator;
//查找操作员by操作员id
function GetOperatorByOperatorID(OperatorID:string):TOperator;
//更改密码
function ChangePwd(newPwd:string;id:integer):boolean;
implementation
function ChangePwd(newPwd:string;id:integer):boolean;
var
sql:string;
begin
sql:='update 操作员信息 set 密码='+''''+newPwd+''''+
' where id='+inttostr(id);
result:=DAHelper.ExeSqlNoQuery(sql);
end;
function GetOperatorByOperatorID(OperatorID:string):TOperator;
var
sql:string;
Operator:TOperator;
ADOQuery:TADOQuery;
begin
ADOQuery:=TADOQuery.Create(nil);
sql:='select id,操作员ID,操作员姓名,密码,权限,isnull(备注,'''') 备注 from 操作员信息'+
' where 操作员ID='+''''+OperatorID+'''';
ADOQuery:=DAHelper.ExeSqlQuery(sql);
if(ADOQuery.RecordCount<1) then
begin
result:=nil;
end
else
begin
Operator:=TOperator.Create;
Operator.id:=ADOQuery.Fields[0].Value;
Operator.Operid:=ADOQuery.Fields[1].Value;
Operator.OperName:=ADOQuery.Fields[2].Value;
Operator.pwd:=ADOQuery.Fields[3].Value;
Operator.privilege:=ADOQuery.Fields[4].Value;
Operator.remark:=ADOQuery.Fields[5].Value;
result:=Operator;
end;
ADOQuery:=nil;
end;
function CheckOperator(OpID,OpPwd:string):TOperator;
var
Operator:TOperator;
sql:string;
Adoq:TADOQuery;
begin
sql:='select 操作员姓名,权限,isnull(备注,''''),id from 操作员信息'+
' where 操作员ID='+''''+OpID+''''+' and '+
' 密码='+''''+OpPwd+'''';
Adoq:=DAHelper.ExeSqlQuery(sql);
if Adoq.RecordCount<1 then
begin
result:=nil;
end
else
begin
Operator:=TOperator.Create;
Operator.Operid:=OpID;
Operator.OperName:=Adoq.Fields[0].Value;
Operator.pwd:=OpPwd;
Operator.privilege:=Adoq.Fields[1].Value;
Operator.remark:=Adoq.Fields[2].Value;
Operator.id:=Adoq.Fields[3].Value;
result:=Operator;
end;
end;
function GetOperatorArray:TADOQuery;
var
sql:string;
begin
sql:='select id,操作员ID,操作员姓名,密码,权限,isnull(备注,'''') 备注 from 操作员信息';
result:=DAHelper.ExeSqlQuery(sql);
end;
function DelOperator(OperatorID:integer):boolean;
var
sql:string;
begin
sql:='delete from 操作员信息 where id='+inttostr(OperatorID);
result:=DAHelper.ExeSqlNoQuery(sql);
end;
function EditOperator(Operator:TOperator):boolean;
var
sql:string;
begin
sql:='update 操作员信息 set 操作员ID='+''''+Operator.Operid+''''+
',操作员姓名='+''''+Operator.OperName +''''+
',密码='+''''+Operator.pwd +''''+
',权限='+''''+Operator.privilege+''''+
',备注='+''''+Operator.remark+''''+
' where id='+inttostr(Operator.id);
result:=DAHelper.ExeSqlNoQuery(sql);
end;
function AddOperator(Operator:TOperator):boolean;
var
sql:string;
begin
sql:='insert into 操作员信息(操作员ID,操作员姓名,密码,权限,'+
'备注)'+' values('+''''+Operator.Operid+''''+','+''''+Operator.OperName+''''+
','+''''+Operator.pwd+''''+','+''''+Operator.privilege+''''+
','+''''+Operator.remark+''''+ ')';
result:=DAHelper.ExeSqlNoQuery(sql);
end;
上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] 下一页