本文整理汇总了C#中Visitor.AssignVisitorAccessCard方法的典型用法代码示例。如果您正苦于以下问题:C# Visitor.AssignVisitorAccessCard方法的具体用法?C# Visitor.AssignVisitorAccessCard怎么用?C# Visitor.AssignVisitorAccessCard使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Visitor
的用法示例。
在下文中一共展示了Visitor.AssignVisitorAccessCard方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MapVisitorData
/// <summary>
/// Maps the visitor data.
/// </summary>
/// <param name="visitor">The visitor.</param>
/// <param name="persons">The persons.</param>
/// <param name="eventType">Type of the event.</param>
private static void MapVisitorData(Visitor visitor, Person persons, NotificationEventType eventType)
{
var selectedPerson = RetrieveSelectedPerson();
Visitor retrievedVisitor = persons.Visitors.FirstOrDefault();
if (visitor != null)
{
if (eventType == NotificationEventType.PersonData)
{
visitor.PersonalDetail.FirstName = retrievedVisitor.PersonalDetail.FirstName;
visitor.PersonalDetail.LastName = retrievedVisitor.PersonalDetail.LastName;
visitor.PersonalDetail.Gender = retrievedVisitor.PersonalDetail.Gender;
visitor.PersonalDetail.Age = retrievedVisitor.PersonalDetail.Age;
visitor.PersonalDetail.Birthdate = retrievedVisitor.PersonalDetail.Birthdate;
visitor.SecurityPhotoAddress = retrievedVisitor.SecurityPhotoAddress;
visitor.PersonalDetail.Country = RetriveCountry(retrievedVisitor.PersonalDetail);
if (visitor.PersonalDetail.Country != null)
{
visitor.PersonalDetail.Country.Name = retrievedVisitor.PersonalDetail.Country.Name;
}
visitor.PersonalDetail.DocumentType = retrievedVisitor.PersonalDetail.DocumentType;
visitor.PersonalDetail.DocumentNumber = retrievedVisitor.PersonalDetail.DocumentNumber;
visitor.PersonalDetail.Title = retrievedVisitor.PersonalDetail.Title;
visitor.PersonalDetail.DepartmentPOC = retrievedVisitor.PersonalDetail.DepartmentPOC;
visitor.VisitorType = retrievedVisitor.VisitorType;
if (visitor.VisitorInfo == null)
{
visitor.VisitorInfo = new VisitorInfo();
}
visitor.VisitorInfo.VisitPurpose = retrievedVisitor.VisitorInfo.VisitPurpose;
visitor.AssignVisitorAccessCard(retrievedVisitor.VisitorAccessCards);
visitor.VisitorInfo.CompanyName = retrievedVisitor.VisitorInfo.CompanyName;
visitor.PersonalDetail.DepartmentName = retrievedVisitor.PersonalDetail.DepartmentName;
visitor.VisitorInfo.ContactNumber = retrievedVisitor.VisitorInfo.ContactNumber;
visitor.VisitorInfo.CompanyContactNumber = retrievedVisitor.VisitorInfo.CompanyContactNumber;
}
else if (eventType == NotificationEventType.BoardingStatus)
{
visitor.IsOnboard = retrievedVisitor.IsOnboard;
visitor.LastEvent = retrievedVisitor.LastEvent;
visitor.LastDateTime = retrievedVisitor.LastDateTime;
if (visitor.VisitorId.Equals(selectedPerson.PersonId, StringComparison.OrdinalIgnoreCase))
{
selectedPerson.IsOnboard = retrievedVisitor.IsOnboard;
selectedPerson.LastEvent = retrievedVisitor.LastEvent;
selectedPerson.LastDateTime = retrievedVisitor.LastDateTime;
}
}
else if (eventType == NotificationEventType.Alert)
{
visitor.HasAlert = retrievedVisitor.HasAlert;
visitor.AssignAlerts(retrievedVisitor.Alerts);
selectedPerson.HasAlert = retrievedVisitor.HasAlert;
selectedPerson.AssignAlerts(retrievedVisitor.Alerts);
Messenger.Instance.Notify(MessengerMessage.NotifyPersonAlert, selectedPerson);
Messenger.Instance.Notify(MessengerMessage.NotifyAlertDetails, selectedPerson);
}
else if (eventType == NotificationEventType.Message)
{
var messageAcknowledge = retrievedVisitor.Messages.All(m => m.StatusId.Equals(CommonConstants.MessageAcknowledgeStatusId));
visitor.AreAllMessagesGotAcknowledged = messageAcknowledge;
visitor.AssignMessages(retrievedVisitor.Messages);
selectedPerson.AreAllMessagesGotAcknowledged = messageAcknowledge;
selectedPerson.AssignPersonMessages(retrievedVisitor.Messages);
Messenger.Instance.Notify(MessengerMessage.NotifyPersonMessage, selectedPerson);
Messenger.Instance.Notify(MessengerMessage.NotifyMessageDetails, selectedPerson);
}
}
}
示例2: MapAsync
/// <summary>
/// Maps the asynchronous.
/// </summary>
/// <param name="visitorEntity">The visitor entities.</param>
/// <returns>Return instance of visitor.</returns>
private static Visitor MapAsync(Entities.Visitor visitorEntity)
{
var visitor = new Visitor();
if (visitorEntity != null)
{
visitor.VisitorId = visitorEntity.VisitorId;
visitor.PersonalDetail = visitorEntity.PersonalDetail;
visitor.VisitorTypeId = visitorEntity.VisitorTypeId;
visitor.SecurityPhotoAddress = visitorEntity.SecurityPhotoAddress;
visitor.VisitorInfo = new AdditionalInfo();
visitor.VisitorInfo.CompanyName = visitorEntity.CompanyName;
visitor.PersonalDetail = visitor.PersonalDetail ?? new PersonalDetail();
visitor.PersonalDetail.DepartmentId = visitorEntity.PersonalDetail.DepartmentId;
var passportDetail = visitorEntity.Identifications.FirstOrDefault(a => a.DocumentTypeId.Equals(ApplicationSetting.DocumentTypeId, StringComparison.OrdinalIgnoreCase));
if (passportDetail != null)
{
visitor.PersonalDetail.DocumentNumber = passportDetail.Number;
visitor.PersonalDetail.DocumentTypeId = passportDetail.DocumentTypeId;
}
else
{
var identificationDetail = visitorEntity.Identifications.FirstOrDefault();
if (identificationDetail != null)
{
visitor.PersonalDetail.DocumentNumber = identificationDetail.Number;
visitor.PersonalDetail.DocumentTypeId = identificationDetail.DocumentTypeId;
}
}
if (visitorEntity.VisitorAccessCards.Count > 0)
{
visitor.AssignVisitorAccessCard(visitorEntity.VisitorAccessCards);
}
if (visitorEntity.Visits.Count > 0)
{
var visit = visitorEntity.Visits.FirstOrDefault();
visitor.VisitorInfo.VisitPurpose = visit != null ? visit.VisitPurposeId : null;
}
if (visitorEntity.Phones.Count > 0)
{
var phone = visitorEntity.Phones.FirstOrDefault();
if (phone != null)
{
visitor.VisitorInfo.ContactNumber = phone.AreaCode + "-" + phone.Number;
}
}
}
return visitor;
}