示例#1
0
 /// <summary>
 /// Constructor for frmAddEditEmployee.
 /// Set EmployeeToAddOrEdit and all fields.
 /// </summary>
 /// <param name="employeeIn">The employee to Add or Edit.</param>
 public frmAddEditEmployee(Employee employeeIn)
 {
     try
     {
         InitializeComponent();
         // set EmployeeToAddOrEdit property
         this.EmployeeToAddOrEdit = employeeIn;
         // set all text fields
         txtFirstName.Text     = this.EmployeeToAddOrEdit.FirstName;
         txtMiddleName.Text    = this.EmployeeToAddOrEdit.MiddleName;
         txtLastName.Text      = this.EmployeeToAddOrEdit.LastName;
         txtJobTitle.Text      = this.EmployeeToAddOrEdit.JobTitle;
         txtPhone.Text         = this.EmployeeToAddOrEdit.Phone;
         txtEmail.Text         = this.EmployeeToAddOrEdit.Email;
         pictureBoxPhoto.Image = ImageFunctions.GetImageFromByteArray(this.EmployeeToAddOrEdit.Photo);
         // store the byte array of the photo in the tag of pictureBoxPhoto
         pictureBoxPhoto.Tag = this.EmployeeToAddOrEdit.Photo;
     }
     catch (Exception ex)
     {
         LogFunctions.LogException(ex);
     }
 }