示例#1
0
        public virtual SupplierTable convertToSupplierTable(ProjectDBProperties prop)
        {
            SupplierTable obj = BlankResourceInitializer.createBlankSupplier(null);

            obj.DatabaseId = SupplierDatabaseId;
            if (DatabaseCreationDate == null)
            {
                obj.DatabaseCreationDate = 100L;                 //ResourceUtil.MISSING_DB_CREATE_DATE);
            }
            else
            {
                obj.DatabaseCreationDate = DatabaseCreationDate;
            }
            obj.Address       = quotationTable.Address;
            obj.Title         = quotationTable.CompanyName;
            obj.ContactPerson = quotationTable.ContactPerson;
            obj.GroupCode     = boqItemTable.GroupCode;
            obj.GekCode       = boqItemTable.GekCode;
            obj.Description   = boqItemTable.Description;
            obj.Notes         = boqItemTable.Notes;
            obj.EditorId      = DatabaseDBUtil.Properties.UserId;
            obj.PhoneNumber   = quotationTable.PhoneNumber;
            obj.MobileNumber  = quotationTable.MobileNumber;
            obj.Email         = quotationTable.Email;
            obj.Url           = quotationTable.Url;
            obj.Country       = quotationTable.Country;
            obj.City          = quotationTable.City;
            obj.StateProvince = quotationTable.StateProvince;
            obj.GeoLocation   = quotationTable.GeoLocation;
            obj.FaxNumber     = quotationTable.FaxNumber;
            obj.Performance   = "" + quotationTable.Performance;
            obj.ExtraCode1    = boqItemTable.ExtraCode1;
            obj.ExtraCode2    = boqItemTable.ExtraCode2;
            obj.ExtraCode3    = boqItemTable.ExtraCode3;
            obj.ExtraCode4    = boqItemTable.ExtraCode4;
            obj.ExtraCode5    = boqItemTable.ExtraCode5;
            obj.ExtraCode6    = boqItemTable.ExtraCode6;
            obj.ExtraCode7    = boqItemTable.ExtraCode7;
            obj.ExtraCode8    = boqItemTable.ExtraCode8;
            obj.ExtraCode9    = boqItemTable.ExtraCode9;
            obj.ExtraCode10   = boqItemTable.ExtraCode10;
            obj.CreateUserId  = quotationTable.EditorId;
            if (quotationTable.ReceivedDate != null)
            {
                obj.LastUpdate = quotationTable.ReceivedDate;
                obj.CreateDate = quotationTable.ReceivedDate;
            }
            else
            {
                obj.LastUpdate = DateTime.Now;
                obj.CreateDate = obj.LastUpdate;
            }
            obj.recalculate();

            return(obj);
        }
        public virtual void mergeToOne(Session paramSession, IList <ParamItemTable> paramList, string paramString)
        {
            this.o_descToAccessRightsMap = new Hashtable();
            System.Collections.IList list1           = createInputList(paramSession, paramList);
            System.Collections.IList list2           = createOutputList(paramSession, paramList);
            ParamItemTable           paramItemTable1 = (ParamItemTable)paramList[0];
            ParamItemTable           paramItemTable2 = BlankResourceInitializer.createBlankParamItem(paramItemTable1);

            if (!StringUtils.isNullOrBlank(this.o_rootNode.UserObject.ToString()))
            {
                paramItemTable2.Title = StringUtils.makeShortTitle(this.o_rootNode.UserObject.ToString());
            }
            else
            {
                if (paramString.IndexOf(" - ", StringComparison.Ordinal) != -1)
                {
                    paramString = paramString.Substring(paramString.IndexOf(" -", StringComparison.Ordinal) + 2);
                }
                paramItemTable2.Title = paramString.ToUpper();
            }
            paramItemTable2.Description  = this.o_rootNode.UserObject.ToString();
            paramItemTable2.SampleRate   = BigDecimalMath.ZERO;
            paramItemTable2.CostModel    = true;
            paramItemTable2.EditorId     = paramItemTable1.EditorId;
            paramItemTable2.AccessRights = "ALL,NODOC";
            paramItemTable2.Keywords     = paramItemTable1.Keywords;
            paramItemTable2.Notes        = "ALL,NODOC";
            paramItemTable2.LastUpdate   = paramItemTable1.LastUpdate;
            paramItemTable2.CreateDate   = paramItemTable1.LastUpdate;
            paramItemTable2.CreateUserId = paramItemTable1.CreateUserId;
            paramItemTable2.InputSet     = new HashSet <object>();
            paramItemTable2.OutputSet    = new HashSet <object>();
            long?long = (long?)paramSession.save(paramItemTable2);

            paramItemTable2 = (ParamItemTable)paramSession.load(typeof(ParamItemTable), long);
            foreach (ParamItemInputTable paramItemInputTable in list1)
            {
                long = (long?)paramSession.save(paramItemInputTable);
                paramItemInputTable = (ParamItemInputTable)paramSession.load(typeof(ParamItemInputTable), long);
                paramItemTable2.InputSet.Add(paramItemInputTable);
                paramItemInputTable.ParamItemTable = paramItemTable2;
                paramSession.update(paramItemInputTable);
            }
            foreach (ParamItemOutputTable paramItemOutputTable in list2)
            {
                long = (long?)paramSession.save(paramItemOutputTable);
                paramItemOutputTable = (ParamItemOutputTable)paramSession.load(typeof(ParamItemOutputTable), long);
                paramItemTable2.OutputSet.Add(paramItemOutputTable);
                paramItemOutputTable.ParamItemTable = paramItemTable2;
                paramSession.update(paramItemOutputTable);
            }
        }
            public virtual void valueChanged(Range param1Range, Expr param1Expr)
            {
                string str = BoqItemFormulaEvaluator.fieldFromVariable(param1Range.Dimension1Name);

                if (!string.ReferenceEquals(str, null) && formulaFields.Contains(str + "Formula"))
                {
                    try
                    {
                        object @object = valueFromExpression(param1Expr);
                        if (@object is decimal)
                        {
                            @object = ((decimal)@object).setScale(10, 4);
                        }
                        BlankResourceInitializer.setFieldValue(outerInstance.boqTable, str, @object);
                    }
                    catch (Exception exception)
                    {
                        Console.WriteLine("CAN NOT EVALUATE: " + str + " = " + param1Expr + " = " + valueFromExpression(param1Expr));
                        Console.WriteLine(exception.ToString());
                        Console.Write(exception.StackTrace);
                    }
                }
                else
                {
                    ResourceToAssignmentTable resourceToAssignmentTable = (ResourceToAssignmentTable)outerInstance.assignmentsWithFormulasMap[param1Range.Dimension1Name];
                    if (resourceToAssignmentTable != null)
                    {
                        decimal bigDecimal = resourceToAssignmentTable.QuantityPerUnit.setScale(10, 4);
                        object  @object    = valueFromExpression(param1Expr);
                        if (@object is decimal)
                        {
                            decimal bigDecimal1 = (decimal)@object;
                            if (resourceToAssignmentTable.AssignmentResourceTable is nomitech.common.db.local.LaborTable || resourceToAssignmentTable.AssignmentResourceTable is nomitech.common.db.local.EquipmentTable)
                            {
                                bigDecimal1 = bigDecimal1 * (ProjectDBUtil.currentProjectDBUtil().Properties.getHoursFromUnit(resourceToAssignmentTable.AssignmentResourceTable.Unit));
                            }
                            bigDecimal1.setScale(10, 4);
                            if (BigDecimalMath.cmpCheckNulls(bigDecimal, bigDecimal1) != 0)
                            {
                                resourceToAssignmentTable.QuantityPerUnit = bigDecimal1;
                                outerInstance.updatedResourceToAssignmentQtyPerUnitSet.Add(resourceToAssignmentTable);
                                outerInstance.someAssignemntFormulaValueChanged = true;
                            }
                        }
                    }
                }
            }
        private void createSubcontractor(Session paramSession, AssemblyTable paramAssemblyTable, string paramString1, decimal paramBigDecimal1, string paramString2, decimal paramBigDecimal2)
        {
            SubcontractorTable subcontractorTable = BlankResourceInitializer.createBlankSubcontractor(paramAssemblyTable);

            subcontractorTable.Title        = paramString1;
            subcontractorTable.Unit         = paramString2;
            subcontractorTable.Rate         = paramBigDecimal1;
            subcontractorTable.Currency     = "USD";
            subcontractorTable.EditorId     = "admin";
            subcontractorTable.Country      = "US";
            subcontractorTable.LastUpdate   = this.lastUpdate;
            subcontractorTable.CreateDate   = this.lastUpdate;
            subcontractorTable.CreateUserId = "admin";
            subcontractorTable.EditorId     = "admin";
            long?long = (long?)paramSession.save(subcontractorTable.clone());

            subcontractorTable.Id = long;
            subcontractorTable    = (SubcontractorTable)paramSession.load(typeof(SubcontractorTable), long);
            AssemblySubcontractorTable assemblySubcontractorTable = new AssemblySubcontractorTable();

            assemblySubcontractorTable.Factor1                     = BigDecimalMath.ONE;
            assemblySubcontractorTable.Factor2                     = BigDecimalMath.ONE;
            assemblySubcontractorTable.Factor3                     = BigDecimalMath.ONE;
            assemblySubcontractorTable.ExchangeRate                = BigDecimalMath.ONE;
            assemblySubcontractorTable.QuantityPerUnit             = paramBigDecimal2;
            assemblySubcontractorTable.QuantityPerUnitFormula      = "";
            assemblySubcontractorTable.QuantityPerUnitFormulaState = ResourceToAssignmentTable.QTYPUFORM_NOFORMULA;
            assemblySubcontractorTable.LocalFactor                 = BigDecimalMath.ONE;
            assemblySubcontractorTable.LocalCountry                = "";
            assemblySubcontractorTable.LocalStateProvince          = "";
            assemblySubcontractorTable.LastUpdate                  = paramAssemblyTable.LastUpdate;
            long = (long?)paramSession.save(assemblySubcontractorTable);
            assemblySubcontractorTable.AssemblySubcontractorId = long;
            paramAssemblyTable.AssemblySubcontractorSet.Add(assemblySubcontractorTable);
            paramSession.saveOrUpdate(paramAssemblyTable);
            assemblySubcontractorTable.SubcontractorTable = subcontractorTable;
            assemblySubcontractorTable.AssemblyTable      = paramAssemblyTable;
            paramSession.saveOrUpdate(assemblySubcontractorTable);
        }
