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

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

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

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

frm_statusU学籍变动界面
public
    procedure FillData;override;
end;

procedure Tfrm_status.FillData;
begin
  DataSource_info.DataSet:=Control_StatusU.GetStatusArray;
  self.DBGrid_info.Columns[0].Visible  :=false;
end;
procedure Tfrm_status.ChangeUIByType(typeStr:string);
begin
  if (typeStr='退学') or (typeStr='休学') then
    begin
      self.Lab_newclass.Visible:=false;
      self.edt_newClass.Visible:=false;
      self.lab_newSchool.Visible:=false;
      self.edt_newSchool.Visible:=false;
    end
  else
    begin
      if (typeStr='转学') then
        begin
          self.Lab_newclass.Visible:=false;
          self.edt_newClass.Visible:=false;
          self.lab_newSchool.Visible:=true;
          self.edt_newSchool.Visible:=true;
        end;
      if (typeStr='调班') then
        begin
          self.Lab_newclass.Visible:=true;
          self.edt_newClass.Visible:=true;
          self.lab_newSchool.Visible:=false;
          self.edt_newSchool.Visible:=false;
        end;
    end;
end;
procedure Tfrm_status.cbx_typeChange(Sender: TObject);
begin
  inherited;
  ChangeUIByType(cbx_type.Text);
end;

procedure Tfrm_status.btn_addClick(Sender: TObject);
var
  Student:TStudent;
  Status:TStatus;
