public void UpdateModel(Models.InteractionEvent interactionEvent) { if (InteractionEventLocationPointX != null && InteractionEventLocationPointY != null) { interactionEvent.InteractionEventLocationSimple = DbSpatialHelper.MakeDbGeometryFromCoordinates(InteractionEventLocationPointX.Value, InteractionEventLocationPointY.Value, MapInitJson.CoordinateSystemId); } }
public InteractionEventDetailViewData(Person currentPerson, Models.InteractionEvent interactionEvent, string locationMapFormID, MapInitJson interactionEventLocationSummaryMapInitJson) : base(currentPerson) { IndexUrl = SitkaRoute <InteractionEventController> .BuildUrlFromExpression(x => x.Index()); EditInteractionEventBasicsUrl = SitkaRoute <InteractionEventController> .BuildUrlFromExpression(x => x.EditInteractionEvent(interactionEvent.PrimaryKey)); EditInteractionEventLocationSimpleUrl = SitkaRoute <InteractionEventController> .BuildUrlFromExpression(x => x.EditInteractionEventLocation(interactionEvent.PrimaryKey)); UserHasInteractionEventManagePermissions = new InteractionEventManageFeature().HasPermissionByPerson(currentPerson); InteractionEvent = interactionEvent; InteractionEventContacts = interactionEvent.InteractionEventContacts.ToList(); InteractionEventProjects = interactionEvent.InteractionEventProjects.ToList(); LocationMapFormID = locationMapFormID; InteractionEventLocationSummaryMapInitJson = interactionEventLocationSummaryMapInitJson; PageTitle = interactionEvent.InteractionEventTitle; var canEditDocuments = new InteractionEventManageFeature().HasPermissionByPerson(CurrentPerson); InteractionEventDetailFileDetailsViewData = new FileDetailsViewData( EntityDocument.CreateFromEntityDocument(new List <IEntityDocument>(interactionEvent.InteractionEventFileResources)), SitkaRoute <InteractionEventController> .BuildUrlFromExpression(x => x.NewInteractionEventFiles(interactionEvent.PrimaryKey)), canEditDocuments, Models.FieldDefinition.InteractionEvent ); }
public InteractionEventMapPopupViewData(Models.InteractionEvent interactionEvent) { InteractionEvent = interactionEvent; InteractionEventContactsWithLinksAsCommaDelimitedHtmlString = BuildHtmlStringOfCommaDelimitedObjects( interactionEvent.InteractionEventContacts.Select(iec => iec.Person.GetFullNameFirstLastAndOrgShortNameAsUrl())); InteractionEventProjectsWithLinksAsCommaDelimitedHtmlString = BuildHtmlStringOfCommaDelimitedObjects(interactionEvent.InteractionEventProjects.Select(iep => iep.Project.DisplayNameAsUrl)); }
public EditInteractionEventViewModel(Models.InteractionEvent interactionEvent) { InteractionEventID = interactionEvent.InteractionEventID; InteractionEventTypeID = interactionEvent.InteractionEventTypeID; Date = interactionEvent.InteractionEventDate; Title = interactionEvent.InteractionEventTitle; Description = interactionEvent.InteractionEventDescription; DNRStaffPersonID = interactionEvent.StaffPersonID; InteractionEventProjects = interactionEvent.InteractionEventProjects.Select(x => new InteractionEventProjectSimpleJson(x.InteractionEvent, x.Project)).ToList(); InteractionEventContacts = interactionEvent.InteractionEventContacts.Select(x => new InteractionEventContactSimpleJson(x.InteractionEvent, x.Person)).ToList(); }
public void UpdateModel(Models.InteractionEvent interactionEvent, Person currentPerson, ICollection <InteractionEventProject> allInteractionEventProjects, ICollection <InteractionEventContact> allInteractionEventContacts) { interactionEvent.InteractionEventTypeID = InteractionEventTypeID; interactionEvent.InteractionEventDate = Date; interactionEvent.InteractionEventTitle = Title; interactionEvent.InteractionEventDescription = Description; interactionEvent.StaffPersonID = DNRStaffPersonID; if (InteractionEventProjects != null) { var interactionEventProjectsUpdated = InteractionEventProjects .Where(x => ModelObjectHelpers.IsRealPrimaryKeyValue(x.ProjectID)).Select(x => new Models.InteractionEventProject(interactionEvent.InteractionEventID, x.ProjectID)).ToList(); interactionEvent.InteractionEventProjects.Merge(interactionEventProjectsUpdated, allInteractionEventProjects, (x, y) => x.InteractionEventID == y.InteractionEventID && x.ProjectID == y.ProjectID); } if (InteractionEventContacts != null) { var interactionEventContactsUpdated = InteractionEventContacts.Where(x => ModelObjectHelpers.IsRealPrimaryKeyValue(x.PersonID)).Select(x => new Models.InteractionEventContact(interactionEvent.InteractionEventID, x.PersonID)).ToList(); interactionEvent.InteractionEventContacts.Merge(interactionEventContactsUpdated, allInteractionEventContacts, (x, y) => x.InteractionEventID == y.InteractionEventID && x.PersonID == y.PersonID); } if (InteractionEventFileResourceData?[0] != null) { var fileResources = InteractionEventFileResourceData.Select(fileData => FileResource.CreateNewFromHttpPostedFile(fileData, currentPerson)); foreach (var fileResource in fileResources) { HttpRequestStorage.DatabaseEntities.FileResources.Add(fileResource); var interactionEventFileResource = new InteractionEventFileResource(interactionEvent, fileResource, fileResource.OriginalCompleteFileName); interactionEvent.InteractionEventFileResources.Add(interactionEventFileResource); } } }
public InteractionEventContactSimpleJson(Models.InteractionEvent interactionEvent, Person person) { InteractionEventID = interactionEvent.InteractionEventID; PersonID = person.PersonID; }
public InteractionEventProjectSimpleJson(Models.InteractionEvent interactionEvent, Models.Project project) { InteractionEventID = interactionEvent.InteractionEventID; ProjectID = project.ProjectID; }