示例#5
0
        public virtual SubcontractorTable convertToSubcontractorTable(ProjectDBProperties prop)
        {
            SubcontractorTable obj = BlankResourceInitializer.createBlankSubcontractor(null);

            BoqItemTable   boqItemTable   = BoqItemTable;
            QuotationTable quotationTable = QuotationTable;

            if (Title.IndexOf(boqItemTable.Title, StringComparison.Ordinal) != -1 && Title.IndexOf(boqItemTable.Description, StringComparison.Ordinal) != -1)
            {
                obj.Title = StringUtils.makeShortTitle(boqItemTable.Title);
            }
            else
            {
                obj.Title = StringUtils.makeShortTitle(Title);
            }

            obj.DatabaseId = DatabaseId;
            if (DatabaseCreationDate == null)
            {
                obj.DatabaseCreationDate = 100L;                 //ResourceUtil.MISSING_DB_CREATE_DATE);
            }
            else
            {
                obj.DatabaseCreationDate = DatabaseCreationDate;
            }
            obj.Address       = quotationTable.Address;
            obj.ContactPerson = quotationTable.ContactPerson;
            obj.GroupCode     = boqItemTable.GroupCode;
            obj.GekCode       = boqItemTable.GekCode;
            obj.Performance   = "" + quotationTable.Performance;
            obj.Project       = prop.getProperty("project.code") + " - " + prop.getProperty("project.name");
            obj.Description   = boqItemTable.Description;
            obj.Notes         = boqItemTable.Notes;

            obj.EditorId        = DatabaseDBUtil.Properties.UserId;
            obj.PhoneNumber     = quotationTable.PhoneNumber;
            obj.MobileNumber    = quotationTable.MobileNumber;
            obj.Email           = quotationTable.Email;
            obj.Country         = quotationTable.Country;
            obj.City            = quotationTable.City;
            obj.StateProvince   = quotationTable.StateProvince;
            obj.SubMaterialRate = MaterialRate;
            obj.Rate            = RateWithIndirect;
            obj.SubMaterialRate = MaterialRate;
            obj.IKA             = Insurance;
            obj.Quantity        = Quantity;
            obj.TotalRate       = calculateFinalRate();
            obj.Unit            = Unit;
            obj.Url             = quotationTable.Url;
            obj.Company         = quotationTable.CompanyName;
            obj.FaxNumber       = quotationTable.FaxNumber;
            obj.Currency        = quotationTable.Currency;
            obj.Accuracy        = SubcontractorTable.QUOTED_ACCURACY;

            if (quotationTable.HasMaterialRate.Value)
            {
                obj.Inclusion = SubcontractorTable.MATERIAL_AND_SHIPMENT_INCLUSION;
            }
            else
            {
                obj.Inclusion = SubcontractorTable.NONE_INCLUSION;
            }

            obj.CreateUserId = quotationTable.EditorId;
            if (quotationTable.ReceivedDate != null)
            {
                obj.LastUpdate = quotationTable.ReceivedDate;
                obj.CreateDate = quotationTable.ReceivedDate;
            }
            else
            {
                obj.LastUpdate = DateTime.Now;
                obj.CreateDate = obj.LastUpdate;
            }

            obj.ExtraCode1  = boqItemTable.ExtraCode1;
            obj.ExtraCode2  = boqItemTable.ExtraCode2;
            obj.ExtraCode3  = boqItemTable.ExtraCode3;
            obj.ExtraCode4  = boqItemTable.ExtraCode4;
            obj.ExtraCode5  = boqItemTable.ExtraCode5;
            obj.ExtraCode6  = boqItemTable.ExtraCode6;
            obj.ExtraCode7  = boqItemTable.ExtraCode7;
            obj.ExtraCode8  = boqItemTable.ExtraCode8;
            obj.ExtraCode9  = boqItemTable.ExtraCode9;
            obj.ExtraCode10 = boqItemTable.ExtraCode10;
            obj.recalculate();

            return(obj);
        }
