本文整理汇总了C#中Metric.GetMergeObjects方法的典型用法代码示例。如果您正苦于以下问题:C# Metric.GetMergeObjects方法的具体用法?C# Metric.GetMergeObjects怎么用?C# Metric.GetMergeObjects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Metric
的用法示例。
在下文中一共展示了Metric.GetMergeObjects方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShowEditDetails
//.........这里部分代码省略.........
<br />
<h4>Example #3</h4>
A metric with multiple partitions.
<ul>
<li>The 1st Column will be the YValue </li>
<li>The 2nd Column will be the EntityId of the 1st Partition </li>
<li>The 3rd Column will be the EntityId of the 2nd Partition </li>
<li>... </li>
<li>The Nth Column will be the EntityId of the (N-1)th Partition </li>
</ul>
<pre>
SELECT COUNT(*), [GroupId], [CampusId], [ScheduleId]
FROM [Attendance]
WHERE DidAttend = 1
AND StartDateTime >= '{{ RunDateTime | Date:'MM/dd/yyyy' }}'
AND StartDateTime < '{{ RunDateTime | DateAdd:1,'d' | Date:'MM/dd/yyyy' }}'
GROUP BY [GroupId], [CampusId], [ScheduleId]
</pre>
<br />
<h4>Example #4</h4>
A metric with multiple partitions with a specific MetricValueDateTime specified.
<ul>
<li>The 1st Column will be the YValue </li>
<li>If a [MetricValueDateTime] field is specified as the 2nd column, that will be the metric value date. NOTE: This should be a constant value for all rows
<li>The 3rd Column will be the EntityId of the 1st Partition </li>
<li>The 4th Column will be the EntityId of the 2nd Partition </li>
<li>etc.</li>
</ul>
<pre>
-- get totals for the previous week
{% assign weekEndDate = RunDateTime | SundayDate | DateAdd:-7,'d' %}
SELECT COUNT(*), '{{ weekEndDate }}' [MetricValueDateTime], [GroupId], [CampusId], [ScheduleId]
FROM [Attendance]
WHERE DidAttend = 1
AND StartDateTime >= '{{ weekEndDate | DateAdd:-6,'d' | Date:'MM/dd/yyyy' }}'
AND StartDateTime < '{{ weekEndDate | DateAdd:1,'d' | Date:'MM/dd/yyyy' }}'
GROUP BY [GroupId], [CampusId], [ScheduleId]
</pre>
NOTE: If a [MetricValueDateTime] is specified and there is already a metric value, the value will get updated. This is handy if you have a weekly metric, but schedule it to calculate every day.
<hr>
The SQL can include Lava merge fields:";
ceSourceSql.Help += metric.GetMergeObjects( RockDateTime.Now ).lavaDebugInfo();
if ( metric.Schedule != null )
{
sbSchedule.iCalendarContent = metric.Schedule.iCalendarContent;
if ( metric.Schedule.Name != string.Empty )
{
// Named Schedule
rblScheduleSelect.SelectedValue = ScheduleSelectionType.NamedSchedule.ConvertToInt().ToString();
sbSchedule.iCalendarContent = null;
ddlSchedule.SelectedValue = metric.ScheduleId.ToString();
}
else
{
// Unique Schedule (specific to this Metric)
rblScheduleSelect.SelectedValue = ScheduleSelectionType.Unique.ConvertToInt().ToString();
sbSchedule.iCalendarContent = metric.Schedule.iCalendarContent;
// set the hidden field for the scheduleId of the Unique schedule so we don't overwrite a named schedule
hfUniqueScheduleId.Value = metric.ScheduleId.ToString();
}
}
else
{
sbSchedule.iCalendarContent = null;
rblScheduleSelect.SelectedValue = rblScheduleSelect.SelectedValue = ScheduleSelectionType.Unique.ConvertToInt().ToString();
}
if ( metric.LastRunDateTime != null )
{
ltLastRunDateTime.LabelType = LabelType.Success;
ltLastRunDateTime.Text = "Last Run: " + metric.LastRunDateTime.ToString();
}
else
{
ltLastRunDateTime.LabelType = LabelType.Warning;
ltLastRunDateTime.Text = "Never Run";
}
ddlDataView.SetValue( metric.DataViewId );
// make sure the control visibility is set based on SourceType
ddlSourceType_SelectedIndexChanged( null, new EventArgs() );
// make sure the control visibility is set based on Schedule Selection Type
rblScheduleSelect_SelectedIndexChanged( null, new EventArgs() );
MetricPartitionsState = new List<MetricPartition>();
foreach ( var item in metric.MetricPartitions )
{
MetricPartitionsState.Add( item );
}
BindMetricPartitionsGrid();
}
示例2: ShowEditDetails
/// <summary>
/// Shows the edit details.
/// </summary>
/// <param name="metric">The metric.</param>
public void ShowEditDetails( Metric metric )
{
if ( metric.Id == 0 )
{
lReadOnlyTitle.Text = ActionTitle.Add( Metric.FriendlyTypeName ).FormatAsHtmlTitle();
}
else
{
lReadOnlyTitle.Text = ActionTitle.Edit( metric.Title ).FormatAsHtmlTitle();
}
SetEditMode( true );
LoadDropDowns();
tbTitle.Text = metric.Title;
tbSubtitle.Text = metric.Subtitle;
tbDescription.Text = metric.Description;
tbIconCssClass.Text = metric.IconCssClass;
cpMetricCategories.SetValues( metric.MetricCategories.Select( a => a.Category ) );
int manualSourceType = DefinedValueCache.Read( Rock.SystemGuid.DefinedValue.METRIC_SOURCE_VALUE_TYPE_MANUAL.AsGuid() ).Id;
ddlSourceType.SetValue( metric.SourceValueTypeId ?? manualSourceType );
tbXAxisLabel.Text = metric.XAxisLabel;
tbYAxisLabel.Text = metric.YAxisLabel;
cbIsCumulative.Checked = metric.IsCumulative;
etpEntityType.SelectedEntityTypeId = metric.EntityTypeId;
ppMetricChampionPerson.SetValue( metric.MetricChampionPersonAlias != null ? metric.MetricChampionPersonAlias.Person : null );
ppAdminPerson.SetValue( metric.AdminPersonAlias != null ? metric.AdminPersonAlias.Person : null );
ceSourceSql.Text = metric.SourceSql;
ceSourceSql.Help = @"Specify the SQL that will return the Y Value for each scheduled Date. Example: <pre>SELECT COUNT(*) FROM [Attendance] </pre>
If this is a metric is partitioned, the 2nd column will be the EntityId value. Example: <pre>SELECT COUNT(*), [CampusId] FROM [Attendance] GROUP BY [CampusId] </pre>
The SQL can include Lava merge fields:";
ceSourceSql.Help += metric.GetMergeObjects( RockDateTime.Now ).lavaDebugInfo();
if ( metric.Schedule != null )
{
sbSchedule.iCalendarContent = metric.Schedule.iCalendarContent;
if ( metric.Schedule.Name != string.Empty )
{
// Named Schedule
rblScheduleSelect.SelectedValue = ScheduleSelectionType.NamedSchedule.ConvertToInt().ToString();
sbSchedule.iCalendarContent = null;
ddlSchedule.SelectedValue = metric.ScheduleId.ToString();
}
else
{
// Unique Schedule (specific to this Metric)
rblScheduleSelect.SelectedValue = ScheduleSelectionType.Unique.ConvertToInt().ToString();
sbSchedule.iCalendarContent = metric.Schedule.iCalendarContent;
// set the hidden field for the scheduleId of the Unique schedule so we don't overwrite a named schedule
hfUniqueScheduleId.Value = metric.ScheduleId.ToString();
}
}
else
{
sbSchedule.iCalendarContent = null;
rblScheduleSelect.SelectedValue = rblScheduleSelect.SelectedValue = ScheduleSelectionType.Unique.ConvertToInt().ToString();
}
if ( metric.LastRunDateTime != null )
{
ltLastRunDateTime.LabelType = LabelType.Success;
ltLastRunDateTime.Text = "Last Run: " + metric.LastRunDateTime.ToString();
}
else
{
ltLastRunDateTime.LabelType = LabelType.Warning;
ltLastRunDateTime.Text = "Never Run";
}
ddlDataView.SetValue( metric.DataViewId );
// make sure the control visibility is set based on SourceType
ddlSourceType_SelectedIndexChanged( null, new EventArgs() );
// make sure the control visibility is set based on Schedule Selection Type
rblScheduleSelect_SelectedIndexChanged( null, new EventArgs() );
}