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

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

frm_evaluationU奖惩信息界面public
    procedure FillData;override;
  end;

procedure Tfrm_evaluation.FillData;
begin
  self.DataSource_info.DataSet:=Control_evaluationU.GetEvaluationArray;
  self.DBGrid_info.Columns[0].Visible  :=false;
end;

procedure Tfrm_evaluation.btn_addClick(Sender: TObject);
var
  Evaluation:TEvaluation;
  Student:TStudent;
begin
  inherited;
 if((edt_stdNo.Text='')) then
        begin
           MessageBox(Handle, '内容填写不正确!', '信息', MB_ICONEXCLAMATION);
           exit;
        end;
 Student:=TStudent.Create;
 Student:=Control_StudentU.GetStudentByStudentNo(self.edt_stdNo.Text);
     if Student=nil then
       begin
         MessageBox(Handle, '学号填写不正确!', '信息', MB_ICONEXCLAMATION);
         edt_stdNo.SetFocus;
         exit;
       end;

      Evaluation:=TEvaluation.Create;
      Evaluation.id:=edt_stdNo.Tag;
      Evaluation.stdNo:=trim(self.edt_stdNo.Text);
      Evaluation.Edate:=DateToStr(now);
      Evaluation.Etype:=self.cbx_type.Text;
      Evaluation.remark:=self.Memo_remark.Text;

      if(Control_EvaluationU.AddEvaluation(Evaluation)) then
        begin
          MessageBox(Handle, '添加成功!', '信息', MB_ICONASTERISK);
          //刷新内容
          FillData;
          if self.DBGrid_info.Fields[0].IsNull then
            begin
              self.edt_stdNo.Tag:=0;//保存id
              self.edt_stdNo.Text:='';
              self.edt_edate.Text :='';
              self.cbx_type.ItemIndex:=0;
              self.Memo_remark.Text:='';
            end
          else
            begin
              self.edt_stdNo.Tag:=self.DBGrid_info.Fields[0].Value;//保存id
              self.edt_stdNo.Text:=self.DBGrid_info.Fields[1].Value;
              self.edt_edate.Text :=self.DBGrid_info.Fields[2].Value;
              self.cbx_type.Text:=self.DBGrid_info.Fields[3].Value;
              self.Memo_remark.Text:=self.DBGrid_info.Fields[4].Value;
            end;
        end
      else
        begin
          MessageBox(Handle, '添加失败!', '信息', MB_ICONEXCLAMATION);
          exit;
        end;
end;

procedure Tfrm_evaluation.btn_delClick(Sender: TObject);
begin
  inherited;
if MessageBox(Handle, '您确定要删除该信息', '信息',
     MB_ICONQUESTION or MB_OKCANCEL) = IDOK then
    begin
      Control_evaluationU.Delevaluation(self.edt_stdNo.Tag);
      FillData;
      if self.DBGrid_info.Fields[0].IsNull then
        begin
          self.edt_stdNo.Tag:=0;//保存id
          self.edt_stdNo.Text:='';
          self.edt_edate.Text :='';
          self.cbx_type.ItemIndex:=0;
          self.Memo_remark.Text:='';
        end
      else
        begin
          self.edt_stdNo.Tag:=self.DBGrid_info.Fields[0].Value;//保存id
          self.edt_stdNo.Text:=self.DBGrid_info.Fields[1].Value;
          self.edt_edate.Text :=self.DBGrid_info.Fields[2].Value;
          self.cbx_type.Text:=self.DBGrid_info.Fields[3].Value;
          self.Memo_remark.Text:=self.DBGrid_info.Fields[4].Value;
        end;
    end;
end;

procedure Tfrm_evaluation.btn_editClick(Sender: TObject);
var
  Evaluation:TEvaluation;
  Student:TStudent;
begin
  inherited;
 if edt_stdNo.Text ='' then
    begin
      MessageBox(Handle, '没有可以修改的数据!', '信息', MB_ICONEXCLAMATION);
      exit;
    end
  else
    begin
      if((edt_stdNo.Text='')) then
      begin
         MessageBox(Handle, '内容填写不正确!', '信息', MB_ICONEXCLAMATION);
         exit;
      end;
     Student:=TStudent.Create;
     Student:=Control_StudentU.GetStudentByStudentNo(self.edt_stdNo.Text);
     if Student=nil then
       begin
         MessageBox(Handle, '学号填写不正确!', '信息', MB_ICONEXCLAMATION);
         edt_stdNo.SetFocus;
         exit;
       end;

      Evaluation:=TEvaluation.Create;
      Evaluation.id:=edt_stdNo.Tag;
      Evaluation.stdNo:=trim(self.edt_stdNo.Text);
      Evaluation.Edate:=trim(self.edt_edate.Text);
      Evaluation.Etype:=self.cbx_type.Text;
      Evaluation.remark:=self.Memo_remark.Text;

      if(Control_evaluationU.Editevaluation(evaluation)) then
        begin
          MessageBox(Handle, '修改成功!', '信息', MB_ICONASTERISK);
          //刷新内容
          FillData;
        end
      else
         begin
          MessageBox(Handle, '修改失败!', '信息', MB_ICONEXCLAMATION);
          exit;
         end;
          self.edt_stdNo.SetFocus;
  end;
