コード例 #1
0
 private static void SetTextFieldMetadata(ColumnMetadata columnMetadata, IFieldMetadata field)
 {
     var textField = field as TextFieldMetadata;
     if (textField != null)
     {
         columnMetadata.IsRichText = textField.IsRichText;
     }
 }
コード例 #2
0
 private static void SetNumericFieldMetadata(ColumnMetadata columnMetadata, IFieldMetadata field)
 {
     var numericField = field as NumericFieldMetadata;
     if (numericField != null)
     {
         columnMetadata.NumericType = numericField.NumericType;
         columnMetadata.DecimalDigits = numericField.DecimalDigits;
     }
 }
コード例 #3
0
 private static void SetImageFieldMetadata(ColumnMetadata columnMetadata, IFieldMetadata field)
 {
     var imageField = field as ImageFieldMetadata;
     if (imageField != null)
     {
         columnMetadata.ImageWidth = imageField.SearchWidth;
         columnMetadata.ImageHeight = imageField.SearchHeight;
     }
 }
コード例 #4
0
 private static void SetBooleanFieldMetadata(ColumnMetadata columnMetadata, IFieldMetadata field)
 {
     var booleanField = field as BooleanFieldMetadata;
     if (booleanField != null)
     {
         columnMetadata.UndefinedLabel = booleanField.UndefinedLabel;
         columnMetadata.FalseLabel = booleanField.FalseLabel;
         columnMetadata.TrueLabel = booleanField.TrueLabel;
     }
 }
コード例 #5
0
 private static void SetDateTimeFieldMetadata(ColumnMetadata columnMetadata, IFieldMetadata field)
 {
     var dateTimeField = field as DateTimeFieldMetadata;
     if (dateTimeField != null)
     {
         columnMetadata.DateTimeFormat = dateTimeField.DateTimeFormat;
     }
 }
コード例 #6
0
        private static void SetFieldMetadata(ColumnMetadata columnMetadata, IFieldMetadata field)
        {
            columnMetadata.Header = field.DisplayName;
            columnMetadata.SystemName = field.Name;
            columnMetadata.ColumnType = field.ColumnType;

            if (field.BackcolorField != null)
            {
                columnMetadata.BackgroundColorColumnName = field.BackcolorField.Name;
            }

            switch (field.ColumnType)
            {
                case ColumnTypes.Boolean:
                    SetBooleanFieldMetadata(columnMetadata, field);
                    break;

                case ColumnTypes.DateTime:
                    SetDateTimeFieldMetadata(columnMetadata, field);
                    break;

                case ColumnTypes.Double:
                case ColumnTypes.Integer:
                case ColumnTypes.Numeric:
                    SetNumericFieldMetadata(columnMetadata, field);
                    break;

                case ColumnTypes.Image:
                    SetImageFieldMetadata(columnMetadata, field);
                    break;

                case ColumnTypes.String:
                    SetTextFieldMetadata(columnMetadata, field);
                    break;
            }
        }
コード例 #7
0
        private static object FormatImageColumn(IInfoClass infoItem, ColumnMetadata column)
        {
            var bytes = infoItem.GetValueByPropertyName(column.SystemName) as byte[];

            if (bytes != null && bytes.Length > 0)
            {
                var width = column.ImageWidth ?? Constants.DefaultImageWidthOnSearch;
                var height = column.ImageHeight ?? Constants.DefaultImageHeightOnSearch;

                bytes = Utils.ResizeImage(bytes, width, height);
            }

            return bytes;
        }
コード例 #8
0
        private object FormatBackcolorColumn(IInfoClass infoItem, ColumnMetadata column)
        {
            var argb = (long)infoItem.GetValueByPropertyName(column.SystemName);
            if (argb == 0)
            {
                // 0 represents no color.
                return null;
            }

            return ColorTranslator.ToHtml(argb);
        }
コード例 #9
0
        private static object FormatApprovalColumn(IInfoClass infoItem, ColumnMetadata column)
        {
            var approvalState = ApprovalStates.NotReadyForApproval;
            var propertyValue = (string)infoItem.GetValueByPropertyName(column.SystemName);

            if (!string.IsNullOrEmpty(propertyValue))
            {
                approvalState = (ApprovalStates)Enum.Parse(typeof(ApprovalStates), propertyValue);
            }

            return approvalState.GetDisplayName();
        }
コード例 #10
0
        private object FormatColumn(IInfoClass infoItem, ColumnMetadata column)
        {
            switch (column.ColumnType)
            {
                case ColumnTypes.Approval:
                    return FormatApprovalColumn(infoItem, column);

                case ColumnTypes.FieldBackcolor:
                    return FormatBackcolorColumn(infoItem, column);

                case ColumnTypes.Image:
                    return FormatImageColumn(infoItem, column);

                default:
                    return infoItem.GetValueByPropertyName(column.SystemName);
            }
        }