本文整理汇总了C#中FPCEstimate.FormulaEvaluator类的典型用法代码示例。如果您正苦于以下问题:C# FormulaEvaluator类的具体用法?C# FormulaEvaluator怎么用?C# FormulaEvaluator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FormulaEvaluator类属于FPCEstimate命名空间,在下文中一共展示了FormulaEvaluator类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EvaluateFormula
public virtual string EvaluateFormula(string formula, BaseClasses.Data.BaseRecord dataSourceForEvaluate, System.Collections.Generic.IDictionary<string, object> variables, FormulaEvaluator e)
{
return this.EvaluateFormula(formula, dataSourceForEvaluate, null, variables, true, e);
}
示例2: PopulateUOMIDDropDownList
// Fill the UOMID list.
protected virtual void PopulateUOMIDDropDownList(string selectedValue, int maxItems)
{
this.UOMID.Items.Clear();
// 1. Setup the static list items
// Add the Please Select item.
this.UOMID.Items.Insert(0, new ListItem(this.Page.GetResourceValue("Txt:PleaseSelect", "FPCEstimate"), "--PLEASE_SELECT--"));
// 2. Set up the WHERE and the ORDER BY clause by calling the CreateWhereClause_UOMIDDropDownList function.
// It is better to customize the where clause there.
WhereClause wc = CreateWhereClause_UOMIDDropDownList();
// Create the ORDER BY clause to sort based on the displayed value.
OrderBy orderBy = new OrderBy(false, false);
orderBy.Add(UOMTable.UOMName, OrderByItem.OrderDir.Asc);
System.Collections.Generic.IDictionary<string, object> variables = new System.Collections.Generic.Dictionary<string, object> ();
// 3. Read a total of maxItems from the database and insert them into the UOMIDDropDownList.
UOMRecord[] itemValues = null;
if (wc.RunQuery)
{
int counter = 0;
int pageNum = 0;
FormulaEvaluator evaluator = new FormulaEvaluator();
do
{
itemValues = UOMTable.GetRecords(wc, orderBy, pageNum, maxItems);
foreach (UOMRecord itemValue in itemValues)
{
// Create the item and add to the list.
string cvalue = null;
string fvalue = null;
if (itemValue.UOMIDSpecified)
{
cvalue = itemValue.UOMID.ToString().ToString();
if (counter < maxItems && this.UOMID.Items.FindByValue(cvalue) == null)
{
Boolean _isExpandableNonCompositeForeignKey = ScopeTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(ScopeTable.UOMID);
if(_isExpandableNonCompositeForeignKey && ScopeTable.UOMID.IsApplyDisplayAs)
fvalue = ScopeTable.GetDFKA(itemValue, ScopeTable.UOMID);
if ((!_isExpandableNonCompositeForeignKey) || (String.IsNullOrEmpty(fvalue)))
fvalue = itemValue.Format(UOMTable.UOMName);
if (fvalue == null || fvalue.Trim() == "")
fvalue = cvalue;
ListItem newItem = new ListItem(fvalue, cvalue);
this.UOMID.Items.Add(newItem);
counter += 1;
}
}
}
pageNum++;
}
while (itemValues.Length == maxItems && counter < maxItems);
}
// 4. Set the selected value (insert if not already present).
if (selectedValue != null &&
selectedValue.Trim() != "" &&
!MiscUtils.SetSelectedValue(this.UOMID, selectedValue) &&
!MiscUtils.SetSelectedDisplayText(this.UOMID, selectedValue))
{
// construct a whereclause to query a record with UOM.UOMID = selectedValue
CompoundFilter filter2 = new CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, null);
WhereClause whereClause2 = new WhereClause();
filter2.AddFilter(new BaseClasses.Data.ColumnValueFilter(UOMTable.UOMID, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, false));
whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator);
// Execute the query
try
{
UOMRecord[] rc = UOMTable.GetRecords(whereClause2, new OrderBy(false, false), 0, 1);
System.Collections.Generic.IDictionary<string, object> vars = new System.Collections.Generic.Dictionary<string, object> ();
// if find a record, add it to the dropdown and set it as selected item
if (rc != null && rc.Length == 1)
{
string fvalue = ScopeTable.UOMID.Format(selectedValue);
ListItem item = new ListItem(fvalue, selectedValue);
item.Selected = true;
this.UOMID.Items.Add(item);
}
}
catch
{
}
}
}
示例3: PopulateParentCatIDFilter
// Get the filters' data for ParentCatIDFilter.
protected virtual void PopulateParentCatIDFilter(string selectedValue, int maxItems)
{
this.ParentCatIDFilter.Items.Clear();
// Set up the WHERE and the ORDER BY clause by calling the CreateWhereClause_ParentCatIDFilter function.
// It is better to customize the where clause there.
//Setup the WHERE clause.
WhereClause wc =this.CreateWhereClause_ParentCatIDFilter();
// Setup the static list items
// Add the All item.
this.ParentCatIDFilter.Items.Insert(0, new ListItem(this.Page.GetResourceValue("Txt:All", "FPCEstimate"), "--ANY--"));
OrderBy orderBy = new OrderBy(false, false);
orderBy.Add(CategoryTable.CatName, OrderByItem.OrderDir.Asc);
System.Collections.Generic.IDictionary<string, object> variables = new System.Collections.Generic.Dictionary<string, object> ();
string noValueFormat = Page.GetResourceValue("Txt:Other", "FPCEstimate");
CategoryRecord[] itemValues = null;
if (wc.RunQuery)
{
int counter = 0;
int pageNum = 0;
FormulaEvaluator evaluator = new FormulaEvaluator();
do
{
itemValues = CategoryTable.GetRecords(wc, orderBy, pageNum, maxItems);
foreach (CategoryRecord itemValue in itemValues)
{
// Create the item and add to the list.
string cvalue = null;
string fvalue = null;
if (itemValue.CatIDSpecified)
{
cvalue = itemValue.CatID.ToString();
if (counter < maxItems && this.ParentCatIDFilter.Items.FindByValue(cvalue) == null)
{
Boolean _isExpandableNonCompositeForeignKey = CategoryTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(CategoryTable.ParentCatID);
if(_isExpandableNonCompositeForeignKey && CategoryTable.ParentCatID.IsApplyDisplayAs)
fvalue = CategoryTable.GetDFKA(itemValue, CategoryTable.ParentCatID);
if ((!_isExpandableNonCompositeForeignKey) || (String.IsNullOrEmpty(fvalue)))
fvalue = itemValue.Format(CategoryTable.CatName);
if (fvalue == null || fvalue.Trim() == "") fvalue = cvalue;
ListItem newItem = new ListItem(fvalue, cvalue);
this.ParentCatIDFilter.Items.Add(newItem);
counter += 1;
}
}
}
pageNum++;
}
while (itemValues.Length == maxItems && counter < maxItems);
}
// Set the selected value.
MiscUtils.SetSelectedValue(this.ParentCatIDFilter, selectedValue);
}