private UPCRMRecord CreateNewRecord( UPCRMRecord parentRecord, UPCRMLinkParticipant participant, bool hasRequirement, UPMEditField requirementField, bool hasAcceptance, UPMEditField acceptanceField) { var record = UPCRMRecord.CreateNew(this.ParticipantsControl.LinkParticipantsInfoAreaId); if (parentRecord.IsNew && (parentRecord.Links == null || parentRecord.Links.Count == 0)) { parentRecord.AddLink(new UPCRMLink(participant.LinkRecordIdentification)); } this.ApplyTemplateFilterToRecord(record); record.AddLink(new UPCRMLink(parentRecord, -1)); record.AddLink(new UPCRMLink(participant.LinkRecordIdentification)); if (hasRequirement) { record.NewValueFieldId(requirementField.StringValue, participant.Context.RequirementField.FieldId); } if (hasAcceptance) { record.NewValueFieldId(acceptanceField.StringValue, participant.Context.AcceptanceField.FieldId); } return(record); }
/// <summary> /// Switches to organizer for link participant. /// </summary> /// <param name="sender">The sender.</param> public void SwitchToOrganizerForLinkParticipant(object sender) { UPMListRow listRow = (UPMListRow)sender; IIdentifier identifier = listRow.Identifier; UPCRMLinkParticipant linkParticipant = (UPCRMLinkParticipant)this.recordParticipants.ParticipantWithKey(identifier.IdentifierAsString); if (linkParticipant != null) { ViewReference viewReference = this.linkParticipantsViewReference.ViewReferenceWith(linkParticipant.LinkRecordIdentification); if (viewReference != null) { this.Delegate.PerformOrganizerAction(this, viewReference, listRow.OnlineData); } } }
private UPCRMRecord CreateRecord(UPCRMRecord parentRecord, UPCRMLinkParticipant participant, bool userChangesOnly) { UPCRMRecord record = null; var hasAcceptance = this.ParticipantsControl.RequirementField != null; var hasRequirement = this.ParticipantsControl.AcceptanceField != null; var participantIdentification = participant.RecordIdentification?.Length > 6 ? participant.RecordIdentification : participant.Key; var editGroup = this.EditGroupForKey(participantIdentification); var dependsEditField = (UPMDependsEditField)editGroup.Fields.FirstOrDefault(); if (dependsEditField == null) { throw new InvalidOperationException("Collection must contain UPMDependsEditField"); } var acceptanceField = dependsEditField.DependField; var requirementField = dependsEditField.DependField2; if (participant.MarkAsDeleted) { if (!string.IsNullOrWhiteSpace(participant.RecordIdentification)) { record = new UPCRMRecord(participant.RecordIdentification, "Delete", null); } } else if ((!userChangesOnly || !participant.NoUserChanges) && (participant.RecordIdentification == null || participant.RecordIdentification.Length < 5) && !string.IsNullOrWhiteSpace(participant.LinkRecordIdentification)) { record = this.CreateNewRecord(parentRecord, participant, hasRequirement, requirementField, hasAcceptance, acceptanceField); } else if (requirementField != null && acceptanceField != null && (requirementField.Changed || acceptanceField.Changed)) { record = this.CreateNewRecord(participant, hasRequirement, requirementField, hasAcceptance, acceptanceField); } return(record); }
private UPCRMRecord CreateNewRecord( UPCRMLinkParticipant participant, bool hasRequirement, UPMEditField requirementField, bool hasAcceptance, UPMEditField acceptanceField) { var record = UPCRMRecord.CreateNew(participant.RecordIdentification); this.ApplyTemplateFilterToRecord(record); if (hasRequirement && requirementField.StringValue != participant.RequirementText) { record.NewValueFromValueFieldId(requirementField.StringValue, participant.RequirementText, participant.Context.RequirementField.FieldId); } if (hasAcceptance && acceptanceField.StringValue != participant.AcceptanceText) { record.NewValueFromValueFieldId(acceptanceField.StringValue, participant.AcceptanceText, participant.Context.AcceptanceField.FieldId); } return(record); }
/// <summary> /// Returns changed links for given info area id /// </summary> /// <param name="infoAreaId">Info Area Id</param> /// <param name="userChangesOnly">Handles user changes only if set to true</param> /// <returns><see cref="Dictionary{string, UPCRMLink}"/></returns> public override Dictionary <string, UPCRMLink> ChangedLinksForInfoAreaId(string infoAreaId, bool userChangesOnly) { if (this.isNew && !userChangesOnly) { UPCRMLinkParticipant participant = this.ParticipantsControl.FirstLinkParticipant(); if (!string.IsNullOrEmpty(participant?.LinkRecordIdentification)) { string val = participant.Options.ValueOrDefault("parentlink") as string; if (Convert.ToInt32(val) != 0) { UPCRMLinkInfo linkInfo = UPCRMDataStore.DefaultStore.LinkInfoForInfoAreaTargetInfoAreaLinkId(infoAreaId, participant.LinkRecordIdentification.InfoAreaId(), 0); if (linkInfo != null) { UPCRMLink link = new UPCRMLink(participant.LinkRecordIdentification); return(new Dictionary <string, UPCRMLink> { { linkInfo.Key, link } }); } } } } return(null); }
private UPMGroup BuildGroup(UPMGroup group) { Dictionary <string, string> infoAreaImageFileNames = new Dictionary <string, string>(); IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; UPConfigExpand repExpand = configStore.ExpandByName("ID"); this.linkParticipantsViewReference = null; if (!string.IsNullOrEmpty(this.linkParticipantsName)) { SearchAndList searchAndList = configStore.SearchAndListByName(this.linkParticipantsName); Menu menu = searchAndList != null?configStore.MenuByName(searchAndList.DefaultAction) : null; this.linkParticipantsViewReference = menu?.ViewReference; } if (this.acceptanceCatalogAttributes == null && this.recordParticipants.AcceptanceField != null) { this.acceptanceCatalogAttributes = configStore.CatalogAttributesForInfoAreaIdFieldId(this.recordParticipants.AcceptanceField.InfoAreaId, this.recordParticipants.AcceptanceField.FieldId); } foreach (UPCRMParticipant participant in this.recordParticipants.Participants) { bool isRepParticipant = participant is UPCRMRepParticipant; IIdentifier identifier = StringIdentifier.IdentifierWithStringId(participant.Key); UPMListRow listRow = new UPMListRow(identifier); UPMStringField nameField = new UPMStringField(StringIdentifier.IdentifierWithStringId("name")); nameField.StringValue = participant.Name; listRow.AddField(nameField); UPMStringField acceptanceField = new UPMStringField(StringIdentifier.IdentifierWithStringId("acceptance")); if (!isRepParticipant || this.recordParticipants.HasRepAcceptance) { acceptanceField.StringValue = participant.AcceptanceDisplayText; UPConfigCatalogValueAttributes configCatalogValueAttributes = this.acceptanceCatalogAttributes?.ValuesByCode[Convert.ToInt32(participant.AcceptanceText)]; string colorString = configCatalogValueAttributes?.ColorKey; if (!string.IsNullOrEmpty(colorString)) { listRow.RowColor = AureaColor.ColorWithString(colorString); } } else { acceptanceField.StringValue = string.Empty; } listRow.AddField(acceptanceField); UPMStringField requirementField = new UPMStringField(StringIdentifier.IdentifierWithStringId("requirement")); requirementField.StringValue = participant.RequirementDisplayText; listRow.AddField(requirementField); if (isRepParticipant) { // listRow.Icon = UIImage.UpImageWithFileName(repExpand.ImageName); // CRM-5007 listRow.RowAction = null; } else { UPCRMLinkParticipant linkParticipant = (UPCRMLinkParticipant)participant; string _infoAreaId = linkParticipant.LinkRecordIdentification.InfoAreaId(); string imageName = infoAreaImageFileNames.ValueOrDefault(_infoAreaId); if (imageName == null) { UPConfigExpand expand = configStore.ExpandByName(_infoAreaId); imageName = expand.ImageName ?? string.Empty; infoAreaImageFileNames.SetObjectForKey(imageName, _infoAreaId); } // listRow.Icon = UIImage.UpImageWithFileName(imageName); // CRM-5007 listRow.OnlineData = !UPCRMDataStore.DefaultStore.RecordExistsOffline(linkParticipant.LinkRecordIdentification); if (this.linkParticipantsViewReference != null) { UPMAction switchToOrganizerAction = new UPMAction(null); switchToOrganizerAction.IconName = "arrow.png"; switchToOrganizerAction.SetTargetAction(this, this.SwitchToOrganizerForLinkParticipant); listRow.RowAction = switchToOrganizerAction; } } group.AddChild(listRow); } return(group); }
/// <inheritdoc/> public object DataFromResultRow(UPCRMResultRow resultRow) { return(UPCRMLinkParticipant.TableCaptionForInfoAreaIdResultRow(resultRow.RootRecordIdentification.InfoAreaId(), resultRow)); }