Пример #1
0
        UPMGroup GroupFromParticipantControl()
        {
            UPMRepeatableEditGroup repeatableEditGroup = new UPMRepeatableEditGroup(this.TabIdentifierForRecordIdentification(this.LinkRecordIdentification));

            repeatableEditGroup.LabelText         = this.TabLabel();
            repeatableEditGroup.AddGroupLabelText = upText_AddNewGroup;
            repeatableEditGroup.AddingEnabled     = this.AddRecordEnabled;
            foreach (UPCRMRepParticipant participant in this.ParticipantsControl.Participants)
            {
                string           repIdString           = participant.Key;
                UPMIdentifier    participantIdentifier = UPMStringIdentifier.IdentifierWithStringId(repIdString);
                UPMStandardGroup group = new UPMStandardGroup(participantIdentifier);
                NSNumber         num   = participant.Options.ObjectForKey("must");
                group.Deletable = this.DeleteRecordEnabled && !num.IntegerValue;
                UPMDependsEditField 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.AddGroup(group);
                this.AddGroupForKey(group, repIdString);
            }
            this.Group           = repeatableEditGroup;
            this.ControllerState = UPGroupModelControllerStateFinished;
            return(repeatableEditGroup);
        }
Пример #2
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);
        }
        private UPMGroup GroupFromParticipantControl()
        {
            UPMRepeatableEditGroup repeatableEditGroup = new UPMRepeatableEditGroup(this.TabIdentifierForRecordIdentification(this.LinkRecordIdentification));

            repeatableEditGroup.LabelText = this.TabLabel;
            this.selectorArray            = new List <UPRecordSelector>();

            for (int fieldNumber = 0; fieldNumber < this.TabConfig.NumberOfFields; fieldNumber++)
            {
                UPConfigFieldControlField configFieldControlField = this.TabConfig.Fields[fieldNumber];
                var selector = configFieldControlField.Attributes.Selector;

                if (selector != null)
                {
                    var recordSelector = new UPRecordSelector("KP", null, -1, selector, null, this.ParticipantsField);
                    this.selectorArray.Add(recordSelector);
                }
            }

            if (this.selectorArray.Count < 1)
            {
                repeatableEditGroup.AddingEnabled = false;
                if (this.ParticipantsControl.Participants.Count < 1)
                {
                    this.Group           = null;
                    this.ControllerState = GroupModelControllerState.Empty;
                    return(null);
                }
            }
            else
            {
                repeatableEditGroup.AddGroupLabelText = LocalizedString.TextAddNewGroup;
                repeatableEditGroup.AddingEnabled     = this.AddRecordEnabled;
            }

            foreach (UPCRMLinkParticipant participant in this.ParticipantsControl.Participants)
            {
                string           recordIdentification  = participant.RecordIdentification;
                IIdentifier      participantIdentifier = new RecordIdentifier(recordIdentification);
                UPMStandardGroup group = new UPMStandardGroup(participantIdentifier);
                string           num   = participant.Options.ValueOrDefault("must") as string;
                group.Deletable = !participant.MayNotBeDeleted && this.DeleteRecordEnabled && num.ToInt() == 0;
                UPMDependsEditField editField = this.CreateEditFieldWithParticipantIdentifierEditGroup(participantIdentifier, group);
                editField.MainField.FieldValue = participant.Name;
                ((UPMParticipantsRecordSelectorEditField)editField.MainField).Participant = participant;
                editField.DependField.FieldValue  = participant.AcceptanceText;
                editField.DependField2.FieldValue = participant.RequirementText;
                bool editOfflineRecord = ConfigurationUnitStore.DefaultStore.ConfigValueIsSetDefaultValue("RecordSelect.EditOfflineRecord", false);
                editField.Deletable = !participant.IsOfflineEmptyParticipant || editOfflineRecord;
                group.AddField(editField);
                repeatableEditGroup.AddChild(group);
                this.AddGroupForKey(group, participant.Key);
            }

            this.Group           = repeatableEditGroup;
            this.ControllerState = GroupModelControllerState.Finished;
            return(repeatableEditGroup);
        }
        private static void AddFieldToGroup(UPMStandardGroup standardGroup, object field, UPChildEditContext childEditContext)
        {
            if (field is UPEditFieldContext)
            {
                var editFieldContext = (UPEditFieldContext)field;
                editFieldContext.ChildEditContext = childEditContext;

                foreach (var editField in editFieldContext.EditFields)
                {
                    editField.EditFieldsContext = childEditContext;
                    standardGroup.AddField(editField);
                }
            }
            else
            {
                standardGroup.AddField((UPMField)field);
            }
        }
        /// <inheritdoc/>
        public override UPMStandardGroup CreateNewGroup(Dictionary <string, string> initialValues)
        {
            var participant = this.ParticipantsControl.AddNewLinkParticipant();

            participant.Options   = this.firstItemOptions;
            this.firstItemOptions = null;
            var requirementKey = initialValues.ValueOrDefault("Requirement");
            var acceptanceKey  = initialValues.ValueOrDefault("Acceptance");

            if (!string.IsNullOrEmpty(requirementKey))
            {
                var v = initialValues[requirementKey];
                if (!string.IsNullOrEmpty(v))
                {
                    participant.RequirementText = v;
                }
            }

            if (!string.IsNullOrEmpty(acceptanceKey))
            {
                var v = initialValues[acceptanceKey];
                if (!string.IsNullOrEmpty(v))
                {
                    participant.AcceptanceText = v;
                }
            }

            IIdentifier participantIdentifier = StringIdentifier.IdentifierWithStringId(participant.Key);
            var         group = new UPMStandardGroup(participantIdentifier);

            group.Deletable = true;

            if (this.isFirst)
            {
                this.isFirst = false;
                if (this.fixedFirstParticipant)
                {
                    group.Deletable = false;
                }
            }

            var editField = this.CreateEditFieldWithParticipantIdentifierEditGroup(participantIdentifier, group);

            editField.MainField.FieldValue    = participant.Name;
            editField.DependField2.FieldValue = participant.RequirementText;
            editField.DependField.FieldValue  = participant.CanChangeAcceptanceState ? participant.AcceptanceText : string.Empty;
            group.AddField(editField);
            this.AddGroupForKey(group, participant.Key);
            return(group);
        }
