unit ModifyUnit;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs,DZModelUserinfo, StdCtrls, ExtCtrls, Buttons;

type
  TModifyForm = class(TForm)
    btnOk: TBitBtn;
    btnCancel: TBitBtn;
    lbledtusername: TLabeledEdit;
    lbledtpass: TLabeledEdit;
    lbledtnickname: TLabeledEdit;
    lbledthead: TLabeledEdit;
    lbledtsex: TLabeledEdit;
    lbledtbirthday: TLabeledEdit;
    lbledtDepart: TLabeledEdit;
    lbledtJobType: TLabeledEdit;
    LbledtEdu: TLabeledEdit;
    lbledtPersonality: TLabeledEdit;
    lbledtPersonHobbie: TLabeledEdit;
    lbledtpersonsign: TLabeledEdit;
    lbledtemail: TLabeledEdit;
    mmoRemark: TMemo;
    lbledtphone: TLabeledEdit;
    lbl1: TLabel;
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure btnOkClick(Sender: TObject);
  private
    { Private declarations }
  public
    Model:TModelUserInfo ;//当前需要修改的实体
    { Public declarations }
  end;

var
  ModifyForm: TModifyForm;

implementation

{$R *.dfm}

procedure TModifyForm.btnOkClick(Sender: TObject);
begin
if Trim(self.lbledtusername.Text)='' then
begin
  self.lbledtusername.SetFocus;
  showmessage('User name Must Input !');
  exit;
end;
  self.Model.UserName.Value:=self.lbledtusername.Text;
  self.Model.Password.Value:=self.lbledtpass.Text;
  self.Model.Nickname.value:=self.lbledtnickname.Text;
  self.model.HeadImg.Value:=self.lbledthead.Text;
  self.Model.Sex.Value:=self.lbledtsex.Text;
  self.Model.Birthday.Value:=self.lbledtbirthday.Text;
  self.Model.DepartMent.value:=self.lbledtDepart.Text;
  self.model.JobType.Value:=self.lbledtJobType.Text;
  self.Model.Edu.Value :=self.LbledtEdu.Text;
  self.Model.Personality.Value:=self.lbledtPersonality.Text;
  self.Model.PersonHobbie.value:=self.lbledtPersonHobbie.Text;
  self.Model.PersonSign.Value:=self.lbledtpersonsign.Text;
  self.Model.Email.value:=self.lbledtemail.Text;
  self.Model.PersonPhone.Value:=self.lbledtphone.Text;
  self.Model.Remark.Value:=self.mmoRemark.Text;
  self.ModalResult:=mrok;
end;

procedure TModifyForm.FormCreate(Sender: TObject);
begin
  Model:=nil;
end;

procedure TModifyForm.FormDestroy(Sender: TObject);
begin
if model<>nil then
model.free;
end;

procedure TModifyForm.FormShow(Sender: TObject);
begin
  self.lbledtusername.Text:=self.Model.UserName.Value;
  self.lbledtpass.Text:=self.Model.Password.Value;
  self.lbledtnickname.Text:=self.Model.Nickname.value;
  self.lbledthead.Text:=self.model.HeadImg.Value;
  self.lbledtsex.Text:=self.Model.Sex.Value;
  self.lbledtbirthday.Text:=self.Model.Birthday.Value;
  self.lbledtDepart.Text:=self.Model.DepartMent.value;
  self.lbledtJobType.Text:=self.model.JobType.Value;
  self.LbledtEdu.Text:=self.Model.Edu.Value ;
  self.lbledtPersonality.Text:=self.Model.Personality.Value;
  self.lbledtPersonHobbie.Text:=self.Model.PersonHobbie.value;
  self.lbledtpersonsign.Text:=self.Model.PersonSign.Value;
  self.lbledtemail.Text:=self.Model.Email.value;
  self.lbledtphone.Text:=self.Model.PersonPhone.Value;
  self.mmoRemark.Text:=self.Model.Remark.Value;
end;

end.
