public override object clone(bool cloneParent, bool cloneResource) { QuoteItemTable obj = (QuoteItemTable)clone(); if (cloneResource && BoqItemTable != null) { obj.BoqItemTable = (BoqItemTable)BoqItemTable.clone(); } if (cloneParent && QuotationTable != null) { obj.QuotationTable = (QuotationTable)QuotationTable.clone(); } return(obj); }
public virtual QuotationTable copyWithItems() { QuotationTable obj = (QuotationTable)clone(); if (QuoteItemSet != null) { obj.quoteItemSet = new HashSet <object>(); System.Collections.IEnumerator iter = quoteItemSet.GetEnumerator(); while (iter.MoveNext()) { QuoteItemTable curMat = (QuoteItemTable)iter.Current; obj.quoteItemSet.Add((QuoteItemTable)curMat.clone()); } } return(obj); }
public virtual object clone() { QuotationTable quotationTable = new QuotationTable(); quotationTable.QuotationId = QuotationId; quotationTable.Subject = Subject; quotationTable.Performance = Performance; quotationTable.Description = Description; quotationTable.QuoteType = QuoteType; quotationTable.Status = Status; quotationTable.Guid = Guid; quotationTable.CompanyName = CompanyName; quotationTable.ContactPerson = ContactPerson; quotationTable.Email = Email; quotationTable.PhoneNumber = PhoneNumber; quotationTable.FaxNumber = FaxNumber; quotationTable.MobileNumber = MobileNumber; quotationTable.City = City; quotationTable.Address = Address; quotationTable.Url = Url; quotationTable.ToMail = ToMail; quotationTable.CcMail = CcMail; quotationTable.BccMail = BccMail; quotationTable.EditorId = EditorId; quotationTable.Currency = Currency; quotationTable.StateProvince = StateProvince; quotationTable.Country = Country; quotationTable.GeoLocation = GeoLocation; quotationTable.TemplateId = TemplateId; quotationTable.HasMaterialRate = HasMaterialRate; quotationTable.OnSiteDelivery = OnSiteDelivery; quotationTable.Notes = Notes; quotationTable.Title = Title; quotationTable.CreateDate = CreateDate; quotationTable.SentDate = SentDate; quotationTable.ReceivedDate = ReceivedDate; quotationTable.ProjectId = ProjectId; return(quotationTable); }
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); }
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); }