Exemplo n.º 1
0
        public static IDataType NativeTypeNameToDataType(Schema.DataTypes dataTypes, string nativeDataTypeName)
        {
            if (nativeDataTypeName.ToLower().StartsWith("row"))
            {
                var rowType = new RowType();

                rowType.Columns.AddRange(ParseColumnTypes(dataTypes, nativeDataTypeName.Substring(4, nativeDataTypeName.Length - 5)));

                return(rowType);
            }
            else if (nativeDataTypeName.ToLower().StartsWith("table"))
            {
                var tableType = new TableType();

                tableType.Columns.AddRange(ParseColumnTypes(dataTypes, nativeDataTypeName.Substring(6, nativeDataTypeName.Length - 7)));

                return(tableType);
            }
            else if (nativeDataTypeName.ToLower().StartsWith("list"))
            {
                var elementType = NativeTypeNameToDataType(dataTypes, nativeDataTypeName.Substring(5, nativeDataTypeName.Length - 6));
                return(new ListType(elementType));
            }
            else
            {
                return(NativeScalarTypeNameToDataType(dataTypes, nativeDataTypeName));
            }
        }
Exemplo n.º 2
0
        private DAE.Runtime.Data.Row CreateSearchRow()
        {
            // Determine the last search control with a search value
            SearchControl pendingIncremental = null;
            SearchControl control;

            for (int i = _searchControls.Count - 1; i >= 0; i--)
            {
                control = (SearchControl)_searchControls[i];
                if (control.Value != null)
                {
                    pendingIncremental = control;
                    break;
                }
            }

            if (pendingIncremental != null)
            {
                // FROM WINDOWS CLIENT

                // Build a row consisting of order columns up to and including the pending control
                RowType rowType = new RowType();
                foreach (OrderColumn column in _order.Columns)
                {
                    rowType.Columns.Add(new DAE.Schema.Column(column.Column.Name, column.Column.DataType));
                    if (column.Column.Name == pendingIncremental.ColumnName)
                    {
                        break;
                    }
                }

                DAE.Runtime.Data.Row row = new DAE.Runtime.Data.Row(Source.Process.ValueManager, rowType);
                try
                {
                    Source.DataView.InitializeFromMaster(row);
                    foreach (DAE.Schema.Column column in rowType.Columns)
                    {
                        if (!Source.DataView.IsDetailKey(column.Name))
                        {
                            if (!FindSearchControl(column.Name).ExtractValue(row))
                            {
                                return(null);
                            }
                        }
                    }
                    return(row);
                }
                catch
                {
                    row.Dispose();
                    throw;
                }

                // END FROM WINDOWS CLIENT
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 3
0
        protected virtual void DeserializeRows(XElement rowsNode)
        {
            if (rowsNode == null)
            {
                return;
            }

            foreach (var rowNode in rowsNode.Elements("row"))
            {
                RowType type = RowType.None;
                Enum.TryParse(rowNode.Attribute("rtype")?.Value, out type);

                switch (type)
                {
                case RowType.Row:
                    var row = new Row.rMindRow();
                    row.Deserialize(rowNode);
                    AddRow(row);
                    break;

                case RowType.Separator:
                    AddSeparator();
                    break;
                }
            }
        }
Exemplo n.º 4
0
        private void SingleCell(RowType row, ColumnType col, PropertyInfo pi, ref int rowIdx)
        {
            object cell = pi.GetValue(this, null);

            m_TickList.Add(new Position(rowIdx, (int)col - 1), cell == null ? null : ((CellBase)cell).Cell);
            rowIdx++;
        }
Exemplo n.º 5
0
        /// <summary>
        /// Draws a rectangular gradient background color.
        /// </summary>
        /// <param name="pdfRowType">Main table's row types</param>
        /// <param name="sharedData">PdfCells Shared Data</param>        
        /// <param name="position">The coordinates of the cell</param>
        /// <param name="canvases">An array of PdfContentByte to add text or graphics</param>
        public static void ApplyGradientBackground(RowType pdfRowType, CellSharedData sharedData, Rectangle position, PdfContentByte[] canvases)
        {
            BaseColor startColor = null;
            BaseColor endColor = null;

            switch (pdfRowType)
            {
                case RowType.HeaderRow:
                    if (sharedData.Template.HeaderBackgroundColor.Count < 2) return;
                    startColor = sharedData.Template.HeaderBackgroundColor[0];
                    endColor = sharedData.Template.HeaderBackgroundColor[1];
                    break;
                case RowType.PreviousPageSummaryRow:
                    if (sharedData.Template.PreviousPageSummaryRowBackgroundColor.Count < 2) return;
                    startColor = sharedData.Template.PreviousPageSummaryRowBackgroundColor[0];
                    endColor = sharedData.Template.PreviousPageSummaryRowBackgroundColor[1];
                    break;
                case RowType.SummaryRow:
                case RowType.AllGroupsSummaryRow:
                    if (sharedData.Template.SummaryRowBackgroundColor.Count < 2) return;
                    startColor = sharedData.Template.SummaryRowBackgroundColor[0];
                    endColor = sharedData.Template.SummaryRowBackgroundColor[1];
                    break;
                case RowType.PageSummaryRow:
                    if (sharedData.Template.PageSummaryRowBackgroundColor.Count < 2) return;
                    startColor = sharedData.Template.PageSummaryRowBackgroundColor[0];
                    endColor = sharedData.Template.PageSummaryRowBackgroundColor[1];
                    break;
            }

            DrawGradientBackground(position, canvases, startColor, endColor);
        }
Exemplo n.º 6
0
 internal IniRow(RowType type, string arg0, string arg1 = null, StringUtil.EscapeHint hint = StringUtil.EscapeHint.None)
 {
     this.rowType = type;
     this.arg0    = arg0;
     this.arg1    = arg1;
     this.hint    = hint;
 }
Exemplo n.º 7
0
        public static CSVData AddRow(CSVData data, RowType row)
        {
            CSVData ret = new CSVData(data);

            ret.AddRow(row);
            return(ret);
        }
Exemplo n.º 8
0
        public string PickLightColor(int clockLightNumber, RowType rowType)
        {
            switch (rowType)
            {
            case RowType.TopLightLow:
                return(LightColor.Yellow);

            case RowType.TopHourRow:
                return(LightColor.Red);

            case RowType.BottomHourRow:
                return(LightColor.Red);

            case RowType.TopMinuteRow:
            {
                return((clockLightNumber != 0 && clockLightNumber % 3 == 0)
                            ? LightColor.Red
                            : LightColor.Yellow);
            }

            case RowType.BottomMinuteRow:
                return(LightColor.Yellow);

            default:
                return(LightColor.None);
            }
        }
Exemplo n.º 9
0
        protected void VisitNewInstanceExpression(SelectStatement select,
                                                  DbNewInstanceExpression expression)
        {
            Debug.Assert(expression.ResultType.EdmType is RowType);

            RowType row = expression.ResultType.EdmType as RowType;

            for (int i = 0; i < expression.Arguments.Count; i++)
            {
                ColumnFragment col;

                SqlFragment fragment = expression.Arguments[i].Accept(this);
                if (fragment is ColumnFragment)
                {
                    col = fragment as ColumnFragment;
                }
                else
                {
                    col         = new ColumnFragment(null, null);
                    col.Literal = fragment;
                }

                col.ColumnAlias = row.Properties[i].Name;
                select.Columns.Add(col);
            }
        }
Exemplo n.º 10
0
            /// <summary>
            /// Specialization of <see cref="CreatePlaceholder" /> for a relationship set extent.
            /// </summary>
            /// <param name="associationSet"></param>
            /// <returns></returns>
            private PropagatorResult CreateAssociationSetPlaceholder(AssociationSet associationSet)
            {
                Debug.Assert(null != associationSet, "Caller must verify parameters are not null");

                var endMetadata = associationSet.ElementType.AssociationEndMembers;

                PropagatorResult[] endReferenceValues = new PropagatorResult[endMetadata.Count];

                // Create a reference expression for each end in the relationship
                for (int endOrdinal = 0; endOrdinal < endMetadata.Count; endOrdinal++)
                {
                    var        end        = endMetadata[endOrdinal];
                    EntityType entityType = (EntityType)((RefType)end.TypeUsage.EdmType).ElementType;

                    // Retrieve key values for this end
                    PropagatorResult[] keyValues = new PropagatorResult[entityType.KeyMembers.Count];
                    for (int memberOrdinal = 0; memberOrdinal < entityType.KeyMembers.Count; memberOrdinal++)
                    {
                        EdmMember        keyMember = entityType.KeyMembers[memberOrdinal];
                        PropagatorResult keyValue  = CreateMemberPlaceholder(keyMember);
                        keyValues[memberOrdinal] = keyValue;
                    }

                    RowType          endType = entityType.GetKeyRowType(m_parent.MetadataWorkspace);
                    PropagatorResult refKeys = PropagatorResult.CreateStructuralValue(keyValues, endType, false);

                    endReferenceValues[endOrdinal] = refKeys;
                }

                PropagatorResult result = PropagatorResult.CreateStructuralValue(endReferenceValues, associationSet.ElementType, false);

                return(result);
            }
Exemplo n.º 11
0
        private static LegacyMetadata.RowType ToLegacyRowType(
            this RowType rowType,
            LegacyMetadata.EdmType[] legacyStoreTypes = null)
        {
            Debug.Assert(rowType != null, "rowType != null");

            var properties =
                rowType.Properties.Select(
                    p => (LegacyMetadata.EdmProperty)LegacyEdmProperyCtor.Invoke(
                        BindingFlags.CreateInstance,
                        null,
                        new object[]
            {
                p.Name,
                p.TypeUsage.EdmType.GetDataSpace() == DataSpace.CSpace
                                    ? p.TypeUsage.ToLegacyEdmTypeUsage()
                                    : p.TypeUsage.ToLegacyStoreTypeUsage(legacyStoreTypes)
            },
                        CultureInfo.InvariantCulture)).ToArray();

            return
                ((LegacyMetadata.RowType)LegacyRowTypeCtor.Invoke(
                     BindingFlags.CreateInstance,
                     null,
                     new object[]
            {
                properties
            },
                     CultureInfo.InvariantCulture));
        }
 private void AddCustomRowObject(CustomFormObject formObject, int NumberOfRows, RowType rowType)
 {
     for (int i = 0; i < NumberOfRows; i++)
     {
         formObject.Rows.Add(CreateRowObject(rowType));
     }
 }
Exemplo n.º 13
0
        public void TranslateColumnMap_returns_correct_columntypes_and_nullablecolumns_for_anonymous_types()
        {
            var metadataWorkspaceMock = new Mock <MetadataWorkspace>();

            metadataWorkspaceMock.Setup(m => m.GetQueryCacheManager()).Returns(QueryCacheManager.Create());
            var edmProperties = new []
            {
                new EdmProperty("P1Int", TypeUsage.Create(PrimitiveType.GetEdmPrimitiveType(PrimitiveTypeKind.Int32),
                                                          new FacetValues {
                    Nullable = false
                })),
                new EdmProperty("P2Bool", TypeUsage.Create(PrimitiveType.GetEdmPrimitiveType(PrimitiveTypeKind.Boolean)))
            };

            var cSpaceEntityType = new RowType(edmProperties);
            var entityTypeUsage  = TypeUsage.Create(cSpaceEntityType);
            var recordMap        = new RecordColumnMap(
                entityTypeUsage, "E",
                new[] { new ScalarColumnMap(cSpaceEntityType.Properties[0].TypeUsage, cSpaceEntityType.Properties[0].Name, 0, 0) },
                new ScalarColumnMap(cSpaceEntityType.Properties[1].TypeUsage, cSpaceEntityType.Properties[1].Name, 0, 1));
            var collectionMap = new SimpleCollectionColumnMap(
                entityTypeUsage, "MockCollectionType", recordMap, null, null);

            var factory =
                new Translator().TranslateColumnMap <object>(
                    collectionMap, metadataWorkspaceMock.Object, new SpanIndex(), MergeOption.NoTracking, streaming: false, valueLayer: false);

            Assert.NotNull(factory);

            Assert.Equal(new[] { typeof(int), null }, factory.ColumnTypes);
            Assert.Equal(new[] { true, true }, factory.NullableColumns);
        }
Exemplo n.º 14
0
        private NewInstancePredicate CreateNewRowExpression(List <KeyValuePair <string, Predicate> > columns, NewExpression linq)
        {
            //var propertyValues = new List<Predicate>(columns.Count);
            //for (var i = 0; i < columns.Count; i++)
            //{
            //    var column = columns[i];
            //    propertyValues.Add(column.Value);
            //}
            //var rowType = new RowType(properties, initializerMetadata)
            //return new NewInstancePredicate(null, new PredicateList(propertyValues));

            var propertyValues = new List <Predicate>(columns.Count);
            var properties     = new List <EdmProperty>(columns.Count);

            for (var i = 0; i < columns.Count; i++)
            {
                var column = columns[i];
                propertyValues.Add(column.Value);
                properties.Add(new EdmProperty(column.Key, column.Value.ResultType));
            }
            var rowType   = new RowType(properties, linq);
            var typeUsage = TypeUsage.Create(rowType);

            return(typeUsage.New(propertyValues));
        }
Exemplo n.º 15
0
 internal override TypeUsage GetTypeUsage()
 {
     if (this._typeUsage == null)
     {
         List <EdmProperty> edmPropertyList = new List <EdmProperty>();
         foreach (RowTypePropertyElement property in this._properties)
         {
             EdmProperty edmProperty = new EdmProperty(property.FQName, property.GetTypeUsage());
             edmProperty.AddMetadataProperties(property.OtherContent);
             edmPropertyList.Add(edmProperty);
         }
         RowType rowType = new RowType((IEnumerable <EdmProperty>)edmPropertyList);
         if (this.Schema.DataModel == SchemaDataModelOption.EntityDataModel)
         {
             rowType.DataSpace = DataSpace.CSpace;
         }
         else
         {
             rowType.DataSpace = DataSpace.SSpace;
         }
         rowType.AddMetadataProperties(this.OtherContent);
         this._typeUsage = TypeUsage.Create((EdmType)rowType);
     }
     return(this._typeUsage);
 }
Exemplo n.º 16
0
 public DataReader(Resultset rs)
 {
     _rs = rs;
     _binder = new Binder(rs);
     _rct = rs.RowType;
     _result_f = true;
 }
        public void EdmModel_NameIsTooLong_not_triggered_for_row_and_collection_types()
        {
            var intType = PrimitiveType.GetEdmPrimitiveType(PrimitiveTypeKind.Int32);

            var properties = new EdmProperty[100];

            for (int i = 0; i < 100; i++)
            {
                properties[i] = EdmProperty.Primitive("Property" + i, intType);
            }

            var rowType = new RowType(properties);

            foreach (var type in new EdmType[] { rowType, rowType.GetCollectionType() })
            {
                var validationContext
                    = new EdmModelValidationContext(new EdmModel(DataSpace.SSpace), true);
                DataModelErrorEventArgs errorEventArgs = null;
                validationContext.OnError += (_, e) => errorEventArgs = e;

                EdmModelSyntacticValidationRules
                .EdmModel_NameIsTooLong
                .Evaluate(validationContext, type);

                Assert.Null(errorEventArgs);
            }
        }
Exemplo n.º 18
0
        internal override TypeUsage GetTypeUsage()
        {
            if (_typeUsage == null)
            {
                var listOfProperties = new List <EdmProperty>();
                foreach (var property in _properties)
                {
                    var edmProperty = new EdmProperty(property.FQName, property.GetTypeUsage());
                    edmProperty.AddMetadataProperties(property.OtherContent);
                    //edmProperty.DeclaringType
                    listOfProperties.Add(edmProperty);
                }

                RowType rowType = new RowType(listOfProperties);
                if (Schema.DataModel == SchemaDataModelOption.EntityDataModel)
                {
                    rowType.DataSpace = DataSpace.CSpace;
                }
                else
                {
                    Debug.Assert(Schema.DataModel == SchemaDataModelOption.ProviderDataModel, "Only DataModel == SchemaDataModelOption.ProviderDataModel is expected");
                    rowType.DataSpace = DataSpace.SSpace;
                }

                rowType.AddMetadataProperties(this.OtherContent);
                _typeUsage = TypeUsage.Create(rowType);
            }
            return(_typeUsage);
        }
Exemplo n.º 19
0
        private EdmType ConvertOSpaceToCSpaceType(EdmType clrType)
        {
            EdmType edmType;

            if (Helper.IsCollectionType((GlobalItem)clrType))
            {
                edmType = (EdmType) new CollectionType(this.ConvertOSpaceToCSpaceType(((CollectionType)clrType).TypeUsage.EdmType));
            }
            else if (Helper.IsRowType((GlobalItem)clrType))
            {
                List <EdmProperty> edmPropertyList = new List <EdmProperty>();
                RowType            rowType         = (RowType)clrType;
                foreach (EdmProperty property in rowType.Properties)
                {
                    EdmType     cspaceType  = this.ConvertOSpaceToCSpaceType(property.TypeUsage.EdmType);
                    EdmProperty edmProperty = new EdmProperty(property.Name, TypeUsage.Create(cspaceType));
                    edmPropertyList.Add(edmProperty);
                }
                edmType = (EdmType) new RowType((IEnumerable <EdmProperty>)edmPropertyList, rowType.InitializerMetadata);
            }
            else
            {
                edmType = !Helper.IsRefType((GlobalItem)clrType) ? ((ObjectTypeMapping)this.GetMap((GlobalItem)clrType)).EdmType : (EdmType) new RefType((EntityType)this.ConvertOSpaceToCSpaceType((EdmType)((RefType)clrType).ElementType));
            }
            return(edmType);
        }
        private EdmType CreateReturnRowType(string propertyName, EdmType edmType)
        {
            if (edmType.BuiltInTypeKind == BuiltInTypeKind.EntityType)
            {
                var propertyToSoreTypeUsage = FindStoreTypeUsages((EntityType)edmType);
                return
                    (RowType.Create(
                         ((EntityType)edmType).Properties.Select(
                             m => EdmProperty.Create(m.Name, propertyToSoreTypeUsage[m])), null));
            }

            if (edmType.BuiltInTypeKind == BuiltInTypeKind.ComplexType)
            {
                return
                    (RowType.Create(
                         ((StructuralType)edmType).Members.Select(
                             m => EdmProperty.Create(m.Name, GetStorePrimitiveTypeUsage(m.TypeUsage))), null));
            }

            if (edmType.BuiltInTypeKind == BuiltInTypeKind.EnumType)
            {
                return(RowType.Create(new[]
                {
                    EdmProperty.Create(propertyName, GetStorePrimitiveTypeUsage(TypeUsage.CreateDefaultTypeUsage(((EnumType)edmType).UnderlyingType)))
                }, null));
            }

            return
                (RowType.Create(
                     new[]
            {
                EdmProperty.Create(propertyName, GetStorePrimitiveTypeUsage(TypeUsage.CreateDefaultTypeUsage(edmType)))
            }, null));
        }
        /// <summary>Convert CSpace TypeMetadata into OSpace TypeMetadata</summary>
        /// <param name="cdmType"></param>
        /// <returns>OSpace type metadata</returns>
        private EdmType ConvertCSpaceToOSpaceType(EdmType cdmType)
        {
            EdmType clrType = null;

            if (Helper.IsCollectionType(cdmType))
            {
                EdmType elemType = ConvertCSpaceToOSpaceType(((CollectionType)cdmType).TypeUsage.EdmType);
                clrType = new CollectionType(elemType);
            }
            else if (Helper.IsRowType(cdmType))
            {
                List <EdmProperty> clrProperties = new List <EdmProperty>();
                foreach (EdmProperty column in ((RowType)cdmType).Properties)
                {
                    EdmType     clrPropertyType = ConvertCSpaceToOSpaceType(column.TypeUsage.EdmType);
                    EdmProperty clrProperty     = new EdmProperty(column.Name, TypeUsage.Create(clrPropertyType));
                    clrProperties.Add(clrProperty);
                }
                clrType = new RowType(clrProperties, ((RowType)cdmType).InitializerMetadata);
            }
            else if (Helper.IsRefType(cdmType))
            {
                clrType = new RefType((EntityType)ConvertCSpaceToOSpaceType(((RefType)cdmType).ElementType));
            }
            else if (Helper.IsPrimitiveType(cdmType))
            {
                clrType = m_objectCollection.GetMappedPrimitiveType(((PrimitiveType)cdmType).PrimitiveTypeKind);
            }
            else
            {
                clrType = ((ObjectTypeMapping)GetMap(cdmType)).ClrType;
            }
            Debug.Assert((null != clrType), "null converted clr type");
            return(clrType);
        }
Exemplo n.º 22
0
 public Binder(RowType.TypeInfo[] fields)
 {
     List<ColumnBinding> list = new List<ColumnBinding>();
     foreach (RowType.TypeInfo ti in fields)
         if (ti.NestedType == null)
         {
             if (!ti.IsHidden)
             {
                 ColumnBinding b = new ColumnBinding();
                 b.Name = ti.Name;
                 b.rnum = ti.Ordinal;
                 b.snum = -1;
                 b.fieldType = ti;
                 b.caseSensitive = ti.IsCaseSensitive;
                 list.Add(b);
             }
         }
         else
             foreach (RowType.TypeInfo ti_det in ti.NestedType.Fields)
             {
                 if (!ti.IsHidden)
                 {
                     ColumnBinding b = new ColumnBinding();
                     b.TableName = ti.Name;
                     b.Name = ti_det.Name;
                     b.rnum = ti.Ordinal;
                     b.snum = ti_det.Ordinal;
                     b.caseSensitive = ti_det.IsCaseSensitive;
                     b.fieldType = ti_det;
                     list.Add(b);
                 }
             }
     _columnBinding = list.ToArray();
     FlagAmbiguos();
 }
Exemplo n.º 23
0
        private static Type GetClrType <TElement>(EdmType ospaceEdmType)
        {
            Type type;

            if (ospaceEdmType.BuiltInTypeKind == BuiltInTypeKind.RowType)
            {
                RowType rowType = (RowType)ospaceEdmType;
                if (rowType.InitializerMetadata != null && rowType.InitializerMetadata.ClrType != (Type)null)
                {
                    type = rowType.InitializerMetadata.ClrType;
                }
                else
                {
                    Type c = typeof(TElement);
                    type = typeof(IDataRecord).IsAssignableFrom(c) || c == typeof(object) ? (Type)null : typeof(TElement);
                }
            }
            else
            {
                type = ospaceEdmType.ClrType;
                if (type == (Type)null)
                {
                    type = typeof(TElement);
                }
            }
            return(type);
        }
Exemplo n.º 24
0
        public int GetDataSize()
        {
            if (!m_IsOpen)
            {
                return(0);
            }
            //
            if (m_Rows == null)
            {
                return(0);
            }
            //
            int size = 0;

            for (int i = 0; i < m_Rows.Count; i++)
            {
                RowType rt = GetRowType(m_Rows[i]);
                if (rt != RowType.DataRow)
                {
                    continue;
                }
                //
                string str = m_Rows[i].Substring((int)RowIndexes.ByteCountIndex, 2);
                size += (int)ToByte(str);
            }
            //
            return(size);
        }
        // <summary>
        // Convert CSpace TypeMetadata into OSpace TypeMetadata
        // </summary>
        // <returns> OSpace type metadata </returns>
        private EdmType ConvertOSpaceToCSpaceType(EdmType clrType)
        {
            EdmType cdmType = null;

            if (Helper.IsCollectionType(clrType))
            {
                var elemType = ConvertOSpaceToCSpaceType(((CollectionType)clrType).TypeUsage.EdmType);
                cdmType = new CollectionType(elemType);
            }
            else if (Helper.IsRowType(clrType))
            {
                var cdmProperties = new List <EdmProperty>();
                var rowType       = (RowType)clrType;
                foreach (var column in rowType.Properties)
                {
                    var cdmPropertyType = ConvertOSpaceToCSpaceType(column.TypeUsage.EdmType);
                    var cdmProperty     = new EdmProperty(column.Name, TypeUsage.Create(cdmPropertyType));
                    cdmProperties.Add(cdmProperty);
                }
                cdmType = new RowType(cdmProperties, rowType.InitializerMetadata);
            }
            else if (Helper.IsRefType(clrType))
            {
                cdmType = new RefType((EntityType)(ConvertOSpaceToCSpaceType(((RefType)clrType).ElementType)));
            }
            else
            {
                cdmType = ((ObjectTypeMapping)GetMap(clrType)).EdmType;
            }
            Debug.Assert((null != cdmType), "null converted clr type");
            return(cdmType);
        }
Exemplo n.º 26
0
        public void SetOpennedRowBool(RowType rowType, GameObject[] row)
        {
            if (rowType == RowType.Vertical)
            {
                if (!verticalRowOpenned)
                {
                    verticalRowOpenned = true;
                    verticalRow        = row;

                    foreach (var pos in verticalRow)
                    {
                        pos.GetComponentInChildren <Card>().HighlightCard();
                    }
                }
            }
            else if (rowType == RowType.Horizontal)
            {
                if (!horizontalRowOpenned)
                {
                    horizontalRowOpenned = true;
                    horizontalRow        = row;

                    foreach (var pos in horizontalRow)
                    {
                        pos.GetComponentInChildren <Card>().HighlightCard();
                    }
                }
            }
        }
        public override DbExpression Visit(DbGroupByExpression expression)
        {
            EntityUtil.CheckArgumentNull(expression, "expression");

            DbExpression result = expression;

            DbGroupExpressionBinding newInput = this.VisitGroupExpressionBinding(expression.Input);

            this.EnterScope(newInput.Variable);
            IList <DbExpression> newKeys = this.VisitExpressionList(expression.Keys);

            this.ExitScope();
            this.EnterScope(newInput.GroupVariable);
            IList <DbAggregate> newAggs = this.VisitList <DbAggregate>(expression.Aggregates, this.VisitAggregate);

            this.ExitScope();

            if (!object.ReferenceEquals(expression.Input, newInput) ||
                !object.ReferenceEquals(expression.Keys, newKeys) ||
                !object.ReferenceEquals(expression.Aggregates, newAggs))
            {
                RowType groupOutput =
                    TypeHelpers.GetEdmType <RowType>(TypeHelpers.GetEdmType <CollectionType>(expression.ResultType).TypeUsage);

                var boundKeys = groupOutput.Properties.Take(newKeys.Count).Select(p => p.Name).Zip(newKeys).ToList();
                var boundAggs = groupOutput.Properties.Skip(newKeys.Count).Select(p => p.Name).Zip(newAggs).ToList();

                result = CqtBuilder.GroupBy(newInput, boundKeys, boundAggs);
            }
            NotifyIfChanged(expression, result);
            return(result);
        }
Exemplo n.º 28
0
 public CellAttribute(RowType row, ColumnType col, Type type)
     : this(row, col)
 {
     ValueType = type;
     Default   = GetDefault(type);
     Format    = "";
 }
Exemplo n.º 29
0
        protected override EdmType VisitType(EdmType type)
        {
            EdmType retType = type;

            if (BuiltInTypeKind.RefType == type.BuiltInTypeKind)
            {
                RefType    refType          = (RefType)type;
                EntityType mappedEntityType = (EntityType)this.VisitType(refType.ElementType);
                if (!object.ReferenceEquals(refType.ElementType, mappedEntityType))
                {
                    retType = new RefType(mappedEntityType);
                }
            }
            else if (BuiltInTypeKind.CollectionType == type.BuiltInTypeKind)
            {
                CollectionType collectionType    = (CollectionType)type;
                TypeUsage      mappedElementType = this.VisitTypeUsage(collectionType.TypeUsage);
                if (!object.ReferenceEquals(collectionType.TypeUsage, mappedElementType))
                {
                    retType = new CollectionType(mappedElementType);
                }
            }
            else if (BuiltInTypeKind.RowType == type.BuiltInTypeKind)
            {
                RowType rowType = (RowType)type;
                List <KeyValuePair <string, TypeUsage> > mappedPropInfo = null;
                for (int idx = 0; idx < rowType.Properties.Count; idx++)
                {
                    EdmProperty originalProp   = rowType.Properties[idx];
                    TypeUsage   mappedPropType = this.VisitTypeUsage(originalProp.TypeUsage);
                    if (!object.ReferenceEquals(originalProp.TypeUsage, mappedPropType))
                    {
                        if (mappedPropInfo == null)
                        {
                            mappedPropInfo = new List <KeyValuePair <string, TypeUsage> >(
                                rowType.Properties.Select(
                                    prop => new KeyValuePair <string, TypeUsage>(prop.Name, prop.TypeUsage)
                                    ));
                        }
                        mappedPropInfo[idx] = new KeyValuePair <string, TypeUsage>(originalProp.Name, mappedPropType);
                    }
                }
                if (mappedPropInfo != null)
                {
                    IEnumerable <EdmProperty> mappedProps = mappedPropInfo.Select(propInfo => new EdmProperty(propInfo.Key, propInfo.Value));
                    retType = new RowType(mappedProps, rowType.InitializerMetadata);
                }
            }
            else
            {
                if (!_metadata.TryGetType(type.Name, type.NamespaceName, type.DataSpace, out retType) ||
                    null == retType)
                {
                    throw EntityUtil.Argument(System.Data.Entity.Strings.Cqt_Copier_TypeNotFound(TypeHelpers.GetFullName(type)));
                }
            }

            return(retType);
        }
Exemplo n.º 30
0
 public static bool RowToRender(this RowType row, QueryDescription query, Type groupingType)
 {
     if (query == null || query.Grouping == null || query.Grouping.Keys == null || query.Grouping.Keys.Count == 0)
     {
         return(row.For.Metadata.ModelType != groupingType);
     }
     return(row.For.Metadata.ModelType == groupingType);
 }
 private void AddSpannedRowType(RowType spannedType, TypeUsage originalType)
 {
     if (this._spanIndex == null)
     {
         this._spanIndex = new SpanIndex();
     }
     this._spanIndex.AddSpannedRowType(spannedType, originalType);
 }
 private void AddSpanMap(RowType rowType, Dictionary <int, AssociationEndMember> columnMap)
 {
     if (this._spanIndex == null)
     {
         this._spanIndex = new SpanIndex();
     }
     this._spanIndex.AddSpanMap(rowType, columnMap);
 }
Exemplo n.º 33
0
 public DataReader(Resultset rs, QueryContext context)
 {
     _rs = rs;
     _context = context;
     _binder = new Binder(rs);
     _rct = rs.RowType;
     _result_f = true;
 }
Exemplo n.º 34
0
 private void addRow(RowType row)
 {
     if (Rows == null)
     {
         Rows = new List <RowType>();
     }
     Rows.Add(row);
 }
Exemplo n.º 35
0
        // <summary>
        // Create a new VarInfo for a structured type Var
        // </summary>
        // <param name="v"> The structured type Var </param>
        // <param name="newType"> "Mapped" type for v </param>
        // <param name="newVars"> List of vars corresponding to v </param>
        // <param name="newProperties"> Flattened Properties </param>
        // <param name="newVarsIncludeNullSentinelVar"> Do the new vars include a var that represents a null sentinel either for this type or for any nested type </param>
        // <returns> the VarInfo </returns>
        internal VarInfo CreateStructuredVarInfo(
            Var v, RowType newType, List <Var> newVars, List <EdmProperty> newProperties, bool newVarsIncludeNullSentinelVar)
        {
            VarInfo varInfo = new StructuredVarInfo(newType, newVars, newProperties, newVarsIncludeNullSentinelVar);

            m_map.Add(v, varInfo);
            return(varInfo);
        }
Exemplo n.º 36
0
 public RowBase(Tweet tweet,string ownerScreenName,SettingData setting,Action<RowAction> rowActionCallBack,RowType type)
 {
     this.ownerScreenName = ownerScreenName;
     this.RowType = type;
     this.Tweet = tweet;
     this.setting = setting;
     
     InitializeBase(rowActionCallBack);
 }
Exemplo n.º 37
0
 /// <summary>
 /// Ajoute une nouvelle ligne d'informations dans la console
 /// </summary>
 /// <param name="message">Le message des données</param>
 /// /// <param name="type">Le type de la ligne</param>
 public void WriteLine(string message, RowType type = RowType.Normal)
 {
     ListViewItem item = new ListViewItem();
     item.ImageIndex = (int)type;
     item.SubItems.Add(DateTime.Now.ToString());
     item.SubItems.Add(message);
     item.ForeColor = ColorList.ElementAt(((int)type < this.ColorList.Count - 1) ? (int)type + 1 : 0);
     this.ListViewConsole.Items.Add(item).EnsureVisible();
 }
        public static void DeclareServerRowtype(Type controllerType, RowType row)
        {
            var pair = new KeyValuePair<Type, string>(controllerType, row.RowId);
            if (!serverTemplates.ContainsKey(pair))
            {
                if (!typeof(Controller).GetTypeInfo().IsAssignableFrom(controllerType))
                    throw new ArgumentException(string.Format(Resources.NotAController, controllerType.Name), nameof(controllerType));
                serverTemplates[pair] = row;
            }

        }
Exemplo n.º 39
0
        public BaseBlock(String text, String highlight, RowType type)
            : base()
        {
            this.Type = type;
            this.Style = Styles.Command;

            this._text = text;
            this._highlight = highlight;

            Render();
        }
Exemplo n.º 40
0
 protected override void PrepareCommand(RowType.TypeInfo[] fields, DbCommand command, Object[] parameters)
 {
     command.CommandText = _commandText;
     for (int k = 0; k < _parameterBindings.Length; k++)
     {
         DbParameter parameter = command.CreateParameter();
         parameter.ParameterName = _helper.FormatParameter(
             String.Format("p{0}", command.Parameters.Count));
         parameter.Direction = ParameterDirection.Input;
         parameter.Value = parameters[_parameterBindings[k]];
         command.Parameters.Add(parameter);
     }
 }
Exemplo n.º 41
0
        /// <summary>
        /// Adds a footer/summary row
        /// </summary>
        /// <param name="pdfRowType"></param>
        public void AddFooterRow(RowType pdfRowType)
        {
            if (SharedData.SummarySettings == null || SharedData.SummarySettings.OverallSummarySettings == null ||
                !SharedData.SummarySettings.OverallSummarySettings.ShowOnEachPage) return;

            if (SharedData.MainTableEvents != null)
                SharedData.MainTableEvents.RowStarted(new EventsArguments { PdfDoc = SharedData.PdfDoc, PdfWriter = SharedData.PdfWriter, Table = MainTable, RowType = pdfRowType, ColumnCellsSummaryData = SharedData.ColumnCellsSummaryData, PreviousTableRowData = _previousTableRowData, PageSetup = SharedData.PageSetup, PdfFont = SharedData.PdfFont, PdfColumnsAttributes = SharedData.PdfColumnsAttributes });

            for (var columnNumber = 0; columnNumber < SharedData.ColumnsCount; columnNumber++)
            {
                var backgroundColor = SharedData.Template.SummaryRowBackgroundColor;
                var foreColor = SharedData.Template.SummaryRowFontColor;
                var col = SharedData.PdfColumnsAttributes[columnNumber];

                int location = -1;
                switch (SharedData.SummarySettings.OverallSummarySettings.SummaryLocation)
                {
                    case SummaryLocation.AtFirstDefinedAggregateCell:
                        if (columnNumber == getFirstDefinedAggregateCell())
                            location = columnNumber;
                        break;
                    case SummaryLocation.AtRowNumberColumn:
                        if (columnNumber == 0)
                            location = 0;
                        break;
                    case SummaryLocation.AtSpecifiedLabelColumnProperty:
                        if (SharedData.SummarySettings.OverallSummarySettings.LabelColumnProperty == col.PropertyName)
                            location = columnNumber;
                        break;
                }

                if (location != -1)
                    TableCellHelper.AddSummaryCell(backgroundColor[0], foreColor, location, CellType.SummaryRowCell, pdfRowType);
                else
                    TableCellHelper.AddSummaryCell(backgroundColor[0], foreColor, null, columnNumber, pdfRowType, CellType.SummaryRowCell);
            }

            if (SharedData.MainTableEvents != null)
                SharedData.MainTableEvents.RowAdded(new EventsArguments { PdfDoc = SharedData.PdfDoc, PdfWriter = SharedData.PdfWriter, Table = MainTable, RowType = pdfRowType, ColumnCellsSummaryData = SharedData.ColumnCellsSummaryData, PreviousTableRowData = _previousTableRowData, PageSetup = SharedData.PageSetup, PdfFont = SharedData.PdfFont, PdfColumnsAttributes = SharedData.PdfColumnsAttributes });
        }
 private CustomRowObject CreateRowObject(RowType rowType)
 {
     return new CustomRowObject { RowType = rowType };
 }
Exemplo n.º 43
0
        /// <summary>
        /// Adds a new Summary PdfPCell to the MainTable
        /// </summary>
        /// <param name="backgroundColor"></param>
        /// <param name="foreColor"></param>
        /// <param name="columnNumber"></param>
        /// <param name="pdfCellType"></param>
        /// <param name="pdfRowType"></param>
        /// <returns></returns>
        public CellAttributes AddSummaryCell(BaseColor backgroundColor, BaseColor foreColor, int columnNumber, CellType pdfCellType, RowType pdfRowType)
        {
            var horizontalAlignment = SharedData.SummarySettings.OverallSummarySettings.LabelHorizontalAlignment;
            var text = SharedData.SummarySettings.OverallSummarySettings.Label;

            if (ShowAllGroupsSummaryRow)
            {
                horizontalAlignment = SharedData.SummarySettings.AllGroupsSummarySettings.LabelHorizontalAlignment;
                text = SharedData.SummarySettings.AllGroupsSummarySettings.Label;
            }

            if (pdfCellType == CellType.PageSummaryCell)
            {
                text = SharedData.SummarySettings.PageSummarySettings.Label;
                horizontalAlignment = SharedData.SummarySettings.PageSummarySettings.LabelHorizontalAlignment;
            }

            return AddGeneralCell(
                            backgroundColor,
                            foreColor,
                            text,
                            columnNumber,
                            pdfRowType,
                            pdfCellType,
                            horizontalAlignment: horizontalAlignment.HasValue ? horizontalAlignment.Value : HorizontalAlignment.None);
        }
Exemplo n.º 44
0
 String GetData(String key, RowType rt)
 {
     if (rt == RowType.Output)
       {
     int index = 2;
     foreach (DataGridViewRow row in dataGridView1.Rows)
     {
       String cur_key = Convert.ToString(row.Cells[0].Value);
       if (cur_key == null || cur_key.CompareTo("") == 0)
       {
     continue;
       }
       if (cur_key.CompareTo(key) == 0)
       {
     return Convert.ToString(row.Cells[2].Value);
       }
     }
     logger.Warn("GetData {0}, {1}", key, index);
       }
       else
       {
     logger.Warn("Not supported");
       }
       return null;
 }
Exemplo n.º 45
0
 /// <summary>
 /// Adds a new Summary PdfPCell to the MainTable
 /// </summary>
 /// <param name="backgroundColor"></param>
 /// <param name="foreColor"></param>        
 /// <param name="rawData"></param>
 /// <param name="columnNumber"></param>
 /// <param name="pdfRowType"></param>
 /// <param name="pdfCellType"></param>
 /// <returns></returns>
 public CellAttributes AddSummaryCell(BaseColor backgroundColor, BaseColor foreColor, object rawData, int columnNumber, RowType pdfRowType, CellType pdfCellType)
 {
     return AddGeneralCell(backgroundColor, foreColor, rawData, columnNumber, pdfRowType, pdfCellType);
 }
Exemplo n.º 46
0
        private Type CreateRowType(RowType rowType, FacetInfo facets)
        {
            Dictionary<string, Type> members = new Dictionary<string, Type>();

            foreach (EdmMember member in rowType.Members)
            {
                members.Add(member.GetColumnName(), this.Convert(member.TypeUsage));
            }

            Type result = DataRowFactory.Create(members);

            return result;
        }
Exemplo n.º 47
0
 public ChartIconDropDownRowCells(RowType typeOfRow)
 {
     TypeOfRow = typeOfRow;
 }
Exemplo n.º 48
0
 public bool GetLocator(string qualifiedName, ref RowType.Locator loc)
 {
     ColumnBinding b = Get(qualifiedName);
     if (b != null)
     {
         loc.master = b.rnum;
         if (b.snum != -1)
             loc.detail = b.snum;
         return true;
     }
     else
         return false;           
 }
Exemplo n.º 49
0
        /// <summary>
        /// Parses a XElement that contains type information
        ///  Accepts an element that is a CollectionType, RowType, ReferenceType, and TypeRef
        /// </summary>
        /// <param name="typeElement">XElement that contains a Type element</param>
        /// <returns>DataType represented by the XElement</returns>
        protected DataType ParseType(XElement typeElement)
        {
            if (typeElement.Name.LocalName == "CollectionType")
            {
                string elementTypeName = typeElement.GetOptionalAttributeValue("ElementType", null);
                if (elementTypeName != null)
                {
                    bool isNullable = XmlConvert.ToBoolean(typeElement.GetOptionalAttributeValue("Nullable", "true"));
                    DataType dataType = this.ParseType(elementTypeName, isNullable, typeElement.Attributes());
                    return DataTypes.CollectionType.WithElementDataType(dataType);
                }
                else
                {
                    var elementType = typeElement.Elements().Single(e => this.IsXsdlNamespace(e.Name.NamespaceName));
                    return DataTypes.CollectionType.WithElementDataType(this.ParseType(elementType));
                }
            }
            else if (typeElement.Name.LocalName == "RowType")
            {
                var row = new RowType();
                foreach (var propertyElement in typeElement.Elements().Where(el => this.IsXsdlElement(el, "Property")))
                {
                    row.Properties.Add(this.ParseProperty(propertyElement));
                }

                return DataTypes.RowType.WithDefinition(row);
            }
            else if (typeElement.Name.LocalName == "ReferenceType")
            {
                DataType dataType = this.ParseType(typeElement.GetRequiredAttributeValue("Type"), true, null);
                return DataTypes.ReferenceType.WithEntityType((dataType as EntityDataType).Definition);
            }
            else if (typeElement.Name.LocalName == "TypeRef")
            {
                bool isNullable = XmlConvert.ToBoolean(typeElement.GetOptionalAttributeValue("Nullable", "true"));
                DataType dataType = this.ParseType(typeElement.GetRequiredAttributeValue("Type"), isNullable, typeElement.Attributes());
                return dataType;
            }
            else
            {
                throw new TaupoNotSupportedException("Unsupported data type element: " + typeElement.Name.LocalName);
            }
        }
Exemplo n.º 50
0
 public TableType(String qualifiedName, String catalogName, String schemaName, String tableName, 
     DataSourceInfo dataSource, RowType tableRowType, bool smart)
 {
     QualifiedName = qualifiedName;
     CatalogName = catalogName;
     SchemaName = schemaName;
     TableName = tableName;
     DataSource = dataSource;
     TableRowType = tableRowType;
     Smart = smart;
 }
Exemplo n.º 51
0
        private TableType GetDataProviderTableType(DataSourceInfo dsi, String identifier)
        {           
            DataProviderHelper helper = new DataProviderHelper(dsi.ProviderInvariantName, dsi.ConnectionString);                       
            using (DbConnection connection = dsi.CreateConnection())
            {                
                DbCommand command = connection.CreateCommand();                
                
                StringBuilder sb = new StringBuilder();
                sb.Append("SELECT * FROM ");
                sb.Append(identifier);
                if (helper.OrderByColumnsInSelect)
                    sb.Append(" ORDER BY 1");
                command.CommandText = sb.ToString();                
                
                try
                {
                    DbDataReader reader;                    
                    connection.Open();
                    bool hasKeyInfo = false;                    
                    try
                    {
                        reader = command.ExecuteReader(CommandBehavior.SchemaOnly | CommandBehavior.KeyInfo);
                        hasKeyInfo = true;
                    }
                    catch (Exception ex)
                    {
                        Trace.TraceWarning("GetDataProviderTableType.ExecuteReader: {0}", ex.Message);                        
                        reader = command.ExecuteReader(CommandBehavior.SchemaOnly);                        
                    }

                    DataTable dt_src = reader.GetSchemaTable();
                    DataTable dt = RowType.CreateSchemaTable();
                    int n = 0;
                    foreach (DataRow r in dt_src.Rows)
                    {
                        DataRow r1 = dt.NewRow();
                        foreach (DataColumn col in dt_src.Columns)
                        {
                            DataColumn dest = dt.Columns[col.ColumnName];
                            if (dt.Columns.IndexOf(col.ColumnName) != -1 && col.ColumnName != "ColumnName")
                                r1[dest] = r[col];
                        }
                        r1["ColumnOrdinal"] = n++;
                        string columnName = (string)r["ColumnName"];
                        r1["ColumnName"] = helper.NativeFormatIdentifier(columnName);
                        r1["ProviderColumnName"] = columnName;
                        r1["IsCaseSensitive"] = 
                            helper.IdentifierCase == IdentifierCase.Sensitive;
                        dt.Rows.Add(r1);
                    }

                    reader.Close();
                    
                    RowType rtype = new RowType(dt);
                    if (hasKeyInfo && rtype.Fields[0].BaseTableName != null)
                        return new TableType(identifier, rtype.Fields[0].BaseCatalogName,
                            rtype.Fields[0].BaseSchemaName, rtype.Fields[0].BaseTableName, dsi, rtype, helper.Smart);
                    else
                    {
                        string schema = null;
                        string catalog = null;
                        string tableName = null;
                        
                        string[] identifierPart = helper.SplitIdentifier(identifier);                        
                        int length = identifierPart.Length;

                        if (length == 3)
                            catalog = identifierPart[identifierPart.Length - length--];

                        if (length == 2)
                            schema = identifierPart[identifierPart.Length - length--];

                        if (length == 1)
                            tableName = identifierPart[identifierPart.Length - length];
                        
                        return new TableType(identifier, catalog, schema, tableName, dsi, rtype, helper.Smart);
                    }
                }
                catch (Exception ex)
                {
                    Trace.TraceWarning("GetDataProviderTableType: {0}", ex.Message);
                    return null;
                }
            }
        }
Exemplo n.º 52
0
 public DataProviderQueryAccessor(DataSourceInfo dataSourceInfo, Notation notation, Symbol squery)
     : base()
 {
     _rowType = null;
     _connectionString = dataSourceInfo.ConnectionString;
     _providerInvariantName = dataSourceInfo.ProviderInvariantName;
     _helper = new DataProviderHelper(_providerInvariantName, _connectionString);
     SqlQueryWriter writer = new SqlQueryWriter(notation);
     writer.ProviderHelper = _helper;
     if (squery.Tag == Tag.Stmt)
         writer.WriteStmt(squery);
     else
         writer.WriteQueryExp(squery);
     _commandText = writer.ToString();
     _parameterBindings = writer.Bindings.ToArray();
 }
Exemplo n.º 53
0
 internal RowCache(Resultset rs)
 {
     _rowType = rs._rtype;
 }
Exemplo n.º 54
0
 public TableType(String qualifiedName, String tableName, DataSourceInfo dataSource, RowType tableRowType)
 {
     QualifiedName = qualifiedName;
     TableName = tableName;
     DataSource = dataSource;
     TableRowType = tableRowType;
 }
Exemplo n.º 55
0
 protected override RowType CreateRowType()
 {
     if (_rowType == null)
     {
         DataProviderHelper helper = new DataProviderHelper(_providerInvariantName, _connectionString);
         DbConnection connection = DataProviderHelper.CreateDbConnection(_providerInvariantName);
         connection.ConnectionString = _connectionString;
         connection.Open();
         DbCommand command = connection.CreateCommand();
         command.CommandText = _commandText;
         for (int k = 0; k < _parameterBindings.Length; k++)
         {
             DbParameter parameter = command.CreateParameter();
             parameter.ParameterName = _helper.FormatParameter(
                 String.Format("p{0}", command.Parameters.Count));
             parameter.Direction = ParameterDirection.Input;
             command.Parameters.Add(parameter);
         }
         DbDataReader reader = command.ExecuteReader(CommandBehavior.SchemaOnly | CommandBehavior.CloseConnection);
         try
         {
             DataTable dt_src = reader.GetSchemaTable();
             DataTable dt = RowType.CreateSchemaTable();
             int n = 0;
             foreach (DataRow r in dt_src.Rows)
             {
                 DataRow r1 = dt.NewRow();
                 foreach (DataColumn col in dt_src.Columns)
                 {
                     DataColumn dest = dt.Columns[col.ColumnName];
                     if (dt.Columns.IndexOf(col.ColumnName) != -1 && col.ColumnName != "ColumnName")
                         r1[dest] = r[col];
                 }
                 r1["ColumnOrdinal"] = n++;
                 string columnName = (string)r["ColumnName"];
                 r1["ColumnName"] = helper.NativeFormatIdentifier(columnName);
                 r1["ProviderColumnName"] = columnName;
                 r1["IsCaseSensitive"] =
                     helper.IdentifierCase == IdentifierCase.Sensitive;
                 dt.Rows.Add(r1);
             }
             _rowType = new RowType(dt);
         }
         finally
         {
             reader.Close();
         }
     }
     return _rowType;
 }
Exemplo n.º 56
0
 /// <summary>
 /// Gets the <see cref="CollectionDataType"/> with row data type as element type.
 /// </summary>
 /// <param name="rowType">Row data type definition.</param>
 /// <returns>The data type.</returns>
 public static CollectionDataType CollectionOfRows(RowType rowType)
 {
     return CollectionType.WithElementDataType(RowType.WithDefinition(rowType));
 }
Exemplo n.º 57
0
 void RegisterDataKey(String key, RowType row_type)
 {
     int index = dataGridView1.Rows.Add();
       dataGridView1.Rows[index].Cells[0].Value = key;
       if (row_type == RowType.Output || row_type == RowType.Important)
       {
     DataGridViewCellStyle style = new DataGridViewCellStyle();
     style.BackColor = Color.LightGray;
     if (row_type == RowType.Important)
     {
       style.Font = new Font(dataGridView1.Font, FontStyle.Bold);
     }
     dataGridView1.Rows[index].DefaultCellStyle = style;
       }
 }
Exemplo n.º 58
0
        // Public Methods (7)
        /// <summary>
        /// Adds a new PdfPCell to the MainTable
        /// </summary>
        /// <param name="backgroundColor"></param>
        /// <param name="foreColor"></param>        
        /// <param name="rawData"></param>
        /// <param name="columnNumber"></param>
        /// <param name="pdfRowType"></param>
        /// <param name="pdfCellType"></param>
        /// <param name="rowValues"></param>
        /// <param name="horizontalAlignment"></param>
        /// <param name="pdfFontStyle"></param>
        /// <param name="rotation"></param>
        /// <param name="setItemTemplate"></param>
        /// <param name="colSpan"></param>         
        /// <returns></returns>
        public CellAttributes AddGeneralCell(
                    BaseColor backgroundColor,
                    BaseColor foreColor,
                    object rawData,
                    int columnNumber,
                    RowType pdfRowType,
                    CellType pdfCellType,
                    IList<CellData> rowValues = null,
                    HorizontalAlignment horizontalAlignment = HorizontalAlignment.None,
                    DocumentFontStyle pdfFontStyle = DocumentFontStyle.None,
                    int rotation = 0,
                    bool setItemTemplate = false,
                    int colSpan = 1)
        {
            var col = SharedData.PdfColumnsAttributes[columnNumber];

            var cellData = new CellAttributes
            {
                RowData = new CellRowData
                {
                    TableRowData = rowValues,
                    Value = rawData,
                    PdfRowType = pdfRowType,
                    ColumnNumber = columnNumber
                },
                SharedData = new CellSharedData
                {
                    PdfColumnAttributes = col,
                    DataRowNumber = CurrentRowInfoData.LastOverallDataRowNumber,
                    GroupNumber = CurrentRowInfoData.LastGroupRowNumber,
                    PdfDoc = SharedData.PdfDoc,
                    PdfWriter = SharedData.PdfWriter,
                    SummarySettings = SharedData.SummarySettings,
                    Template = SharedData.Template
                },
                ItemTemplate = setItemTemplate ? col.ColumnItemsTemplate : null,
                BasicProperties = new CellBasicProperties
                {
                    PdfFont = SharedData.PdfFont,
                    Rotation = rotation,
                    PdfFontStyle = (pdfFontStyle == DocumentFontStyle.None) ? DocumentFontStyle.Normal : pdfFontStyle,
                    BackgroundColor = backgroundColor,
                    BorderColor = SharedData.Template.CellBorderColor,
                    FontColor = foreColor,
                    RunDirection = SharedData.PageSetup.PagePreferences.RunDirection,
                    ShowBorder = SharedData.Template.ShowGridLines,
                    HorizontalAlignment = (horizontalAlignment == HorizontalAlignment.None) ? col.CellsHorizontalAlignment : horizontalAlignment,
                    FixedHeight = pdfRowType == RowType.DataTableRow ? col.FixedHeight : 0,
                    MinimumHeight = pdfRowType == RowType.DataTableRow ? col.MinimumHeight : 0
                }
            };

            if (SharedData.MainTableEvents != null) SharedData.MainTableEvents.CellCreated(new EventsArguments { PdfDoc = SharedData.PdfDoc, PdfWriter = SharedData.PdfWriter, Cell = cellData, CellType = pdfCellType, RowType = pdfRowType, ColumnNumber = columnNumber, ColumnCellsSummaryData = SharedData.ColumnCellsSummaryData, PreviousTableRowData = CurrentRowInfoData.PreviousTableRowData, PageSetup = SharedData.PageSetup, PdfFont = SharedData.PdfFont, PdfColumnsAttributes = SharedData.PdfColumnsAttributes });
            var cell = cellData.CreateSafePdfPCell(new TextBlockField());
            cell.CellEvent = new MainTableCellsEvent(cellData)
            {
                SummaryCellsData = SharedData.ColumnCellsSummaryData,
                IsGroupingEnabled = SharedData.IsGroupingEnabled,
                CurrentRowInfoData = CurrentRowInfoData
            };

            if (colSpan > 1) cell.Colspan = colSpan;

            MainTable.AddCell(cell);
            if (SharedData.MainTableEvents != null) SharedData.MainTableEvents.CellAdded(new EventsArguments { PdfDoc = SharedData.PdfDoc, PdfWriter = SharedData.PdfWriter, Cell = cellData, CellType = pdfCellType, RowType = pdfRowType, ColumnNumber = columnNumber, ColumnCellsSummaryData = SharedData.ColumnCellsSummaryData, PreviousTableRowData = CurrentRowInfoData.PreviousTableRowData, PageSetup = SharedData.PageSetup, PdfFont = SharedData.PdfFont, PdfColumnsAttributes = SharedData.PdfColumnsAttributes });

            return cellData;
        }
Exemplo n.º 59
0
 protected override void PrepareCommand(RowType.TypeInfo[] fields, DbCommand command, Object[] parameters)
 {            
     DataProviderHelper helper = new DataProviderHelper(_providerInvariantName, _connectionString);
     Binder binder = new Binder(fields);
     StringBuilder sb = new StringBuilder();
     sb.Append("SELECT ");
     for (int k = 0; k < fields.Length; k++)
     {
         if (k > 0)
             sb.Append(", ");
         if (fields[k].ProviderColumnName != null)
             sb.Append(helper.FormatIdentifier(fields[k].ProviderColumnName));
         else
             sb.Append(helper.FormatIdentifier(fields[k].Name));
     }
     sb.AppendLine();
     sb.Append(" FROM ");
     sb.Append(TableType.ToString(helper));
     if (TableType.Smart)
     {
         if (FilterPredicate != null || AccessPredicate != null)
             sb.AppendLine(" WHERE ");
         if (FilterPredicate != null)
         {
             if (AccessPredicate != null)
                 sb.Append("(");
             command.Parameters.Clear();
             sb.AppendLine(WriteExpr(binder, helper, FilterPredicate, 
                 parameters, command));
             if (AccessPredicate != null)
                 sb.Append(")");
         }
         if (AccessPredicate != null)
         {
             if (FilterPredicate != null)
                 sb.AppendLine(" AND (");
             for (int s = 0; s < AccessPredicateValues.Length; s++)
             {
                 if (s > 0)
                     sb.Append(" OR ");
                 sb.Append("(");
                 for (int k = 0; k < AccessPredicate.Length; k++)
                 {
                     if (k > 0)
                         sb.Append(" AND ");
                     sb.Append(helper.FormatIdentifier(AccessPredicate[k]));
                     Object predicateValue = AccessPredicateValues[s][k];
                     if (predicateValue == DBNull.Value)
                         sb.Append(" IS NULL");
                     else
                     {
                         sb.Append("=");
                         sb.Append(WriteLiteral(helper, predicateValue));
                     }
                 }
                 sb.Append(")");
             }
             if (FilterPredicate != null)
                 sb.Append(")");
         }
     }
     if (SortColumns != null)
     {
         sb.AppendLine(" ORDER BY ");
         for (int k = 0; k < SortColumns.Length; k++)               
             {
                 if (k > 0)
                     sb.Append(", ");
                 sb.Append(helper.FormatIdentifier(SortColumns[k].ColumnName));
                 if (SortColumns[k].Direction == SortDirection.Descending)
                     sb.Append(" DESC");
             }
         sb.AppendLine();
     }
     command.CommandText = sb.ToString();            
 }
Exemplo n.º 60
0
 public String GetName(RowType.Locator loc)
 {
     foreach (ColumnBinding b in _columnBinding)
         if (loc.master == b.rnum && (loc.detail ?? -1) == b.snum)
         {
             if (b.TableName != null)
                 return String.Format("{0}.{1}", b.TableName, b.Name);
             else
                 return b.Name;
         }
     return null;
 }