public static SingleCrossRefFieldOptions Create(string value, CrossRefFieldAttribute CrossRefFieldAttr, int? crid, List<ProcessMetadata> relatedProcesses)
        {
            var result = new SingleCrossRefFieldOptions();
            result.AllowClear = CrossRefFieldAttr.AllowClear;
            result.AllowViewDetail = CrossRefFieldAttr.AllowViewDetail; 
            result.FieldName = CrossRefFieldAttr.RefFieldName;
            result.id = crid;
            result.ProcessSystemName = CrossRefFieldAttr.ReferenceTableName;
            result.RelatedProcesses = relatedProcesses;
            result.ValueAsText = value;
            result.displayFieldList = CrossRefFieldAttr.DisplayFieldList;

            return result;

        }
Exemplo n.º 2
0
        public static MultiCrossRefFieldOptions Create(PropertyInfo property, CrossRefFieldAttribute CrossRefFieldAttr, MultiCrossRefResult multiCrossRefResult, List<ProcessMetadata> relatedProcesses)
        {
            var result = new MultiCrossRefFieldOptions();
            result.AllowClear = CrossRefFieldAttr.AllowClear;
            result.AllowViewDetail = CrossRefFieldAttr.AllowViewDetail;
            result.FieldName = CrossRefFieldAttr.RefFieldName;         
            result.ProcessSystemName = CrossRefFieldAttr.ReferenceTableName;
            result.RelatedProcesses = relatedProcesses;           
            result.LinkFieldSystemName = CrossRefFieldAttr.LinkFieldSystemName;
            result.MultiCrAllowLinkUnlink = CrossRefFieldAttr.MultiCrAllowLinkUnlink;
            result.DisplayFieldList = CrossRefFieldAttr.DisplayFieldList;
            result.MultiCrAllowAddNew = CrossRefFieldAttr.MultiCrAllowAddNew;
            result.Columns = multiCrossRefResult == null ? null : multiCrossRefResult.ColumnList;

            return result;
        }
        /// <summary>
        /// Gets the cr field vm.
        /// </summary>
        /// <param name="prop">The property.</param>
        /// <param name="model">The model.</param>
        /// <param name="crossRefAttr">The cross reference attribute.</param>
        /// <param name="promptAttr">The prompt attribute.</param>
        /// <param name="display">The display.</param>
        /// <param name="fieldEditorAttr">The field editor attribute.</param>
        /// <returns></returns>
        private ICrossRefFieldViewModelBase GetCRFieldVM(PropertyInfo prop, IEditableRoot model, CrossRefFieldAttribute crossRefAttr, PromptAttribute promptAttr, DisplayAttribute display, FieldEditorAttribute fieldEditorAttr)
        {
            ICrossRefFieldViewModelBase crossReffieldViewModel;

            dynamic defaultValue = null;
            if (crossRefAttr.AllowMultiple)
            {
                crossReffieldViewModel = MultiCrossRefFieldViewModelFactory.CreateExport().Value;
                var crType = TheDynamicTypeManager.GetCrossReferenceListType(model.ProcessName, prop.Name);
                defaultValue = Activator.CreateInstance(crType);
            }
            else
            {
                var vm = SingleCrossRefFieldViewModelFactory.CreateExport().Value;

                vm.AllowAddNew = false; // crossRefAttr.AllowAddNew;
                vm.AllowViewDetail = false; // crossRefAttr.AllowViewDetail;
                vm.AllowClear = crossRefAttr.AllowClear;

                crossReffieldViewModel = vm;
            }

            crossReffieldViewModel.List = null;
            crossReffieldViewModel.ReferenceName = crossRefAttr.ReferenceTableName;
            crossReffieldViewModel.DisplayField = crossRefAttr.RefFieldName;
            crossReffieldViewModel.DisplayPath = crossRefAttr.DisplayFieldList;
            crossReffieldViewModel.FieldType = crossRefAttr.AllowMultiple ? "MultiCrossRef" : "SingleCrossRef";
            crossReffieldViewModel.ItemProcess = crossRefAttr.ReferenceTableName;


            SetupField(prop, promptAttr, display, crossReffieldViewModel, model, defaultValue);

            crossReffieldViewModel.ItemType = crossReffieldViewModel.List != null
                                                  ? crossReffieldViewModel.List.GetType().BaseType.GetGenericArguments()[1]
                                                  : TheDynamicTypeManager.GetCrossReferenceItemType(model.ProcessName, prop.Name);

            return crossReffieldViewModel;
        }
Exemplo n.º 4
0
        private static string GetCrossRefType(CrossRefFieldAttribute crossRefAttr, System.Attribute attr)
        {
            if (crossRefAttr.AllowMultiple)
            {
                if (attr != null && new AqlAttribute().GetType() == attr.GetType())
                    return "Aql";

                return crossRefAttr.EditViaSpreadsheet ? "SpreadsheetMultiCrossRef" : "MultiCrossRef";
            }

            return "SingleCrossRef";
        }
Exemplo n.º 5
0
        private static IInfoList GetList(CrossRefFieldAttribute crossRefAttr, IUnitOfWork detailsModel, PropertyInfo prop)
        {
            var propName = string.Format(CultureInfo.InvariantCulture, "{0}List", prop.Name);

            var propInfo = detailsModel.GetType().GetProperty(propName);
            var value = propInfo == null ? GetBasePropertyValue(detailsModel, propName) : propInfo.GetValue(detailsModel, null);

            return (IInfoList)value;
        }
Exemplo n.º 6
0
 public static ColumnItem CreateColumn(IPageableList owner, ColumnCollection columns, CrossRefFieldAttribute crossRef = null)
 {
     return crossRef != null ? new CRColumnItem(owner, columns) : new ColumnItem(owner, columns);
 }