示例#6
0
        public virtual MaterialTable convertToMaterialTable(ProjectDBProperties prop)
        {
            MaterialTable  obj            = BlankResourceInitializer.createBlankMaterial(null);
            BoqItemTable   boqItemTable   = BoqItemTable;
            QuotationTable quotationTable = QuotationTable;

            double[] projectGeoPosition  = StringUtils.extractDoubles(prop.getProperty("project.geolocation"));
            double[] supplierGeoPosition = StringUtils.extractDoubles(quotationTable.GeoLocation);
            double   distanceKm          = HaversineDistanceUtil.distance(HaversineDistanceUtil.KM_DISTANCE, projectGeoPosition, supplierGeoPosition);

            if (Title.IndexOf(boqItemTable.Title, StringComparison.Ordinal) != -1 && Title.IndexOf(boqItemTable.Description, StringComparison.Ordinal) != -1)
            {
                obj.Title = StringUtils.makeShortTitle(boqItemTable.Title);
            }
            else
            {
                obj.Title = StringUtils.makeShortTitle(Title);
            }
            obj.DatabaseId = DatabaseId;
            if (DatabaseCreationDate == null)
            {
                obj.DatabaseCreationDate = 100L;                 //ResourceUtil.MISSING_DB_CREATE_DATE);
            }
            else
            {
                obj.DatabaseCreationDate = DatabaseCreationDate;
            }
            obj.Weight        = BigDecimalMath.ZERO;
            obj.WeightUnit    = "KG";
            obj.GroupCode     = boqItemTable.GroupCode;
            obj.GekCode       = boqItemTable.GekCode;
            obj.Project       = prop.getProperty("project.code") + " - " + prop.getProperty("project.name");
            obj.Description   = boqItemTable.Description;
            obj.Notes         = boqItemTable.Notes;
            obj.EditorId      = DatabaseDBUtil.Properties.UserId;
            obj.Country       = quotationTable.Country;
            obj.StateProvince = quotationTable.StateProvince;
            obj.Rate          = Rate;

            obj.DistanceToSite = new BigDecimalFixed("" + distanceKm);
            obj.DistanceUnit   = "KM";

            obj.RawMaterial         = MaterialTable.UNSPECIFIED_RAWMAT;
            obj.RawMaterialReliance = BigDecimalMath.ZERO;

            obj.CreateUserId = quotationTable.EditorId;
            if (quotationTable.ReceivedDate != null)
            {
                obj.LastUpdate = quotationTable.ReceivedDate;
                obj.CreateDate = quotationTable.ReceivedDate;
            }
            else
            {
                obj.LastUpdate = DateTime.Now;
                obj.CreateDate = obj.LastUpdate;
            }

            if (quotationTable.OnSiteDelivery.Value)
            {
                if (ShipmentCost != null)
                {
                    decimal indirectRate = BigDecimalMath.ZERO;

                    if (IndirectCost != null)
                    {
                        decimal qty = Quantity;
                        if (BigDecimalMath.cmpCheckNulls(qty, BigDecimalMath.ZERO) == 0)
                        {
                            qty = BigDecimalMath.ONE;
                        }

                        obj.ShipmentRate = BigDecimalMath.div(shipmentCost, qty);
                    }

                    //				double qty = getQuantity().doubleValue();
                    //				if ( qty == 0 )
                    //					qty = 1;
                    //				double srate = shipmentCost.doubleValue()/getQuantity().doubleValue();
                    //				obj.setShipmentRate(new BigDecimalFixed(""+srate));
                }
                else
                {
                    obj.ShipmentRate = BigDecimalMath.ZERO;
                }

                obj.Inclusion = MaterialTable.SHIPMENT_INCLUSION;
            }
            else
            {
                obj.Inclusion    = MaterialTable.NONE_INCLUSION;
                obj.ShipmentRate = BigDecimalMath.ZERO;
            }

            obj.FabricationRate = BigDecimalMath.ZERO;
            obj.TotalRate       = obj.Rate + obj.ShipmentRate;
            obj.Quantity        = Quantity;
            obj.Unit            = Unit;
            obj.Currency        = quotationTable.Currency;
            obj.Accuracy        = MaterialTable.QUOTED_ACCURACY;

            obj.ExtraCode1  = boqItemTable.ExtraCode1;
            obj.ExtraCode2  = boqItemTable.ExtraCode2;
            obj.ExtraCode3  = boqItemTable.ExtraCode3;
            obj.ExtraCode4  = boqItemTable.ExtraCode4;
            obj.ExtraCode5  = boqItemTable.ExtraCode5;
            obj.ExtraCode6  = boqItemTable.ExtraCode6;
            obj.ExtraCode7  = boqItemTable.ExtraCode7;
            obj.ExtraCode8  = boqItemTable.ExtraCode8;
            obj.ExtraCode9  = boqItemTable.ExtraCode9;
            obj.ExtraCode10 = boqItemTable.ExtraCode10;

            boqItemTable.loadBimMaterialsAndTypes();

            obj.BimMaterial = boqItemTable.BimMaterial;
            obj.BimType     = boqItemTable.BimType;
            obj.recalculate();

            return(obj);
        }
        public virtual BoqItemTable convertToBoqItem(DateTime projectStartDate, long?code, ProjectDBUtil currentDBUtil, bool online, bool useProductivity, bool replaceQuantity)
        {
            BoqItemTable boqTable = BlankResourceInitializer.createBlankBoqItem(this, code, projectStartDate, useProductivity);

            Timestamp updateTime = new Timestamp(DateTimeHelper.CurrentUnixTimeMillis());

            //if ( useProductivity ) {
            //	boqTable.setCalculationType(BoqItemTable.s_PRODUCTIVITY_METHOD);
            //}
            //else {
            //	boqTable.setCalculationType(BoqItemTable.s_TOTAL_UNITS_METHOD);
            //}
            //boqTable.setProductivity(BigDecimalMath.ONE);
            //boqTable.setQuantity(BigDecimalMath.ONE);
            //boqTable.setDuration(BigDecimalMath.ONE);

            boqTable.LastUpdate = updateTime;
            boqTable.CreateDate = updateTime;

            boqTable.BoqItemAssemblySet      = new HashSet <object>();
            boqTable.BoqItemEquipmentSet     = new HashSet <object>();
            boqTable.BoqItemSubcontractorSet = new HashSet <object>();
            boqTable.BoqItemLaborSet         = new HashSet <object>();
            boqTable.BoqItemMaterialSet      = new HashSet <object>();
            boqTable.BoqItemConsumableSet    = new HashSet <object>();
            boqTable.BoqItemConditionSet     = new HashSet <object>();

            ConditionTable        conditionTable    = (ConditionTable)convertToConditionTable();
            BoqItemConditionTable boqConditionTable = new BoqItemConditionTable();

            boqConditionTable.Factor1         = BigDecimalMath.ONE;
            boqConditionTable.Factor2         = BigDecimalMath.ONE;
            boqConditionTable.QuantityPerUnit = BigDecimalMath.ONE;
            boqConditionTable.Sumup           = BigDecimalMath.ZERO;

            if (replaceQuantity)
            {
                if (conditionTable.DefaultQuantity == null || conditionTable.DefaultQuantity == 0 || conditionTable.DefaultQuantity == 1)
                {
                    boqTable.Quantity = conditionTable.Quantity1;
                }
                else if (conditionTable.DefaultQuantity == 2)
                {
                    boqTable.Quantity = conditionTable.Quantity2;
                }
                else if (conditionTable.DefaultQuantity == 3)
                {
                    boqTable.Quantity = conditionTable.Quantity3;
                }
                else if (conditionTable.DefaultQuantity == 4)
                {
                    boqTable.Quantity = conditionTable.QuantityF;
                }
            }
            if (conditionTable.DefaultQuantity == null || conditionTable.DefaultQuantity == 0 || conditionTable.DefaultQuantity == 1)
            {
                boqConditionTable.SelectedUnit = BoqItemConditionTable.SELECTED_UNIT1;
                boqTable.Quantity         = conditionTable.Quantity1;
                boqTable.MeasuredQuantity = conditionTable.Quantity1;
                //boqTable.setEstimatedQuantity(conditionTable.getQuantity1());
                boqTable.Unit       = conditionTable.Unit1;
                boqTable.SecondUnit = Unit1ToUnit2Util.Instance.getUnit2(conditionTable.Unit1);
                boqTable.UnitsDiv   = Unit1ToUnit2Util.Instance.getUnitDiv(conditionTable.Unit1);
            }
            else if (conditionTable.DefaultQuantity == 2)
            {
                boqConditionTable.SelectedUnit = BoqItemConditionTable.SELECTED_UNIT2;
                boqTable.Quantity         = conditionTable.Quantity2;
                boqTable.MeasuredQuantity = conditionTable.Quantity2;
                //boqTable.setEstimatedQuantity(conditionTable.getQuantity2());
                boqTable.Unit       = conditionTable.Unit2;
                boqTable.SecondUnit = Unit1ToUnit2Util.Instance.getUnit2(conditionTable.Unit2);
                boqTable.UnitsDiv   = Unit1ToUnit2Util.Instance.getUnitDiv(conditionTable.Unit2);
            }
            else if (conditionTable.DefaultQuantity == 3)
            {
                boqConditionTable.SelectedUnit = BoqItemConditionTable.SELECTED_UNIT3;
                boqTable.Quantity = conditionTable.Quantity3;
                //boqTable.setEstimatedQuantity(conditionTable.getQuantity3());
                boqTable.MeasuredQuantity = conditionTable.Quantity3;
                boqTable.Unit             = conditionTable.Unit3;
                boqTable.SecondUnit       = Unit1ToUnit2Util.Instance.getUnit2(conditionTable.Unit3);
                boqTable.UnitsDiv         = Unit1ToUnit2Util.Instance.getUnitDiv(conditionTable.Unit3);
            }
            else if (conditionTable.DefaultQuantity == 4)
            {
                boqConditionTable.SelectedUnit = BoqItemConditionTable.SELECTED_UNITF;
                boqTable.Quantity = conditionTable.QuantityF;
                //boqTable.setEstimatedQuantity(conditionTable.getQuantity3());
                boqTable.MeasuredQuantity = conditionTable.QuantityF;
                boqTable.Unit             = conditionTable.UnitF;
                boqTable.SecondUnit       = Unit1ToUnit2Util.Instance.getUnit2(conditionTable.UnitF);
                boqTable.UnitsDiv         = Unit1ToUnit2Util.Instance.getUnitDiv(conditionTable.UnitF);
            }

            boqConditionTable.LastUpdate = updateTime;

            boqConditionTable.ConditionTable = conditionTable;
            boqConditionTable.BoqItemTable   = boqTable;

            boqTable.BoqItemConditionSet.Add(boqConditionTable);

            boqTable.recalculate();

            return(boqTable);
        }