end;

procedure Tfrm_evaluation.DBGrid_infoCellClick(Column: TColumn);
begin
  inherited;
      if self.DBGrid_info.Fields[0].IsNull then
        begin
          self.edt_stdNo.Tag:=0;//保存id
          self.edt_stdNo.Text:='';
          self.edt_edate.Text :='';
          self.cbx_type.ItemIndex:=0;
          self.Memo_remark.Text:='';
        end
      else
        begin
          self.edt_stdNo.Tag:=self.DBGrid_info.Fields[0].Value;//保存id
          self.edt_stdNo.Text:=self.DBGrid_info.Fields[1].Value;
          self.edt_edate.Text :=self.DBGrid_info.Fields[2].Value;
          self.cbx_type.Text:=self.DBGrid_info.Fields[3].Value;
          self.Memo_remark.Text:=self.DBGrid_info.Fields[4].Value;
        end;
end;

procedure Tfrm_evaluation.btn_search_stdNoClick(Sender: TObject);
begin
  inherited;
  self.DataSource_info.DataSet:=
       Control_evaluationU.GetEvaluationByStdNO(self.edt_stdNo_s.Text);
  self.DBGrid_info.Columns[0].Visible  :=false;
end;frm_experienceU教育经历界面
public
    procedure FillData;override;
  end;

procedure Tfrm_experience.FillData;
begin
  self.DataSource_info.DataSet:=Control_experienceU.GetExperienceArray;
  self.DBGrid_info.Columns[0].Visible  :=false;
end;

procedure Tfrm_experience.btn_addClick(Sender: TObject);
var
  Experience:TExperience;
  Student:TStudent;
begin
  inherited;
 if((edt_stdNo.Text='') or (edt_school.Text='')
    or (DTP_beginDate.Date>DTP_endDate.Date)) then
        begin
           MessageBox(Handle, '内容填写不正确!', '信息', MB_ICONEXCLAMATION);
           exit;
        end;
 Student:=TStudent.Create;
 Student:=Control_StudentU.GetStudentByStudentNo(self.edt_stdNo.Text);
     if Student=nil then
       begin
         MessageBox(Handle, '学号填写不正确!', '信息', MB_ICONEXCLAMATION);
         edt_stdNo.SetFocus;
         exit;
       end;

      Experience:=TExperience.Create;
      Experience.id:=edt_stdNo.Tag;
      Experience.stdNo:=trim(self.edt_stdNo.Text);
      Experience.beginDate:=DateToStr(self.DTP_beginDate.Date);
      Experience.endDate:=DateToStr(self.DTP_endDate.Date);
      Experience.school:=self.edt_school.Text;
      Experience.duty:=self.edt_duty.Text;

      if(Control_ExperienceU.AddExperience(Experience)) then
        begin
          MessageBox(Handle, '添加成功!', '信息', MB_ICONASTERISK);
          //刷新内容
          FillData;
          if self.DBGrid_info.Fields[0].IsNull then
            begin
              self.edt_stdNo.Tag:=0;//保存id
              self.edt_stdNo.Text:='';
              self.DTP_beginDate.Date :=now;
              self.DTP_endDate.Date:=now;
              self.edt_school.Text:='';
              self.edt_duty.Text:='';
            end
          else
            begin
              self.edt_stdNo.Tag:=self.DBGrid_info.Fields[0].Value;//保存id
              self.edt_stdNo.Text:=self.DBGrid_info.Fields[1].Value;
              self.DTP_beginDate.Date :=self.DBGrid_info.Fields[2].Value;
              self.DTP_endDate.Date:=self.DBGrid_info.Fields[3].Value;
              self.edt_school.Text:=self.DBGrid_info.Fields[4].Value;
              self.edt_duty.Text:=self.DBGrid_info.Fields[5].Value;
            end;
        end
      else
        begin
          MessageBox(Handle, '添加失败!', '信息', MB_ICONEXCLAMATION);
          exit;
        end;
end;

procedure Tfrm_experience.btn_delClick(Sender: TObject);
begin
  inherited;