Пример #6
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);
        }
Пример #7
0
        /// <inheritdoc/>
        public override UPMStandardGroup CreateNewGroup(Dictionary <string, string> initialValues)
        {
            var participant = this.ParticipantsControl.AddNewRepParticipant();

            participant.Options   = this.firstItemOptions;
            this.firstItemOptions = null;

            IIdentifier participantIdentifier = StringIdentifier.IdentifierWithStringId(participant.Key);
            var         group = new UPMStandardGroup(participantIdentifier);

            group.Deletable = true;

            var editField = this.CreateEditFieldWithParticipantIdentifierEditGroup(participantIdentifier, group);

            editField.MainField.FieldValue    = participant.RepIdString;
            editField.DependField.FieldValue  = null;
            editField.DependField2.FieldValue = participant.RequirementText;
            group.AddField(editField);
            this.AddGroupForKey(group, participant.Key);

            return(group);
        }
        private UPMStandardGroup CreateNewGroupRecordAsNew(Dictionary <string, object> parentInitialValues, UPCRMRecord record, bool asNew)
        {
            UPContainerMetaInfo metaInfo = new UPContainerMetaInfo(this.ChildFieldControl);
            UPCRMResult         result   = !string.IsNullOrEmpty(record?.RecordId) ? metaInfo.NewRecordWithRecordId(record.RecordId) : metaInfo.NewRecord();

            UPCRMResultRow     childRow         = (UPCRMResultRow)result.ResultRowAtIndex(0);
            UPChildEditContext childEditContext = new UPChildEditContext(childRow, this.NextPostfix);

            if (asNew)
            {
                childEditContext.SetAsNew();
            }

            if (record != null)
            {
                childEditContext.AddChangedLinksFromRecordParentLink(record, null);
            }

            FieldControlTab childFieldControlTab = this.ChildFieldControl.TabAtIndex(0);

            this.combinedInitialValues = null;
            if (this.initialValues != null)
            {
                if (parentInitialValues != null)
                {
                    Dictionary <string, object> combined = new Dictionary <string, object>(this.initialValues);
                    foreach (var item in parentInitialValues)
                    {
                        combined[item.Key] = item.Value;
                    }

                    this.combinedInitialValues = combined;
                }
                else
                {
                    this.combinedInitialValues = this.initialValues;
                }
            }
            else
            {
                this.combinedInitialValues = parentInitialValues;
            }

            List <UPCRMRecord> initialRecords = record != null ? new List <UPCRMRecord> {
                record
            } : null;

            List <object> editFieldContextArray = this.EditContextsFor(childRow, childFieldControlTab,
                                                                       childEditContext.EditFieldContext, this.combinedInitialValues, initialRecords);
            int editFieldCount = editFieldContextArray.Count;

            if (editFieldCount > 0)
            {
                UPMStandardGroup group = new UPMStandardGroup(new RecordIdentifier(childRow.RootRecordIdentification));
                group.Deletable        = true;
                childEditContext.Group = group;
                this.AddChildRecordContext(childEditContext);
                for (int j = 0; j < editFieldCount; j++)
                {
                    UPEditFieldContext editFieldContext = editFieldContextArray[j] as UPEditFieldContext;
                    if (editFieldContext != null)
                    {
                        editFieldContext.ChildEditContext  = childEditContext;
                        editFieldContext.FieldLabelPostfix = childEditContext.FieldLabelPostfix;
                        List <UPMEditField> editFields = editFieldContext.EditFields;
                        if (editFields.Count > 0)
                        {
                            foreach (UPMEditField editField in editFields)
                            {
                                editField.EditFieldsContext = childEditContext;
                                group.AddField(editField);
                            }
                        }
                        else
                        {
                            UPMField field = editFieldContext.Field;
                            if (field != null)
                            {
                                group.AddField(field);
                            }
                        }
                    }
                    else
                    {
                        group.AddField((UPMField)editFieldContextArray[j]);
                    }
                }

                childEditContext.HandleDependentFields();
                return(group);
            }

            return(null);
        }
