private List <UPMEditField> ApplyCopyValuesRecordSelectorEditField(Dictionary <string, object> copyValues, UPMRecordSelectorEditField field)
        {
            List <UPMEditField> changedFields = new List <UPMEditField>();

            if (copyValues != null && field.EditFieldsContext != null)
            {
                UPEditPageContext fieldEditPageContext = (UPEditPageContext)field.EditFieldsContext;
                foreach (UPEditFieldContext fieldContext in fieldEditPageContext.EditFields.Values)
                {
                    if (!string.IsNullOrEmpty(fieldContext.FieldFunction))
                    {
                        string value = copyValues[fieldContext.FieldFunction] as string;
                        if (value != null)
                        {
                            fieldContext.Value = value;
                            fieldContext.SetChanged(true);
                            if (fieldContext.EditField != null)
                            {
                                changedFields.Add(fieldContext.EditField);
                            }
                        }
                    }
                }
            }

            return(changedFields);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="UPEditFieldGroupModelController"/> class.
 /// </summary>
 /// <param name="fieldControl">
 /// The field control.
 /// </param>
 /// <param name="tabIndex">
 /// Index of the tab.
 /// </param>
 /// <param name="editPageContext">
 /// The edit page context.
 /// </param>
 /// <param name="theDelegate">
 /// The delegate.
 /// </param>
 /// <param name="_editHeader">
 /// if set to <c>true</c> [_edit header].
 /// </param>
 public UPEditFieldGroupModelController(
     FieldControl fieldControl,
     int tabIndex,
     UPEditPageContext editPageContext,
     IGroupModelControllerDelegate theDelegate,
     bool _editHeader = false)
     : base(fieldControl, tabIndex, editPageContext, theDelegate)
 {
     this.editHeader = _editHeader;
 }
Esempio n. 3
0
        /// <summary>
        /// Edits the group model controller for.
        /// </summary>
        /// <param name="fieldControl">The field control.</param>
        /// <param name="tabIndex">Index of the tab.</param>
        /// <param name="editPageContext">The edit page context.</param>
        /// <param name="theDelegate">The delegate.</param>
        /// <returns></returns>
        public static UPGroupModelController EditGroupModelControllerFor(FieldControl fieldControl, int tabIndex,
                                                                         UPEditPageContext editPageContext, IGroupModelControllerDelegate theDelegate)
        {
            var tab     = fieldControl.TabAtIndex(tabIndex);
            var tabType = tab.Type;

            if (tabType.StartsWith("CHILDREN"))
            {
                if (fieldControl.ControlName != "Edit")
                {
                    // CHILDREN only supported in explicit Edit Controls
                    return(null);
                }

                //2019-05-27 Vipul Commented out code for link participants
                //return new EditChildrenGroupModelController(fieldControl, tabIndex, editPageContext, theDelegate);
                return(null);
            }

            if (tabType.StartsWith("REPPARTICIPANTS") || tabType.StartsWith("PARTICIPANTS"))
            {
                return(new UPEditRepParticipantsGroupModelController(fieldControl, tabIndex, editPageContext, theDelegate));
            }

            if (tabType.StartsWith("LINKPARTICIPANTS"))
            {
                //2019-05-27 Vipul Commented out code for link participants
                //return new UPEditLinkParticipantsGroupModelController(fieldControl, tabIndex, editPageContext, theDelegate);
                return(null);
            }

            if (tabType.StartsWith("EDITHEADER"))
            {
                return(new UPEditFieldGroupModelController(fieldControl, tabIndex, editPageContext, theDelegate, true));
            }

            if (fieldControl.ControlName == "Details" && tabType == "GRID")
            {
                // PVCS 81779  Dont ignore Grid groups from Detail
                return(new UPEditFieldGroupModelController(fieldControl, tabIndex, editPageContext, theDelegate));
            }

            if (!string.IsNullOrEmpty(tabType) && tabType != "GRID")
            {
                // ignore other Tab Types
                return(null);
            }

            return(new UPEditFieldGroupModelController(fieldControl, tabIndex, editPageContext, theDelegate));
        }
        private void UserDidChangeCatalogField(UPMCatalogEditField editField)
        {
            UPEditPageContext  fieldEditPageContext = (UPEditPageContext)editField.EditFieldsContext;
            UPEditFieldContext context = fieldEditPageContext.ContextForEditField(editField);

            if (context.HasDependentFields)
            {
                context.NotifyDependentFields();
                this.SimpleChangedValue(editField);
                this.Delegate.ForceRedraw(this);
            }
            else
            {
                this.SimpleChangedValue(editField);
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="UPEditChildrenGroupModelControllerBase"/> class.
        /// </summary>
        /// <param name="fieldControl">The field control.</param>
        /// <param name="tabIndex">Index of the tab.</param>
        /// <param name="editPageContext">The edit page context.</param>
        /// <param name="theDelegate">The delegate.</param>
        protected UPEditChildrenGroupModelControllerBase(FieldControl fieldControl, int tabIndex,
                                                         UPEditPageContext editPageContext, IGroupModelControllerDelegate theDelegate)
            : base(fieldControl, tabIndex, editPageContext, theDelegate)
        {
            this.AddRecordEnabled    = this.AddRecordEnabledDefault(this.EditPageContext.IsNewRecord);
            this.DeleteRecordEnabled = this.DeleteRecordEnabledDefault;

            string attrValue = fieldControl.ValueForAttribute($"AddRecords_{tabIndex + 1}");

            if (!string.IsNullOrEmpty(attrValue))
            {
                attrValue = fieldControl.ValueForAttribute($"{(editPageContext.IsNewRecord ? @"New" : @"Update")}.AddRecords_{tabIndex + 1}");
            }

            if (!string.IsNullOrEmpty(attrValue))
            {
                this.MaxChildren      = Convert.ToInt32(attrValue);
                this.AddRecordEnabled = this.MaxChildren > 0;
            }

            attrValue = fieldControl.ValueForAttribute($"MaxRecords_{tabIndex + 1}");
            if (!string.IsNullOrEmpty(attrValue))
            {
                attrValue = fieldControl.ValueForAttribute($"{(editPageContext.IsNewRecord ? @"New" : @"Update")}.MaxRecords_{tabIndex + 1}");
            }

            if (!string.IsNullOrEmpty(attrValue))
            {
                this.MinChildren = Convert.ToInt32(attrValue);
            }

            attrValue = fieldControl.ValueForAttribute($"DeleteRecord_{tabIndex + 1}");

            if (!string.IsNullOrEmpty(attrValue))
            {
                this.DeleteRecordEnabled = Convert.ToBoolean(attrValue);
            }

            this._displayIndex = 0;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="UPParticipantsGroupModelController"/> class.
 /// </summary>
 /// <param name="fieldControl">The field control.</param>
 /// <param name="tabIndex">Index of the tab.</param>
 /// <param name="editPageContext">The edit page context.</param>
 /// <param name="theDelegate">The delegate.</param>
 public UPParticipantsGroupModelController(FieldControl fieldControl, int tabIndex,
                                           UPEditPageContext editPageContext, IGroupModelControllerDelegate theDelegate)
     : base(fieldControl, tabIndex, editPageContext, theDelegate)
 {
 }
Esempio n. 7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UPFieldControlBasedEditGroupModelController"/> class.
 /// </summary>
 /// <param name="fieldControl">The field control.</param>
 /// <param name="tabIndex">Index of the tab.</param>
 /// <param name="editPageContext">The edit page context.</param>
 /// <param name="theDelegate">The delegate.</param>
 public UPFieldControlBasedEditGroupModelController(FieldControl fieldControl, int tabIndex, UPEditPageContext editPageContext, IGroupModelControllerDelegate theDelegate)
     : base(fieldControl, tabIndex, theDelegate)
 {
     this.EditPageContext = editPageContext;
 }
 /// <summary>
 /// Constraints the violations with page context.
 /// </summary>
 /// <param name="editPageContext">The edit page context.</param>
 /// <returns></returns>
 public virtual List <UPEditConstraintViolation> ConstraintViolationsWithPageContext(UPEditPageContext editPageContext)
 {
     return(null);
 }
 /// <summary>
 /// Edits the group model controller for control.
 /// </summary>
 /// <param name="fieldControl">The field control.</param>
 /// <param name="tabIndex">Index of the tab.</param>
 /// <param name="editPageContext">The edit page context.</param>
 /// <param name="theDelegate">The delegate.</param>
 /// <returns></returns>
 public static UPGroupModelController EditGroupModelControllerForControl(FieldControl fieldControl, int tabIndex, UPEditPageContext editPageContext, IGroupModelControllerDelegate theDelegate)
 {
     return(UPFieldControlBasedEditGroupModelController.EditGroupModelControllerFor(fieldControl, tabIndex, editPageContext, theDelegate));
 }
        /// <summary>
        /// Constraints the violations with page context.
        /// </summary>
        /// <param name="editPageContext">The edit page context.</param>
        /// <returns></returns>
        public override List <UPEditConstraintViolation> ConstraintViolationsWithPageContext(UPEditPageContext editPageContext)
        {
            List <UPEditConstraintViolation> violations = null;

            foreach (UPChildEditContext childEditContext in this.ChildEditContexts?.Values)
            {
                foreach (UPEditFieldContext fieldContext in childEditContext.EditFieldContext.Values)
                {
                    List <UPEditConstraintViolation> contraintViolations = fieldContext?.ConstraintViolationsWithPageContext(editPageContext);
                    if (contraintViolations != null)
                    {
                        if (violations != null)
                        {
                            violations.AddRange(contraintViolations);
                        }
                        else
                        {
                            violations = new List <UPEditConstraintViolation>(contraintViolations);
                        }
                    }
                }
            }

            if (this.AddedChildEditContexts != null)
            {
                foreach (UPChildEditContext childEditContext in this.AddedChildEditContexts)
                {
                    foreach (UPEditFieldContext fieldContext in childEditContext.EditFieldContext.Values)
                    {
                        List <UPEditConstraintViolation> contraintViolations = fieldContext.ConstraintViolationsWithPageContext(editPageContext);
                        if (contraintViolations != null)
                        {
                            if (violations != null)
                            {
                                violations.AddRange(contraintViolations);
                            }
                            else
                            {
                                violations = new List <UPEditConstraintViolation>(contraintViolations);
                            }
                        }
                    }
                }
            }

            return(violations);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="EditChildrenGroupModelController"/> class.
        /// </summary>
        /// <param name="fieldControl">The field control.</param>
        /// <param name="tabIndex">Index of the tab.</param>
        /// <param name="editPageContext">The edit page context.</param>
        /// <param name="theDelegate">The delegate.</param>
        /// <exception cref="Exception">
        /// TabConfig is null
        /// or
        /// ChildFieldControl is null
        /// </exception>
        public EditChildrenGroupModelController(FieldControl fieldControl, int tabIndex, UPEditPageContext editPageContext, IGroupModelControllerDelegate theDelegate)
            : base(fieldControl, tabIndex, editPageContext, theDelegate)
        {
            FieldControlTab tabConfig = fieldControl.TabAtIndex(tabIndex);

            if (tabConfig == null)
            {
                throw new Exception("TabConfig is null");
            }

            var typeParts = tabConfig.Type.Split('_');

            if (typeParts.Length > 1)
            {
                string detailsConfigurationName = (string)typeParts[1];
                var    configNameParts          = detailsConfigurationName.Split('#');
                if (configNameParts.Length > 1)
                {
                    this.LinkId = Convert.ToInt32(configNameParts[1]);
                    detailsConfigurationName = configNameParts[0];
                }

                IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore;
                this.ChildFieldControl = configStore.FieldControlByNameFromGroup("Edit", detailsConfigurationName);
                if (this.ChildFieldControl.NumberOfTabs > 1)
                {
                    this.ChildFieldControl = this.ChildFieldControl.FieldControlWithSingleTab(0);
                }

                this.ChildInfoAreaId = this.ChildFieldControl.InfoAreaId;
                if (typeParts.Length > 2)
                {
                    UPConfigFilter templateFilter = configStore.FilterByName((string)typeParts[2]);
                    if (templateFilter != null)
                    {
                        templateFilter     = templateFilter.FilterByApplyingReplacements(UPConditionValueReplacement.DefaultParameters);
                        this.initialValues = templateFilter.FieldsWithConditions(false);
                    }
                }
            }
            else if (tabConfig.NumberOfFields > 0)
            {
                UPConfigFieldControlField childField = tabConfig.FieldAtIndex(0);
                this.ChildInfoAreaId   = childField.InfoAreaId;
                this.LinkId            = childField.LinkId;
                this.ChildFieldControl = fieldControl.FieldControlWithSingleTabRootInfoAreaIdRootLinkId(tabIndex, this.ChildInfoAreaId, this.LinkId);
            }
            else
            {
                this.ChildFieldControl = null;
            }

            if (this.ChildFieldControl == null)
            {
                throw new Exception("ChildFieldControl is null");
            }
        }
Esempio n. 12
0
        /// <summary>
        /// Initializes a new instance of the <see cref="UPEditParticipantsGroupModelController"/> class.
        /// </summary>
        /// <param name="_fieldControl">The field control.</param>
        /// <param name="_tabIndex">Index of the tab.</param>
        /// <param name="_editPageContext">The edit page context.</param>
        /// <param name="_theDelegate">The delegate.</param>
        public UPEditParticipantsGroupModelController(FieldControl _fieldControl, int _tabIndex, UPEditPageContext _editPageContext, IGroupModelControllerDelegate _theDelegate)
            : base(_fieldControl, _tabIndex, _editPageContext, _theDelegate)
        {
            int fieldCount = this.TabConfig.NumberOfFields;

            for (int i = 0; i < fieldCount; i++)
            {
                UPConfigFieldControlField fieldConfig = this.TabConfig.FieldAtIndex(i);
                if (fieldConfig.Field.FieldInfo.IsParticipantsField)
                {
                    this.ParticipantsField = fieldConfig;
                    break;
                }
            }

            var tabTypeParts = this.TabConfig.Type.Split('_');

            this.LinkParticipantsName = null;
            if (tabTypeParts.Length > 1)
            {
                this.LinkParticipantsName = tabTypeParts[1];
                var configParts = this.LinkParticipantsName.Split('#');
                if (configParts.Length > 1)
                {
                    this.LinkParticipantsName = configParts[0];
                    this.LinkId = Convert.ToInt32(configParts[1]);
                }

                SearchAndList searchAndList = ConfigurationUnitStore.DefaultStore.SearchAndListByName(this.LinkParticipantsName);
                if (searchAndList != null)
                {
                    this.ParticipantInfoAreaId = searchAndList.InfoAreaId;
                }
                else
                {
                    FieldControl fieldControl = ConfigurationUnitStore.DefaultStore.FieldControlByNameFromGroup("List", this.LinkParticipantsName);
                    this.ParticipantInfoAreaId = fieldControl.InfoAreaId;
                }
            }

            this.RootInfoAreaId = _fieldControl.InfoAreaId;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="UPEditLinkParticipantsGroupModelController"/> class.
        /// </summary>
        /// <param name="fieldControl">Field control</param>
        /// <param name="tabIndex">Tab index</param>
        /// <param name="editPageContext">Edit page context</param>
        /// <param name="Delegate">Delegate</param>
        public UPEditLinkParticipantsGroupModelController(FieldControl fieldControl, int tabIndex, UPEditPageContext editPageContext, IGroupModelControllerDelegate Delegate)
            : base(fieldControl, tabIndex, editPageContext, Delegate)
        {
            this.ProtectedParentLinkString = fieldControl.ValueForAttribute($"ProtectedParent_{tabIndex + 1}");
            if (string.IsNullOrEmpty(this.ProtectedParentLinkString))
            {
                this.ProtectedParentLinkString = fieldControl.ValueForAttribute("ProtectedParent");
            }

            if (this.ProtectedParentLinkString == "none")
            {
                this.ProtectedParentLinkString = string.Empty;
            }
            else if (string.IsNullOrEmpty(this.ProtectedParentLinkString))
            {
                this.ProtectedParentLinkString = ServerSession.CurrentSession.IsUpdateCrm ? "CP;PE;FI" : "KP;FI";
            }
        }