private void AddCategoryActionsToRow(UPMResultRow row)
        {
            var      categories      = this.Analysis.CategoryDictionary.Values;
            UPMGroup detailGroupCol1 = new UPMGroup(StringIdentifier.IdentifierWithStringId("det1"));

            foreach (AnalysisCategory category in categories)
            {
                UPMStringField field = new UPMStringField(null)
                {
                    LabelText   = category.Key,
                    StringValue = category.Label
                };

                detailGroupCol1.AddField(field);
            }

            row.AddDetailGroup(detailGroupCol1);
            UPMGroup detailGroupCol2 = new UPMGroup(StringIdentifier.IdentifierWithStringId("det2"));

            row.AddDetailGroup(detailGroupCol2);
            foreach (var analysisResultColumn in this.AnalysisSettings.ResultColumns)
            {
                UPMStringField field = new UPMStringField(null)
                {
                    LabelText   = analysisResultColumn.Key,
                    StringValue = analysisResultColumn.Label
                };
                detailGroupCol2.AddField(field);
            }
        }
        /// <summary>
        /// Groups from row.
        /// </summary>
        /// <param name="resultRow">The result row.</param>
        /// <returns>
        /// The <see cref="UPMGroup" />.
        /// </returns>
        public override UPMGroup GroupFromRow(UPCRMResultRow resultRow)
        {
            UPMGroup group = base.GroupFromRow(resultRow);

            this.skipTemplateFilter = false;
            if (group != null)
            {
                if (this.emptyMustFieldCount < 0)
                {
                    this.emptyMustFieldCount = 0;
                    List <string> mustFieldFunctionNames = this.mustFieldDictionary.Keys.ToList();
                    foreach (string functionName in mustFieldFunctionNames)
                    {
                        UPEditFieldContext ctx = this.editFieldDictionary[functionName];
                        if (ctx.FieldConfig.IsEmptyValue(ctx.Value))
                        {
                            this.emptyMustFieldCount++;
                            this.mustFieldDictionary[functionName] = string.Empty;
                        }
                        else if (string.IsNullOrEmpty(ctx.Value))
                        {
                            this.mustFieldDictionary[functionName] = "0";
                        }
                        else
                        {
                            this.mustFieldDictionary[functionName] = ctx.Value;
                        }
                    }
                }

                this.Delegate.GroupModelControllerValueChanged(this, this.CurrentData);
            }

            return(group);
        }
        /// <summary>
        /// Applies the result row.
        /// </summary>
        /// <param name="row">The row.</param>
        /// <returns></returns>
        public override UPMGroup ApplyResultRow(UPCRMResultRow row)
        {
            UPMGroup group = this.ApplyLinkRecordIdentification(row.RootRecordIdentification);

            group?.Actions.AddRange(this.BuildAdditionalActionsForRecordIdentification(row.RootRecordIdentification));
            return(group);
        }
Exemple #4
0
        /// <summary>
        /// Applies the result row.
        /// </summary>
        /// <param name="row">The row.</param>
        /// <returns></returns>
        public override UPMGroup ApplyResultRow(UPCRMResultRow row)
        {
            string   recordIdentification = row.RootRecordIdentification;
            UPMGroup group = this.GroupFromRow(row);

            group?.Actions.AddRange(this.BuildAdditionalActionsForRecordIdentification(recordIdentification));
            return(group);
        }
        /// <summary>
        /// The add detail group.
        /// </summary>
        /// <param name="detailGroup">
        /// The detail group.
        /// </param>
        public void AddDetailGroup(UPMGroup detailGroup)
        {
            if (this.DetailGroups == null)
            {
                this.DetailGroups = new List <UPMGroup>();
            }

            this.DetailGroups.Add(detailGroup);
        }
Exemple #6
0
        /// <summary>
        /// Groups the model controller finished.
        /// </summary>
        /// <param name="sender">The sender.</param>
        public override void GroupModelControllerFinished(UPGroupModelController sender)
        {
            if (sender.ControllerState == GroupModelControllerState.Error)
            {
                this.portfolioGroup = null;
            }

            this.InformAboutDidChangeTopLevelElement(this.Page, this.Page, null, null);
        }