示例#8
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private nomitech.common.db.local.EquipmentTable saveOrUpdateEquipmentTable(org.hibernate.Session paramSession, Desktop.common.nomitech.common.migration.spon.SponLineItem paramSponLineItem) throws Exception
        private EquipmentTable saveOrUpdateEquipmentTable(Session paramSession, SponLineItem paramSponLineItem)
        {
            SponLineItem sponLineItem;

            for (sponLineItem = (SponLineItem)paramSponLineItem.Parent; string.ReferenceEquals(sponLineItem.WbsCode, null); sponLineItem = (SponLineItem)sponLineItem.Parent)
            {
                ;
            }
            double?double = convertToCostOSRate(paramSponLineItem.Unit, paramSponLineItem.Plant);

            null             = BlankResourceInitializer.createBlankEquipment(null);
            null.EquipmentId = null;
            string str1 = paramSponLineItem.makeShortTitle();

            null.Title = str1;
            null.Model = "";
            null.Make  = "";
            string str2 = convertToCostOSUnit(paramSponLineItem.Unit);

            if (string.ReferenceEquals(str2, null))
            {
                throw new Exception("FATAL: UNIT WAS NULL FOR " + paramSponLineItem.Unit);
            }
            null.GroupCode     = sponLineItem.WbsCode + " - " + sponLineItem.makeShortTitle();
            null.GekCode       = "";
            null.ExtraCode1    = "";
            null.ExtraCode2    = "";
            null.ExtraCode3    = "";
            null.ExtraCode4    = "";
            null.ExtraCode5    = "";
            null.ExtraCode6    = "";
            null.ExtraCode7    = "";
            null.ExtraCode8    = "";
            null.ExtraCode9    = "";
            null.ExtraCode10   = "";
            null.Country       = "GB";
            null.StateProvince = "";
            null.Unit          = str2;
            null.EditorId      = "spon";
            null.Unit          = "HOUR";
            if (str2.Equals("DAY"))
            {
                double = Convert.ToDouble(double.Value * 0.125D);
            }
            else if (str2.Equals("WEEK"))
            {
                double = Convert.ToDouble(double.Value * 0.025D);
            }
            else if (str2.Equals("MONTH"))
            {
                double = Convert.ToDouble(double.Value * 0.00625D);
            }
            if (str1.ToLower().IndexOf("diesel", StringComparison.Ordinal) != -1)
            {
                null.FuelType = "DIESEL";
            }
            else if (str1.ToLower().IndexOf("gas", StringComparison.Ordinal) != -1)
            {
                null.FuelType = "PETROL";
            }
            else if (str1.ToLower().IndexOf("electric", StringComparison.Ordinal) != -1)
            {
                null.FuelType = "ELECTRIC";
            }
            else
            {
                null.FuelType = "OTHER";
            }
            null.DepreciationCalculationMethod = EquipmentTable.USER_DEFINED_METHOD;
            null.DepreciationYears             = BigInteger.Parse("6");
            null.OccupationalFactor            = new BigDecimalFixed("0.73");
            null.OccupationHoursPerMonth       = new BigDecimalFixed("175.0");
            null.InitAquasitionPrice           = new BigDecimalFixed("0.0");
            null.InterestRate     = new BigDecimalFixed("0.065");
            null.LubricatesRate   = new BigDecimalFixed("0");
            null.TiresRate        = new BigDecimalFixed("0");
            null.FuelConsumption  = new BigDecimalFixed("0");
            null.SparePartsRate   = new BigDecimalFixed("0");
            null.ReservationRate  = new BigDecimalFixed("" + double);
            null.DepreciationRate = new BigDecimalFixed("0");
            null.FuelRate         = new BigDecimalFixed("0");
            null.TotalRate        = new BigDecimalFixed("" + double);
            null.Currency         = "GBP";
            null.Notes            = "SPON Major Rate";
            null.Description      = paramSponLineItem.makeFullDescription() + "\nCODE: " + paramSponLineItem.Code;
            null.LastUpdate       = this.lastUpdate;
            null.CreateDate       = this.lastUpdate;
            null.CreateUserId     = "spon";
            null.recalculate();
            long?long = null.EquipmentId;

            if (long == null)
            {
                long = (long?)paramSession.save(null);
            }
            else
            {
                paramSession.update(null);
            }
            return((EquipmentTable)DatabaseDBUtil.loadBulk(typeof(EquipmentTable), new long?[] { long })[0]);
        }
