//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void processSponCostItem(Desktop.common.nomitech.common.migration.spon.SponLineItem paramSponLineItem, org.hibernate.Session paramSession) throws Exception private void processSponCostItem(SponLineItem paramSponLineItem, Session paramSession) { MaterialTable materialTable = null; SubcontractorTable subcontractorTable = null; EquipmentTable equipmentTable = null; if (paramSponLineItem.Material != null && paramSponLineItem.Material.Value != 0.0D) { materialTable = saveOrUpdateMaterialTable(paramSession, paramSponLineItem); } if (paramSponLineItem.Labor != null && paramSponLineItem.Labor.Value != 0.0D) { subcontractorTable = saveOrSubcontractorTable(paramSession, paramSponLineItem, paramSponLineItem.Labor); } if (paramSponLineItem.Plant != null && paramSponLineItem.Plant.Value != 0.0D) { equipmentTable = saveOrUpdateEquipmentTable(paramSession, paramSponLineItem); } if ((materialTable != null && subcontractorTable != null) || (materialTable != null && equipmentTable != null) || (equipmentTable != null && subcontractorTable != null)) { saveOrUpdateAssemblyTable(paramSession, paramSponLineItem, materialTable, subcontractorTable, equipmentTable); } else if (paramSponLineItem.Total != null && paramSponLineItem.Total.Value != 0.0D && materialTable == null && subcontractorTable == null && equipmentTable == null) { saveOrSubcontractorTable(paramSession, paramSponLineItem, paramSponLineItem.Total); } }
public virtual object clone() { BoqItemSubcontractorTable obj = new BoqItemSubcontractorTable(); obj.ParamItemId = ParamItemId; obj.BoqItemSubcontractorId = BoqItemSubcontractorId; obj.FinalRate = FinalRate; obj.TotalCost = TotalCost; obj.Factor1 = Factor1; obj.Factor2 = Factor2; obj.Factor3 = Factor3; obj.QuantityPerUnit = QuantityPerUnit; obj.QuantityPerUnitFormula = QuantityPerUnitFormula; obj.QuantityPerUnitFormulaState = QuantityPerUnitFormulaState; obj.ExchangeRate = ExchangeRate; obj.LocalFactor = LocalFactor; obj.LocalCountry = LocalCountry; obj.LocalStateProvince = LocalStateProvince; obj.TotalUnits = TotalUnits; obj.HasUserTotalUnits = HasUserTotalUnits; obj.LastUpdate = LastUpdate; obj.FixedCost = FixedCost; obj.FinalFixedCost = FinalFixedCost; obj.VariableCost = VariableCost; obj.Comment = Comment; obj.PvVars = PvVars; obj.ProjectId = ProjectId; if (BoqItemTable != null) { obj.BoqItemTable = (BoqItemTable)BoqItemTable.clone(); } if (SubcontractorTable != null) { obj.SubcontractorTable = (SubcontractorTable)SubcontractorTable.clone(); } return(obj); }
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); }
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); }
//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); }
//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; } } }