Exemple #7
0
        private void FillPage(Page pageObject)
        {
            var questionGroups = this.Survey.VisibleQuestionGroups;
            UPMQuestionnairePage page;

            if (pageObject is UPMQuestionnairePage)
            {
                page = (UPMQuestionnairePage)pageObject;
            }
            else
            {
                return;
            }

            page.Readonly = this.Readonly || this.ViewReference.ViewName == "QuestionnaireView";
            if (this.questionnaireConfirmed)
            {
                page.FinalizedText = this.ConfirmedFilter.DisplayName;
                if (string.IsNullOrEmpty(page.FinalizedText))
                {
                    page.FinalizedText = LocalizedString.TextProcessQuestionnaireFinalized;
                }
            }
            else if (this.ConfirmationButton != null)
            {
                var action = new UPMAction(StringIdentifier.IdentifierWithStringId("Action.Approve"))
                {
                    LabelText = this.ConfirmationButton.Label
                };
                if (string.IsNullOrEmpty(action.LabelText))
                {
                    action.LabelText = LocalizedString.TextProcessQuestionnaireFinalize;
                }

                action.SetTargetAction(this, this.FinalizeButtonClicked);
                page.FinalizeAction = action;
            }

            page.RemoveAllChildren();
            if (this.PortfolioMode)
            {
                this.portfolioGroup = this.PortfolioGroupForSurvey();
            }

            int index = 0;

            page.LabelText = this.Survey.Questionnaire.Label;
            foreach (var currentGroup in questionGroups)
            {
                ++index;
                this.ProcessGroup(page, index, currentGroup);
            }

            page.Status = null;
        }
Exemple #8
0
        /// <summary>
        /// Adds the group for key.
        /// </summary>
        /// <param name="group">The group.</param>
        /// <param name="key">The key.</param>
        public void AddGroupForKey(UPMGroup group, string key)
        {
            if (key == null)
            {
                return;
            }

            if (this.keyToEditGroupDictionary == null)
            {
                this.keyToEditGroupDictionary = new Dictionary <string, UPMGroup>();
            }

            this.keyToEditGroupDictionary[key] = group;
        }
Exemple #9
0
        private UPMGroup PortfolioGroupForSurvey()
        {
            this.portfolioGroupController = new UPWebContentGroupModelController(this);
            ViewReference portfolioViewReference = new ViewReference(this.ViewReference, null, "Portfolio", "ReportType");

            portfolioViewReference.SetValueForKey("SurveyRecordId", this.ViewReference.ContextValueForKey("RecordId"));
            portfolioViewReference.SetValueForKey("InfoAreaId", this.ViewReference.ContextValueForKey("RecordId"));
            portfolioViewReference.SetValueForKey("ParentLink", string.Empty);

            UPMGroup group = this.portfolioGroupController.ApplyLinkRecordIdentification(this.Survey.AnswerRootRecordIdentification, null, portfolioViewReference);

            group.LabelText = LocalizedString.TextProcessPortfolioResult;
            return(group);
        }
        private UPMGroup AddFieldToDetailGroup(UPMGroup detailGroup, FieldAttributes fieldAttributes, UPMStringField field, string recordIdentification)
        {
            SetAttributesOnField(fieldAttributes, field);
            if (detailGroup == null)
            {
                detailGroup = new UPMStandardGroup(this.TabIdentifierForRecordIdentification(recordIdentification));
                ((UPMStandardGroup)detailGroup).ColumnStyle = this.columnStyle;
                detailGroup.LabelText = this.TabLabel;
            }

            detailGroup.AddField(field);

            return(detailGroup);
        }
        private UPMGroup AddFieldToDetailGroup(UPMGroup detailGroup, FieldIdentifier fieldIdentifier, string recordIdentification)
        {
            if (detailGroup == null)
            {
                detailGroup = new UPMStandardGroup(this.TabIdentifierForRecordIdentification(recordIdentification));
                ((UPMStandardGroup)detailGroup).ColumnStyle = this.columnStyle;
                detailGroup.LabelText = this.TabLabel;
            }

            var field = new UPMStringField(fieldIdentifier);

            detailGroup.AddField(field);

            return(detailGroup);
        }
