当前位置: 首页>>代码示例>>C#>>正文


C# FPCEstimate.FormulaEvaluator类代码示例

本文整理汇总了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);
 }
开发者ID:ciswebb,项目名称:FPC-Estimate-App,代码行数:4,代码来源:ShowUOMTable.Controls.cs

示例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
                {
                }

            }
        }
开发者ID:ciswebb,项目名称:FPC-Estimate-App,代码行数:99,代码来源:EditScope.Controls.cs

示例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);
        }
开发者ID:ciswebb,项目名称:FPC-Estimate-App,代码行数:67,代码来源:ShowCategoryTable.Controls.cs


注:本文中的FPCEstimate.FormulaEvaluator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。