コード例 #1
0
        public static void SetContactValue(this OpenHR001Person person, vocContactType contactType, string value)
        {
            dtContact contact = (person.contact ?? new dtContact[] { }).FirstOrDefault(t => t.contactType == contactType);

            if (!string.IsNullOrEmpty(value))
            {
                if (contact == null)
                {
                    contact = new dtContact()
                    {
                        contactType = contactType,
                        updateMode  = vocUpdateMode.add,
                        id          = Guid.NewGuid().ToString()
                    };

                    person.contact = (person.contact ?? new dtContact[] { })
                                     .Concat(new dtContact[] { contact })
                                     .ToArray();
                }

                contact.value = value;
            }
            else
            {
                if (contact != null)
                {
                    person.contact = person.contact
                                     .Where(t => t != contact)
                                     .ToArray();
                }
            }
        }
コード例 #2
0
 public static string GetCuiDobString(this OpenHR001Person person)
 {
     return(person.birthDate.ToString("dd-MMM-yyyy"));
 }
コード例 #3
0
 public static string GetCuiDobStringWithAge(this OpenHR001Person person)
 {
     return(GetCuiDobString(person) + " (" + ((int)((DateTime.Now - person.birthDate).TotalDays / 365)).ToString() + "y)");
 }
コード例 #4
0
 public static string GetCuiDisplayName(this OpenHR001Person person)
 {
     return(person.surname.ToUpper() + ", " + person.forenames + " (" + person.title + ")");
 }