示例#9
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private nomitech.common.db.local.SubcontractorTable saveOrSubcontractorTable(org.hibernate.Session paramSession, Desktop.common.nomitech.common.migration.spon.SponLineItem paramSponLineItem, System.Nullable<double> paramDouble) throws Exception
        private SubcontractorTable saveOrSubcontractorTable(Session paramSession, SponLineItem paramSponLineItem, double?paramDouble)
        {
            SponLineItem sponLineItem;

            for (sponLineItem = (SponLineItem)paramSponLineItem.Parent; string.ReferenceEquals(sponLineItem.WbsCode, null); sponLineItem = (SponLineItem)sponLineItem.Parent)
            {
                ;
            }
            null = BlankResourceInitializer.createBlankSubcontractor(null);
            null.SubcontractorId = null;
            null.Title           = paramSponLineItem.makeShortTitle();
            string str = convertToCostOSUnit(paramSponLineItem.Unit);

            if (string.ReferenceEquals(str, null))
            {
                throw new Exception("FATAL: UNIT WAS NULL FOR " + paramSponLineItem.Unit);
            }
            null.GroupCode       = sponLineItem.WbsCode + " - " + sponLineItem.makeShortTitle();
            null.GekCode         = "";
            null.ExtraCode1      = "";
            null.ExtraCode2      = "";
            null.ExtraCode3      = "";
            null.ExtraCode4      = "";
            null.ExtraCode5      = "";
            null.ExtraCode6      = "";
            null.ExtraCode7      = "";
            null.ExtraCode8      = "";
            null.ExtraCode9      = "";
            null.ExtraCode10     = "";
            null.Unit            = str;
            null.EditorId        = "spon";
            null.ContactPerson   = "";
            null.PhoneNumber     = "";
            null.MobileNumber    = "";
            null.FaxNumber       = "";
            null.Email           = "";
            null.Url             = "";
            null.Company         = "";
            null.Performance     = "8";
            null.Address         = "";
            null.City            = "";
            null.IKA             = BigDecimalMath.ZERO;
            null.SubMaterialRate = BigDecimalMath.ZERO;
            null.Rate            = new BigDecimalFixed("" + convertToCostOSRate(paramSponLineItem.Unit, paramDouble));
            null.Project         = "";
            null.Country         = "GB";
            null.StateProvince   = "";
            null.Currency        = "GBP";
            null.Accuracy        = "enum.quotation.accuracy.estimated";
            null.Inclusion       = "enum.inclusion.subonly";
            null.Quantity        = new BigDecimalFixed(0);
            null.Notes           = "SPON Major Rate";
            null.Description     = paramSponLineItem.makeFullDescription() + "\nCODE: " + paramSponLineItem.Code;
            null.LastUpdate      = this.lastUpdate;
            null.CreateDate      = this.lastUpdate;
            null.CreateUserId    = "spon";
            null.recalculate();
            long?long = null.SubcontractorId;

            if (long == null)
            {
                long = (long?)paramSession.save(null);
            }
            else
            {
                paramSession.update(null);
            }
            return((SubcontractorTable)DatabaseDBUtil.loadBulk(typeof(SubcontractorTable), new long?[] { long })[0]);
        }
示例#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;
            }
        }
