public static EmploymentTerm CreateEmploymentTerm(string personnelNumber,
                                                          string legalEntityId,
                                                          global::System.DateTimeOffset employmentStartDate,
                                                          global::System.DateTimeOffset employmentEndDate,
                                                          string agreementTermId,
                                                          global::System.DateTimeOffset validFrom,
                                                          global::System.DateTimeOffset validTo,
                                                          global::Microsoft.Dynamics.DataEntities.Employment employment,
                                                          global::Microsoft.Dynamics.DataEntities.AgreementTerm agreementTerm)
        {
            EmploymentTerm employmentTerm = new EmploymentTerm();

            employmentTerm.PersonnelNumber     = personnelNumber;
            employmentTerm.LegalEntityId       = legalEntityId;
            employmentTerm.EmploymentStartDate = employmentStartDate;
            employmentTerm.EmploymentEndDate   = employmentEndDate;
            employmentTerm.AgreementTermId     = agreementTermId;
            employmentTerm.ValidFrom           = validFrom;
            employmentTerm.ValidTo             = validTo;
            if ((employment == null))
            {
                throw new global::System.ArgumentNullException("employment");
            }
            employmentTerm.Employment = employment;
            if ((agreementTerm == null))
            {
                throw new global::System.ArgumentNullException("agreementTerm");
            }
            employmentTerm.AgreementTerm = agreementTerm;
            return(employmentTerm);
        }
 partial void OnAgreementTermChanging(global::Microsoft.Dynamics.DataEntities.AgreementTerm value);