Exemplo n.º 1
0
        public string EvaluateFormula_Base(string formula, BaseClasses.Data.BaseRecord dataSourceForEvaluate, string format, System.Collections.Generic.IDictionary<string, object> variables, bool includeDS)
        {
            FormulaEvaluator e = new FormulaEvaluator();

            // add variables for formula evaluation
            if (variables != null)
            {
                System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<string, object>> enumerator = variables.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value);
                }
            }

            if (includeDS)
            {

            }

            e.CallingControl = this;

            // All variables referred to in the formula are expected to be
            // properties of the DataSource.  For example, referring to
            // UnitPrice as a variable will refer to DataSource.UnitPrice
            e.DataSource = dataSourceForEvaluate;

            // Define the calling control.
            e.CallingControl = this;

            object resultObj = e.Evaluate(formula);
            if (resultObj == null)
                return "";

            if ( !string.IsNullOrEmpty(format) && (string.IsNullOrEmpty(formula) || formula.IndexOf("Format(") < 0) )
            {
                return FormulaUtils.Format(resultObj, format);
            }
            else
            {
                return resultObj.ToString();
            }
        }
Exemplo n.º 2
0
        /**
         *
         * Returns the Formatted value of a cell as a <tt>String</tt> regardless
         * of the cell type. If the Excel FormatBase pattern cannot be Parsed then the
         * cell value will be Formatted using a default FormatBase.
         *
         * When passed a null or blank cell, this method will return an empty
         * String (""). Formula cells will be evaluated using the given
         * {@link HSSFFormulaEvaluator} if the evaluator is non-null. If the
         * evaluator is null, then the formula String will be returned. The caller
         * is responsible for setting the currentRow on the evaluator
         *
         *
         * @param cell The cell (can be null)
         * @param evaluator The HSSFFormulaEvaluator (can be null)
         * @return a string value of the cell
         */
        public String FormatCellValue(Cell cell, FormulaEvaluator evaluator)
        {
            if (cell == null)
            {
                return "";
            }

            CellType cellType = cell.CellType;
            if (evaluator != null && cellType == CellType.FORMULA)
            {
                try
                {
                    cellType = evaluator.EvaluateFormulaCell(cell);
                }
                catch (Exception e)
                {
                    throw new Exception("Did you forGet to set the current" +
                            " row on the HSSFFormulaEvaluator?", e);
                }
            }
            switch (cellType)
            {
                case CellType.FORMULA:
                    // should only occur if evaluator is null
                    return cell.CellFormula;

                case CellType.NUMERIC:

                    if (DateUtil.IsCellDateFormatted(cell))
                    {
                        return GetFormattedDateString(cell);
                    }
                    return GetFormattedNumberString(cell);

                case CellType.STRING:
                    return cell.RichStringCellValue.String;

                case CellType.BOOLEAN:
                    return cell.BooleanCellValue.ToString().ToUpper();
                case CellType.BLANK:
                    return "";
            }
            throw new Exception("Unexpected celltype (" + cellType + ")");
        }
Exemplo n.º 3
0
 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));
 }
