本文整理汇总了C#中WorkClass类的典型用法代码示例。如果您正苦于以下问题:C# WorkClass类的具体用法?C# WorkClass怎么用?C# WorkClass使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WorkClass类属于命名空间,在下文中一共展示了WorkClass类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetWorkClass
public SetWorkClass(WorkClass workClass, bool cacheRawMessage)
: base(COMMAND, MessageType.Command, cacheRawMessage, ((char)workClass).ToString())
{
}
示例2: SetWorkClass
public void SetWorkClass(WorkClass workClass)
{
_client.Send(new SetWorkClass(workClass));
}
示例3: GetValue
private WorkClass GetValue(Report rpt)
{
WorkClass wc = rpt.Cache.Get(this, "wc") as WorkClass;
if (wc == null)
{
wc = new WorkClass(this);
rpt.Cache.Add(this, "wc", wc);
}
return wc;
}
示例4: SetValue
private void SetValue(Report rpt, WorkClass w)
{
rpt.Cache.AddReplace(_key, w);
}
示例5: PrepGroups
private void PrepGroups(Report rpt, WorkClass wc)
{
if (_Grouping == null)
return;
int i=0;
// 1) Build array of all GroupExpression objects
List<GroupExpression> gea = _Grouping.GroupExpressions.Items;
GroupEntry[] currentGroups = new GroupEntry[1];
_Grouping.SetIndex(rpt, 0); // set the index of this group (so we can find the GroupEntry)
currentGroups[0] = new GroupEntry(_Grouping, _Sorting, 0);
// Save the typecodes, and grouping by groupexpression; for later use
TypeCode[] tcs = new TypeCode[gea.Count];
Grouping[] grp = new Grouping[gea.Count];
i=0;
foreach (GroupExpression ge in gea)
{
grp[i] = (Grouping) (ge.Parent.Parent); // remember the group
tcs[i++] = ge.Expression.GetTypeCode(); // remember type of expression
}
// 2) Loop thru the data, then loop thru the GroupExpression list
wc.Groups = new List<GroupEntry>();
object[] savValues=null;
object[] grpValues=null;
int rowCurrent = 0;
foreach (Row row in wc.Data.Data)
{
// Get the values for all the group expressions
if (grpValues == null)
grpValues = new object[gea.Count];
i=0;
foreach (GroupExpression ge in gea) // Could optimize to only calculate as needed in comparison loop below??
{
grpValues[i++] = ge.Expression.Evaluate(rpt, row);
}
// For first row we just primed the pump; action starts on next row
if (rowCurrent == 0) // always start new group on first row
{
rowCurrent++;
savValues = grpValues;
grpValues = null;
continue;
}
// compare the values; if change then we have a group break
for (i = 0; i < savValues.Length; i++)
{
if (Filter.ApplyCompare(tcs[i], savValues[i], grpValues[i]) != 0)
{
// start a new group; and force a break on every subgroup
GroupEntry saveGe=null;
for (int j = grp[i].GetIndex(rpt); j < currentGroups.Length; j++)
{
currentGroups[j].EndRow = rowCurrent-1;
if (j == 0)
wc.Groups.Add(currentGroups[j]); // top group
else if (saveGe == null)
currentGroups[j-1].NestedGroup.Add(currentGroups[j]);
else
saveGe.NestedGroup.Add(currentGroups[j]);
saveGe = currentGroups[j]; // retain this GroupEntry
currentGroups[j] = new GroupEntry(currentGroups[j].Group,currentGroups[j].Sort, rowCurrent);
}
savValues = grpValues;
grpValues = null;
break; // break out of the value comparison loop
}
}
rowCurrent++;
}
// End of all rows force break on end of rows
for (i = 0; i < currentGroups.Length; i++)
{
currentGroups[i].EndRow = rowCurrent-1;
if (i == 0)
wc.Groups.Add(currentGroups[i]); // top group
else
currentGroups[i-1].NestedGroup.Add(currentGroups[i]);
}
return;
}
示例6: RunPageGroups
private void RunPageGroups(Pages pgs, WorkClass wc, List<GroupEntry> groupEntries)
{
Report rpt = pgs.Report;
Page p = pgs.CurrentPage;
float pagebottom = OwnerReport.BottomOfPage;
p.YOffset += (Top == null? 0: this.Top.Points);
float listoffset = GetOffsetCalc(pgs.Report)+LeftCalc(pgs.Report);
float height;
Row row;
foreach (GroupEntry ge in groupEntries)
{
// set the group entry value
int index;
if (ge.Group != null) // groups?
{
ge.Group.ResetHideDuplicates(rpt); // reset duplicate checking
index = ge.Group.GetIndex(rpt); // yes
}
else // no; must be main dataset
index = 0;
wc.Data.CurrentGroups[index] = ge;
if (ge.NestedGroup.Count > 0)
RunGroupsSetGroups(rpt, wc, ge.NestedGroup);
if (ge.Group == null)
{ // need to run all the rows since no group defined
for (int r=ge.StartRow; r <= ge.EndRow; r++)
{
row = wc.Data.Data[r];
height = HeightOfList(rpt, pgs.G, row);
float saveYoffset = p.YOffset; // this can be affected by other page items
_ReportItems.RunPage(pgs, row, listoffset);
p.YOffset = saveYoffset + height;
if (p.YOffset + height > pagebottom) // need another page for next row?
{
p = RunPageNew(pgs, p); // yes; if at end this page is empty
} // and will be cleaned up later
}
}
else
{ // need to process just whole group as a List entry
if (ge.Group.PageBreakAtStart && !p.IsEmpty())
p = RunPageNew(pgs, p);
// pass the first row of the group
row = wc.Data.Data[ge.StartRow];
height = HeightOfList(rpt, pgs.G, row);
float saveYoffset = p.YOffset; // this can be affected by other page items
_ReportItems.RunPage(pgs, row, listoffset);
p.YOffset = saveYoffset + height;
if (ge.Group.PageBreakAtEnd || // need another page for next group?
p.YOffset + height > pagebottom)
{
p = RunPageNew(pgs, p); // yes; if at end empty page will be cleaned up later
}
}
}
}
示例7: RunCountSubtotalRows
int RunCountSubtotalRows(Report rpt, WorkClass wc, MatrixEntry m, int level)
{
// Get the number of static columns
int srCount = Math.Max(1, this._RowGroupings.StaticCount);
int count = 0;
// Increase the row count when subtotal is requested at this level
RowGrouping rg = (RowGrouping) (_RowGroupings.Items[level]);
if (rg.DynamicRows != null &&
rg.DynamicRows.Subtotal != null)
count = srCount;
if (m.GetSortedData(rpt) == null || level+1 >= _RowGroupings.Items.Count)
return count;
// Now dive into the data
foreach (MatrixEntry ame in m.GetSortedData(rpt))
{
count += RunCountSubtotalRows(rpt, wc, ame, level+1);
}
return count;
}
示例8: RunColumnHeaders
void RunColumnHeaders(Report rpt, WorkClass wc, MatrixEntry m, MatrixCellEntry[,] matrix, Rows _Data, int iRow, ref int iColumn, int level)
{
foreach (MatrixEntry ame in m.GetSortedData(rpt))
{
matrix[iRow, iColumn] = RunGetColumnHeader(rpt, ame, _Data);
matrix[iRow, iColumn].Width = RunGetColumnWidth(matrix[iRow, iColumn]);
matrix[iRow, iColumn].Height = ame.ColumnGroup.Height == null? 0: ame.ColumnGroup.Height.Points;
if (ame.GetSortedData(rpt) != null)
{
RunColumnHeaders(rpt, wc, ame, matrix, _Data, iRow+1, ref iColumn, level+1);
}
else
iColumn++;
}
ColumnGrouping cg = (ColumnGrouping) (_ColumnGroupings.Items[level]);
// if we need subtotal on the group
if (cg.DynamicColumns != null &&
cg.DynamicColumns.Subtotal != null)
{
ReportItem ri = cg.DynamicColumns.Subtotal.ReportItems.Items[0];
matrix[iRow, iColumn] = new MatrixCellEntry(_Data, ri);
matrix[iRow, iColumn].Height = cg.Height.Points;
matrix[iRow, iColumn].Width = RunGetColumnWidth(matrix[iRow, iColumn]);
RunColumnStaticHeaders(rpt, wc, matrix, _Data, iRow, iColumn, level);
iColumn += this.CountMatrixCells;
}
}
示例9: RunPageColumns
void RunPageColumns(Pages pgs, WorkClass wc, MatrixCellEntry[,] matrix, int iRow, int maxColumns)
{
Report rpt = pgs.Report;
float xpos = GetOffsetCalc(pgs.Report) + LeftCalc(rpt);
for (int iColumn = 0; iColumn < maxColumns; iColumn++)
{
MatrixCellEntry mce = matrix[iRow, iColumn];
if (mce == null)
{ // have a null column but we need to fill column space
xpos += WidthOfColumn(matrix, iColumn);
continue;
}
wc.Data = mce.Data; // Must set this for evaluation
Row lrow = wc.Data.Data.Count > 0? wc.Data.Data[0]:null;
SetGroupingValues(rpt, mce);
mce.DisplayItem.SetMC(rpt, mce); // set for use by the display item
mce.XPosition = xpos;
mce.DisplayItem.RunPage(pgs, lrow);
xpos += mce.Width;
iColumn += (mce.ColSpan-1); // skip columns already accounted for
}
}
示例10: HandleColumnGrouping
void HandleColumnGrouping(Report rpt, WorkClass wc, Rows rows, Row r, MatrixEntry m, int cgi, int iRow, ref int maxColumns)
{
while (cgi < _ColumnGroupings.Items.Count)
{
ColumnGrouping cg = _ColumnGroupings.Items[cgi] as ColumnGrouping;
Grouping grp=null;
string result;
if (cg.StaticColumns != null) // handle static columns
{
for (int sci=0; sci < cg.StaticColumns.Items.Count; sci++)
{
result = Convert.ToChar(Convert.ToInt32('a')+sci).ToString() + terminal; // static column; put all data in it
StaticColumn sc = cg.StaticColumns.Items[sci] as StaticColumn;
MatrixEntry ame;
m.HashData.TryGetValue(result, out ame);
if (ame == null)
{
ame = new MatrixEntry(r, result, m, rows.Data.Count);
ame.ColumnGroup = cg;
ame.StaticColumn = sci;
m.HashData.Add(result, ame);
if (cg == LastCg) // Add a column when we add data at lowest level
maxColumns++;
}
ame.Rows.Set(iRow, true);
// Logic in FirstRow and Last row determine whether value gets set
ame.FirstRow = iRow;
ame.LastRow = iRow;
HandleColumnGrouping(rpt, wc, rows, r, ame, cgi+1, iRow, ref maxColumns);
}
break; // handled ones below it recursively
}
else // handle dynamic columns
{
grp = cg.DynamicColumns.Grouping;
StringBuilder sb = new StringBuilder();
foreach (GroupExpression ge in grp.GroupExpressions.Items)
{
string temp = ge.Expression.EvaluateString(rpt, r);
if (temp == null || temp == "")
sb.Append(nullterminal);
else
sb.Append(temp);
sb.Append(terminal); // mark end of group
}
result = sb.ToString();
MatrixEntry ame;
m.HashData.TryGetValue(result, out ame);
if (ame == null)
{
ame = new MatrixEntry(r, result, m, rows.Data.Count);
ame.ColumnGroup = cg;
m.HashData.Add(result, ame);
if (cg == LastCg) // Add a column when we add data at lowest level
maxColumns++;
}
ame.Rows.Set(iRow, true);
// Logic in FirstRow and Last row determine whether value gets set
ame.FirstRow = iRow;
ame.LastRow = iRow;
m = ame; // now go down a level
cgi++;
}
}
}
示例11: RunRowStaticHeaders
void RunRowStaticHeaders(Report rpt, WorkClass wc, MatrixCellEntry[,] matrix, Rows _Data, int iRow, int level)
{
RowGrouping rg=null;
int i;
int iColumn=0;
for (i=level+1; i < _RowGroupings.Items.Count; i++)
{
iColumn++; // Column for the row static headers
rg = (RowGrouping) (_RowGroupings.Items[i]);
if (rg.StaticRows != null)
break;
}
if (rg == null || rg.StaticRows == null)
return;
i=0;
foreach (StaticRow sr in rg.StaticRows.Items)
{
ReportItem ri = sr.ReportItems.Items[0];
matrix[iRow, iColumn] = new MatrixCellEntry(_Data, ri);
matrix[iRow, iColumn].Width = rg.Width.Points;
MatrixRow mr = this.MatrixRows.Items[i++] as MatrixRow;
float height = mr.Height == null? 0: mr.Height.Points;
matrix[iRow, iColumn].Height = height;
iRow++;
}
return;
}
示例12: RunCountSubtotalColumns
int RunCountSubtotalColumns(WorkClass wc, MatrixEntry m, int level)
{
// Get the number of static columns
int scCount = Math.Max(1, this._ColumnGroupings.StaticCount);
int count = 0;
// Increase the column count when subtotal is requested at this level
ColumnGrouping cg = (ColumnGrouping) (_ColumnGroupings.Items[level]);
if (cg.DynamicColumns != null &&
cg.DynamicColumns.Subtotal != null)
count = scCount;
if (m.SortedData == null || level+1 >= _ColumnGroupings.Items.Count)
return count;
// Now dive into the data
foreach (MatrixEntry ame in m.SortedData.Values)
{
count += RunCountSubtotalColumns(wc, ame, level+1);
}
return count;
}
示例13: HandleRowGrouping
void HandleRowGrouping(Report rpt, WorkClass wc, Rows rows, Row r, MatrixEntry m, int rgi, int iRow, ref int maxRows)
{
while (rgi < _RowGroupings.Items.Count)
{
RowGrouping rg = _RowGroupings.Items[rgi] as RowGrouping;
Grouping grp=null;
string result;
if (rg.StaticRows != null) // handle static rows
{
for (int sri=0; sri < rg.StaticRows.Items.Count; sri++)
{
result = Convert.ToChar(Convert.ToInt32('a')+sri).ToString() + terminal; // static row; put all data in it
StaticRow sr = rg.StaticRows.Items[sri] as StaticRow;
MatrixEntry ame = (MatrixEntry) (m.HashData[result]);
if (ame == null)
{
ame = new MatrixEntry(m, rows.Data.Count);
ame.RowGroup = rg;
ame.StaticRow = sri;
m.HashData.Add(result, ame);
if (rg == LastRg) // Add a row when we add data at lowest level
maxRows++;
}
ame.Rows.Set(iRow, true);
// Logic in FirstRow and Last row determine whether value gets set
ame.FirstRow = iRow;
ame.LastRow = iRow;
HandleRowGrouping(rpt, wc, rows, r, ame, rgi+1, iRow, ref maxRows);
}
break; // handled ones below it recursively
}
else // handle dynamic columns
{
grp = rg.DynamicRows.Grouping;
StringBuilder sb = new StringBuilder();
foreach (GroupExpression ge in grp.GroupExpressions.Items)
{
string temp = ge.Expression.EvaluateString(rpt, r);
if (temp == null || temp == "")
sb.Append(nullterminal);
else
sb.Append(temp);
sb.Append(terminal); // mark end of group
}
result = sb.ToString();
MatrixEntry ame = (MatrixEntry) (m.HashData[result]);
if (ame == null)
{
ame = new MatrixEntry(m, rows.Data.Count);
ame.RowGroup = rg;
m.HashData.Add(result, ame);
if (rg == LastRg) // Add a row when we add data at lowest level
maxRows++;
}
ame.Rows.Set(iRow, true);
// Logic in FirstRow and Last row determine whether value gets set
ame.FirstRow = iRow;
ame.LastRow = iRow;
m = ame; // now go down a level
rgi++;
}
}
}
示例14: SetValue
private void SetValue(Report rpt, WorkClass w)
{
rpt.Cache.AddReplace(this, "wc", w);
}
示例15: RunColumnStaticHeaders
void RunColumnStaticHeaders(Report rpt, WorkClass wc, MatrixCellEntry[,] matrix, Rows _Data, int iRow, int iColumn, int level)
{
ColumnGrouping cg=null;
for (int i=level+1; i < _ColumnGroupings.Items.Count; i++)
{
iRow++; // the row will below the headers
cg = (ColumnGrouping) (_ColumnGroupings.Items[i]);
if (cg.StaticColumns != null)
break;
}
if (cg == null || cg.StaticColumns == null)
return;
foreach (StaticColumn sc in cg.StaticColumns.Items)
{
ReportItem ri = sc.ReportItems.Items[0];
matrix[iRow, iColumn] = new MatrixCellEntry(_Data, ri);
matrix[iRow, iColumn].Height = cg.Height.Points;
matrix[iRow, iColumn].Width = RunGetColumnWidth(matrix[iRow, iColumn]);
iColumn++;
}
return;
}