本文整理汇总了C#中IRecord.SetFieldValue方法的典型用法代码示例。如果您正苦于以下问题:C# IRecord.SetFieldValue方法的具体用法?C# IRecord.SetFieldValue怎么用?C# IRecord.SetFieldValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IRecord
的用法示例。
在下文中一共展示了IRecord.SetFieldValue方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnUpdateRecord
/// <summary>
/// Called when the record is to be updated
/// </summary>
/// <param name="record">The record.</param>
protected override void OnUpdateRecord(IRecord record)
{
int iOne = record.GetFieldValue<int>("One", 0);
int iTwo = record.GetFieldValue<int>("Two", 0);
int iThree = record.GetFieldValue<int>("Three", 0);
record.SetFieldValue<int>("One + Two", iOne + iTwo);
record.SetFieldValue<int>("One + Three", iOne + iThree);
}
示例2: UpdateMaterialFields
/// <summary>
/// Updates the lookup.
/// </summary>
/// <param name="record">The record.</param>
protected void UpdateMaterialFields(IRecord record)
{
string materialCode = record.GetFieldValue<string>("Material Code", null);
if (!string.IsNullOrEmpty(materialCode))
{
string vendor = materialService.GetVendor(materialCode);
record.SetFieldValue("Material Vendor", vendor);
}
}
示例3: OnUpdateRecord
/// <summary>
/// Called when the record is to be updated
/// </summary>
/// <param name="record">The record.</param>
protected override void OnUpdateRecord(IRecord record)
{
bool refresh = record.GetFieldValue<bool>("Refresh Material", false);
if (refresh)
{
UpdateMaterialFields(record);
record.SetFieldValue("Refresh Material", false);
}
}
示例4: OnUpdateRecord
/// <summary>
/// Called when the record is to be updated
/// </summary>
/// <param name="record">The record.</param>
protected override void OnUpdateRecord(IRecord record)
{
double source = record.GetFieldValue<double>(sourceField, 0);
if (source > 0)
{
double log = System.Math.Log10(source);
record.SetFieldValue<double>(logResultField, log);
}
else
{
TraceError("{0} - Unable to calculate ['{1}'] = Math.Log10({2}) ({2} = {3})", this, logResultField, sourceField, source);
}
}
示例5: OnUpdateNewRecord
/// <summary>
/// Called when the record is a new record.
/// </summary>
/// <param name="record">The record.</param>
protected override void OnUpdateNewRecord(IRecord record)
{
string currentValue = record.GetFieldValue<string>("Shift", null);
if (string.IsNullOrEmpty(currentValue))
{
DateTime utcSample = record.GetFieldValue<DateTime>("SampleDateTime", DateTime.UtcNow);
TimeSpan time = utcSample.ToLocalTime().TimeOfDay;
string shift = time >= MorningShift && time < EveningShift ? "Day" : "Night";
record.SetFieldValue("Shift", shift);
}
}
示例6: UpdateWeightAndPercentage
private static void UpdateWeightAndPercentage(IRecord record, string[] measurements, string weightFormat, string percentageFormat)
{
using (RecordAggregate aggregate = new RecordAggregate(record))
{
string[] weightFieldNames = ExpandFieldNames(weightFormat, measurements);
double total = aggregate.SumValues(0, weightFieldNames);
record.SetFieldValue(ExpandFieldName(weightFormat, "Total"), total);
double runningTotal = 0;
foreach (string measurement in measurements)
{
string weightField = ExpandFieldName(weightFormat, measurement);
string percentageField = ExpandFieldName(percentageFormat, measurement);
double ratio = aggregate.GetRatio(weightField, total);
runningTotal += ratio;
record.SetFieldValue(percentageField, ratio*100);
}
record.SetFieldValue(ExpandFieldName(percentageFormat, "Total"), runningTotal);
}
}