Exemplo n.º 4
0
        public virtual string EvaluateFormula(string formula, BaseClasses.Data.BaseRecord dataSourceForEvaluate, string format, System.Collections.Generic.IDictionary <string, object> variables, bool includeDS, FormulaEvaluator e)
        {
            if (e == null)
            {
                e = new FormulaEvaluator();
            }

            e.Variables.Clear();
            // add variables for formula evaluation
            if (variables != null)
            {
                System.Collections.Generic.IEnumerator <System.Collections.Generic.KeyValuePair <string, object> > enumerator = variables.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value);
                }
            }


            if (includeDS)
            {
            }

            // All variables referred to in the formula are expected to be
            // properties of the DataSource.  For example, referring to
            // UnitPrice as a variable will refer to DataSource.UnitPrice
            if (dataSourceForEvaluate == null)
            {
                e.DataSource = this.DataSource;
            }
            else
            {
                e.DataSource = dataSourceForEvaluate;
            }

            // Define the calling control.  This is used to add other
            // related table and record controls as variables.
            e.CallingControl = this;

            object resultObj = e.Evaluate(formula);

            if (resultObj == null)
            {
                return("");
            }

            if (!string.IsNullOrEmpty(format) && (string.IsNullOrEmpty(formula) || formula.IndexOf("Format(") < 0))
            {
                return(FormulaUtils.Format(resultObj, format));
            }
            else
            {
                return(resultObj.ToString());
            }
        }
        public virtual void SetFieldTripId()
        {
            string selectedValue = null;

            // figure out the selectedValue



            // Set the FieldTripId QuickSelector on the webpage with value from the
            // DatabaseOLR_db%dbo.FieldTripOptions database record.

            // this.DataSource is the DatabaseOLR_db%dbo.FieldTripOptions record retrieved from the database.
            // this.FieldTripId is the ASP:QuickSelector on the webpage.

            // You can modify this method directly, or replace it with a call to
            //     base.SetFieldTripId();
            // and add your own custom code before or after the call to the base function.


            // Default Value could also be NULL.
            if (this.DataSource != null && this.DataSource.IsCreated)
            {
                selectedValue = this.DataSource.FieldTripId.ToString();
            }
            else
            {
                selectedValue = EvaluateFormula("URL(\"FieldTripId\")");
            }


            // Add the Please Select item.
            if (selectedValue == null || selectedValue == "")
            {
                MiscUtils.ResetSelectedItem(this.FieldTripId, new ListItem(this.Page.GetResourceValue("Txt:PleaseSelect", "OLR"), "--PLEASE_SELECT--"));
            }


            // Populate the item(s) to the control

            this.FieldTripId.SetFieldMaxLength(50);

            System.Collections.Generic.IDictionary <string, object> variables = new System.Collections.Generic.Dictionary <string, object>();
            FormulaEvaluator evaluator = new FormulaEvaluator();

            if (selectedValue != null &&
                selectedValue.Trim() != "" &&
                !MiscUtils.SetSelectedValue(this.FieldTripId, selectedValue) &&
                !MiscUtils.SetSelectedDisplayText(this.FieldTripId, selectedValue))
            {
                // construct a whereclause to query a record with DatabaseOLR_db%dbo.FieldTrips.FieldTripId = selectedValue

                CompoundFilter filter2      = new CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, null);
                WhereClause    whereClause2 = new WhereClause();
                filter2.AddFilter(new BaseClasses.Data.ColumnValueFilter(FieldTripsTable.FieldTripId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, false));
                whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator);

                // Execute the query
                try
                {
                    FieldTripsRecord[] rc = FieldTripsTable.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)
                    {
                        FieldTripsRecord itemValue = rc[0];
                        string           cvalue    = null;
                        string           fvalue    = null;
                        if (itemValue.FieldTripIdSpecified)
                        {
                            cvalue = itemValue.FieldTripId.ToString();
                        }
                        Boolean _isExpandableNonCompositeForeignKey = FieldTripOptionsTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(FieldTripOptionsTable.FieldTripId);
                        if (_isExpandableNonCompositeForeignKey && FieldTripOptionsTable.FieldTripId.IsApplyDisplayAs)
                        {
                            fvalue = FieldTripOptionsTable.GetDFKA(itemValue, FieldTripOptionsTable.FieldTripId);
                        }
                        if ((!_isExpandableNonCompositeForeignKey) || (String.IsNullOrEmpty(fvalue)))
                        {
                            fvalue = itemValue.Format(FieldTripsTable.Description);
                        }

                        if (fvalue == null || fvalue.Trim() == "")
                        {
                            fvalue = cvalue;
                        }
                        MiscUtils.ResetSelectedItem(this.FieldTripId, new ListItem(fvalue, cvalue));
                    }
                }
                catch
                {
                }
            }

            string url = this.ModifyRedirectUrl("../FieldTrips/FieldTrips-QuickSelector.aspx", "", true);

            url = this.Page.ModifyRedirectUrl(url, "", true);

            url += "?Target=" + this.FieldTripId.ClientID + "&DFKA=" + (this.Page as BaseApplicationPage).Encrypt("Description") + "&IndexField=" + (this.Page as BaseApplicationPage).Encrypt("FieldTripId") + "&EmptyValue=" + (this.Page as BaseApplicationPage).Encrypt("--PLEASE_SELECT--") + "&EmptyDisplayText=" + (this.Page as BaseApplicationPage).Encrypt(this.Page.GetResourceValue("Txt:PleaseSelect")) + "&Mode=" + (this.Page as BaseApplicationPage).Encrypt("FieldValueSingleSelection") + "&RedirectStyle=" + (this.Page as BaseApplicationPage).Encrypt("Popup");

            this.FieldTripId.Attributes["onClick"] = "initializePopupPage(this, '" + url + "', " + Convert.ToString(FieldTripId.AutoPostBack).ToLower() + ", event); return false;";
        }
        public virtual string EvaluateFormula(string formula)
        {
            FormulaEvaluator e = new FormulaEvaluator();

            e.DataSource = this.DataSource;

            // Define the calling control.  This is used to add other
            // related table and record controls as variables.
            e.CallingControl = this;

            object resultObj = e.Evaluate(formula);
            if (resultObj == null)
                return "";

            return resultObj.ToString();
        }
        //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        //ORIGINAL LINE: private void loadLineItems(org.hibernate.Session paramSession, String paramString) throws Exception
        private void loadLineItems(Session paramSession, string paramString)
        {
            POIFSFileSystem pOIFSFileSystem = new POIFSFileSystem(new FileStream(paramString, FileMode.Open, FileAccess.Read));
            HSSFWorkbook    hSSFWorkbook    = new HSSFWorkbook(pOIFSFileSystem);

            this.o_evaluator = hSSFWorkbook.CreationHelper.createFormulaEvaluator();
            HSSFSheet hSSFSheet = hSSFWorkbook.getSheetAt(0);

            Console.WriteLine("Loading Line Items...");
            int            i              = getRealNumberOfRows(hSSFSheet);
            string         str1           = null;
            string         str2           = null;
            GroupCodeTable groupCodeTable = null;
            string         str3           = null;

            for (int j = 1; j < i; j++)
            {
                if (j % this.rowsToCommit == 0)
                {
                    paramSession.Transaction.commit();
                    paramSession.Transaction.begin();
                    Console.WriteLine("Processing next 500...");
                }
                HSSFRow hSSFRow = hSSFSheet.getRow(j);
                string  str4    = notNull(hSSFRow.getCell(0));
                string  str5    = notNull(hSSFRow.getCell(1));
                if (!str4.StartsWith("Group", StringComparison.Ordinal))
                {
                    string str6 = notNull(hSSFRow.getCell(2));
                    string str7 = notNull(hSSFRow.getCell(3));
                    if (!StringUtils.isNullOrBlank(str4))
                    {
                        Console.WriteLine(str6 + " - " + str7);
                        str1 = str4;
                        str1 = StringUtils.replaceAll(str1, ".", "");
                        str1 = StringUtils.replaceAll(str1, "-", "");
                        str1 = str1.Substring(0, 4);
                        str3 = str1;
                        GroupCode groupCode = addGroupCode1(str1, str7);
                        this.dprPhaseMap[str6] = groupCode;
                        paramSession.save(groupCode);
                    }
                    else if (!StringUtils.isNullOrBlank(str5))
                    {
                        Console.WriteLine(str6 + " - " + str7);
                        str2 = str5;
                        str2 = StringUtils.replaceAll(str2, ".", "");
                        str2 = StringUtils.replaceAll(str2, "-", "");
                        str1 = str2.Substring(0, 4);
                        str2 = str2.Substring(4, str2.Length - 4);
                        GroupCode groupCode = addGroupCode1(str3 + "." + str2, str7);
                        this.dprPhaseMap[str6] = groupCode;
                        long?long                  = (long?)paramSession.save(groupCode);
                        groupCodeTable             = (GroupCodeTable)groupCode;
                        groupCodeTable.GroupCodeId = long;
                    }
                    else
                    {
                        decimal bigDecimal1  = notNullBigDecimal(hSSFRow.getCell(4), 1.0D);
                        string  str8         = toCorrectUnit(notNull(hSSFRow.getCell(5)));
                        string  str9         = notNull(hSSFRow.getCell(6));
                        decimal bigDecimal2  = notNullBigDecimal(hSSFRow.getCell(7), 0.0D);
                        string  str10        = toCorrectUnit(notNull(hSSFRow.getCell(8)));
                        decimal bigDecimal3  = notNullBigDecimal(hSSFRow.getCell(9), 0.0D);
                        string  str11        = toCorrectUnit(notNull(hSSFRow.getCell(10)));
                        decimal bigDecimal4  = notNullBigDecimal(hSSFRow.getCell(11), 0.0D);
                        string  str12        = notNull(hSSFRow.getCell(12)).ToUpper();
                        decimal bigDecimal5  = notNullBigDecimal(hSSFRow.getCell(13), 0.0D);
                        string  str13        = toCorrectUnit(notNull(hSSFRow.getCell(14)));
                        decimal bigDecimal6  = notNullBigDecimal(hSSFRow.getCell(15), 0.0D);
                        decimal bigDecimal7  = notNullBigDecimal(hSSFRow.getCell(16), 1.0D);
                        string  str14        = toCorrectUnit(notNull(hSSFRow.getCell(17)));
                        decimal bigDecimal8  = notNullBigDecimal(hSSFRow.getCell(18), 1.0D);
                        string  str15        = toCorrectUnit(notNull(hSSFRow.getCell(19)));
                        decimal bigDecimal9  = notNullBigDecimal(hSSFRow.getCell(20), 0.0D);
                        string  str16        = toCorrectUnit(notNull(hSSFRow.getCell(21)));
                        decimal bigDecimal10 = notNullBigDecimal(hSSFRow.getCell(22), 0.0D);
                        decimal bigDecimal11 = notNullBigDecimal(hSSFRow.getCell(23), 0.0D);
                        string  str17        = toCorrectUnit(notNull(hSSFRow.getCell(24)));
                        decimal bigDecimal12 = notNullBigDecimal(hSSFRow.getCell(25), 0.0D);
                        string  str18        = toCorrectUnit(notNull(hSSFRow.getCell(26)));
                        decimal bigDecimal13 = notNullBigDecimal(hSSFRow.getCell(27), 0.0D);
                        string  str19        = toCorrectUnit(notNull(hSSFRow.getCell(28)));
                        decimal bigDecimal14 = notNullBigDecimal(hSSFRow.getCell(29), 0.0D);
                        string  str20        = toCorrectUnit(notNull(hSSFRow.getCell(30)));
                        decimal bigDecimal15 = notNullBigDecimal(hSSFRow.getCell(31), 0.0D);
                        decimal bigDecimal16 = notNullBigDecimal(hSSFRow.getCell(32), 1.0D);
                        string  str21        = toCorrectUnit(notNull(hSSFRow.getCell(33)));
                        decimal bigDecimal17 = notNullBigDecimal(hSSFRow.getCell(34), 0.0D);
                        string  str22        = toCorrectUnit(notNull(hSSFRow.getCell(35)));
                        decimal bigDecimal18 = notNullBigDecimal(hSSFRow.getCell(36), 1.0D);
                        string  str23        = toCorrectUnit(notNull(hSSFRow.getCell(37)));
                        decimal bigDecimal19 = notNullBigDecimal(hSSFRow.getCell(38), 0.0D);
                        string  str24        = toCorrectUnit(notNull(hSSFRow.getCell(39)));
                        decimal bigDecimal20 = notNullBigDecimal(hSSFRow.getCell(40), 0.0D);
                        decimal bigDecimal21 = notNullBigDecimal(hSSFRow.getCell(41), 0.0D);
                        string  str25        = toCorrectUnit(notNull(hSSFRow.getCell(42)));
                        decimal bigDecimal22 = notNullBigDecimal(hSSFRow.getCell(43), 0.0D);
                        string  str26        = toCorrectUnit(notNull(hSSFRow.getCell(44)));
                        decimal bigDecimal23 = notNullBigDecimal(hSSFRow.getCell(45), 0.0D);
                        string  str27        = toCorrectUnit(notNull(hSSFRow.getCell(46)));
                        decimal bigDecimal24 = notNullBigDecimal(hSSFRow.getCell(47), 0.0D);
                        string  str28        = toCorrectUnit(notNull(hSSFRow.getCell(48)));
                        decimal bigDecimal25 = notNullBigDecimal(hSSFRow.getCell(49), 0.0D);
                        decimal bigDecimal26 = notNullBigDecimal(hSSFRow.getCell(50), 0.0D);
                        string  str29        = toCorrectUnit(notNull(hSSFRow.getCell(51)));
                        decimal bigDecimal27 = notNullBigDecimal(hSSFRow.getCell(52), 0.0D);
                        Console.WriteLine(str6 + " - " + str7 + " " + str8 + " " + bigDecimal1 + " " + str9 + " " + bigDecimal27);
                        string        str30         = notNull(hSSFRow.getCell(53));
                        string        str31         = notNull(hSSFRow.getCell(54));
                        string        str32         = notNull(hSSFRow.getCell(55));
                        string        str33         = notNull(hSSFRow.getCell(56));
                        string        str34         = notNull(hSSFRow.getCell(57));
                        string        str35         = notNull(hSSFRow.getCell(58));
                        string        str36         = notNull(hSSFRow.getCell(59));
                        AssemblyTable assemblyTable = BlankResourceInitializer.createBlankAssembly(null);
                        assemblyTable.ItemCode = str6;
                        assemblyTable.PublishedRevisionCode = str6;
                        assemblyTable.Title        = str7;
                        assemblyTable.Unit         = str8;
                        assemblyTable.Currency     = "USD";
                        assemblyTable.Country      = "US";
                        assemblyTable.Quantity     = bigDecimal1;
                        assemblyTable.LastUpdate   = this.lastUpdate;
                        assemblyTable.Description  = "";
                        assemblyTable.LastUpdate   = this.lastUpdate;
                        assemblyTable.CreateDate   = this.lastUpdate;
                        assemblyTable.CreateUserId = "admin";
                        assemblyTable.EditorId     = "admin";
                        if (groupCodeTable != null)
                        {
                            assemblyTable.GroupCode = groupCodeTable.ToString();
                        }
                        assemblyTable.AssemblyEquipmentSet     = new HashSet <object>();
                        assemblyTable.AssemblySubcontractorSet = new HashSet <object>();
                        assemblyTable.AssemblyLaborSet         = new HashSet <object>();
                        assemblyTable.AssemblyMaterialSet      = new HashSet <object>();
                        assemblyTable.AssemblyConsumableSet    = new HashSet <object>();
                        long?long     = (long?)paramSession.save(assemblyTable.clone());
                        assemblyTable = (AssemblyTable)paramSession.load(typeof(AssemblyTable), long);
                        if (!StringUtils.isNullOrBlank(str9))
                        {
                            LaborTable laborTable = (LaborTable)this.laborCache[str9];
                            if (laborTable == null)
                            {
                                laborTable              = BlankResourceInitializer.createBlankLabor(null);
                                laborTable.Title        = str9;
                                laborTable.Unit         = "HOUR";
                                laborTable.Rate         = bigDecimal5;
                                laborTable.IKA          = BigDecimalMath.ZERO;
                                laborTable.Currency     = "USD";
                                laborTable.Country      = "US";
                                laborTable.LastUpdate   = this.lastUpdate;
                                laborTable.CreateDate   = this.lastUpdate;
                                laborTable.CreateUserId = "admin";
                                laborTable.EditorId     = "admin";
                                long                  = (long?)paramSession.save(laborTable.clone());
                                laborTable.Id         = long;
                                this.laborCache[str9] = laborTable;
                            }
                            else
                            {
                                laborTable = (LaborTable)paramSession.load(typeof(LaborTable), laborTable.Id);
                            }
                            if (BigDecimalMath.cmp(bigDecimal4, BigDecimalMath.ZERO) <= 0 && BigDecimalMath.cmp(bigDecimal2, BigDecimalMath.ZERO) > 0)
                            {
                                bigDecimal4 = BigDecimalMath.div(BigDecimalMath.ONE, bigDecimal2);
                            }
                            laborTable = (LaborTable)paramSession.load(typeof(LaborTable), laborTable.Id);
                            AssemblyLaborTable assemblyLaborTable = new AssemblyLaborTable();
                            assemblyLaborTable.Factor1                     = BigDecimalMath.ONE;
                            assemblyLaborTable.Factor2                     = BigDecimalMath.ONE;
                            assemblyLaborTable.Factor3                     = BigDecimalMath.ONE;
                            assemblyLaborTable.ExchangeRate                = BigDecimalMath.ONE;
                            assemblyLaborTable.QuantityPerUnit             = bigDecimal4;
                            assemblyLaborTable.QuantityPerUnitFormula      = "";
                            assemblyLaborTable.QuantityPerUnitFormulaState = ResourceToAssignmentTable.QTYPUFORM_NOFORMULA;
                            assemblyLaborTable.LocalFactor                 = BigDecimalMath.ONE;
                            assemblyLaborTable.LocalCountry                = "";
                            assemblyLaborTable.LocalStateProvince          = "";
                            assemblyLaborTable.LastUpdate                  = assemblyTable.LastUpdate;
                            long = (long?)paramSession.save(assemblyLaborTable);
                            assemblyLaborTable.AssemblyLaborId = long;
                            assemblyTable.AssemblyLaborSet.Add(assemblyLaborTable);
                            paramSession.saveOrUpdate(assemblyTable);
                            assemblyLaborTable.LaborTable    = laborTable;
                            assemblyLaborTable.AssemblyTable = assemblyTable;
                            paramSession.saveOrUpdate(assemblyLaborTable);
                        }
                        if (bigDecimal14 != null && BigDecimalMath.cmp(bigDecimal14, BigDecimalMath.ZERO) > 0)
                        {
                            if (bigDecimal11 != null && BigDecimalMath.cmp(bigDecimal11, BigDecimalMath.ZERO) > 0)
                            {
                                decimal bigDecimal = bigDecimal13;
                                if (BigDecimalMath.cmp(bigDecimal, BigDecimalMath.ZERO) <= 0 && BigDecimalMath.cmp(bigDecimal11, BigDecimalMath.ZERO) > 0)
                                {
                                    bigDecimal = BigDecimalMath.div(BigDecimalMath.ONE, bigDecimal11);
                                }
                                if (str8.Equals("DAY"))
                                {
                                    bigDecimal14 = BigDecimalMath.mult(bigDecimal14, BigDecimalMath.div(BigDecimalMath.ONE, HOURS_OF_DAY));
                                }
                                else if (str8.Equals("WEEK") || str8.Equals("WK"))
                                {
                                    bigDecimal14 = BigDecimalMath.mult(bigDecimal14, BigDecimalMath.div(BigDecimalMath.ONE, HOURS_OF_WEEK));
                                }
                                else if (str8.Equals("MONTH") || str8.Equals("MO"))
                                {
                                    bigDecimal14 = BigDecimalMath.mult(bigDecimal14, BigDecimalMath.div(BigDecimalMath.ONE, HOURS_OF_MONTH));
                                }
                                if (str20.Equals("WEEK"))
                                {
                                    bigDecimal = BigDecimalMath.mult(bigDecimal, HOURS_OF_WEEK);
                                }
                                else if (str20.Equals("MO") || str20.Equals("MONTH"))
                                {
                                    bigDecimal = BigDecimalMath.mult(bigDecimal, HOURS_OF_MONTH);
                                }
                                else if (str20.Equals("DAY"))
                                {
                                    bigDecimal = BigDecimalMath.mult(bigDecimal, HOURS_OF_DAY);
                                }
                                EquipmentTable equipmentTable = BlankResourceInitializer.createBlankEquipment(assemblyTable);
                                equipmentTable.Title           = assemblyTable.Title;
                                equipmentTable.Unit            = str20;
                                equipmentTable.ReservationRate = bigDecimal14;
                                equipmentTable.Currency        = "USD";
                                equipmentTable.EditorId        = "admin";
                                equipmentTable.Country         = "US";
                                equipmentTable.LastUpdate      = this.lastUpdate;
                                equipmentTable.CreateDate      = this.lastUpdate;
                                equipmentTable.CreateUserId    = "admin";
                                equipmentTable.EditorId        = "admin";
                                long = (long?)paramSession.save(equipmentTable.clone());
                                equipmentTable.Id = long;
                                equipmentTable    = (EquipmentTable)paramSession.load(typeof(EquipmentTable), long);
                                AssemblyEquipmentTable assemblyEquipmentTable = new AssemblyEquipmentTable();
                                assemblyEquipmentTable.Factor1                     = BigDecimalMath.ONE;
                                assemblyEquipmentTable.Factor2                     = BigDecimalMath.ONE;
                                assemblyEquipmentTable.Factor3                     = BigDecimalMath.ONE;
                                assemblyEquipmentTable.ExchangeRate                = BigDecimalMath.ONE;
                                assemblyEquipmentTable.QuantityPerUnit             = bigDecimal;
                                assemblyEquipmentTable.QuantityPerUnitFormula      = "";
                                assemblyEquipmentTable.QuantityPerUnitFormulaState = ResourceToAssignmentTable.QTYPUFORM_NOFORMULA;
                                assemblyEquipmentTable.LocalFactor                 = BigDecimalMath.ONE;
                                assemblyEquipmentTable.LocalCountry                = "";
                                assemblyEquipmentTable.LocalStateProvince          = "";
                                assemblyEquipmentTable.EnergyPrice                 = BigDecimalMath.ZERO;
                                assemblyEquipmentTable.FuelRate                    = BigDecimalMath.ZERO;
                                assemblyEquipmentTable.LastUpdate                  = assemblyTable.LastUpdate;
                                long = (long?)paramSession.save(assemblyEquipmentTable);
                                assemblyEquipmentTable.AssemblyEquipmentId = long;
                                assemblyTable.AssemblyEquipmentSet.Add(assemblyEquipmentTable);
                                paramSession.saveOrUpdate(assemblyTable);
                                assemblyEquipmentTable.EquipmentTable = equipmentTable;
                                assemblyEquipmentTable.AssemblyTable  = assemblyTable;
                                paramSession.saveOrUpdate(assemblyEquipmentTable);
                            }
                            else
                            {
                                createSubcontractor(paramSession, assemblyTable, "Equipment: " + assemblyTable.Title, bigDecimal14, str20, bigDecimal13);
                            }
                        }
                        if (bigDecimal9 != null && BigDecimalMath.cmp(bigDecimal9, BigDecimalMath.ZERO) > 0)
                        {
                            MaterialTable materialTable = BlankResourceInitializer.createBlankMaterial(assemblyTable);
                            materialTable.Title        = assemblyTable.Title;
                            materialTable.Unit         = str16;
                            materialTable.Rate         = bigDecimal9;
                            materialTable.Currency     = "USD";
                            materialTable.EditorId     = "admin";
                            materialTable.Country      = "US";
                            materialTable.LastUpdate   = this.lastUpdate;
                            materialTable.CreateDate   = this.lastUpdate;
                            materialTable.CreateUserId = "admin";
                            materialTable.EditorId     = "admin";
                            long             = (long?)paramSession.save(materialTable.clone());
                            materialTable.Id = long;
                            materialTable    = (MaterialTable)paramSession.load(typeof(MaterialTable), long);
                            AssemblyMaterialTable assemblyMaterialTable = new AssemblyMaterialTable();
                            assemblyMaterialTable.Factor1                     = BigDecimalMath.ONE;
                            assemblyMaterialTable.Factor2                     = BigDecimalMath.ONE;
                            assemblyMaterialTable.Factor3                     = BigDecimalMath.ONE;
                            assemblyMaterialTable.ExchangeRate                = BigDecimalMath.ONE;
                            assemblyMaterialTable.QuantityPerUnit             = bigDecimal8;
                            assemblyMaterialTable.QuantityPerUnitFormula      = "";
                            assemblyMaterialTable.QuantityPerUnitFormulaState = ResourceToAssignmentTable.QTYPUFORM_NOFORMULA;
                            assemblyMaterialTable.LocalFactor                 = BigDecimalMath.ONE;
                            assemblyMaterialTable.LocalCountry                = "";
                            assemblyMaterialTable.LocalStateProvince          = "";
                            assemblyMaterialTable.LastUpdate                  = assemblyTable.LastUpdate;
                            long = (long?)paramSession.save(assemblyMaterialTable);
                            assemblyMaterialTable.AssemblyMaterialId = long;
                            assemblyTable.AssemblyMaterialSet.Add(assemblyMaterialTable);
                            paramSession.saveOrUpdate(assemblyTable);
                            assemblyMaterialTable.MaterialTable = materialTable;
                            assemblyMaterialTable.AssemblyTable = assemblyTable;
                            paramSession.saveOrUpdate(assemblyMaterialTable);
                        }
                        if (bigDecimal24 != null && BigDecimalMath.cmp(bigDecimal24, BigDecimalMath.ZERO) > 0)
                        {
                            createSubcontractor(paramSession, assemblyTable, assemblyTable.Title, bigDecimal24, str28, bigDecimal23);
                        }
                        if (bigDecimal19 != null && BigDecimalMath.cmp(bigDecimal19, BigDecimalMath.ZERO) > 0)
                        {
                            ConsumableTable consumableTable = BlankResourceInitializer.createBlankConsumable(assemblyTable);
                            consumableTable.Title        = assemblyTable.Title;
                            consumableTable.Unit         = str24;
                            consumableTable.Rate         = bigDecimal19;
                            consumableTable.Currency     = "USD";
                            consumableTable.EditorId     = "admin";
                            consumableTable.Country      = "US";
                            consumableTable.LastUpdate   = this.lastUpdate;
                            consumableTable.CreateDate   = this.lastUpdate;
                            consumableTable.CreateUserId = "admin";
                            consumableTable.EditorId     = "admin";
                            long = (long?)paramSession.save(consumableTable.clone());
                            consumableTable.Id = long;
                            consumableTable    = (ConsumableTable)paramSession.load(typeof(ConsumableTable), long);
                            AssemblyConsumableTable assemblyConsumableTable = new AssemblyConsumableTable();
                            assemblyConsumableTable.Factor1                     = BigDecimalMath.ONE;
                            assemblyConsumableTable.Factor2                     = BigDecimalMath.ONE;
                            assemblyConsumableTable.Factor3                     = BigDecimalMath.ONE;
                            assemblyConsumableTable.ExchangeRate                = BigDecimalMath.ONE;
                            assemblyConsumableTable.QuantityPerUnit             = bigDecimal18;
                            assemblyConsumableTable.QuantityPerUnitFormula      = "";
                            assemblyConsumableTable.QuantityPerUnitFormulaState = ResourceToAssignmentTable.QTYPUFORM_NOFORMULA;
                            assemblyConsumableTable.LocalFactor                 = BigDecimalMath.ONE;
                            assemblyConsumableTable.LocalCountry                = "";
                            assemblyConsumableTable.LocalStateProvince          = "";
                            assemblyConsumableTable.LastUpdate                  = assemblyTable.LastUpdate;
                            long = (long?)paramSession.save(assemblyConsumableTable);
                            assemblyConsumableTable.AssemblyConsumableId = long;
                            assemblyTable.AssemblyConsumableSet.Add(assemblyConsumableTable);
                            paramSession.saveOrUpdate(assemblyTable);
                            assemblyConsumableTable.ConsumableTable = consumableTable;
                            assemblyConsumableTable.AssemblyTable   = assemblyTable;
                            paramSession.saveOrUpdate(assemblyConsumableTable);
                        }
                        if (DatabaseDBUtil.LocalCommunication)
                        {
                            assemblyTable.recalculate();
                            paramSession.saveOrUpdate(assemblyTable);
                        }
                    }
                }
            }
            if (hSSFWorkbook != null)
            {
                hSSFWorkbook.close();
            }
        }