Пример #9
0
        /// <summary>
        /// Makes the system information group.
        /// </summary>
        /// <returns></returns>
        public UPMGroup MakeSystemInfoGroup()
        {
            return(null);

#if PORTING
            IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore;
            bool             hideEmptyFields    = configStore.ConfigValueIsSet("SettingsView.HideEmptyFields");
            UPMStandardGroup detailGroup        = new UPMStandardGroup(StringIdentifier.IdentifierWithStringId("systeminfo_1"));

            UPSystemInfo  systemInfo    = new UPSystemInfo();
            NSDictionary  infos         = this.GetFunctionNameDictionaryForSystemInfo(systemInfo);
            FieldControl  listControl   = null;
            ViewReference systemViewRef = new ViewReference(new List <object> {
                "fieldgroup", "SYSTEMINFO"
            }, "SystemInfoView");
            string fieldGroup = systemViewRef.ContextValueForKey("fieldgroup");
            if (fieldGroup != null)
            {
                listControl = configStore.FieldControlByNameFromGroup("List", fieldGroup);
                int row = 0;
                foreach (UPConfigFieldControlField field in listControl.Fields)
                {
                    string functionName          = field.Function;
                    string label                 = field.Label;
                    string functionNameLowerCase = functionName.ToLower();
                    if (infos.ObjectForKey(functionNameLowerCase) != null)
                    {
                        IIdentifier fieldIdentifier = StringIdentifier.IdentifierWithStringId($"Id_{functionName}");
                        string      fieldValue      = infos[functionNameLowerCase];
                        if (!string.IsNullOrEmpty(fieldValue) || !hideEmptyFields)
                        {
                            UPMStringField stringField = new UPMStringField(fieldIdentifier);
                            stringField.StringValue = fieldValue;
                            stringField.LabelText   = label;
                            if (functionName == "webversion" && ServerSession.CurrentSession().IsEnterprise)
                            {
                                stringField.StringValue = $"{fieldValue} Enterprise";
                            }

                            detailGroup.AddField(stringField);
                        }
                    }

                    row++;
                }
            }

            if (systemInfo.WebconfigParameter())
            {
                foreach (UPConfigWebConfigLayoutField configField in systemInfo.WebconfigParameter().AllValues())
                {
                    IIdentifier fieldIdentifier = StringIdentifier.IdentifierWithStringId(NSString.StringWithFormat("Id_%@", configField.ValueName()));
                    string      label           = configField.ValueName();
                    if (listControl != null)
                    {
                        UPConfigFieldControlField field = listControl.FieldWithFunction(configField.ValueName());
                        if (!string.IsNullOrEmpty(field?.Label))
                        {
                            label = field.Label;
                        }
                    }

                    UPMStringField field = new UPMStringField(fieldIdentifier);
                    field.StringValue = configField.Value();
                    field.LabelText   = label;
                    detailGroup.AddField(field);
                }
            }

            return(detailGroup);
#endif
        }