public void GetColumnNameTest()
        {
            // Arrange.
            var frenchCulture = new CultureInfo("fr-FR");
            var spanishCulture = new CultureInfo("es-ES");
            var process = new ReferenceProcessDefinition { SystemName = "TestProcess" };
            process.SupportedLocalizations.Add(new LocalizationInfoAttribute(Constants.DefaultCultureName));
            process.SupportedLocalizations.Add(new LocalizationInfoAttribute(frenchCulture.Name));
            var simpleField = new ReferenceDisplayFieldDefinition { SystemName = "Field1", DefinedIn = process, AllowLocalizedData = false };
            var localizedField = new ReferenceDisplayFieldDefinition { SystemName = "Field2", DefinedIn = process, AllowLocalizedData = true };

            // Act / Assert.
            Assert.AreEqual("Field1", simpleField.GetColumnName(Constants.DefaultCultureName));
            Assert.AreEqual("Field1", simpleField.GetColumnName(frenchCulture.Name));
            Assert.AreEqual("Field1", simpleField.GetColumnName(spanishCulture.Name));

            Assert.AreEqual("Field2", localizedField.GetColumnName(Constants.DefaultCultureName));
            Assert.AreEqual("Field2_fr_FR", localizedField.GetColumnName(frenchCulture.Name));
            Assert.AreEqual("Field2", localizedField.GetColumnName(spanishCulture.Name));
        }
        public void RefGetRealFieldTest()
        {
            // Arrange
            ReferenceDisplayFieldDefinition displayField = null;
            ReferenceDisplayFieldDefinition displaySubField = null;
            // Act
            var result = SearchQueryGeneratorTest.RefGetRealField_Public(displayField);
            // Assert
            Assert.IsNull(result);

            // Arrange
            displayField = new ReferenceDisplayFieldDefinition { ColumnType = ColumnTypes.Approval };
            // Act
            result = SearchQueryGeneratorTest.RefGetRealField_Public(displayField);
            // Assert
            Assert.AreEqual(result, displayField);

            // Arrange
            displayField = new ReferenceDisplayFieldDefinition { ColumnType = ColumnTypes.Reference };
            // Act
            result = SearchQueryGeneratorTest.RefGetRealField_Public(displayField);
            // Assert
            Assert.AreEqual(result, displayField);

            // Arrange
            displayField = new ReferenceDisplayFieldDefinition { ColumnType = ColumnTypes.Reference };
            displaySubField = new ReferenceDisplayFieldDefinition() { ShowOnSearch = false };
            displayField.Subfields.Add(displaySubField);
            // Act
            result = SearchQueryGeneratorTest.RefGetRealField_Public(displayField);
            // Assert
            Assert.AreEqual(result, displayField);

            // Arrange
            displayField = new ReferenceDisplayFieldDefinition { ColumnType = ColumnTypes.Reference };
            displaySubField = new ReferenceDisplayFieldDefinition { ShowOnSearch = true };
            displayField.Subfields.Add(displaySubField);
            // Act
            result = SearchQueryGeneratorTest.RefGetRealField_Public(displayField);
            // Assert
            Assert.AreEqual(result, displaySubField);
        }
 /// <summary>
 /// Refs the get real field_ public.
 /// <author>unknown</author>
 /// </summary>
 /// <param name="displayField">The display field.</param>
 /// <returns>ReferenceDisplayFieldDefinition.</returns>
 public static ReferenceDisplayFieldDefinition RefGetRealField_Public(ReferenceDisplayFieldDefinition displayField)
 {
     return RefGetRealField(displayField);
 }
 /// <summary>
 /// Refs the get single reverse cross reference field select.
 /// <author>unknown</author>
 /// </summary>
 /// <param name="prefix">The prefix.</param>
 /// <param name="displayField">The display field.</param>
 /// <returns>System.String.</returns>
 /// <exception cref="System.NotImplementedException"></exception>
 protected override string RefGetSingleReverseCrossReferenceFieldSelect(string prefix, ReferenceDisplayFieldDefinition displayField)
 {
     throw new NotImplementedException();
 }
 /// <summary>
 /// Refs the get multi reverse cross reference field select.
 /// <author>unknown</author>
 /// </summary>
 /// <param name="tableName">Name of the table.</param>
 /// <param name="displayField">The display field.</param>
 /// <param name="tableAliases">The table aliases.</param>
 /// <param name="cteString">The cte string.</param>
 /// <returns>System.String.</returns>
 /// <exception cref="System.NotImplementedException"></exception>
 protected override string RefGetMultiReverseCrossReferenceFieldSelect(
     string tableName,
     ReferenceDisplayFieldDefinition displayField,
     TableAliasCollection tableAliases,
     StringBuilder cteString)
 {
     throw new NotImplementedException();
 }
 /// <summary>
 /// Refs the get field select.
 /// <author>unknown</author>
 /// </summary>
 /// <param name="displayField">The display field.</param>
 /// <param name="tableAliases">The table aliases.</param>
 /// <param name="cteString">The cte string.</param>
 /// <param name="fromString">From string.</param>
 /// <param name="whereString">The where string.</param>
 /// <returns>System.String.</returns>
 /// <exception cref="System.NotImplementedException"></exception>
 protected override string RefGetFieldSelect(
     ReferenceDisplayFieldDefinition displayField,
     TableAliasCollection tableAliases,
     StringBuilder cteString,
     StringBuilder fromString,
     StringBuilder whereString)
 {
     throw new NotImplementedException();
 }
 /// <summary>
 /// Refs the convert to string.
 /// <author>unknown</author>
 /// </summary>
 /// <param name="displayField">The display field.</param>
 /// <param name="expression">The expression.</param>
 /// <returns>System.String.</returns>
 /// <exception cref="System.NotImplementedException"></exception>
 protected override string RefConvertToString(ReferenceDisplayFieldDefinition displayField, string expression)
 {
     throw new NotImplementedException();
 }
Esempio n. 8
0
        /// <summary>
        /// Gets the name of the database view that returns the links for the specified reference field.
        /// </summary>
        /// <param name="field">
        /// The reference field metadata.
        /// </param>
        /// <returns>
        /// The view name.
        /// </returns>
        public static string GetReferenceFieldIdMappingsViewName(ReferenceDisplayFieldDefinition field)
        {
            if (field == null)
                throw new ArgumentNullException("field");

            return GetReferenceFieldIdMappingsViewName(field.DefinedIn.SystemName, field.SystemName);
        }
Esempio n. 9
0
        public static string GetJoinTableName(ReferenceDisplayFieldDefinition displayField)
        {
            if (displayField == null)
            {
                return null;
            }

            if (displayField.ColumnType == ColumnTypes.MultiReference && displayField.ReferenceField == null)
            {
                return GetMultiCrossReferenceJoinTableName(
                    displayField.DefinedIn.SystemName,
                    displayField.SystemName,
                    displayField.ReferencedProcess.SystemName);
            }

            throw new InvalidOperationException("Invalid field type.");
        }