Exemple #12
0
        /// <summary>
        /// Handles removing an item from repeatable edit group
        /// </summary>
        /// <param name="group">Group to remove</param>
        /// <param name="repeatableEditGroup">Repeatable edit group to remove from</param>
        public override void UserWillDeleteGroupInRepeatableEditGroup(UPMGroup group, UPMRepeatableEditGroup repeatableEditGroup)
        {
            string participantKey = this.KeyForEditGroup(group);

            if (!string.IsNullOrEmpty(participantKey))
            {
                UPCRMParticipant participant = this.ParticipantsControl.ParticipantWithKey(participantKey);
                if (participant != null && this.ParticipantsControl.MarkParticipantAsDeleted(participant))
                {
                    repeatableEditGroup.RemoveChild(group);
                    if (this.MaxChildren > 0)
                    {
                        repeatableEditGroup.AddingEnabled = this.AddRecordEnabled;
                    }
                }
            }
        }
        /// <summary>
        /// Groups from row group.
        /// </summary>
        /// <param name="resultRow">The result row.</param>
        /// <param name="group">The group.</param>
        /// <returns></returns>
        public UPMGroup GroupFromRowGroup(UPCRMResultRow resultRow, UPMGroup group)
        {
            var recordIdentification = resultRow.RootRecordIdentification;

            var detailGroup = this.AddFieldsToDetailGroup(group, recordIdentification, resultRow, out var documentKey, out var documentFieldConfig);

            var standardGroup = detailGroup as UPMStandardGroup;

            if (standardGroup != null && !string.IsNullOrEmpty(documentKey))
            {
                ProccessStandardGroup(standardGroup, documentFieldConfig, documentKey, recordIdentification);
            }

            this.ControllerState = detailGroup != null ? GroupModelControllerState.Finished : GroupModelControllerState.Empty;
            this.Group           = detailGroup;
            return(detailGroup);
        }
        private UPMGroup AddFieldToDetailGroup(UPMGroup detailGroup, string recordIdentification, FieldIdentifier fieldIdentifier, FieldAttributes fieldAttributes)
        {
            if (detailGroup == null)
            {
                detailGroup = new UPMStandardGroup(this.TabIdentifierForRecordIdentification(recordIdentification));
                ((UPMStandardGroup)detailGroup).ColumnStyle = this.columnStyle;
                detailGroup.LabelText = this.TabLabel;
            }

            var field = new UPMStringField(fieldIdentifier)
            {
                StripNewLines = fieldAttributes.NoMultiLine
            };

            detailGroup.AddField(field);

            return(detailGroup);
        }
        /// <summary>
        /// Handles removing an item from repeatable edit group
        /// </summary>
        /// <param name="group">Group to remove</param>
        /// <param name="repeatableEditGroup">Repeatable edit group to remove from</param>
        public override void UserWillDeleteGroupInRepeatableEditGroup(UPMGroup group, UPMRepeatableEditGroup repeatableEditGroup)
        {
            UPChildEditContext editContext = this.ChildContextForGroup(group);

            if (editContext != null)
            {
                repeatableEditGroup.RemoveChild(group);
                if (this.MaxChildren > 0)
                {
                    repeatableEditGroup.AddingEnabled = this.AddRecordEnabled;
                }

                editContext.DeleteRecord = true;
                if (this.AddedChildEditContexts.Contains(editContext))
                {
                    this.AddedChildEditContexts.Remove(editContext);
                }
            }
        }
Exemple #16
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);
        }
