本文整理汇总了C#中IPerson类的典型用法代码示例。如果您正苦于以下问题:C# IPerson类的具体用法?C# IPerson怎么用?C# IPerson使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IPerson类属于命名空间,在下文中一共展示了IPerson类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: IsOlderThan
public bool IsOlderThan(IPerson other)
{
DateTime firstDate, secondDate;
try
{
firstDate = DateTime.Parse(this.OtherInfo.Substring(this.OtherInfo.Length - 10));
}
catch (Exception)
{
throw new InvalidCastException("First data is not valid!");
}
try
{
secondDate = DateTime.Parse(other.OtherInfo.Substring(other.OtherInfo.Length - 10));
}
catch (Exception)
{
throw new InvalidCastException("Second data is not valid!");
}
return firstDate < secondDate;
}
开发者ID:jerko0,项目名称:Telerik-Academy,代码行数:25,代码来源:Student.cs
示例2: MapToEntity
public virtual void MapToEntity(IPersonModel model, ref IPerson entity, int currentDepth = 1)
{
currentDepth++;
// Assign Base properties
NameableEntityMapper.MapToEntity(model, ref entity);
// Person Properties
entity.Hometown = model.Hometown;
entity.Country = model.Country;
entity.Email = model.Email;
entity.Website = model.Website;
entity.BirthDate = model.BirthDate;
entity.DeathDate = model.DeathDate;
// Related Objects
entity.PrimaryImageFileId = model.PrimaryImageFileId;
entity.PrimaryImageFile = (ImageFile)model.PrimaryImageFile?.MapToEntity();
entity.GenderId = model.GenderId;
entity.Gender = (Gender)model.Gender?.MapToEntity();
// Associated Objects
entity.CharactersCreated = model.CharactersCreated?.Where(i => i.Active).Select(CreatorCharacterMapperExtensions.MapToEntity).ToList();
entity.PersonAliases = model.PersonAliases?.Where(i => i.Active).Select(PersonAliasMapperExtensions.MapToEntity).ToList();
entity.IssuesWritten = model.IssuesWritten?.Where(i => i.Active).Select(IssueWriterMapperExtensions.MapToEntity).ToList();
entity.MoviesProduced = model.MoviesProduced?.Where(i => i.Active).Select(MovieProducerMapperExtensions.MapToEntity).ToList();
entity.MoviesWritten = model.MoviesWritten?.Where(i => i.Active).Select(MovieWriterMapperExtensions.MapToEntity).ToList();
entity.PromosWritten = model.PromosWritten?.Where(i => i.Active).Select(PromoMapperExtensions.MapToEntity).ToList();
entity.StoryArcsWritten = model.StoryArcsWritten?.Where(i => i.Active).Select(StoryArcWriterMapperExtensions.MapToEntity).ToList();
entity.VolumesWritten = model.VolumesWritten?.Where(i => i.Active).Select(VolumeWriterMapperExtensions.MapToEntity).ToList();
}
开发者ID:Jothay,项目名称:comic-vinescraper-api,代码行数:27,代码来源:People.PersonMappings.cs
示例3: UpdatePerson
public void UpdatePerson(IPerson person)
{
var ctx = new AddressBookContext();
var entity = ctx.Persons.Find(person.ID);
Mappings.Map(person, entity);
ctx.SaveChanges();
}
开发者ID:guttsy,项目名称:CslaAddressBook,代码行数:7,代码来源:PersonRepository.cs
示例4: ContainsPerson
public bool ContainsPerson(IPerson person)
{
if (person == null)
throw new ArgumentNullException(nameof(person));
return _cache.ContainsKey(person);
}
开发者ID:Mirandatz,项目名称:Bentham,代码行数:7,代码来源:PersonCollectionControl.cs
示例5: AddPerson
/// <summary>
/// Adds the person.
/// </summary>
/// <param name="person">The person.</param>
/// <param name="hostName">Name of the host.</param>
/// <returns></returns>
/// <exception cref="InverGrove.Domain.Exceptions.ParameterNullException">person</exception>
public IPerson AddPerson(IPerson person, string hostName)
{
Guard.ParameterNotNull(person, "person");
/* TODO - Check if this EMAIL address exists. Email will be the sole check to guard against duplicate persons.
TODO - People will be a cached list that is placed into cache when a person logs into the website.
This list will never be more than a couple hundred (likley around 150) so no big deal caching that.
*/
var existingPerson = this.personRepository.Get(p => p.EmailPrimary == person.PrimaryEmail).FirstOrDefault().ToModel();
var existingEmail = this.EmailExists(person, existingPerson);
if (!string.IsNullOrEmpty(person.PrimaryEmail) && existingEmail)
{
person.PersonId = existingPerson.PersonId;
person.ErrorMessage = "This email address already exists.";
return person;
}
person.PersonId = this.personRepository.Add(person);
if (person.IsUser && (person.PersonId > 0))
{
this.SendNewUserVerification(person, hostName);
}
return person;
}
开发者ID:danghung1202,项目名称:invergrovechurch,代码行数:35,代码来源:PersonService.cs
示例6: AddNewContact
public IContact AddNewContact(IPerson person, string typeContact, string valueContact)
{
if (person == null) throw new ArgumentNullException("person");
if (string.IsNullOrWhiteSpace(typeContact)) throw new ArgumentNullException("typeContact");
if (string.IsNullOrWhiteSpace(valueContact)) throw new ArgumentNullException("valueContact");
int newId = 1;
while (true)
{
bool flag = true;
foreach (var z in Persons)
foreach(var cont in z.Contacts)
if (cont.ID == newId)
{
++newId;
flag = false;
}
if(flag)
break;
}
var newContact = new Contact(newId, person.ID, typeContact, valueContact);
person.Contacts.Add(newContact);
RaisePropertyChanged("Persons");
return newContact;
}
开发者ID:phoenixdd28,项目名称:Kursovik,代码行数:31,代码来源:RamConnection.cs
示例7: it_must_have_a_converter
public void it_must_have_a_converter(BindingManager bindingManager, MultiSourceBinding binding, IPerson targetObject, IAddress sourceObject)
{
bindingManager.Bindings.Remove(binding);
binding.Converter = null;
var ex = Assert.Throws<InvalidOperationException>(() => bindingManager.Bindings.Add(binding));
Assert.Equal("All MultiSourceBindings require a converter.", ex.Message);
}
开发者ID:tfreitasleal,项目名称:MvvmFx,代码行数:7,代码来源:When_a_multi_source_binding_is_added_to_a_binding_manager.cs
示例8: changes_to_the_source_should_be_marshalled_via_a_call_to_send
public void changes_to_the_source_should_be_marshalled_via_a_call_to_send(Mock<SynchronizationContext> synchronizationContext, BindingManager bindingManager, IPerson targetObject, IAddress sourceObject)
{
synchronizationContext.Setup(x => x.Send(It.IsAny<SendOrPostCallback>(), It.IsAny<object>()));
sourceObject.Line1 = "Line 1, mighty fine";
synchronizationContext.VerifyAll();
}
开发者ID:tfreitasleal,项目名称:MvvmFx,代码行数:7,代码来源:When_a_binding_has_a_synchronization_context.cs
示例9: the_converted_value_is_used_when_the_target_is_changed
public void the_converted_value_is_used_when_the_target_is_changed(BindingManager bindingManager, SingleSourceBinding binding, Mock<IValueConverter> converter, IPerson targetObject, IPerson sourceObject)
{
converter.Setup(x => x.ConvertBack("Value", typeof(string), "parameter", null)).Returns("Converted Value");
targetObject.Address.Line2 = "Value";
Assert.Equal("Converted Value", sourceObject.Address.Line1);
converter.VerifyAll();
}
开发者ID:tfreitasleal,项目名称:MvvmFx,代码行数:7,代码来源:When_a_single_source_binding_has_a_converter.cs
示例10: conversions_from_target_to_source_are_ignored_when_there_is_no_converter
public void conversions_from_target_to_source_are_ignored_when_there_is_no_converter(BindingManager bindingManager, SingleSourceBinding binding, IPerson targetObject, IPerson sourceObject)
{
targetObject.Name = "Kent";
Assert.Null(sourceObject.Gender);
targetObject.Name = "Male";
Assert.Null(sourceObject.Gender);
}
开发者ID:tfreitasleal,项目名称:MvvmFx,代码行数:8,代码来源:When_a_single_source_binding_has_a_mismatch_between_target_and_source_types_and_no_automatic_conversion_exists.cs
示例11: updating_the_target_does_not_update_the_source
public void updating_the_target_does_not_update_the_source(BindingManager bindingManager, IPerson targetObject, IAddress sourceObject)
{
targetObject.Name = "A new address";
Assert.Null(sourceObject.Line1);
targetObject.Name = "Another new address";
Assert.Null(sourceObject.Line1);
}
开发者ID:tfreitasleal,项目名称:MvvmFx,代码行数:8,代码来源:When_a_binding_is_one_way_to_target.cs
示例12: it_is_not_yet_active
public void it_is_not_yet_active(SingleSourceBinding binding, IPerson targetObject, IPerson sourceObject)
{
sourceObject.Name = "New Name";
Assert.Null(targetObject.Name);
targetObject.Name = "Another Name";
Assert.Equal("New Name", sourceObject.Name);
}
开发者ID:tfreitasleal,项目名称:MvvmFx,代码行数:8,代码来源:When_a_single_source_binding_is_created_with_source_and_target_information.cs
示例13: Spouse
public Spouse(IPerson me, IPerson so, DateTime marriageDt, DateTime? divorceDt, int ordinal)
{
_me = me;
_est = so;
_marriedOn = marriageDt;
_separatedOn = divorceDt;
_ordinal = ordinal;
}
开发者ID:nofuture-git,项目名称:31g,代码行数:8,代码来源:Spouse.cs
示例14: conversions_from_target_to_source_are_automatically_converted_where_possible
public void conversions_from_target_to_source_are_automatically_converted_where_possible(BindingManager bindingManager, SingleSourceBinding binding, IPerson targetObject, IPerson sourceObject)
{
targetObject.Name = "69";
Assert.Equal(69, sourceObject.Age);
targetObject.Name = "13a";
Assert.Equal(69, sourceObject.Age);
}
开发者ID:tfreitasleal,项目名称:MvvmFx,代码行数:8,代码来源:When_a_single_source_binding_has_a_mismatch_between_target_and_source_types_and_an_automatic_conversion_exists.cs
示例15: InsertPerson
public void InsertPerson(IPerson person)
{
var ctx = new AddressBookContext();
var entity = new Person();
Mappings.Map(person, entity);
ctx.Persons.Add(entity);
ctx.SaveChanges();
}
开发者ID:guttsy,项目名称:CslaAddressBook,代码行数:8,代码来源:PersonRepository.cs
示例16: CompareTo
public int CompareTo(IPerson other)
{
if (this.Id < other.Id) return -1;
return this.Id > other.Id ? 1 : 0;
// If ids are both 0 (no id for students), then no guidelines are given => equals.
// But we could consider sorting them by their family names if needed.
}
开发者ID:matgardon,项目名称:InfomaniakPeopleManagementTool,代码行数:8,代码来源:Person.cs
示例17: it_becomes_active
public void it_becomes_active(BindingManager bindingManager, SingleSourceBinding binding, IPerson targetObject, IPerson sourceObject)
{
sourceObject.Name = "New Name";
Assert.Equal("New Name", targetObject.Name);
targetObject.Name = "Another Name";
Assert.Equal("Another Name", sourceObject.Name);
}
开发者ID:tfreitasleal,项目名称:MvvmFx,代码行数:8,代码来源:When_a_single_source_binding_is_added_to_a_binding_manager.cs
示例18: Supplement
public Supplement(bool isHourCanceled, DateTime date, ITeachingHour hour, ISchedule schedule, IPerson teacher = null)
{
this.IsHourCanceled = isHourCanceled;
this.Date = date;
this.Hour = hour;
this.Schedule = schedule;
this.Teacher = teacher;
}
开发者ID:Kobzol,项目名称:VIS-project,代码行数:8,代码来源:Supplement.cs
示例19: IsDismissed
private bool IsDismissed(IPerson person, DateTime day)
{
if (person.DayOfWeekDismisses.Any(d => d.GetDismissStatus(day).Dismissed))
return true;
if (person.TemporaryDismisses.Any(d => d.GetDismissStatus(day).Dismissed))
return true;
return false;
}
开发者ID:Mirandatz,项目名称:Bentham,代码行数:8,代码来源:Report.cs
示例20: it_is_not_yet_active
public void it_is_not_yet_active(MultiSourceBinding binding, IPerson targetObject, IAddress sourceObject)
{
sourceObject.Line1 = "Line 1";
Assert.Null(targetObject.Name);
targetObject.Name = "Another Name";
Assert.Equal("Line 1", sourceObject.Line1);
}
开发者ID:tfreitasleal,项目名称:MvvmFx,代码行数:8,代码来源:When_a_multi_source_binding_is_created_with_target_information.cs
注:本文中的IPerson类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论