本文整理汇总了C#中Person.GetLatestRegistration方法的典型用法代码示例。如果您正苦于以下问题:C# Person.GetLatestRegistration方法的具体用法?C# Person.GetLatestRegistration怎么用?C# Person.GetLatestRegistration使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Person
的用法示例。
在下文中一共展示了Person.GetLatestRegistration方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HotelUpdate
public void HotelUpdate(Person person, string siteId)
{
var seminar = SiteService.GetLatestSeminar(siteId);
var seminarPerson = person.GetLatestRegistration(siteId);
if (seminarPerson.Seminar == seminar && !string.IsNullOrWhiteSpace(seminarPerson.HotelConfirmation))
{
_notificationService.RemoveFromMailingList(seminar, person, MailingLists.HotelReminder);
}
}
示例2: GetDisplayPerson
/// <summary>
/// Generates person with the associated latest revision of firm
/// </summary>
/// <param name="person"></param>
/// <param name="firms">List of firms, there should only be one instance of each firm in this list</param>
/// <returns></returns>
public DisplayPerson GetDisplayPerson(Person person, string site, Seminar seminar = null)
{
Check.Require(person != null, "person is required.");
var displayPerson = new DisplayPerson() {Person = person};
var reg = seminar == null ? person.GetLatestRegistration(site) : person.SeminarPeople.Where(a=>a.Seminar == seminar).FirstOrDefault();
if (reg == null) return displayPerson;
displayPerson.Seminar = reg.Seminar;
displayPerson.Firm = reg.Firm;
displayPerson.Title = reg.Title;
return displayPerson;
}
示例3: Paid
public void Paid(Person person, string siteId)
{
var seminar = SiteService.GetLatestSeminar(siteId);
var seminarPerson = person.GetLatestRegistration(siteId);
if (seminarPerson.Paid)
{
_notificationService.RemoveFromMailingList(seminar, person, MailingLists.PaymentReminder);
_notificationService.AddToMailingList(seminar, person, MailingLists.Attending);
}
}
示例4: Create
public static PersonViewModel Create(IRepository repository, IFirmService firmService, string site, Seminar seminar = null, Person person = null, string email = null, Firm firm = null)
{
Check.Require(repository != null, "Repository must be supplied");
var viewModel = new PersonViewModel()
{
Person = person ?? new Person(),
Addresses = repository.OfType<AddressType>().Queryable.Select(a => new Address() { AddressType = a}).ToList(),
Contacts = repository.OfType<ContactType>().Queryable.Select( a => new Contact(){ContactType = a}).ToList(),
Countries = repository.OfType<Country>().GetAll(),
CommunicationOptions = repository.OfType<CommunicationOption>().GetAll(),
SeminarPerson = person != null ? person.GetLatestRegistration(site) : null,
Email = email,
Seminar = seminar,
Commodities = repository.OfType<Commodity>().Queryable.Where(a=>a.IsActive).ToList(),
Firm = firm ?? new Firm()
};
if (firm == null && viewModel.SeminarPerson != null)
{
viewModel.Firm = viewModel.SeminarPerson.Firm;
}
// find any addresses and replace them into the list
if (person != null)
{
foreach(var a in person.Addresses)
{
var addr = viewModel.Addresses.Where(b => b.AddressType == a.AddressType).FirstOrDefault();
if (addr != null) viewModel.Addresses.Remove(addr);
viewModel.Addresses.Add(a);
}
foreach (var a in person.Contacts)
{
var ct = viewModel.Contacts.Where(b => b.ContactType == a.ContactType).FirstOrDefault();
if (ct != null) viewModel.Contacts.Remove(ct);
viewModel.Contacts.Add(a);
}
}
// reorder so always in the same order
viewModel.Addresses = viewModel.Addresses.OrderBy(a => a.AddressType.Id).ToList();
viewModel.Contacts = viewModel.Contacts.OrderBy(a => a.ContactType.Id).ToList();
// get the firms and add the "Other" option
var firms = new List<Firm>(firmService.GetAllFirms());
firms.Add(new Firm() { Name = "Other (Not Listed)" });
viewModel.Firms = firms;
if (viewModel.Person.User != null) viewModel.UserName = viewModel.Person.User.UserName;
return viewModel;
}