示例#11
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void saveOrUpdateAssemblyTable(org.hibernate.Session paramSession, Desktop.common.nomitech.common.migration.spon.SponLineItem paramSponLineItem, nomitech.common.db.local.MaterialTable paramMaterialTable, nomitech.common.db.local.SubcontractorTable paramSubcontractorTable, nomitech.common.db.local.EquipmentTable paramEquipmentTable) throws Exception
        private void saveOrUpdateAssemblyTable(Session paramSession, SponLineItem paramSponLineItem, MaterialTable paramMaterialTable, SubcontractorTable paramSubcontractorTable, EquipmentTable paramEquipmentTable)
        {
            SponLineItem sponLineItem;

            for (sponLineItem = (SponLineItem)paramSponLineItem.Parent; string.ReferenceEquals(sponLineItem.WbsCode, null); sponLineItem = (SponLineItem)sponLineItem.Parent)
            {
                ;
            }
            AssemblyTable assemblyTable = BlankResourceInitializer.createBlankAssembly(null);

            assemblyTable.AssemblyId = null;
            assemblyTable.Title      = paramSponLineItem.makeShortTitle();
            string str = convertToCostOSUnit(paramSponLineItem.Unit);

            if (string.ReferenceEquals(str, null))
            {
                throw new Exception("FATAL: UNIT WAS NULL FOR " + paramSponLineItem.Unit);
            }
            assemblyTable.GroupCode             = sponLineItem.WbsCode + " - " + sponLineItem.makeShortTitle();
            assemblyTable.GekCode               = "";
            assemblyTable.Unit                  = str;
            assemblyTable.EditorId              = "spon";
            assemblyTable.StateProvince         = "";
            assemblyTable.Country               = "GB";
            assemblyTable.Currency              = "GBP";
            assemblyTable.Productivity          = BigDecimalMath.ZERO;
            assemblyTable.Project               = "";
            assemblyTable.PublishedRate         = new BigDecimalFixed("" + convertToCostOSRate(paramSponLineItem.Unit, paramSponLineItem.Total));
            assemblyTable.PublishedRevisionCode = paramSponLineItem.Code;
            assemblyTable.Notes                 = "SPON Major Rate";
            assemblyTable.Description           = paramSponLineItem.makeFullDescription() + "\nCODE: " + paramSponLineItem.Code;
            assemblyTable.Virtual               = false;
            assemblyTable.VirtualEquipment      = false;
            assemblyTable.VirtualSubcontractor  = false;
            assemblyTable.VirtualLabor          = false;
            assemblyTable.VirtualMaterial       = false;
            assemblyTable.VirtualConsumable     = false;
            assemblyTable.LastUpdate            = this.lastUpdate;
            assemblyTable.Quantity              = new BigDecimalFixed("0");
            assemblyTable.Accuracy              = "enum.quotation.accuracy.estimated";
            assemblyTable.CreateDate            = assemblyTable.LastUpdate;
            assemblyTable.CreateUserId          = "spon";
            Serializable serializable = assemblyTable.AssemblyId;

            if (serializable == null)
            {
                serializable = paramSession.save(assemblyTable);
            }
            else
            {
                paramSession.update(assemblyTable);
            }
            assemblyTable = (AssemblyTable)paramSession.load(typeof(AssemblyTable), serializable);
            if (paramSubcontractorTable != null)
            {
                paramSubcontractorTable = (SubcontractorTable)DatabaseDBUtil.loadBulk(typeof(SubcontractorTable), new long?[] { paramSubcontractorTable.SubcontractorId })[0];
                AssemblySubcontractorTable assemblySubcontractorTable = new AssemblySubcontractorTable();
                assemblySubcontractorTable.Factor1                     = BigDecimalMath.ONE;
                assemblySubcontractorTable.Factor2                     = BigDecimalMath.ONE;
                assemblySubcontractorTable.Factor3                     = BigDecimalMath.ONE;
                assemblySubcontractorTable.QuantityPerUnit             = BigDecimalMath.ONE;
                assemblySubcontractorTable.QuantityPerUnitFormula      = "";
                assemblySubcontractorTable.QuantityPerUnitFormulaState = ResourceToAssignmentTable.QTYPUFORM_NOFORMULA;
                assemblySubcontractorTable.LocalFactor                 = BigDecimalMath.ONE;
                assemblySubcontractorTable.LocalCountry                = "";
                assemblySubcontractorTable.LocalStateProvince          = "";
                assemblySubcontractorTable.LastUpdate                  = assemblyTable.LastUpdate;
                long?long = (long?)paramSession.save(assemblySubcontractorTable);
                assemblySubcontractorTable.AssemblySubcontractorId = long;
                if (DatabaseDBUtil.LocalCommunication)
                {
                    paramSubcontractorTable.AssemblySubcontractorSet.Add(assemblySubcontractorTable);
                    paramSession.saveOrUpdate(paramSubcontractorTable);
                    assemblyTable.AssemblySubcontractorSet.Add(assemblySubcontractorTable);
                    paramSession.saveOrUpdate(assemblyTable);
                    assemblySubcontractorTable.SubcontractorTable = paramSubcontractorTable;
                    assemblySubcontractorTable.AssemblyTable      = assemblyTable;
                    paramSession.saveOrUpdate(assemblySubcontractorTable);
                }
                else
                {
                    assemblySubcontractorTable = (AssemblySubcontractorTable)DatabaseDBUtil.associateAssemblyResource(assemblyTable, paramSubcontractorTable, assemblySubcontractorTable);
                    assemblyTable = (AssemblyTable)paramSession.load(typeof(AssemblyTable), assemblyTable.Id);
                }
            }
            if (paramMaterialTable != null)
            {
                paramMaterialTable = (MaterialTable)DatabaseDBUtil.loadBulk(typeof(MaterialTable), new long?[] { paramMaterialTable.MaterialId })[0];
                AssemblyMaterialTable assemblyMaterialTable = new AssemblyMaterialTable();
                assemblyMaterialTable.Factor1                     = BigDecimalMath.ONE;
                assemblyMaterialTable.Factor2                     = BigDecimalMath.ONE;
                assemblyMaterialTable.Factor3                     = BigDecimalMath.ONE;
                assemblyMaterialTable.QuantityPerUnit             = BigDecimalMath.ONE;
                assemblyMaterialTable.QuantityPerUnitFormula      = "";
                assemblyMaterialTable.QuantityPerUnitFormulaState = ResourceToAssignmentTable.QTYPUFORM_NOFORMULA;
                assemblyMaterialTable.LocalFactor                 = BigDecimalMath.ONE;
                assemblyMaterialTable.LocalCountry                = "";
                assemblyMaterialTable.LocalStateProvince          = "";
                assemblyMaterialTable.LastUpdate                  = assemblyTable.LastUpdate;
                long?long = (long?)paramSession.save(assemblyMaterialTable);
                assemblyMaterialTable.AssemblyMaterialId = long;
                if (DatabaseDBUtil.LocalCommunication)
                {
                    paramMaterialTable.AssemblyMaterialSet.Add(assemblyMaterialTable);
                    paramSession.saveOrUpdate(paramMaterialTable);
                    assemblyTable.AssemblyMaterialSet.Add(assemblyMaterialTable);
                    paramSession.saveOrUpdate(assemblyTable);
                    assemblyMaterialTable.MaterialTable = paramMaterialTable;
                    assemblyMaterialTable.AssemblyTable = assemblyTable;
                    paramSession.saveOrUpdate(assemblyMaterialTable);
                }
                else
                {
                    assemblyMaterialTable = (AssemblyMaterialTable)DatabaseDBUtil.associateAssemblyResource(assemblyTable, paramMaterialTable, assemblyMaterialTable);
                    assemblyTable         = (AssemblyTable)paramSession.load(typeof(AssemblyTable), assemblyTable.Id);
                }
            }
            if (paramEquipmentTable != null)
            {
                paramEquipmentTable = (EquipmentTable)DatabaseDBUtil.loadBulk(typeof(EquipmentTable), new long?[] { paramEquipmentTable.EquipmentId })[0];
                AssemblyEquipmentTable assemblyEquipmentTable = new AssemblyEquipmentTable();
                assemblyEquipmentTable.Factor1                     = BigDecimalMath.ONE;
                assemblyEquipmentTable.Factor2                     = BigDecimalMath.ONE;
                assemblyEquipmentTable.Factor3                     = BigDecimalMath.ONE;
                assemblyEquipmentTable.QuantityPerUnit             = BigDecimalMath.ONE;
                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 = (long?)paramSession.save(assemblyEquipmentTable);
                assemblyEquipmentTable.AssemblyEquipmentId = long;
                if (DatabaseDBUtil.LocalCommunication)
                {
                    paramEquipmentTable.AssemblyEquipmentSet.Add(assemblyEquipmentTable);
                    paramSession.saveOrUpdate(paramEquipmentTable);
                    assemblyTable.AssemblyEquipmentSet.Add(assemblyEquipmentTable);
                    paramSession.saveOrUpdate(assemblyTable);
                    assemblyEquipmentTable.EquipmentTable = paramEquipmentTable;
                    assemblyEquipmentTable.AssemblyTable  = assemblyTable;
                    paramSession.saveOrUpdate(assemblyEquipmentTable);
                }
                else
                {
                    assemblyEquipmentTable = (AssemblyEquipmentTable)DatabaseDBUtil.associateAssemblyResource(assemblyTable, paramEquipmentTable, assemblyEquipmentTable);
                    assemblyTable          = (AssemblyTable)paramSession.load(typeof(AssemblyTable), assemblyTable.Id);
                }
            }
            assemblyTable = (AssemblyTable)paramSession.load(typeof(AssemblyTable), assemblyTable.Id);
            assemblyTable.recalculate();
            paramSession.update(assemblyTable);
        }
