Exemplo n.º 1
0
 public EditAnimalForm(Animal animal)
 {
     InitializeComponent( );
     AnimalKindForm = new AnimalKindForm(this);
     isNew          = animal == null;
     if (isNew)
     {
         this.Animal = new Animal( );
         TextBoxNameAdd.BackColor        = Program.ErrorBackColor;
         TextBoxAddAge.BackColor         = Program.ErrorBackColor;
         DateTimePickerAdd.Value         = DateTime.Now;
         TextBoxAddPerson1Name.BackColor = Program.ErrorBackColor;
         TextBoxAddPerson2Name.BackColor = Program.ErrorBackColor;
     }
     else
     {
         this.Animal                = animal;
         TextBoxNameAdd.Text        = Animal.Name;
         TextBoxAddAge.Text         = Animal.Age.ToString( );
         TextBoxAddDescription.Text = Animal.Description;
         DateTimePickerAdd.Value    = Animal.ReceiptDate;
         (Animal.IsInRedBook ? RadioButtonIsIn : RadioButtonIsNotIn).Checked = true;
         LabelType.Text             = Animal.Type;
         LabelClass.Text            = Animal.Class;
         LabelDetachment.Text       = Animal.Detachment;
         TextBoxAddPerson1Name.Text = Animal.Bailee.FirstName;
         TextBoxAddPerson2Name.Text = Animal.Bailee.LastName;
         UpdateHabitats( );
     }
 }
Exemplo n.º 2
0
 private void ButtonKindEdit_Click(Object sender, EventArgs e)
 {
     AnimalKindForm = new AnimalKindForm(this);
     AnimalKindForm.Show( );
     AnimalKindForm.Focus( );
 }