Ejemplo n.º 1
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]);
        }
Ejemplo n.º 2
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]);
        }
Ejemplo n.º 3
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]);
        }
Ejemplo n.º 4
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);
        }