示例#12
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public org.boris.expr.Expr evaluate(org.boris.expr.IEvaluationContext paramIEvaluationContext, org.boris.expr.Expr[] paramArrayOfExpr) throws org.boris.expr.ExprException
        public virtual Expr evaluate(IEvaluationContext paramIEvaluationContext, Expr[] paramArrayOfExpr)
        {
            assertMinArgCount(paramArrayOfExpr, 1);
            for (sbyte b = 0; b < paramArrayOfExpr.Length; b++)
            {
                if (paramArrayOfExpr[b] is org.boris.expr.ExprEvaluatable)
                {
                    paramArrayOfExpr[b] = evalArg(paramIEvaluationContext, paramArrayOfExpr[b]);
                }
            }
            if (!(paramArrayOfExpr[0] is ExprString))
            {
                throw new ExprException("Input " + paramArrayOfExpr[0].ToString() + " is not a String.");
            }
            string str = ((ExprString)paramArrayOfExpr[0]).str;
            bool   bool1;

            for (bool1 = true; bool1 < paramArrayOfExpr.Length; bool1++)
            {
                if (paramArrayOfExpr[bool1] is ExprVariable)
                {
                    paramArrayOfExpr[bool1] = paramIEvaluationContext.evaluateVariable((ExprVariable)paramArrayOfExpr[bool1]);
                }
                if (!(paramArrayOfExpr[bool1] is ExprString) && !(paramArrayOfExpr[bool1] is org.boris.expr.ExprNumber) && !(paramArrayOfExpr[bool1] is ExprBoolean))
                {
                    throw new ExprException("Invalid Parameter Value: " + paramArrayOfExpr[bool1]);
                }
            }
            bool1 = true;
            Session session = null;
            bool    bool2   = true;

            if (paramIEvaluationContext is ExprAbstractEvaluationContext)
            {
                session = ((ExprAbstractEvaluationContext)paramIEvaluationContext).MasterDatabaseSession;
                if (session == null)
                {
                    bool1   = DatabaseDBUtil.hasOpenedSession();
                    session = DatabaseDBUtil.currentSession();
                    bool2   = DatabaseDBUtil.LocalCommunication;
                }
            }
            string[] arrayOfString = null;
            int      i             = 0;

            try
            {
                SQLQuery sQLQuery             = null;
                System.Collections.IList list = Collections.EMPTY_LIST;
                if (bool2)
                {
                    Query query;
                    sQLQuery           = session.createSQLQuery(str);
                    sQLQuery.Cacheable = true;
                    for (sbyte b2 = 1; b2 < paramArrayOfExpr.Length; b2++)
                    {
                        if (paramArrayOfExpr[b2] is ExprString)
                        {
                            query = sQLQuery.setString(b2 - true, ((ExprString)paramArrayOfExpr[b2]).str);
                        }
                        else if (paramArrayOfExpr[b2] is ExprDouble)
                        {
                            query = query.setDouble(b2 - true, ((ExprDouble)paramArrayOfExpr[b2]).doubleValue());
                        }
                        else if (paramArrayOfExpr[b2] is ExprInteger)
                        {
                            query = query.setInteger(b2 - true, ((ExprInteger)paramArrayOfExpr[b2]).intValue());
                        }
                        else if (paramArrayOfExpr[b2] is ExprBoolean)
                        {
                            query = query.setBoolean(b2 - true, ((ExprBoolean)paramArrayOfExpr[b2]).booleanValue());
                        }
                    }
                    list = query.list();
                    if (list.Count != 0)
                    {
                        object @object = list[0];
                        if (@object is BaseEntity)
                        {
                            ClassMetadata classMetadata = ((SessionImplementor)session).Factory.getClassMetadata(@object.GetType());
                            arrayOfString = classMetadata.PropertyNames;
                            if (arrayOfString == null)
                            {
                                throw new Exception("Invalid class name: " + @object.GetType());
                            }
                            i = arrayOfString.Length;
                        }
                        else if (@object is object[])
                        {
                            i = (object[])@object.length;
                        }
                        else
                        {
                            i = 1;
                        }
                    }
                }
                else
                {
                    List <object> arrayList = new List <object>();
                    for (sbyte b2 = 1; b2 < paramArrayOfExpr.Length; b2++)
                    {
                        if (paramArrayOfExpr[b2] is ExprString)
                        {
                            arrayList.Add(new HqlParameterWithValue(b2 - true, ((ExprString)paramArrayOfExpr[b2]).str));
                        }
                        else if (paramArrayOfExpr[b2] is ExprDouble)
                        {
                            arrayList.Add(new HqlParameterWithValue(b2 - true, Convert.ToDouble(((ExprDouble)paramArrayOfExpr[b2]).doubleValue())));
                        }
                        else if (paramArrayOfExpr[b2] is ExprInteger)
                        {
                            arrayList.Add(new HqlParameterWithValue(b2 - true, new long?(((ExprInteger)paramArrayOfExpr[b2]).intValue())));
                        }
                        else if (paramArrayOfExpr[b2] is ExprBoolean)
                        {
                            arrayList.Add(new HqlParameterWithValue(b2 - true, "" + ((ExprBoolean)paramArrayOfExpr[b2]).booleanValue()));
                        }
                    }
                    throw new System.ArgumentException("not implemented as a web service");
                }
                ExprArray exprArray = new ExprArray(list.Count, i);
                sbyte     b1        = 0;
                foreach (object @object in list)
                {
                    if (@object is HqlResultValue[])
                    {
                        HqlResultValue[] arrayOfHqlResultValue = (HqlResultValue[])@object;
                        for (sbyte b2 = 0; b2 < arrayOfHqlResultValue.Length; b2++)
                        {
                            setArrayValue(exprArray, arrayOfHqlResultValue[b2], b1, b2);
                        }
                    }
                    else if (@object is object[])
                    {
                        object[] arrayOfObject = (object[])@object;
                        for (sbyte b2 = 0; b2 < arrayOfObject.Length; b2++)
                        {
                            setArrayValue(exprArray, arrayOfObject[b2], b1, b2);
                        }
                    }
                    else if (@object is BaseEntity)
                    {
                        sbyte b2 = 0;
                        foreach (string str1 in arrayOfString)
                        {
                            object object1 = BlankResourceInitializer.getFieldValue((BaseEntity)@object, str1);
                            setArrayValue(exprArray, object1, b1, b2++);
                        }
                    }
                    else if (i == 1)
                    {
                        setArrayValue(exprArray, @object, b1, 0);
                    }
                    else
                    {
                        if (!bool1)
                        {
                            DatabaseDBUtil.closeSession();
                        }
                        throw new ExprException("Not a persistent class: " + @object.GetType().Name);
                    }
                    b1++;
                }
                if (!bool1)
                {
                    DatabaseDBUtil.closeSession();
                }
                return(exprArray);
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception.ToString());
                Console.Write(exception.StackTrace);
                if (!bool1)
                {
                    DatabaseDBUtil.closeSession();
                }
                throw new ExprException(exception.Message);
            }
        }
        //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();
            }
        }