Exemplo n.º 8
0
        public Subtotal(IXLRange range, bool summaryAbove, GroupTag[] groupTags = null, FormulaEvaluator evaluator = null)
        {
            _range        = range;
            _summaryAbove = summaryAbove;
            _groupTags    = groupTags;
            _evaluator    = evaluator;
            Sheet.Outline.SummaryVLocation = _summaryAbove ? XLOutlineSummaryVLocation.Top : XLOutlineSummaryVLocation.Bottom;
            var          workbook  = Sheet.Workbook;
            const string tempsheet = "__tempsheet";

            if (!workbook.Worksheets.TryGetWorksheet(tempsheet, out _tempSheet))
            {
                _tempSheet       = workbook.AddWorksheet(tempsheet);
                _tempSheet.Style = Sheet.Style;
                _tempSheet.Hide();
            }
        }
Exemplo n.º 9
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void loadCSI95(org.hibernate.Session paramSession, String paramString) throws Exception
        private void loadCSI95(Session paramSession, string paramString)
        {
            Console.WriteLine("\n\n\n\nLoading CSI 1995");
            POIFSFileSystem pOIFSFileSystem = new POIFSFileSystem(new FileStream(paramString, FileMode.Open, FileAccess.Read));
            HSSFWorkbook    hSSFWorkbook    = new HSSFWorkbook(pOIFSFileSystem);

            this.o_evaluator = hSSFWorkbook.CreationHelper.createFormulaEvaluator();
            HSSFSheet hSSFSheet = hSSFWorkbook.getSheetAt(0);
            int       i         = getRealNumberOfRows(hSSFSheet);

            for (int j = 1; j < i; j++)
            {
                string str4;
                string str3;
                string str2;
                if (j % this.rowsToCommit == 0)
                {
                    paramSession.Transaction.commit();
                    paramSession.Transaction.begin();
                    Console.WriteLine("Processing next " + this.rowsToCommit + "...");
                }
                HSSFRow hSSFRow = hSSFSheet.getRow(j);
                string  str1    = notNull(hSSFRow.getCell(1));
                if (StringUtils.isEmpty(str1))
                {
                    string str = notNull(hSSFRow.getCell(3));
                    int    k   = str.IndexOf(" -- ", StringComparison.Ordinal);
                    if (k == -1)
                    {
                        continue;
                    }
                    str2 = str.Substring(0, k);
                    str2 = StringUtils.replaceAll(str2, "Division ", "");
                    if (str2.Length == 1)
                    {
                        str2 = "0" + str2;
                    }
                    str3 = StringUtils.replaceAll(str, " -- ", " ");
                    str4 = str2 + "000";
                }
                else if (str1.Equals("00"))
                {
                    str2 = str4 = notNull(hSSFRow.getCell(2));
                    str3 = notNull(hSSFRow.getCell(4));
                    str2 = str4.Substring(0, 2) + "." + str4.Substring(2, 1);
                    str3 = StringUtils.replaceAll(str3, " - ", " ");
                }
                else
                {
                    str2 = str4 = notNull(hSSFRow.getCell(2));
                    str3 = notNull(hSSFRow.getCell(5));
                    string str = str2.Substring(2, 1);
                    str  = str + ".";
                    str2 = str4.Substring(0, 2) + "." + str + str4.Substring(3, 2);
                    str3 = StringUtils.replaceAll(str3, " - ", " ");
                }
                GroupCodeTable groupCodeTable = (GroupCodeTable)addGroupCode1(str2, str3, str4);
                long?long = (long?)paramSession.save(groupCodeTable);
                groupCodeTable.GroupCodeId = long;
                this.csi95Map[str4]        = groupCodeTable.ToString();
                Console.WriteLine(str2 + " = " + str4 + " = " + str3);
                continue;
            }
        }
