/// <summary> /// The create edit field. /// </summary> /// <returns> /// The <see cref="UPMEditField"/>. /// </returns> public override UPMEditField CreateEditField() { UPMRepEditField field = new UPMRepEditField(this.FieldIdentifier); UPCRMRepType repType = UPCRMReps.RepTypeFromString(this.FieldConfig.Field.RepType); var possibleValues = UPCRMDataStore.DefaultStore.Reps.AllRepsOfTypes(repType); var explicitKeyOrder = UPCRMDataStore.DefaultStore.Reps.AllRepIdsOfTypes(repType); var repContainer = UPRepsService.CreateRepContainerForRepType(repType); field.RepContainer = repContainer; // Adding all rep values from UPCRMDataStore to the PossibleValues list. foreach (var obj in possibleValues) { UPMCatalogPossibleValue possibleValue = new UPMCatalogPossibleValue(); UPMStringField valueField = new UPMStringField(StringIdentifier.IdentifierWithStringId("x")); UPCRMRep rep = obj; valueField.StringValue = rep.RepName; possibleValue.TitleLabelField = valueField; possibleValue.Key = rep.RepId; field.AddPossibleValue(possibleValue); } field.SetFieldValue(this.OriginalValue); field.NullValueKey = "0"; field.ExplicitKeyOrder = explicitKeyOrder; this.ApplyAttributesOnEditFieldConfig(field, this.FieldConfig); return(field); }
private UPMEditField CreateMainEditFieldWithParticipantIdentifierEditGroup(IIdentifier participantIdentifier, UPMGroup editGroup) { var field = new UPMRepEditField(participantIdentifier) { Group = editGroup, GroupModelController = this, MultiSelectMode = false, HelpIdentifier = StringIdentifier.IdentifierWithStringId("RepPartitipant") }; var repType = UPCRMReps.RepTypeFromString(this.ParticipantsField.Field.RepType); var possibleValues = UPCRMDataStore.DefaultStore.Reps.AllRepsOfTypes(repType); var explicitKeyOrder = UPCRMDataStore.DefaultStore.Reps.AllRepIdsOfTypes(repType); var repContainer = UPRepsService.CreateRepContainerForRepType(repType); field.RepContainer = repContainer; // Adding all rep values from UPCRMDataStore to the PossibleValues list. foreach (var obj in possibleValues) { var possibleValue = new UPMCatalogPossibleValue(); var valueField = new UPMStringField(StringIdentifier.IdentifierWithStringId("x")); var rep = obj; valueField.StringValue = rep.RepName; possibleValue.TitleLabelField = valueField; possibleValue.Key = rep.RepId; field.AddPossibleValue(possibleValue); } field.NullValueKey = "0"; field.ExplicitKeyOrder = explicitKeyOrder; return(field); }
UPMEditField CreateMainEditFieldWithParticipantIdentifierEditGroup(UPMIdentifier participantIdentifier, UPMGroup editGroup) { UPMRepEditField editField = new UPMRepEditField(participantIdentifier); editField.Group = editGroup; editField.GroupModelController = this; editField.MultiSelectMode = true; editField.HelpIdentifier = UPMStringIdentifier.IdentifierWithStringId("RepPartitipant"); UPCRMRepType repType = UPCRMReps.RepTypeFromString(this.ParticipantsField.Field.RepType); UPMRepContaner repContaner = UPRepsService.CreateRepContanerForRepType(repType); editField.RepContaner = repContaner; editField.ContinuousUpdate = true; return(editField); }
public List <IIdentifier> UserDidChangeField(UPMEditField field, object pageModelController) { if (field.GetType() == (typeof(UPMRepEditField))) { UPMRepEditField _field = (UPMRepEditField)field; string key = keyForEditGroup(field.Group); if (key != null) { UPCRMRepParticipant participant = (UPCRMRepParticipant)this.ParticipantsControl.ParticipantWithKey(key); if (participant != null) { participant.MarkAsDeleted = false; participant.ChangeRep(field.FieldValue); } } } else if (_field.IsKindOfClass(typeof(UPMParticipantCatalogEditField))) { UPMParticipantCatalogEditField field = (UPMParticipantCatalogEditField)_field; string key = this.KeyForEditGroup(field.Group); if (key != null) { UPCRMRepParticipant participant = (UPCRMRepParticipant)this.ParticipantsControl.ParticipantWithKey(key); string participantIdentification = participant.Key; UPMGroup editGroup = this.EditGroupForKey(participantIdentification); UPMDependsEditField dependsEditField = (UPMDependsEditField)editGroup.Fields.ObjectAtIndex(0); UPMEditField acceptanceField = dependsEditField.DependField; UPMEditField requirementField = dependsEditField.DependField2; if (field == acceptanceField) { participant.AcceptanceText = field.FieldValue; } else if (field == requirementField) { participant.RequirementText = field.FieldValue; } } } return(null); }