Ejemplo n.º 1
0
        /// <summary>
        /// Returns true if UserDetailsInfo instances are equal
        /// </summary>
        /// <param name="other">Instance of UserDetailsInfo to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(UserDetailsInfo other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     FirstName == other.FirstName ||
                     FirstName != null &&
                     FirstName.Equals(other.FirstName)
                     ) &&
                 (
                     LastName == other.LastName ||
                     LastName != null &&
                     LastName.Equals(other.LastName)
                 ) &&
                 (
                     DateOfBirth == other.DateOfBirth ||
                     DateOfBirth != null &&
                     DateOfBirth.Equals(other.DateOfBirth)
                 ) &&
                 (
                     PlaceOfBirth == other.PlaceOfBirth ||
                     PlaceOfBirth != null &&
                     PlaceOfBirth.Equals(other.PlaceOfBirth)
                 ) &&
                 (
                     NationalIdNumber == other.NationalIdNumber ||
                     NationalIdNumber != null &&
                     NationalIdNumber.Equals(other.NationalIdNumber)
                 ) &&
                 (
                     NationalIdType == other.NationalIdType ||
                     NationalIdType != null &&
                     NationalIdType.Equals(other.NationalIdType)
                 ) &&
                 (
                     PrimaryCitizenshipId == other.PrimaryCitizenshipId ||
                     PrimaryCitizenshipId != null &&
                     PrimaryCitizenshipId.Equals(other.PrimaryCitizenshipId)
                 ) &&
                 (
                     PrimaryAddressId == other.PrimaryAddressId ||
                     PrimaryAddressId != null &&
                     PrimaryAddressId.Equals(other.PrimaryAddressId)
                 ));
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (FirstName != null)
         {
             hashCode = hashCode * 59 + FirstName.GetHashCode();
         }
         if (LastName != null)
         {
             hashCode = hashCode * 59 + LastName.GetHashCode();
         }
         if (DateOfBirth != null)
         {
             hashCode = hashCode * 59 + DateOfBirth.GetHashCode();
         }
         if (PlaceOfBirth != null)
         {
             hashCode = hashCode * 59 + PlaceOfBirth.GetHashCode();
         }
         if (NationalIdNumber != null)
         {
             hashCode = hashCode * 59 + NationalIdNumber.GetHashCode();
         }
         if (NationalIdType != null)
         {
             hashCode = hashCode * 59 + NationalIdType.GetHashCode();
         }
         if (PrimaryCitizenshipId != null)
         {
             hashCode = hashCode * 59 + PrimaryCitizenshipId.GetHashCode();
         }
         if (PrimaryAddressId != null)
         {
             hashCode = hashCode * 59 + PrimaryAddressId.GetHashCode();
         }
         return(hashCode);
     }
 }
        public override object ConvertTo(System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
        {
            var r = value as zz;

            if (destinationType.Equals(typeof(Client)))
            {
                var c = new Client();
                c.Id         = r.CLIENT_ID;
                c.Agency     = agencies.Single(f => f.Id == r.ORG_ID);
                c.LastName   = r.LAST_NAME;
                c.FirstName  = r.FIRST_NAME;
                c.MiddleName = r.MIDDLE_NAME;
                c.BirthDate  = r.DOB;

                c.Address = r.ADDRESS;
                c.City    = r.CITY;
                if (!string.IsNullOrEmpty(r.STATE_CODE))
                {
                    try { c.State = states.Single(f => f.Code == r.STATE_CODE); }
                    catch (InvalidOperationException) { /*ignore states*/ }
                }
                if (!string.IsNullOrEmpty(r.TYPE_OF_ID))
                {
                    try { c.NationalIdType = nationalIdTypes.Single(f => f.Name.Equals(r.TYPE_OF_ID, StringComparison.InvariantCultureIgnoreCase)); }
                    catch (InvalidOperationException)
                    {
                        var n = new NationalIdType()
                        {
                            Name = r.TYPE_OF_ID
                        };
                        using (var db = new ccEntities())
                        {
                            db.NationalIdTypes.AddObject(n);
                            db.SaveChanges();
                            c.NationalIdType = n;
                            nationalIdTypes.Add(n);
                        }
                        //throw new InvalidOperationException("NationalIdType \"" + r.TYPE_OF_ID + "\" is invalid.");
                    }
                }
                c.NationalId = r.Gov_ID;
                c.Phone      = r.PHONE;

                c.IsCeefRecipient = r.CLIENT_COMP_PROGRAM;
                c.CeefId          = r.COMP_PROG_REG_NUM;

                c.AddCompName = r.AdditionalComp;
                c.AddCompId   = r.AdditionalCompNum;

                //c.Deceased
                c.DeceasedDate = r.DOD;
                c.New_Client   = r.New_Client;
                c.UpdatedAt    = r.Upload_Date ?? DateTime.Now;
                c.MatchFlag    = r.MatchFlag;
                c.FundStatus   = r.Fund_Status;


                return(c);
            }
            return(base.ConvertTo(context, culture, value, destinationType));
        }