Exemplo n.º 10
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void loadWorkgroups(org.hibernate.Session paramSession, String paramString) throws Exception
        private void loadWorkgroups(Session paramSession, string paramString)
        {
            Console.WriteLine("\n\n\n\nLoading Workgroups");
            POIFSFileSystem pOIFSFileSystem = new POIFSFileSystem(new FileStream(paramString, FileMode.Open, FileAccess.Read));
            HSSFWorkbook    hSSFWorkbook    = new HSSFWorkbook(pOIFSFileSystem);

            this.o_evaluator = hSSFWorkbook.CreationHelper.createFormulaEvaluator();
            HSSFSheet hSSFSheet = hSSFWorkbook.getSheetAt(4);
            int       i         = getRealNumberOfRows(hSSFSheet);
            int       j;

            for (j = 1; j < i; j++)
            {
                if (j % this.rowsToCommit == 0)
                {
                    paramSession.Transaction.commit();
                    paramSession.Transaction.begin();
                    Console.WriteLine("Processing next " + this.rowsToCommit + "...");
                }
                HSSFRow hSSFRow     = hSSFSheet.getRow(j);
                string  str1        = notNull(hSSFRow.getCell(0));
                string  str2        = notNull(hSSFRow.getCell(1));
                string  str3        = toCostOSUoM(notNull(hSSFRow.getCell(2)));
                decimal bigDecimal1 = notNullBigDecimal(hSSFRow.getCell(3), 0.0D);
                decimal bigDecimal2 = notNullBigDecimal(hSSFRow.getCell(4), 1.0D);
                string  str4        = notNull(hSSFRow.getCell(5));
                string  str5        = notNull(hSSFRow.getCell(8));
                string  str6        = "";
                if (str5.Length >= 2 && !StringUtils.isBlank(str5))
                {
                    str6 = "0" + str5.Substring(0, 2) + "00";
                }
                if (acceptProject(str1))
                {
                    AssemblyTable assemblyTable = BlankResourceInitializer.createBlankAssembly(null);
                    assemblyTable.ItemCode                 = str2;
                    assemblyTable.Title                    = str4;
                    assemblyTable.Unit                     = str3;
                    assemblyTable.Quantity                 = bigDecimal1;
                    assemblyTable.Project                  = str1;
                    assemblyTable.Currency                 = "USD";
                    assemblyTable.ActivityBased            = false;
                    assemblyTable.AssemblyChildSet         = new HashSet <object>();
                    assemblyTable.AssemblyEquipmentSet     = new HashSet <object>();
                    assemblyTable.AssemblySubcontractorSet = new HashSet <object>();
                    assemblyTable.AssemblyLaborSet         = new HashSet <object>();
                    assemblyTable.AssemblyMaterialSet      = new HashSet <object>();
                    assemblyTable.AssemblyConsumableSet    = new HashSet <object>();
                    assemblyTable.EditorId                 = "ccc";
                    assemblyTable.CreateUserId             = "ccc";
                    assemblyTable.LastUpdate               = this.lastUpdate;
                    assemblyTable.CreateDate               = this.lastUpdate;
                    assemblyTable.CustomText1              = "Workgroup";
                    if (this.csi95Map.ContainsKey(str6))
                    {
                        assemblyTable.GroupCode = (string)this.csi95Map[str6];
                    }
                    else if (!StringUtils.isBlank(str6))
                    {
                        Console.WriteLine("CSI Not Found: " + str6);
                    }
                    long?long     = (long?)paramSession.save(assemblyTable);
                    assemblyTable = (AssemblyTable)paramSession.load(assemblyTable.GetType(), long);
                    this.operationsMap[str1 + str2] = assemblyTable;
                }
            }
            hSSFSheet = hSSFWorkbook.getSheetAt(3);
            i         = getRealNumberOfRows(hSSFSheet);
            for (j = 1; j < i; j++)
            {
                if (j % this.rowsToCommit == 0)
                {
                    paramSession.Transaction.commit();
                    paramSession.Transaction.begin();
                    Console.WriteLine("Processing next " + this.rowsToCommit + " - " + j + "/" + i + "...");
                }
                HSSFRow       hSSFRow       = hSSFSheet.getRow(j);
                string        str1          = notNull(hSSFRow.getCell(0));
                string        str2          = notNull(hSSFRow.getCell(1));
                string        str3          = notNull(hSSFRow.getCell(2));
                string        str4          = notNull(hSSFRow.getCell(3));
                string        str5          = notNull(hSSFRow.getCell(4));
                decimal       bigDecimal    = notNullBigDecimal(hSSFRow.getCell(5), 0.0D);
                AssemblyTable assemblyTable = (AssemblyTable)this.operationsMap[str1 + str2];
                ResourceTable resourceTable = (ResourceTable)this.resourcesMap[str1 + str3];
                if (assemblyTable == null)
                {
                    Console.Error.WriteLine("Workgroup not found: " + str2 + ", project: " + str1);
                    continue;
                }
                if (resourceTable == null)
                {
                    resourceTable = (ResourceTable)this.operationsMap[str1 + str3];
                    if (resourceTable == null)
                    {
                        Console.Error.WriteLine("Operation or Resource not found: " + str3 + ", project: " + str1);
                        continue;
                    }
                }
                if (BigDecimalMath.cmp(BigDecimalMath.ZERO, assemblyTable.Quantity) == 0)
                {
                    Console.WriteLine("Divide by zero error on workgroup: " + str2 + ", operation or resource: " + str3 + ", project: " + str1);
                    bigDecimal = BigDecimalMath.ONE;
                }
                else
                {
                    bigDecimal = BigDecimalMath.div(bigDecimal, assemblyTable.Quantity);
                }
                assignToResource(paramSession, assemblyTable, resourceTable, bigDecimal);
                paramSession.flush();
                assemblyTable = (AssemblyTable)paramSession.load(assemblyTable.GetType(), assemblyTable.Id);
                assemblyTable.recalculate();
                paramSession.update(assemblyTable);
                continue;
            }
        }