Exemple #17
0
        /// <summary>
        /// Adds the group.
        /// </summary>
        /// <param name="group">
        /// The group.
        /// </param>
        public virtual void AddGroup(UPMGroup group)
        {
            if (group == null)
            {
                return;
            }

            if (string.IsNullOrEmpty(group.LabelText))
            {
                group.LabelText = "Overview";
            }

            if (this.Groups.Contains(group))
            {
                return;
            }

            this.Groups.Add(group);

            this.GUIPage?.ChildrenAdded(group);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="UPInBoxPageModelController"/> class.
        /// </summary>
        /// <param name="viewReference">The view reference.</param>
        public UPInBoxPageModelController(ViewReference viewReference)
            : base(viewReference)
        {
            UPMInBoxPage page = new UPMInBoxPage(StringIdentifier.IdentifierWithStringId("Inbox"))
            {
                Invalid = true,
                SkipUploadIfPossible = viewReference.ContextValueIsSet("SkipUploadPageIfPossible")
            };

            this.removeUploadedFileFromInbox = viewReference.ContextValueIsSet("RemoveUploadedFile");
            this.TopLevelElement             = page;
            this.editFieldContexts           = new Dictionary <StringIdentifier, UPEditFieldContext>();
            IConfigurationUnitStore configStore      = ConfigurationUnitStore.DefaultStore;
            FieldControl            editFieldControl = configStore.FieldControlByNameFromGroup("Edit", viewReference.ContextValueForKey("UploadFields"));
            UPMGroup uploadFieldGroup = new UPMGroup(StringIdentifier.IdentifierWithStringId("uploadFieldGroup"));

            if (editFieldControl != null)
            {
                int numberOfFields = editFieldControl.NumberOfFields;
                for (int index = 0; index < numberOfFields; index++)
                {
                    UPConfigFieldControlField field                 = editFieldControl.FieldAtIndex(index);
                    StringIdentifier          fieldIdentifier       = StringIdentifier.IdentifierWithStringId($"Field {field.FieldId} {field.InfoAreaId}");
                    UPEditFieldContext        initialValueEditField = UPEditFieldContext.FieldContextFor(field, fieldIdentifier, null, (List <UPEditFieldContext>)null);
                    this.editFieldContexts[fieldIdentifier] = initialValueEditField;
                    if (field.Function == "Filename")
                    {
                        page.FileNameEditField = initialValueEditField.EditField;
                    }

                    uploadFieldGroup.AddField(initialValueEditField.EditField);
                }
            }

            this.recordIdentification = this.ViewReference.ContextValueForKey("RecordId");
            page.UploadFieldGroup     = uploadFieldGroup; // load directly
            this.UpdatedElement(page);
        }
Exemple #19
0
        private UPMDependsEditField CreateEditFieldWithParticipantIdentifierEditGroup(IIdentifier participantIdentifier, UPMGroup editGroup)
        {
            var dependsEditField = new UPMDependsEditField(StringIdentifier.IdentifierWithStringId($"depenfEditField_{participantIdentifier}"))
            {
                MainField             = this.CreateMainEditFieldWithParticipantIdentifierEditGroup(participantIdentifier, editGroup),
                DependField           = this.CreateDependEditField(participantIdentifier, this.ParticipantsControl.AcceptanceCatalog, editGroup),
                DependField2          = this.CreateDependEditField(participantIdentifier, this.ParticipantsControl.RequirementCatalog, editGroup),
                InitialSelectableOnly = true
            };

            return(dependsEditField);
        }
Exemple #20
0
        UPMDependsEditField CreateEditFieldWithParticipantIdentifierEditGroup(UPMIdentifier participantIdentifier, UPMGroup editGroup)
        {
            UPMDependsEditField dependsEditField = new UPMDependsEditField(UPMStringIdentifier.IdentifierWithStringId(NSString.StringWithFormat("depenfEditField_%@", participantIdentifier.Description)));

            dependsEditField.MainField             = this.CreateMainEditFieldWithParticipantIdentifierEditGroup(participantIdentifier, editGroup);
            dependsEditField.DependField           = this.CreateDependEditFieldWithParticipantIdentifierCatalogEditGroup(participantIdentifier, this.ParticipantsControl.AcceptanceCatalog, editGroup);
            dependsEditField.DependField2          = this.CreateDependEditFieldWithParticipantIdentifierCatalogEditGroup(participantIdentifier, this.ParticipantsControl.RequirementCatalog, editGroup);
            dependsEditField.initialSelectableOnly = true;
            return(dependsEditField);
        }
        private UPChildEditContext ChildContextForGroup(UPMGroup group)
        {
            UPChildEditContext editContext = this.ChildEditContexts.Values.FirstOrDefault(x => x.Group == group);

            return(editContext ?? this.AddedChildEditContexts.FirstOrDefault(x => x.Group == group));
        }
Exemple #22
0
 /// <summary>
 /// Adds the detail input group.
 /// </summary>
 /// <param name="detailGroup">The detail group.</param>
 public void AddDetailInputGroup(UPMGroup detailGroup)
 {
     this.AddChild(detailGroup);
 }
Exemple #23
0
        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);
        }
