示例#1
0
        private UPMGroup GroupFromParticipantControl()
        {
            var repeatableEditGroup = new UPMRepeatableEditGroup(this.TabIdentifierForRecordIdentification(this.LinkRecordIdentification))
            {
                LabelText         = this.TabLabel,
                AddGroupLabelText = LocalizedString.TextAddNewGroup,
                AddingEnabled     = this.AddRecordEnabled
            };

            if (this.ParticipantsControl.Participants.Count > 0)
            {
                UPCRMRepParticipant sparticipant           = (UPCRMRepParticipant)this.ParticipantsControl.Participants[0];
                IIdentifier         sparticipantIdentifier = StringIdentifier.IdentifierWithStringId(sparticipant.Key);
                var group = new UPMStandardGroup(sparticipantIdentifier);


                foreach (UPCRMRepParticipant participant in this.ParticipantsControl.Participants)
                {
                    var         repIdString           = participant.Key;
                    IIdentifier participantIdentifier = StringIdentifier.IdentifierWithStringId(repIdString);
                    //var group = new UPMStandardGroup(participantIdentifier);

                    var num = participant.Options.ValueOrDefault("must") as string;
                    group.Deletable = this.DeleteRecordEnabled && Convert.ToInt32(num) == 0;

                    var editField = this.CreateEditFieldWithParticipantIdentifierEditGroup(participantIdentifier, group);
                    editField.MainField.FieldValue = participant.RepIdString;

                    if (this.ParticipantsControl.HasRepAcceptance && participant.CanChangeAcceptanceState)
                    {
                        editField.DependField.FieldValue = participant.AcceptanceText;
                    }
                    else
                    {
                        editField.DependField.FieldValue = null;
                    }

                    editField.DependField2.FieldValue = participant.RequirementText;
                    group.AddField(editField);
                }

                repeatableEditGroup.AddChild(group);
                this.AddGroupForKey(group, sparticipant.Key);
            }
            else
            {
                IIdentifier sparticipantIdentifier = StringIdentifier.IdentifierWithStringId("00000");
                var         group     = new UPMStandardGroup(sparticipantIdentifier);
                var         editField = this.CreateEditFieldWithParticipantIdentifierEditGroup(sparticipantIdentifier, group);
                group.AddField(editField);
                repeatableEditGroup.AddChild(group);
                this.AddGroupForKey(group, "00000");
            }

            this.Group           = repeatableEditGroup;
            this.ControllerState = GroupModelControllerState.Finished;
            return(repeatableEditGroup);
        }
示例#2
0
        UPMStandardGroup CreateNewGroup(NSDictionary initialValues)
        {
            UPCRMRepParticipant participant = this.ParticipantsControl.AddNewRepParticipant();

            participant.Options = firstItemOptions;
            firstItemOptions    = null;
            UPMIdentifier    participantIdentifier = UPMStringIdentifier.IdentifierWithStringId(participant.Key);
            UPMStandardGroup group = new UPMStandardGroup(participantIdentifier);

            group.Deletable = true;
            UPMDependsEditField editField = this.CreateEditFieldWithParticipantIdentifierEditGroup(participantIdentifier, group);

            editField.MainField.FieldValue    = participant.RepIdString;
            editField.DependField.FieldValue  = string.Empty;
            editField.DependField2.FieldValue = participant.RequirementText;
            group.AddField(editField);
            this.AddGroupForKey(group, participant.Key);
            return(group);
        }
示例#3
0
        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);
        }