Exemplo n.º 11
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void loadResources(org.hibernate.Session paramSession, String paramString) throws Exception
        private void loadResources(Session paramSession, string paramString)
        {
            Console.WriteLine("\n\n\n\nLoading RESOURSES");
            POIFSFileSystem pOIFSFileSystem = new POIFSFileSystem(new FileStream(paramString, FileMode.Open, FileAccess.Read));
            HSSFWorkbook    hSSFWorkbook    = new HSSFWorkbook(pOIFSFileSystem);

            this.o_evaluator = hSSFWorkbook.CreationHelper.createFormulaEvaluator();
            HSSFSheet hSSFSheet = hSSFWorkbook.getSheetAt(0);
            int       i         = getRealNumberOfRows(hSSFSheet);

            for (int j = 1; j < i; j++)
            {
                if (j % this.rowsToCommit == 0)
                {
                    paramSession.Transaction.commit();
                    paramSession.Transaction.begin();
                    Console.WriteLine("Processing next " + this.rowsToCommit + "...");
                }
                HSSFRow hSSFRow     = hSSFSheet.getRow(j);
                string  str1        = notNull(hSSFRow.getCell(0));
                string  str2        = notNull(hSSFRow.getCell(1));
                string  str3        = notNull(hSSFRow.getCell(2));
                string  str4        = toCostOSUoM(notNull(hSSFRow.getCell(3)));
                decimal bigDecimal1 = notNullBigDecimal(hSSFRow.getCell(4), 0.0D);
                string  str5        = notNull(hSSFRow.getCell(7));
                decimal bigDecimal2 = notNullBigDecimal(hSSFRow.getCell(17), 0.0D);
                string  str6        = notNull(hSSFRow.getCell(14));
                string  str7        = "";
                if (str6.Length >= 2 && !StringUtils.isBlank(str6))
                {
                    str7 = "0" + str6.Substring(0, 2) + "00";
                }
                if (acceptProject(str1) && !str4.Equals(""))
                {
                    SubcontractorTable subcontractorTable = null;
                    if (str5.Equals("F&O"))
                    {
                        subcontractorTable = BlankResourceInitializer.createBlankEquipment(null);
                        ((EquipmentTable)subcontractorTable).Currency = "USD";
                        ((EquipmentTable)subcontractorTable).FuelRate = bigDecimal1;
                    }
                    else if (str5.Equals("LAB") && str4.Equals("HOUR"))
                    {
                        LaborTable laborTable = BlankResourceInitializer.createBlankLabor(null);
                        ((LaborTable)laborTable).Currency = "USD";
                        ((LaborTable)laborTable).Rate     = bigDecimal1;
                    }
                    else if (str5.Equals("STF") && str4.Equals("DAY"))
                    {
                        LaborTable laborTable = BlankResourceInitializer.createBlankLabor(null);
                        ((LaborTable)laborTable).Currency = "USD";
                        ((LaborTable)laborTable).Rate     = bigDecimal1;
                    }
                    else if (str5.Equals("STF") && str4.Equals("MONTH"))
                    {
                        LaborTable laborTable = BlankResourceInitializer.createBlankLabor(null);
                        ((LaborTable)laborTable).Currency = "USD";
                        ((LaborTable)laborTable).Rate     = bigDecimal1;
                    }
                    else if (str5.Equals("GEN") || str5.Equals("REC"))
                    {
                        ConsumableTable consumableTable = BlankResourceInitializer.createBlankConsumable(null);
                        ((ConsumableTable)consumableTable).Currency = "USD";
                        ((ConsumableTable)consumableTable).Rate     = bigDecimal1;
                    }
                    else if (str5.Equals("LOC") || str5.Equals("IMP"))
                    {
                        MaterialTable materialTable = BlankResourceInitializer.createBlankMaterial(null);
                        ((MaterialTable)materialTable).Currency = "USD";
                        ((MaterialTable)materialTable).Rate     = bigDecimal1;
                    }
                    else if (str5.Equals("S/C"))
                    {
                        SubcontractorTable subcontractorTable1 = BlankResourceInitializer.createBlankSubcontractor(null);
                        ((SubcontractorTable)subcontractorTable1).Currency = "USD";
                        ((SubcontractorTable)subcontractorTable1).Rate     = bigDecimal1;
                    }
                    else if (str5.Equals("PLA"))
                    {
                        subcontractorTable = BlankResourceInitializer.createBlankEquipment(null);
                        ((EquipmentTable)subcontractorTable).Currency        = "USD";
                        ((EquipmentTable)subcontractorTable).ReservationRate = bigDecimal1;
                    }
                    else
                    {
                        subcontractorTable = BlankResourceInitializer.createBlankSubcontractor(null);
                        ((SubcontractorTable)subcontractorTable).Currency = "USD";
                        ((SubcontractorTable)subcontractorTable).Rate     = bigDecimal1;
                    }
                    subcontractorTable.ItemCode = str2;
                    subcontractorTable.Title    = str3;
                    subcontractorTable.Project  = str1;
                    subcontractorTable.Quantity = bigDecimal2;
                    subcontractorTable.Unit     = str4;
                    subcontractorTable.GekCode  = str5 + " - " + str5;
                    if (this.csi95Map.ContainsKey(str7))
                    {
                        subcontractorTable.GroupCode = (string)this.csi95Map[str7];
                    }
                    else if (!StringUtils.isBlank(str7))
                    {
                        Console.WriteLine("CSI Not Found: " + str7);
                    }
                    subcontractorTable.LastUpdate   = this.lastUpdate;
                    subcontractorTable.CreateDate   = this.lastUpdate;
                    subcontractorTable.EditorId     = "ccc";
                    subcontractorTable.CreateUserId = "ccc";
                    long?long = (long?)paramSession.save(subcontractorTable);
                    ResourceTable resourceTable = (ResourceTable)paramSession.load(subcontractorTable.GetType(), long);
                    this.resourcesMap[str1 + str2] = resourceTable;
                }
            }
        }
