public bool setNewBid(QuoteBidDTO newBid, int companyId) { //bool result = false; QuoteParticipantService newParticipantSupplier = new QuoteParticipantService(); newParticipantSupplier.CompanyID = companyId; newParticipantSupplier.QuoteID = newBid.QuoteID; newParticipantSupplier.SetNewParticipant(companyId, newBid.QuoteID); using (TransactionScope transaction = new TransactionScope()) { try { QuoteParticipant newQuoteParticipant = new QuoteParticipant(); QuoteParticipantBase newParticipant; newParticipant = newParticipantSupplier.GetQuoteParticipant(companyId, newBid.QuoteID); newQuoteParticipant.QuoteParticipantID = newParticipant.QuoteParticipantID; QuoteBid newBidToCreate = new QuoteBid() { QuoteParticipantID = newQuoteParticipant.QuoteParticipantID, QuoteID = newBid.QuoteID, Amount = newBid.Amount, Notes = newBid.Notes }; using (var context = new RFQEntities()) { if (newBidToCreate.EntityState == EntityState.Detached) { context.QuoteBids.AddObject(newBidToCreate); } context.SaveChanges(); } } catch (Exception e) { transaction.Dispose(); return false; } transaction.Complete(); return true; } }
/// <summary> /// Deprecated Method for adding a new object to the QuoteBids EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToQuoteBids(QuoteBid quoteBid) { base.AddObject("QuoteBids", quoteBid); }
/// <summary> /// Create a new QuoteBid object. /// </summary> /// <param name="quoteBidID">Initial value of the QuoteBidID property.</param> /// <param name="quoteID">Initial value of the QuoteID property.</param> /// <param name="quoteParticipantID">Initial value of the QuoteParticipantID property.</param> /// <param name="amount">Initial value of the Amount property.</param> public static QuoteBid CreateQuoteBid(global::System.Int32 quoteBidID, global::System.Int32 quoteID, global::System.Int32 quoteParticipantID, global::System.Decimal amount) { QuoteBid quoteBid = new QuoteBid(); quoteBid.QuoteBidID = quoteBidID; quoteBid.QuoteID = quoteID; quoteBid.QuoteParticipantID = quoteParticipantID; quoteBid.Amount = amount; return quoteBid; }