/* (non-Javadoc)
* @see systole.view.crud.controller.ControllerEntityEdition#loadEntityFromForm()
*/
@Override
protected void loadEntityFromForm() {
Medic medicToLoad = (Medic) this.curretnEntity;
JDialogMedic formToLoad = (JDialogMedic) this.editForm;
medicToLoad.setSurname(formToLoad.getjEdtSurname().getText());
medicToLoad.setName(formToLoad.getjEdtName().getText());
if (medicToLoad.getIdentityCard() == null) {
medicToLoad.setIdentityCard(new IdentityCard());
}
medicToLoad.getIdentityCard().setCardType(
(IdentityCardType) formToLoad.getjCbmIdentityType().getSelectedItem());
try {
medicToLoad.getIdentityCard().setNumber(
Integer.parseInt(formToLoad.getjEdtIdentityNumber().getText()));
} catch (NumberFormatException e) {
medicToLoad.getIdentityCard().setCardType(null);
}
medicToLoad.setSex((String) formToLoad.getjCbmSex().getSelectedItem());
formToLoad.getjCbmSex().setSelectedItem(medicToLoad.getSex());
medicToLoad.setCellphone(formToLoad.getjEdtCellphone().getText());
medicToLoad.setEmail(formToLoad.getjEdtMail().getText());
medicToLoad.setTelephone(formToLoad.getjEdtTelephone().getText());
medicToLoad.setBirthdate(formToLoad.getjXDatePickerBirthdate().getDate());
medicToLoad.setSpecialty(formToLoad.getjTxtSpeciality().getText());
medicToLoad.setLicense(formToLoad.getjTxtLicense().getText());
medicToLoad.setLastUpdate(Calendar.getInstance());
}