Exemple #24
0
        UPMEditField CreateDependEditFieldWithParticipantIdentifierCatalogEditGroup(UPMIdentifier participantIdentifier, UPCatalog catalog, UPMGroup editGroup)
        {
            UPCRMField field;

            if (catalog == this.ParticipantsControl.RequirementCatalog)
            {
                field = this.ParticipantsControl.RequirementField;
            }
            else if (catalog == this.ParticipantsControl.AcceptanceCatalog)
            {
                field = this.ParticipantsControl.AcceptanceField;
            }

            UPMParticipantCatalogEditField editField = new UPMParticipantCatalogEditField(UPMStringIdentifier.IdentifierWithStringId(NSString.StringWithFormat("dependField_%@_%@_%ld", participantIdentifier.Description, field.InfoAreaId, (long)field.FieldId)));

            editField.GroupModelController = this;
            editField.Group = editGroup;
            if (catalog != null)
            {
                ArrayList                 possibleValues = catalog.Values;
                ArrayList                 explicitKeyOrder;
                NSDictionary              possibleValuesAsString      = catalog ? catalog.TextValuesForFieldValues() : null;
                UPConfigurationUnitStore  configStore                 = UPConfigurationUnitStore.DefaultStore();
                UPConfigCatalogAttributes acceptanceCatalogAttributes = configStore.CatalogAttributesForInfoAreaIdFieldId(field.InfoAreaId, field.FieldId);
                possibleValues.EnumerateObjectsUsingBlock(delegate(object obj, uint idx, bool stop)
                {
                    UPMCatalogPossibleValue possibleValue = new UPMCatalogPossibleValue();
                    UPMStringField valueField             = new UPMStringField(UPMStringIdentifier.IdentifierWithStringId("x"));
                    UPCatalogValue catalogValue           = (UPCatalogValue)obj;
                    valueField.StringValue        = catalogValue.Text;
                    possibleValue.TitleLabelField = valueField;
                    UPConfigCatalogValueAttributes configCatalogValueAttributes = acceptanceCatalogAttributes.ValuesByCode().ObjectForKey(NSNumber.NumberWithInt(catalogValue.CodeKey.IntValue));
                    if (configCatalogValueAttributes)
                    {
                        string colorString = configCatalogValueAttributes.ColorKey();
                        if (colorString)
                        {
                            possibleValue.IndicatorColor = UPColor.ColorWithString(colorString);
                        }

                        possibleValue.ImageString = configCatalogValueAttributes.ImageName();
                    }

                    editField.AddPossibleValueForKey(possibleValue, catalogValue.CodeKey);
                });
                if (((string)possibleValuesAsString.ObjectForKey("0")).Length == 0)
                {
                    editField.NullValueKey = "0";
                }

                if (catalog != null && acceptanceCatalogAttributes != null && !UPConfigurationUnitStore.DefaultStore().ConfigValueIsSet("FixedCatalog.SortByAttributeFilter"))
                {
                    explicitKeyOrder = this.ExplicitKeyOrderByCatalogAttributeCodeOrder(acceptanceCatalogAttributes, catalog.ExplicitKeyOrderByCodeEmptyValueIncludeHidden(false, false));
                }
                else if (catalog != null && UPConfigurationUnitStore.DefaultStore().ConfigValueIsSet("FixedCatalog.SortByCode"))
                {
                    explicitKeyOrder = catalog.ExplicitKeyOrderByCodeEmptyValueIncludeHidden(false, false);
                }
                else
                {
                    explicitKeyOrder = catalog.ExplicitKeyOrderEmptyValueIncludeHidden(false, false);
                }

                if (explicitKeyOrder != null)
                {
                    editField.ExplicitKeyOrder = explicitKeyOrder;
                }

                editField.ContinuousUpdate = true;
            }

            return(editField);
        }
        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);
        }
 /// <summary>
 /// Handles removing an item from repeatable edit group
 /// </summary>
 /// <param name="group">Group to remove</param>
 /// <param name="repeatableEditGroup">Repeatable edit group to remove from</param>
 public virtual void UserWillDeleteGroupInRepeatableEditGroup(UPMGroup group, UPMRepeatableEditGroup repeatableEditGroup)
 {
 }
Exemple #27
0
        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);
        }
