Example #1
0
        protected void AddControlColumn(XlsGroup band, XlsRow gridRow, BizControl control)
        {
            if (control.Invisible)
            {
                return;
            }

            band.AddGroup(new XlsTextNode(control.Caption));
            if (DataSet != null)
            {
                gridRow.AddDataField(new DocFormDataSetField(DataSet, control));
            }
            else if (SqlDataSet != null)
            {
                if (!(control is BizDataControl))
                {
                    return;
                }

                var attr = SqlDataSet.Reader.Query.FindAttribute(((BizDataControl)control).AttributeDefId ?? Guid.Empty) ??
                           SqlDataSet.Reader.Query.FindAttribute(((BizDataControl)control).AttributeName);
                if (attr != null)
                {
                    gridRow.AddDataField(new SqlQueryDataSetField(SqlDataSet, attr, control));
                }
            }
        }
Example #2
0
        protected void AddControlColumn(XlsGroup band, XlsRow gridRow, BizControl control, SqlQueryDataSet dataSet)
        {
            if (control.Invisible)
            {
                return;
            }

            var header = new XlsTextNode(control.Caption);

            band.AddGroup(header);
            var info = _adjuster.Find(control);
            var attr = dataSet.Reader.Query.FindAttribute(((BizDataControl)control).AttributeDefId ?? Guid.Empty);

            if (attr != null)
            {
                var field = gridRow.AddDataField(new SqlQueryDataSetField(dataSet, attr, control));
                if (info != null)
                {
                    header.ColSpan = info.ColSpan;
                    field.ColSpan  = info.ColSpan;
                }
            }

/*
 *          var field = gridRow.AddDataField(new SqlQueryDataSetField(dataSet, control));
 *          if (info != null)
 *          {
 *              header.ColSpan = info.ColSpan;
 *              field.ColSpan = info.ColSpan;
 * //                if (info.ColSpan == 1)
 * //                    field.Width = info.Size;
 *          }
 */
        }
Example #3
0
        protected void BuildHeaderColumns(XlsGroup band, XlsRow gridRow)
        {
            XlsTextNode header;

            foreach (var col in Table.Columns.OfType <CrossDataKeyColumn>())
            {
                header = new XlsTextNode(col.Caption);
                band.AddGroup(header);
                var info = _adjuster.Find(col);
                if (info != null)
                {
                    header.ColSpan = info.ColSpan;
                }
            }
            var group = Table.Columns.OfType <CrossDataGroupColumn>().FirstOrDefault();

            if (group != null)
            {
                header = new XlsTextNode(group.Caption);
                band.AddGroup(header);
                if (group.Values != null && group.Values.Count > 0)
                {
                    foreach (var val in group.Values)
                    {
                        var h = new XlsTextNode(val.Value != null ? val.Value.ToString() : "");
                        header.AddGroup(h);
                        AddGroupBandColumns(h, val);
                    }
                }
                else
                {
                    AddGroupBandColumns(header, null);
                }
            }
        }
        protected void AddControlBand(XlsGroup band, XlsRow gridRow, BizControl control)
        {
            if (control.Invisible)
            {
                return;
            }

            if (control is BizPanel

                /*control is BizTableColumn ||
                 * control is BizDocumentControl || control is BizDocumentListForm*/)
            {
                var node = new XlsTextNode(control.Caption);
                band.AddGroup(node);

                foreach (var child in control.Children)
                {
                    AddControlBand(node, gridRow, child);
                }
            }
            else if (control is BizTableColumn ||
                     control is BizDocumentControl || control is BizDocumentListForm)
            {
                if (control.Children != null)
                {
                    foreach (var child in control.Children)
                    {
                        AddControlBand(band, gridRow, child);
                    }
                }
            }
            else if (control is BizDataControl)
            {
                AddControlColumn(band, gridRow, control);
            }
            else
            if (control.Children != null)
            {
                foreach (var child in control.Children)
                {
                    AddControlBand(band.AddGroup(new XlsTextNode(child.Caption)), gridRow, child);
                }
            }
        }
        protected void AddControlColumn(XlsGroup band, XlsRow gridRow, BizControl control)
        {
            if (control.Invisible)
            {
                return;
            }

            var header = new XlsTextNode(control.Caption);

            band.AddGroup(header);
            var info = _adjuster.Find(control);

            if (DataSet != null)
            {
                var field = gridRow.AddDataField(new DocFormDataSetField(DataSet, control));
                if (info != null)
                {
                    header.ColSpan = info.ColSpan;
                    field.ColSpan  = info.ColSpan;
                }
            }
            else if (SqlDataSet != null)
            {
                if (!(control is BizDataControl))
                {
                    return;
                }

                var attr = SqlDataSet.Reader.Query.FindAttribute(((BizDataControl)control).AttributeDefId ?? Guid.Empty);
                if (attr != null)
                {
                    var field = gridRow.AddDataField(new SqlQueryDataSetField(SqlDataSet, attr, control));
                    if (info != null)
                    {
                        header.ColSpan = info.ColSpan;
                        field.ColSpan  = info.ColSpan;
                    }
                }
            }
        }
        protected void AddColumn(XlsGroup band, XlsRow gridRow, ReportColumnDef column, Dictionary <Guid, SqlQuerySource> sourceMap)
        {
            var header = new XlsTextNode(column.Caption);

            band.AddGroup(header);
            var info       = _adjuster.Find(column);
            var attrColumn = column as ReportAttributeColumnDef;

            if (attrColumn != null && SqlDataSet != null)
            {
                SqlQuerySource querySource;
                var            reportSource     = Report.GetSourceDef(attrColumn.Attribute.SourceId);
                var            reportSourceAttr = reportSource.Attributes != null
                    ? reportSource.Attributes.FirstOrDefault(a => a.Id == attrColumn.Attribute.AttributeId)
                    : null;

                var hasQuerySource = sourceMap.TryGetValue(attrColumn.Attribute.SourceId, out querySource);

                var attr = reportSourceAttr == null
                    ? !hasQuerySource
                        ? SqlDataSet.Reader.Query.FindAttribute(attrColumn.Attribute.AttributeId)
                        : SqlDataSet.Reader.Query.FindAttribute(querySource, attrColumn.Attribute.AttributeId)
                    : !hasQuerySource
                        ? SqlDataSet.Reader.Query.FindAttribute(reportSourceAttr.Ident)
                        : SqlDataSet.Reader.Query.FindAttribute(querySource, reportSourceAttr.Ident);

                if (attr != null)
                {
                    var field = gridRow.AddDataField(new SqlQueryDataSetField(SqlDataSet, attr, attrColumn.ToSqlGrouping()));
                    if (info != null)
                    {
                        header.ColSpan = info.ColSpan;
                        field.ColSpan  = info.ColSpan;
                    }
                }
            }
        }
Example #7
0
 public XlsGroup AddGroup(XlsGroup group)
 {
     Items.Add(group);
     return(group);
 }