Exemplo n.º 1
0
        UPMGroup GroupFromRow(UPCRMResultRow resultRow)
        {
            if (resultRow.IsNewRow())
            {
                this.ParticipantsControl = new UPCRMMutableParticipants(null, resultRow.RootRecordIdentification.InfoAreaId(), null, -1, null, this);
                NSDictionary parentInitialValues            = this.EditPageContext.initialValues;
                string       childGroupKey                  = this.ChildGroupKey();
                ArrayList    parentInitialValueDictionaries = parentInitialValues.ObjectForKey(childGroupKey);
                if (parentInitialValueDictionaries.Count > 0)
                {
                    if (parentInitialValueDictionaries != null)
                    {
                        foreach (NSDictionary parentInitialValueForChild in parentInitialValueDictionaries)
                        {
                            string       value   = null;
                            NSDictionary options = null;
                            foreach (string key in parentInitialValueForChild)
                            {
                                if (key.IsEqualToString(".Options"))
                                {
                                    ArrayList optionStringArray = parentInitialValueForChild.ObjectForKey(key);
                                    options = UPEditChildrenGroupModelControllerBase.OptionsFromStringArray(optionStringArray);
                                }
                                else if (value == null)
                                {
                                    value = parentInitialValueForChild.ObjectForKey(key);
                                }
                            }
                            if (value.Length > 0)
                            {
                                this.ParticipantsControl.AddRepParticipantWithRepIdWithOptions(value, options);
                            }
                            else
                            {
                                firstItemOptions = options;
                            }
                        }
                    }
                }

                if (this.ParticipantsField != null)
                {
                    editFieldContext = new UPParticipantsEditFieldContext(this.ParticipantsField, null, string.Empty, null);
                }
            }
            else if (this.ParticipantsField != null)
            {
                this.LinkRecordIdentification = resultRow.RootRecordIdentification();
                string participantsString = resultRow.ValueAtIndex(this.ParticipantsField.TabIndependentFieldIndex);
                this.ParticipantsControl = new UPCRMMutableParticipants(null, null, null, -1, resultRow.RootRecordIdentification(), this);
                editFieldContext         = new UPParticipantsEditFieldContext(this.ParticipantsField, null, participantsString, null);
                this.ParticipantsControl.AddParticipantsFromString(participantsString);
            }
            else
            {
                this.Group           = null;
                this.ControllerState = UPGroupModelControllerStateEmpty;
                return(this.Group);
            }

            if (editFieldContext != null)
            {
                editFieldContext.GroupModelController = this;
                this.EditPageContext.EditFields.SetObjectForKey(editFieldContext, editFieldContext.Key);
            }

            if (this.LinkParticipantsName.Length)
            {
                this.ParticipantsControl.SetFieldsFromSearchAndListConfigurationName(this.LinkParticipantsName);
            }

            if (this.AddRecordEnabled || this.ParticipantsControl.Participants.Count > 0)
            {
                this.ControllerState = UPGroupModelControllerStatePending;
                this.ParticipantsControl.Load();
            }
            else
            {
                this.Group           = null;
                this.ControllerState = UPGroupModelControllerStateEmpty;
            }

            signalFinished = true;
            return(this.Group);
        }
Exemplo n.º 2
0
 string ChildGroupKey()
 {
     return(UPEditChildrenGroupModelControllerBase.ChildGroupKeyForInfoAreaIdLinkId("ID", 0));
 }