if MessageBox(Handle, '您确定要删除该信息', '信息',
     MB_ICONQUESTION or MB_OKCANCEL) = IDOK then
    begin
      Control_ExperienceU.DelExperience(self.edt_stdNo.Tag);
      FillData;
      if self.DBGrid_info.Fields[0].IsNull then
        begin
          self.edt_stdNo.Tag:=0;//
          self.edt_stdNo.Text:='';
          self.DTP_beginDate.Date :=now;
          self.DTP_endDate.Date:=now;
          self.edt_school.Text:='';
          self.edt_duty.Text:='';
        end
      else
        begin
          self.edt_stdNo.Tag:=self.DBGrid_info.Fields[0].Value;//保存id
          self.edt_stdNo.Text:=self.DBGrid_info.Fields[1].Value;
          self.DTP_beginDate.Date :=self.DBGrid_info.Fields[2].Value;
          self.DTP_endDate.Date:=self.DBGrid_info.Fields[3].Value;
          self.edt_school.Text:=self.DBGrid_info.Fields[4].Value;
          self.edt_duty.Text:=self.DBGrid_info.Fields[5].Value;
        end;
    end;
end;

procedure Tfrm_experience.btn_editClick(Sender: TObject);
var
  Experience:TExperience;
  Student:TStudent;
begin
  inherited;
 if edt_stdNo.Text ='' then
    begin
      MessageBox(Handle, '没有可以修改的数据!', '信息', MB_ICONEXCLAMATION);
      exit;
    end
  else
    begin
      if((edt_stdNo.Text='') or (edt_school.Text='')
         or (DTP_beginDate.Date>DTP_endDate.Date)) then
      begin
         MessageBox(Handle, '内容填写不正确!', '信息', MB_ICONEXCLAMATION);
         exit;
      end;
     Student:=TStudent.Create;
     Student:=Control_StudentU.GetStudentByStudentNo(self.edt_stdNo.Text);
     if Student=nil then
       begin
         MessageBox(Handle, '学号填写不正确!', '信息', MB_ICONEXCLAMATION);
         edt_stdNo.SetFocus;
         exit;
       end;

      Experience:=TExperience.Create;
      Experience.id:=edt_stdNo.Tag;
      Experience.stdNo:=trim(self.edt_stdNo.Text);
      Experience.beginDate:=DateToStr(self.DTP_beginDate.Date);
      Experience.endDate:=DateToStr(self.DTP_endDate.Date);
      Experience.school:=self.edt_school.Text;
      Experience.duty:=self.edt_duty.Text;

      if(Control_ExperienceU.EditExperience(Experience)) then
        begin
          MessageBox(Handle, '修改成功!', '信息', MB_ICONASTERISK);
          //刷新内容
          FillData;
        end
      else
         begin
          MessageBox(Handle, '修改失败!', '信息', MB_ICONEXCLAMATION);
          exit;
         end;
          self.edt_stdNo.SetFocus;
  end;
end;

procedure Tfrm_experience.DBGrid_infoCellClick(Column: TColumn);
begin
  inherited;
    if self.DBGrid_info.Fields[0].IsNull then
        begin
          self.edt_stdNo.Tag:=0;//
          self.edt_stdNo.Text:='';
          self.DTP_beginDate.Date :=now;
          self.DTP_endDate.Date:=now;
          self.edt_school.Text:='';
          self.edt_duty.Text:='';
        end
      else
        begin
          self.edt_stdNo.Tag:=self.DBGrid_info.Fields[0].Value;//保存id
          self.edt_stdNo.Text:=self.DBGrid_info.Fields[1].Value;
          self.DTP_beginDate.Date :=self.DBGrid_info.Fields[2].Value;
          self.DTP_endDate.Date:=self.DBGrid_info.Fields[3].Value;
          self.edt_school.Text:=self.DBGrid_info.Fields[4].Value;
          self.edt_duty.Text:=self.DBGrid_info.Fields[5].Value;
        end;
end;

procedure Tfrm_experience.btn_search_stdNoClick(Sender: TObject);
begin
  inherited;
  self.DataSource_info.DataSet:=
       Control_experienceU.GetExperienceByStdNO(self.edt_stdNo_s.Text);
  self.DBGrid_info.Columns[0].Visible  :=false;
end;frm_infoU各管理窗体模板
procedure Tfrm_info.btn_exitClick(Sender: TObject);
begin
close;
end;

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

procedure Tfrm_info.FormShow(Sender: TObject);
begin
FillData;
end;

procedure Tfrm_info.DBGrid_infoCellClick(Column: TColumn);
begin
if self.DBGrid_info.Fields[0].IsNull then
    exit;
end;

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

  • 上一篇文章:
  • 下一篇文章:
  • Copyright © 2007-2012 www.chuibin.com 六维论文网 版权所有