Exemple #28
0
        private UPMEditField CreateDependEditField(IIdentifier participantIdentifier, UPCatalog catalog, UPMGroup editGroup)
        {
            UPCRMField field = null;

            if (catalog == this.ParticipantsControl.RequirementCatalog)
            {
                field = this.ParticipantsControl.RequirementField;
            }
            else if (catalog == this.ParticipantsControl.AcceptanceCatalog)
            {
                field = this.ParticipantsControl.AcceptanceField;
            }

            var editField = new UPMParticipantCatalogEditField(StringIdentifier.IdentifierWithStringId(
                                                                   field != null ? $"dependField_{participantIdentifier}_{field.InfoAreaId}_{field.FieldId}" : $"dependField_{participantIdentifier}_(null)_0"))
            {
                GroupModelController = this,
                Group = editGroup
            };

            if (catalog != null)
            {
                var           possibleValues = catalog.Values;
                List <string> explicitKeyOrder;
                var           possibleValuesAsString      = catalog.TextValuesForFieldValues(false);
                var           configStore                 = ConfigurationUnitStore.DefaultStore;
                var           acceptanceCatalogAttributes = configStore.CatalogAttributesForInfoAreaIdFieldId(field.InfoAreaId, field.FieldId);
                foreach (var catalogValue in possibleValues)
                {
                    var possibleValue = new UPMCatalogPossibleValue
                    {
                        TitleLabelField = new UPMStringField(StringIdentifier.IdentifierWithStringId("x"))
                        {
                            StringValue = catalogValue.Text
                        }
                    };

                    var configCatalogValueAttributes = acceptanceCatalogAttributes.ValuesByCode.ValueOrDefault(catalogValue.CodeKey.ToInt());

                    if (configCatalogValueAttributes != null)
                    {
                        var colorString = configCatalogValueAttributes.ColorKey;
                        if (!string.IsNullOrEmpty(colorString))
                        {
                            possibleValue.IndicatorColor = AureaColor.ColorWithString(colorString);
                        }

                        possibleValue.ImageString = configCatalogValueAttributes.ImageName;
                    }

                    possibleValue.Key = catalogValue.CodeKey;

                    editField.AddPossibleValue(possibleValue);
                }

                if (string.IsNullOrEmpty(possibleValuesAsString.ValueOrDefault("0")))
                {
                    editField.NullValueKey = "0";
                }

                if (acceptanceCatalogAttributes != null && !ConfigurationUnitStore.DefaultStore.ConfigValueIsSet("FixedCatalog.SortByAttributeFilter"))
                {
                    explicitKeyOrder = this.ExplicitKeyOrderByCatalogAttributeCodeOrder(acceptanceCatalogAttributes, catalog.ExplicitKeyOrderByCodeEmptyValueIncludeHidden(false, false));
                }
                else if (ConfigurationUnitStore.DefaultStore.ConfigValueIsSet("FixedCatalog.SortByCode"))
                {
                    explicitKeyOrder = catalog.ExplicitKeyOrderByCodeEmptyValueIncludeHidden(false, false);
                }
                else
                {
                    explicitKeyOrder = catalog.ExplicitKeyOrderEmptyValueIncludeHidden(false, false);
                }

                if (explicitKeyOrder != null)
                {
                    editField.ExplicitKeyOrder = explicitKeyOrder;
                }

                editField.ContinuousUpdate = true;
                editField.DisplayValues    = possibleValuesAsString.Values.ToList();
            }

            return(editField);
        }
        private UPMGroup AddFieldsToDetailGroup(UPMGroup upmGroup, string recordIdentification, UPCRMResultRow resultRow, out string documentKey, out UPConfigFieldControlField documentFieldConfig)
        {
            var configStore     = ConfigurationUnitStore.DefaultStore;
            var hideEmptyFields = configStore.ConfigValueIsSet("View.HideEmptyFields");

            documentKey         = string.Empty;
            documentFieldConfig = null;
            var listFormatter = new UPCRMListFormatter(this.TabConfig, false);
            var fieldCount    = listFormatter.PositionCount;
            var detailGroup   = upmGroup;

            for (var j = 0; j < fieldCount; j++)
            {
                var fieldConfig     = listFormatter.FirstFieldForPosition(j);
                var fieldAttributes = fieldConfig.Attributes;
                var fieldIdentifier = FieldIdentifier.IdentifierWithRecordIdentificationFieldId(recordIdentification, fieldConfig.Identification);
                var hasFieldValue   = false;
                if (fieldAttributes.Image)
                {
                    documentKey         = resultRow.ValueAtIndex(fieldConfig.TabIndependentFieldIndex);
                    documentFieldConfig = fieldConfig;
                    if (!string.IsNullOrEmpty(documentKey) && fieldCount == 1)
                    {
                        detailGroup = this.AddFieldToDetailGroup(detailGroup, fieldIdentifier, recordIdentification);
                    }

                    continue;
                }

                if (fieldAttributes.Hide)
                {
                    continue;
                }

                if (fieldAttributes.Empty)
                {
                    detailGroup = this.AddFieldToDetailGroup(detailGroup, recordIdentification, fieldIdentifier, fieldAttributes);
                    continue;
                }

                string fieldValue = null;

                try
                {
                    fieldValue = listFormatter.StringFromRowForPosition(resultRow, j);
                }
                catch (Exception error)
                {
                    SimpleIoc.Default.GetInstance <ILogger>().LogError(error);
                }

                if (!string.IsNullOrEmpty(fieldValue))
                {
                    hasFieldValue = true;
                }

                if (!hasFieldValue && hideEmptyFields && !this.columnStyle)
                {
                    if (!(detailGroup is UPMCalendarPopoverGroup) || j > 3)
                    {
                        continue;
                    }
                }

                if (fieldAttributes.MultiLine && j + 1 == fieldCount && detailGroup == null)
                {
                    var multiLineGroup = this.CreateMultilineGroup(recordIdentification, CreateStringField(fieldIdentifier, fieldAttributes, fieldValue), fieldConfig);
                    this.ControllerState = GroupModelControllerState.Finished;
                    this.Group           = multiLineGroup;
                    return(multiLineGroup);
                }

                var field = this.CreateField(fieldAttributes, fieldIdentifier, fieldConfig, resultRow, recordIdentification, configStore);
                if (field == null)
                {
                    continue;
                }

                UpdateField(field, fieldAttributes, fieldConfig, fieldValue);
                if (string.IsNullOrWhiteSpace(field.LabelText) && string.IsNullOrEmpty(fieldValue))
                {
                    continue;
                }

                detailGroup = this.AddFieldToDetailGroup(detailGroup, fieldAttributes, field, recordIdentification);
            }

            return(detailGroup);
        }
