コード例 #1
0
        /*public Patient DeepClone()
         * {
         *  Patient ret = base.Clone() as Patient;
         *  ret.m_IsNew = this.IsNew;
         *  ret.m_ObjectName = this.m_ObjectName;
         *  Accessor acc = Accessor.Instance(null);
         *  if (CurrentResidenceAddress != null)
         *      ret.CurrentResidenceAddress = CurrentResidenceAddress.DeepClone();
         *  if (EmployerAddress != null)
         *      ret.EmployerAddress = EmployerAddress.DeepClone();
         *  using (DbManagerProxy manager = DbManagerFactory.Factory.Create(ModelUserContext.Instance))
         *  {
         *      acc._SetupLoad(manager, ret);
         *  }
         *  return ret;
         * }*/

        public Patient CopyFrom(DbManagerProxy manager, Patient source)
        {
            // copy all fields, except primaryKey
            var ret = source.CloneWithSetup(manager) as Patient;

            if (ret == null)
            {
                return(null);
            }

            ret.idfHuman     = idfHuman;
            ret.idfRootHuman = source.idfRootHuman.HasValue ? source.idfRootHuman : source.idfHuman;
            if (CurrentResidenceAddress != null && source.CurrentResidenceAddress != null)
            {
                ret.CurrentResidenceAddress = CurrentResidenceAddress.CopyFrom(manager, source.CurrentResidenceAddress);
            }
            if (EmployerAddress != null && source.EmployerAddress != null)
            {
                ret.EmployerAddress = EmployerAddress.CopyFrom(manager, source.EmployerAddress);
            }
            if (RegistrationAddress != null && source.RegistrationAddress != null)
            {
                ret.RegistrationAddress = RegistrationAddress.CopyFrom(manager, source.RegistrationAddress);
            }
            else if (source.RegistrationAddress != null)
            {
                ret.RegistrationAddress = source.RegistrationAddress.CloneWithSetup(manager) as Address;
            }

            return(ret);
        }
コード例 #2
0
        /// <inheritdoc/>
        public string ToDelimitedString()
        {
            CultureInfo culture = CultureInfo.CurrentCulture;

            return(string.Format(
                       culture,
                       StringHelper.StringFormatSequence(0, 19, Configuration.FieldSeparator),
                       Id,
                       SetId.HasValue ? SetId.Value.ToString(culture) : null,
                       ActionCode,
                       EnteredDate.HasValue ? EnteredDate.Value.ToString(Consts.DateFormatPrecisionDay, culture) : null,
                       Occupation?.ToDelimitedString(),
                       Industry?.ToDelimitedString(),
                       WorkClassification?.ToDelimitedString(),
                       JobStartDate.HasValue ? JobStartDate.Value.ToString(Consts.DateFormatPrecisionDay, culture) : null,
                       JobEndDate.HasValue ? JobEndDate.Value.ToString(Consts.DateFormatPrecisionDay, culture) : null,
                       WorkSchedule?.ToDelimitedString(),
                       AverageHoursWorkedPerDay.HasValue ? AverageHoursWorkedPerDay.Value.ToString(Consts.NumericFormat, culture) : null,
                       AverageDaysWorkedPerWeek.HasValue ? AverageDaysWorkedPerWeek.Value.ToString(Consts.NumericFormat, culture) : null,
                       EmployerOrganization?.ToDelimitedString(),
                       EmployerAddress != null ? string.Join(Configuration.FieldRepeatSeparator, EmployerAddress.Select(x => x.ToDelimitedString())) : null,
                       SupervisoryLevel?.ToDelimitedString(),
                       JobDuties != null ? string.Join(Configuration.FieldRepeatSeparator, JobDuties) : null,
                       OccupationalHazards != null ? string.Join(Configuration.FieldRepeatSeparator, OccupationalHazards) : null,
                       JobUniqueIdentifier?.ToDelimitedString(),
                       CurrentJobIndicator?.ToDelimitedString()
                       ).TrimEnd(Configuration.FieldSeparator.ToCharArray()));
        }
コード例 #3
0
 public void Handle(EmployerChangedEvent message)
 {
     _selectedEmployer = message.Employer;
     EmployerAddress   = _myRepository.GetEmployeeAddresses()
                         .FirstOrDefault(e => e.EmployerId == _selectedEmployer.Id);
 }