示例#14
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public org.boris.expr.Expr evaluate(org.boris.expr.IEvaluationContext paramIEvaluationContext, org.boris.expr.Expr[] paramArrayOfExpr) throws org.boris.expr.ExprException
        public virtual Expr evaluate(IEvaluationContext paramIEvaluationContext, Expr[] paramArrayOfExpr)
        {
            assertMinArgCount(paramArrayOfExpr, 1);
            for (sbyte b = 0; b < paramArrayOfExpr.Length; b++)
            {
                if (paramArrayOfExpr[b] is org.boris.expr.ExprEvaluatable)
                {
                    paramArrayOfExpr[b] = evalArg(paramIEvaluationContext, paramArrayOfExpr[b]);
                }
            }
            if (!(paramArrayOfExpr[0] is ExprString))
            {
                throw new ExprException("Input " + paramArrayOfExpr[0].ToString() + " is not a String.");
            }
            string str = ((ExprString)paramArrayOfExpr[0]).str;
            bool   @bool;

            for (@bool = true; @bool < paramArrayOfExpr.Length; @bool++)
            {
                if (paramArrayOfExpr[@bool] is ExprVariable)
                {
                    paramArrayOfExpr[@bool] = paramIEvaluationContext.evaluateVariable((ExprVariable)paramArrayOfExpr[@bool]);
                }
                if (!(paramArrayOfExpr[@bool] is ExprString) && !(paramArrayOfExpr[@bool] is org.boris.expr.ExprNumber) && !(paramArrayOfExpr[@bool] is ExprBoolean))
                {
                    throw new ExprException("Invalid Parameter Value: " + paramArrayOfExpr[@bool]);
                }
            }
            @bool = true;
            Session       session       = null;
            ProjectDBUtil projectDBUtil = null;

            if (paramIEvaluationContext is ExprAbstractEvaluationContext)
            {
                session = ((ExprAbstractEvaluationContext)paramIEvaluationContext).ProjectDatabaseSession;
                if (session == null)
                {
                    projectDBUtil = ProjectDBUtil.currentProjectDBUtil();
                    if (projectDBUtil == null)
                    {
                        return(new DummyExprArray());
                    }
                    @bool   = projectDBUtil.hasOpenedSession();
                    session = projectDBUtil.currentSession();
                }
            }
            string[] arrayOfString = null;
            try
            {
                Query query = session.createQuery(str);
                query.Cacheable = true;
                for (sbyte b1 = 1; b1 < paramArrayOfExpr.Length; b1++)
                {
                    if (paramArrayOfExpr[b1] is ExprString)
                    {
                        query = query.setString(b1 - true, ((ExprString)paramArrayOfExpr[b1]).str);
                    }
                    else if (paramArrayOfExpr[b1] is ExprDouble)
                    {
                        query = query.setDouble(b1 - true, ((ExprDouble)paramArrayOfExpr[b1]).doubleValue());
                    }
                    else if (paramArrayOfExpr[b1] is ExprInteger)
                    {
                        query = query.setInteger(b1 - true, ((ExprInteger)paramArrayOfExpr[b1]).intValue());
                    }
                    else if (paramArrayOfExpr[b1] is ExprBoolean)
                    {
                        query = query.setBoolean(b1 - true, ((ExprBoolean)paramArrayOfExpr[b1]).booleanValue());
                    }
                }
                System.Collections.IList list = query.list();
                int i = 0;
                if (list.Count != 0)
                {
                    object @object = list[0];
                    if (@object is BaseEntity)
                    {
                        ClassMetadata classMetadata = ((SessionImplementor)session).Factory.getClassMetadata(@object.GetType());
                        arrayOfString = classMetadata.PropertyNames;
                        if (arrayOfString == null)
                        {
                            throw new Exception("Invalid class name: " + @object.GetType());
                        }
                        i = arrayOfString.Length;
                    }
                    else if (@object is object[])
                    {
                        i = (object[])@object.length;
                    }
                    else
                    {
                        i = 1;
                    }
                }
                ExprArray exprArray = new ExprArray(list.Count, i);
                sbyte     b2        = 0;
                foreach (object @object in list)
                {
                    if (@object is object[])
                    {
                        object[] arrayOfObject = (object[])@object;
                        for (sbyte b3 = 0; b3 < arrayOfObject.Length; b3++)
                        {
                            setArrayValue(exprArray, arrayOfObject[b3], b2, b3);
                        }
                    }
                    else if (@object is BaseEntity)
                    {
                        sbyte b3 = 0;
                        foreach (string str1 in arrayOfString)
                        {
                            object object1 = BlankResourceInitializer.getFieldValue((BaseEntity)@object, str1);
                            setArrayValue(exprArray, object1, b2, b3++);
                        }
                    }
                    else if (i == 1)
                    {
                        setArrayValue(exprArray, @object, b2, 0);
                    }
                    else
                    {
                        if (!@bool)
                        {
                            projectDBUtil.closeSession();
                        }
                        throw new ExprException("Not a persistent class: " + @object.GetType().Name);
                    }
                    b2++;
                }
                if (projectDBUtil != null && !@bool)
                {
                    projectDBUtil.closeSession();
                }
                return(exprArray);
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception.ToString());
                Console.Write(exception.StackTrace);
                if (!@bool)
                {
                    projectDBUtil.closeSession();
                }
                throw new ExprException(exception.Message);
            }
        }
示例#15
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private nomitech.common.db.local.MaterialTable saveOrUpdateMaterialTable(org.hibernate.Session paramSession, Desktop.common.nomitech.common.migration.spon.SponLineItem paramSponLineItem) throws Exception
        private MaterialTable saveOrUpdateMaterialTable(Session paramSession, SponLineItem paramSponLineItem)
        {
            SponLineItem sponLineItem;

            for (sponLineItem = (SponLineItem)paramSponLineItem.Parent; string.ReferenceEquals(sponLineItem.WbsCode, null); sponLineItem = (SponLineItem)sponLineItem.Parent)
            {
                ;
            }
            null            = BlankResourceInitializer.createBlankMaterial(null);
            null.MaterialId = null;
            null.Title      = paramSponLineItem.makeShortTitle();
            string str = convertToCostOSUnit(paramSponLineItem.Unit);

            if (string.ReferenceEquals(str, null))
            {
                throw new Exception("FATAL: UNIT WAS NULL FOR " + paramSponLineItem.Unit);
            }
            null.GroupCode           = sponLineItem.WbsCode + " - " + sponLineItem.makeShortTitle();
            null.GekCode             = "";
            null.ExtraCode1          = "";
            null.ExtraCode2          = "";
            null.ExtraCode3          = "";
            null.ExtraCode4          = "";
            null.ExtraCode5          = "";
            null.ExtraCode6          = "";
            null.ExtraCode7          = "";
            null.ExtraCode8          = "";
            null.ExtraCode9          = "";
            null.ExtraCode10         = "";
            null.Unit                = str;
            null.EditorId            = "spon";
            null.Weight              = new BigDecimalFixed("0");
            null.WeightUnit          = "KG";
            null.RawMaterial         = "enum.rm.unspecified";
            null.RawMaterialReliance = new BigDecimalFixed("100");
            null.Rate                = new BigDecimalFixed("" + convertToCostOSRate(paramSponLineItem.Unit, paramSponLineItem.Material));
            null.Project             = "";
            null.Country             = "GB";
            null.StateProvince       = "";
            null.Currency            = "GBP";
            null.Notes               = "SPON Major Rate";
            null.Description         = paramSponLineItem.makeFullDescription() + "\nCODE: " + paramSponLineItem.Code;
            null.LastUpdate          = this.lastUpdate;
            null.Accuracy            = "enum.quotation.accuracy.estimated";
            null.Inclusion           = "enum.inclusion.matonly";
            null.Quantity            = new BigDecimalFixed(0);
            null.DistanceToSite      = new BigDecimalFixed(0);
            null.DistanceUnit        = "MILE";
            null.ShipmentRate        = new BigDecimalFixed(0);
            null.FabricationRate     = new BigDecimalFixed(0);
            null.TotalRate           = null.Rate;
            null.CreateDate          = this.lastUpdate;
            null.CreateUserId        = "spon";
            null.recalculate();
            long?long = null.MaterialId;

            if (long == null)
            {
                long = (long?)paramSession.save(null);
            }
            else
            {
                paramSession.update(null);
            }
            return((MaterialTable)DatabaseDBUtil.loadBulk(typeof(MaterialTable), new long?[] { long })[0]);
        }
 public LineItemEvaluationContext(AssemblyTable paramAssemblyTable)
 {
     this.assemblyTable = paramAssemblyTable;
     this.boqItemTable  = BlankResourceInitializer.createBlankBoqItem(null, null, null, false);
     reloadVariables();
 }
示例#17
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;
                }
            }
        }