Exemplo n.º 1
0
        public void LoadData()
        {
            ParticipantByQuoteDTO allParticipantsInQuote = new ParticipantByQuoteDTO();
            label1.Text = allParticipantsInQuote.Text;

            QuoteParticipantService quoteParticipantsService = new QuoteParticipantService();
            dgvParticipantsInQuote.DataSource = quoteParticipantsService.GetQuoteParticipantsList(_quoteId);
        }
Exemplo n.º 2
0
        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;

            }
        }