private void UpdatePersonOptionalField(Person person, OptionalFields optionalField, string value)
 {
     var personOptionalField = person.PersonOptionalFields.FirstOrDefault(c => c.OptionalFieldId == (int)optionalField);
     if (personOptionalField == null)
     {
         personOptionalField = new PersonOptionalField
         {
             OptionalFieldId = (int)optionalField,
             Created = DateTime.Now,
             Changed = DateTime.Now
         };
         person.PersonOptionalFields.Add(personOptionalField);
     }
     if (personOptionalField.Value != (value ?? string.Empty))
         personOptionalField.Changed = DateTime.Now;
     personOptionalField.Value = value ?? string.Empty;
 }
        private static void AddCellPhoneNoToList(ICollection<string> cellPhoneNos, PersonOptionalField po)
        {
            if (po.Value.Trim() == string.Empty)
                return;

            if (!cellPhoneNos.Contains(po.Value.Trim()))
                cellPhoneNos.Add(po.Value.Trim());
        }
예제 #3
0
 /// <summary>
 /// Create a new PersonOptionalField object.
 /// </summary>
 /// <param name="personOptionalFieldId">Initial value of the PersonOptionalFieldId property.</param>
 /// <param name="personId">Initial value of the PersonId property.</param>
 /// <param name="optionalFieldId">Initial value of the OptionalFieldId property.</param>
 /// <param name="value">Initial value of the Value property.</param>
 /// <param name="created">Initial value of the Created property.</param>
 /// <param name="changed">Initial value of the Changed property.</param>
 public static PersonOptionalField CreatePersonOptionalField(global::System.Int32 personOptionalFieldId, global::System.Int32 personId, global::System.Int32 optionalFieldId, global::System.String value, global::System.DateTime created, global::System.DateTime changed)
 {
     PersonOptionalField personOptionalField = new PersonOptionalField();
     personOptionalField.PersonOptionalFieldId = personOptionalFieldId;
     personOptionalField.PersonId = personId;
     personOptionalField.OptionalFieldId = optionalFieldId;
     personOptionalField.Value = value;
     personOptionalField.Created = created;
     personOptionalField.Changed = changed;
     return personOptionalField;
 }
예제 #4
0
 /// <summary>
 /// Deprecated Method for adding a new object to the PersonOptionalFields EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToPersonOptionalFields(PersonOptionalField personOptionalField)
 {
     base.AddObject("PersonOptionalFields", personOptionalField);
 }
예제 #5
0
        private static void AddCellPhoneNoToList(Person currentPerson, List<string> cellPhoneNos, PersonOptionalField po)
        {
            if (po.Value.Trim() == string.Empty)
                return;

            string internationalCellPhoneNo = Utils.ConvertCellPhoneToInternational(po.Value, currentPerson.Church.Country);
            if (!cellPhoneNos.Contains(internationalCellPhoneNo))
                cellPhoneNos.Add(internationalCellPhoneNo);
        }
예제 #6
0
 public void SaveWindowsLiveId(PersonViewModel person, Person personToSave)
 {
     if (string.IsNullOrEmpty(person.WindowsLiveId)) return;
     var windowsLiveId = Context.PersonOptionalFields.FirstOrDefault(p => p.OptionalFieldId == (int)OptionalFields.WindowsLive && p.PersonId == personToSave.PersonId);
     if (windowsLiveId == null)
     {
         windowsLiveId = new PersonOptionalField
         {
             Changed = DateTime.Now,
             Created = DateTime.Now,
             OptionalFieldId = (int)OptionalFields.WindowsLive,
             PersonId = personToSave.PersonId,
             Value = person.WindowsLiveId
         };
         Context.AddToPersonOptionalFields(windowsLiveId);
         Context.SaveChanges();
     }
     else
     {
         if (windowsLiveId.Value != person.WindowsLiveId)
         {
             windowsLiveId.Value = person.WindowsLiveId;
             Context.SaveChanges();
         }
     }
 }