コード例 #1
0
        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;

        }
コード例 #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;
        }
コード例 #3
0
        /// <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;
        }
コード例 #4
0
ファイル: FieldFactory.cs プロジェクト: mparsin/Elements
        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";
        }
コード例 #5
0
ファイル: FieldFactory.cs プロジェクト: mparsin/Elements
        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;
        }
コード例 #6
0
 public static ColumnItem CreateColumn(IPageableList owner, ColumnCollection columns, CrossRefFieldAttribute crossRef = null)
 {
     return crossRef != null ? new CRColumnItem(owner, columns) : new ColumnItem(owner, columns);
 }