Exemplo n.º 12
0
 public void Part2()
 {
     Assert.Equal(9966990988262, StringListRetriever.Retreive("InputList18.txt").Select(x => FormulaEvaluator.EvaluateAdvanced(x)).Sum());
 }
Exemplo n.º 13
0
 public void Part1()
 {
     Assert.Equal(280014646144, StringListRetriever.Retreive("InputList18.txt").Select(x => FormulaEvaluator.Evaluate(x)).Sum());
 }
Exemplo n.º 14
0
        public void Part1Sample()
        {
            List <string> formulas = GetPart1SampleData();

            Assert.Equal(71, FormulaEvaluator.Evaluate(formulas[0]));
            Assert.Equal(51, FormulaEvaluator.Evaluate(formulas[1]));
            Assert.Equal(26, FormulaEvaluator.Evaluate(formulas[2]));
            Assert.Equal(437, FormulaEvaluator.Evaluate(formulas[3]));
            Assert.Equal(12240, FormulaEvaluator.Evaluate(formulas[4]));
            Assert.Equal(13632, FormulaEvaluator.Evaluate(formulas[5]));
            Assert.Equal(71 + 51 + 26 + 437 + 12240 + 13632, GetPart1SampleData().Select(x => FormulaEvaluator.Evaluate(x)).Sum());
            Assert.Equal(72077, FormulaEvaluator.Evaluate("9 + 2 * ((7 + 9 + 5 + 7) * 3 + (5 * 3 * 6 * 5 + 6) + (9 * 4 + 9 * 6 + 9)) * 8 + 5"));
        }
        public void WrongExpressionShouldThrowParseException()
        {
            var eval = new FormulaEvaluator();

            Assert.Throws <ParseException>(() => eval.Evaluate("{{missing}}"));
        }