begin
  inherited;
 if((self.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;
     self.edt_oldClass.Text:=Student.ClassName;

    Status:=TStatus.Create;
    Status.studentNo:=self.edt_stdNo.Text;
    Status.changeType:=self.cbx_type.Text;
    Status.changeDate:=DateToStr(now);
    Status.oldClass:=self.edt_oldClass.Text;
    Status.newSchool:=self.edt_newSchool.Text;
    Status.newClass:=self.edt_newClass.Text;
    Status.reason:=self.Memo_reason.Text;
    Status.remark:=self.Memo_remark.Text;

      if(Control_StatusU.AddStatus(Status)) then
        begin
          MessageBox(Handle, '添加成功!', '信息', MB_ICONASTERISK);
          //刷新内容
          FillData;
        end
      else
        begin
          MessageBox(Handle, '添加失败!', '信息', MB_ICONEXCLAMATION);
          exit;
        end;
end;

procedure Tfrm_status.btn_delClick(Sender: TObject);
begin
  inherited;
  if MessageBox(Handle, '您确定要删除该条信息', '信息',
     MB_ICONQUESTION or MB_OKCANCEL) = IDOK then
    begin
      Control_statusU.Delstatus(self.edt_stdNo.Tag);
      FillData;
      if self.DBGrid_info.Fields[0].IsNull then
        exit;
      self.edt_stdNo.Tag:=self.DBGrid_info.Fields[0].Value;//保存id
      self.edt_stdNo.Text:=self.DBGrid_info.Fields[1].Value;
      self.cbx_type.Text:=self.DBGrid_info.Fields[2].Value;
      self.edt_changeDate.Text:=self.DBGrid_info.Fields[3].Value;
      self.edt_oldClass.Text:=self.DBGrid_info.Fields[4].Value;
      self.edt_newSchool.Text:=self.DBGrid_info.Fields[5].Value;
      self.edt_newClass.Text:=self.DBGrid_info.Fields[6].Value;
      self.Memo_reason.Text :=self.DBGrid_info.Fields[7].Value;
      self.Memo_remark.Text:=self.DBGrid_info.Fields[8].Value;
    end;
end;

procedure Tfrm_status.btn_editClick(Sender: TObject);
var
  status:Tstatus;
  Student:TStudent;
  typeStr:string;
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;
     self.edt_oldClass.Text:=Student.ClassName;
    typeStr:=self.cbx_type.Text;
     if (typeStr='退学') or (typeStr='休学') then
    begin
      self.edt_newClass.Text:='';
      self.edt_newSchool.Text:='';
    end
  else
    begin
      if (typeStr='转学') then
        begin
          self.edt_newClass.Text:='';
        end;
      if (typeStr='调班') then
        begin
          self.edt_newSchool.Text:='';
        end;
    end;

    Status:=TStatus.Create;
    Status.id:=self.edt_stdNo.Tag;
    Status.studentNo:=self.edt_stdNo.Text;
    Status.changeType:=self.cbx_type.Text;
    Status.changeDate:=self.edt_changeDate.Text;
    Status.oldClass:=self.edt_oldClass.Text;
    Status.newSchool:=self.edt_newSchool.Text;
    Status.newClass:=self.edt_newClass.Text;
    Status.reason:=self.Memo_reason.Text;
    Status.remark:=self.Memo_remark.Text;

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

procedure Tfrm_status.DBGrid_infoCellClick(Column: TColumn);
var
  typeStr:string;
begin
  inherited;
if self.DBGrid_info.Fields[0].IsNull then
    exit;
typeStr:=self.DBGrid_info.Fields[2].Value;//变动类型
if (typeStr='退学') or (typeStr='休学') then
    begin
      self.Lab_newclass.Visible:=false;
      self.edt_newClass.Visible:=false;
      self.lab_newSchool.Visible:=false;
      self.edt_newSchool.Visible:=false;
    end
  else
    begin
      if (typeStr='转学') then
        begin
          self.Lab_newclass.Visible:=false;
          self.edt_newClass.Visible:=false;
          self.lab_newSchool.Visible:=true;
          self.edt_newSchool.Visible:=true;
        end;
      if (typeStr='调班') then
        begin
          self.Lab_newclass.Visible:=true;
          self.edt_newClass.Visible:=true;
          self.lab_newSchool.Visible:=false;
          self.edt_newSchool.Visible:=false;
        end;
    end;
  self.edt_stdNo.Tag:=self.DBGrid_info.Fields[0].Value;//保存id
  self.edt_stdNo.Text:=self.DBGrid_info.Fields[1].Value;
  self.cbx_type.Text :=self.DBGrid_info.Fields[2].Value;

  self.edt_changeDate.Text:=DatetoStr(self.DBGrid_info.Fields[3].Value);
  self.edt_oldClass.Text:=self.DBGrid_info.Fields[4].Value;
  self.edt_newSchool.Text:=self.DBGrid_info.Fields[5].Value;
  self.edt_newClass.Text:=self.DBGrid_info.Fields[6].Value;
 
  self.Memo_reason.Text:=self.DBGrid_info.Fields[7].Value;
  self.Memo_remark.Text:=self.DBGrid_info.Fields[8].Value;
end;

procedure Tfrm_status.btn_search_stdNoClick(Sender: TObject);
begin
  inherited;
  if self.edt_stdNo_s.Text='' then
    DataSource_info.DataSet:=Control_statusU.GetStatusArray
  else
    DataSource_info.DataSet:=GetStatusQueryByStdNo(self.edt_stdNo_s.Text);
  self.DBGrid_info.Columns[0].Visible  :=false;
end;frm_StudentU学生信息界面
private
    stdNo:string;//保存当前学生证号
  public
    //填充数据
    procedure FillData;override;
  end;

procedure Tfrm_Student.FillData;
begin
  DataSource_info.DataSet:=Control_StudentU.GetStudentArray;
  self.DBGrid_info.Columns[2].Visible  :=false;//照片路径不可见
  Control_classU.FillCombobox(self.cbx_class);
end;

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

procedure Tfrm_Student.DBGrid_infoCellClick(Column: TColumn);
var
  WorkPath:string;
begin
  if self.DBGrid_info.Fields[0].IsNull then
    exit;
  stdNo:= self.DBGrid_info.Fields[0].Value;//保存当前学生证号
  self.edt_studentNo.Text :=self.DBGrid_info.Fields[0].Value;
  self.edt_name.Text:=self.DBGrid_info.Fields[1].Value;
   //显示照片信息
  WorkPath := ExtractFilePath(Application.ExeName);
  try
  self.image_pic.Picture.LoadFromFile(WorkPath+self.DBGrid_info.Fields[2].Value);
  except
  self.image_pic.Picture:=nil;
  end;
  self.cbx_sex.Text:=self.DBGrid_info.Fields[3].Value;
  self.edt_nation.Text:=self.DBGrid_info.Fields[4].Value;
  self.DTP_birthday.Date:=self.DBGrid_info.Fields[5].Value;
  self.edt_native.Text :=self.DBGrid_info.Fields[6].Value;
  self.edt_IDCard.Text:=self.DBGrid_info.Fields[7].Value;
  self.edt_hometel.Text:=self.DBGrid_info.Fields[8].Value;
  self.edt_address.Text:=self.DBGrid_info.Fields[9].Value;
  self.edt_postalcode.Text:=self.DBGrid_info.Fields[10].Value;
  self.DTP_indate.Date:=self.DBGrid_info.Fields[11].Value;
  self.cbx_class.Text:=self.DBGrid_info.Fields[12].Value;
  self.edt_duty.Text:=self.DBGrid_info.Fields[13].Value;
  self.Memo_remark.Text:=self.DBGrid_info.Fields[14].Value;
  inherited;
end;

procedure Tfrm_Student.btn_addClick(Sender: TObject);
var
  Student:TStudent;
  WorkPath:string;
begin
  inherited;
 if((self.edt_studentNo.Text='') or (edt_Name.Text='')
        or (edt_nation.Text='') or (self.edt_native.Text='')
        or (edt_IDCard.Text='') or (self.edt_homeTel.Text='')
        or (edt_address.Text='') or (self.edt_postalcode.Text='')
        ) then
        begin
           MessageBox(Handle, '*为必填信息!', '信息', MB_ICONEXCLAMATION);
           exit;
        end;
       //查找是否存在重复
      if (Control_StudentU.GetStudentByStudentNo(trim(edt_studentNo.Text)))<>nil then
        begin
          MessageBox(Handle, '该学号已经存在,请重新设置!', '信息', MB_ICONEXCLAMATION);
          exit;
        end;
     WorkPath := ExtractFilePath(Application.ExeName);
     Student:=TStudent.Create;
     Student.stdNo:=self.edt_studentNo.Text;
     Student.stdName:=self.edt_name.Text;
     Student.picPath:='photo\'+Student.stdNo+'.bmp';
     Student.sex:=self.cbx_sex.Text;
     Student.nation:=self.edt_nation.Text;
     Student.birthday:=DateToStr(self.DTP_birthday.date);
     Student.native:=self.edt_native.Text;
     Student.IDCard:=self.edt_IDCard.Text;
     Student.homeTel:=self.edt_homeTel.Text;
     Student.address:=self.edt_address.Text;
     Student.postalcode:=self.edt_postalcode.Text;
     Student.inDate:=DateTostr(self.DTP_indate.Date);
     Student.ClassName:=self.cbx_class.Text;
     Student.duty:=self.edt_duty.Text;
     Student.remark:=self.Memo_remark.Text;
          
      if(Control_StudentU.AddStudent(Student)) then
        begin

          self.image_pic.Picture.SaveToFile(WorkPath+Student.picPath);
          MessageBox(Handle, '添加成功!', '信息', MB_ICONASTERISK);
          //刷新内容
          FillData;
        end
      else
        begin
          MessageBox(Handle, '添加失败!', '信息', MB_ICONEXCLAMATION);
          exit;
        end;

end;

procedure Tfrm_Student.btn_delClick(Sender: TObject);
begin
 if MessageBox(Handle, '您确定要删除该学生信息', '信息',
         MB_ICONQUESTION or MB_OKCANCEL) = IDOK then
        begin
          Control_StudentU.DelStudent(self.edt_studentNo.Text);
          FillData;
          if self.DBGrid_info.Fields[0].IsNull then
            exit;
          self.edt_studentNo.Text :=self.DBGrid_info.Fields[0].Value;
          self.edt_name.Text:=self.DBGrid_info.Fields[1].Value;
          self.image_pic.Picture.LoadFromFile(self.DBGrid_info.Fields[2].Value);
          self.cbx_sex.Text:=self.DBGrid_info.Fields[3].Value;
          self.edt_nation.Text:=self.DBGrid_info.Fields[4].Value;
          self.DTP_birthday.Date:=self.DBGrid_info.Fields[5].Value;
          self.edt_native.Text :=self.DBGrid_info.Fields[6].Value;
          self.edt_IDCard.Text:=self.DBGrid_info.Fields[7].Value;
          self.edt_hometel.Text:=self.DBGrid_info.Fields[8].Value;
          self.edt_address.Text:=self.DBGrid_info.Fields[9].Value;
          self.edt_postalcode.Text:=self.DBGrid_info.Fields[10].Value;
          self.DTP_indate.Date:=self.DBGrid_info.Fields[11].Value;
          self.cbx_class.Text:=self.DBGrid_info.Fields[12].Value;
          self.edt_duty.Text:=self.DBGrid_info.Fields[13].Value;
          self.Memo_remark.Text:=self.DBGrid_info.Fields[14].Value;
        end;
end;

procedure Tfrm_Student.btn_editClick(Sender: TObject);
var
  Student:TStudent;
  WorkPath:string;
begin
inherited;
  if edt_StudentNo.Text ='' then
    begin
       MessageBox(Handle, '没有可以修改的数据!', '信息', MB_ICONEXCLAMATION);
      exit;
    end
  else
    begin
      if((self.edt_studentNo.Text='') or (edt_Name.Text='')
        or (edt_nation.Text='') or (self.edt_native.Text='')
        or (edt_IDCard.Text='') or (self.edt_homeTel.Text='')
        or (edt_address.Text='') or (self.edt_postalcode.Text='')
        ) then
      begin
         MessageBox(Handle, '*为必填信息!', '信息', MB_ICONEXCLAMATION);
         exit;
      end;
  //查找是否存在重复
  Student:=TStudent.Create;
  Student:=GetStudentByStudentNo(trim(edt_StudentNo.Text));
  if(Student<>nil) then
    begin
      if(Student.stdNo<>stdNo) then
        begin
          MessageBox(Handle, '该学生证号已经存在,请重新设置!', '信息', MB_ICONEXCLAMATION);
          exit;
        end;
    end;
   WorkPath := ExtractFilePath(Application.ExeName);
   Student:=TStudent.Create;
   Student.stdNo:=self.edt_studentNo.Text;
   Student.stdName:=self.edt_name.Text;
   Student.picPath:='photo\'+Student.stdNo+'.bmp';
   Student.sex:=self.cbx_sex.Text;
   Student.nation:=self.edt_nation.Text;
   Student.birthday:=DateToStr(self.DTP_birthday.date);
   Student.native:=self.edt_native.Text;
   Student.IDCard:=self.edt_IDCard.Text;
   Student.homeTel:=self.edt_homeTel.Text;
   Student.address:=self.edt_address.Text;
   Student.postalcode:=self.edt_postalcode.Text;
   Student.inDate:=DateTostr(self.DTP_indate.Date);
   Student.ClassName:=self.cbx_class.Text;
   Student.duty:=self.edt_duty.Text;
   Student.remark:=self.Memo_remark.Text;
  if(Control_StudentU.EditStudent(Student,stdNo)) then
    begin
      self.image_pic.Picture.SaveToFile(WorkPath+Student.picPath);
      MessageBox(Handle, '修改成功!', '信息', MB_ICONASTERISK);
      //刷新内容
      FillData;
    end
  else
     begin
      MessageBox(Handle, '修改失败!', '信息', MB_ICONEXCLAMATION);
      exit;
     end;
      self.edt_StudentNo.SetFocus;
  end;
end;

procedure Tfrm_Student.btn_search_nameClick(Sender: TObject);
begin
  inherited;
if self.edt_name_s.Text='' then
  self.FillData
else
  begin
    self.DataSource_info.DataSet:=
         Control_StudentU.GetStudentByName(trim(self.edt_name_s.Text));
    self.DBGrid_info.Columns[2].Visible  :=false;
  end;
end;

procedure Tfrm_Student.image_picClick(Sender: TObject);
begin
  inherited;
  if self.OpenD_pic.Execute then
   begin
    image_pic.Picture.LoadFromFile(self.OpenD_pic.FileName );
   end;
end;

procedure Tfrm_Student.edt_postalcodeKeyPress(Sender: TObject;
  var Key: Char);
begin
  inherited;
if not((key in ['0'..'9',#8,#13])) then
    key:=#0;
end;

procedure Tfrm_Student.btn_search_stdNoClick(Sender: TObject);
begin
  inherited;
if self.edt_stdNo_s.Text='' then
  self.FillData
else
  begin
    self.DataSource_info.DataSet:=
         Control_StudentU.GetStudentQueryByStudentNo(trim(self.edt_stdNo_s.Text));
    self.DBGrid_info.Columns[2].Visible  :=false;
  end;
end;

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

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

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