Exemple #30
0
        /// <summary>
        /// Applies the result row.
        /// </summary>
        /// <param name="row">The row.</param>
        /// <returns></returns>
        public override UPMGroup ApplyResultRow(UPCRMResultRow row)
        {
            this.RecordIdentification = row.RootRecordIdentification;
            IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore;
            string infoAreaId = this.RecordIdentification.InfoAreaId();

            this.fieldControl = null;
            UPContainerMetaInfo containerMetaInfo;

            if (this.searchAndList != null)
            {
                containerMetaInfo = new UPContainerMetaInfo(this.searchAndList, null);
                this.fieldControl = containerMetaInfo.SourceFieldControl;
            }
            else
            {
                if (infoAreaId == "D1")
                {
                    this.fieldControl = configStore.FieldControlByNameFromGroup("List", "D1DocData");
                }

                if (this.fieldControl == null)
                {
                    this.fieldControl = configStore.FieldControlByNameFromGroup("List", "D3DocData");
                }

                if (this.fieldControl == null)
                {
                    this.ControllerState = GroupModelControllerState.Error;
                    this.Group           = null;
                    this.Error           = new Exception("configuration error");
                    return(null);
                }

                containerMetaInfo = new UPContainerMetaInfo(this.fieldControl);
            }

            if (infoAreaId == "D1" || infoAreaId == "D3")
            {
                containerMetaInfo.SetLinkRecordIdentification(this.RecordIdentification);
            }
            else
            {
                containerMetaInfo.SetLinkRecordIdentification(this.RecordIdentification, 126, 127);
            }

            if (this.MaxResults > 0)
            {
                containerMetaInfo.MaxResults = this.MaxResults;
            }

            if (this.RequestOption == UPRequestOption.FastestAvailable || this.RequestOption == UPRequestOption.Offline)
            {
                UPCRMResult result = containerMetaInfo.Find();
                if (result != null)
                {
                    UPMGroup group = this.GroupFromResult(result);
                    group?.Actions.AddRange(this.BuildAdditionalActionsForRecordIdentification(this.RecordIdentification));
                    return(group);
                }
            }

            if (this.RequestOption != UPRequestOption.Offline)
            {
                containerMetaInfo.Find(this.RequestOption, this);
                this.ControllerState = GroupModelControllerState.Pending;
                return(null);
            }

            base.ControllerState = GroupModelControllerState.Empty;
            base.Group           = null;
            return(null);
        }