// ++++++++++++++++++++++++++++++++++++++++++++++++ // Send company a notification that another company has bid on their quote request public void NotifyCompanyOfNewBidOnQuoteRequestItem(int bidId) { BidDomain bid = _BidService.BidGetById(bidId); CompanyDomain company = _CompanyService.GetByIdCompany(bid.ReceivingCompanyId); CompanyDomain company2 = _CompanyService.GetByIdCompany(bid.SubmittingCompanyId); string BidAmount = String.Format("{0:0.00}", bid.Amount); if (company != null) { try { EmailRequest notification = new EmailRequest(); notification.UserEmail = company.Email; notification.Subject = "New Bid On Your Quote Request"; notification.Content = "There was a new bid on your quote request: " + bid.QrName + ". " + company2.Name + " submitted a bid of $" + BidAmount + " on the quote request item " + bid.QriName + ". The provided shipping address was " + bid.Address1 + ", " + bid.City + ", " + bid.State + " " + bid.ZipCode + ". Log into your QuoteMule account(http://quotemule.dev/) to view and take action."; _UserEmailService.SendEmail(notification); NotificationInsertRequest notificationModel = new NotificationInsertRequest(); notificationModel.UserId = company.OwnerId; notificationModel.Category = "New Bid On Your Quote Request"; notificationModel.Message1 = company2.Name + " submitted a bid on your quote request: " + bid.QrName + ". Click "; notificationModel.Link = "/quoterequest/manage/" + bid.QuoteRequestId; notificationModel.Message2 = "here"; notificationModel.Message3 = " to view it."; notificationModel.Is_Read = false; NotificationInsert(notificationModel); NotificationInsertRequest toastrModel = new NotificationInsertRequest(); toastrModel.UserId = company.OwnerId; toastrModel.Category = "New Bid On Your Quote Request"; toastrModel.Message1 = "<a href='/quoterequest/manage/" + bid.QuoteRequestId + "#/active'>" + company2.Name + " submitted a bid on your quote request: " + bid.QrName + ".</a>"; toastrModel.Is_Read = false; UserProfileService UserProfile = new UserProfileService(); List <CompanyEmployeeDomain> notificationList = UserProfile.GetAllEmployees(bid.ReceivingCompanyId); NotifyAllCompanyUsers(toastrModel, notificationList); } catch (Exception ex) { throw ex; } } }
public bool NotifySellerCompanyOfAcceptedBid(int bidId) { bool Success = false; BidDomain bid = _BidService.BidGetById(bidId); int QuoteRequestId = bid.QuoteRequestId; CompanyDomain buyerCompany = _CompanyService.GetByIdCompany(bid.ReceivingCompanyId); CompanyDomain supplierCompany = _CompanyService.GetByIdCompany(bid.SubmittingCompanyId); string link = "/quoterequest/manage/" + QuoteRequestId; try { NotificationInsertRequest model = new NotificationInsertRequest(); model.UserId = supplierCompany.OwnerId; model.Category = "Bid Accepted"; model.Message1 = buyerCompany.Name + " has accepted your bid! "; model.Link = link; model.Message2 = "here"; model.Message3 = " to convert to quote."; model.Is_Read = false; NotificationInsert(model); NotificationInsertRequest toastrModel = new NotificationInsertRequest(); toastrModel.UserId = supplierCompany.OwnerId; toastrModel.Category = "Bid Accepted"; toastrModel.Message1 = "<a href='/quoterequest/manage/" + bid.QuoteRequestId + "#/pending'><div>" + buyerCompany.Name + " has accepted your bid! Click here!</div></a>"; UserProfileService UserProfile = new UserProfileService(); List <CompanyEmployeeDomain> notificationList = UserProfile.GetAllEmployees(bid.SubmittingCompanyId); NotifyAllCompanyUsers(toastrModel, notificationList); Success = true; } catch (Exception ex) { throw ex; } return(Success); }
public void CreatePage(Document document, int BidId) { BidDomain bid = _BidService.BidGetById(BidId); Section section = document.AddSection(); // Create the text frame for the address TextFrame addressFrame = section.AddTextFrame(); addressFrame.Height = "3.0cm"; addressFrame.Width = "7.0cm"; addressFrame.Left = ShapePosition.Left; addressFrame.RelativeHorizontal = RelativeHorizontal.Margin; addressFrame.Top = "5.0cm"; addressFrame.RelativeVertical = RelativeVertical.Page; // Add content to address frame Paragraph paragraph = addressFrame.AddParagraph(); paragraph.AddText(bid.Address1 + ", " + bid.City); paragraph.AddLineBreak(); paragraph.AddText(bid.State + " " + bid.ZipCode); Paragraph paragraph2 = section.AddParagraph(); paragraph2.Format.SpaceBefore = "8cm"; // Create the item table Table table = section.AddTable(); table.Style = "Table"; //table.Borders.Color = TableBorder; table.Borders.Width = 0.25; table.Borders.Left.Width = 0.5; table.Borders.Right.Width = 0.5; table.Rows.LeftIndent = 0; // Before you can add a row, you must define the columns Column column = table.AddColumn("1cm"); column.Format.Alignment = ParagraphAlignment.Center; column = table.AddColumn("2.5cm"); column.Format.Alignment = ParagraphAlignment.Right; column = table.AddColumn("3cm"); column.Format.Alignment = ParagraphAlignment.Right; column = table.AddColumn("3.5cm"); column.Format.Alignment = ParagraphAlignment.Right; //column = table.AddColumn("2cm"); //column.Format.Alignment = ParagraphAlignment.Center; //column = table.AddColumn("4cm"); //column.Format.Alignment = ParagraphAlignment.Right; // Create the header of the table Row row = table.AddRow(); row.HeadingFormat = true; row.Format.Alignment = ParagraphAlignment.Center; row.Format.Font.Bold = true; //row.Shading.Color = TableBlue; row.Cells[0].AddParagraph("Item"); row.Cells[0].Format.Font.Bold = false; row.Cells[0].Format.Alignment = ParagraphAlignment.Left; row.Cells[0].VerticalAlignment = VerticalAlignment.Bottom; row.Cells[0].MergeDown = 1; //row.Cells[1].AddParagraph("Title and Author"); //row.Cells[1].Format.Alignment = ParagraphAlignment.Left; //row.Cells[1].MergeRight = 3; //row.Cells[5].AddParagraph("Extended Price"); //row.Cells[5].Format.Alignment = ParagraphAlignment.Left; //row.Cells[5].VerticalAlignment = VerticalAlignment.Bottom; //row.Cells[5].MergeDown = 1; row = table.AddRow(); row.HeadingFormat = true; row.Format.Alignment = ParagraphAlignment.Center; row.Format.Font.Bold = true; //row.Shading.Color = TableBlue; row.Cells[1].AddParagraph("Quote Request"); row.Cells[1].Format.Alignment = ParagraphAlignment.Left; row.Cells[2].AddParagraph("Quote Request Item"); row.Cells[2].Format.Alignment = ParagraphAlignment.Left; row.Cells[3].AddParagraph("Amount"); row.Cells[3].Format.Alignment = ParagraphAlignment.Left; //row.Cells[4].AddParagraph("Taxable"); //row.Cells[4].Format.Alignment = ParagraphAlignment.Left; string quoteRequestName = bid.QrName; string quoteRequestItemName = bid.QriName; decimal bidAmount = bid.Amount; Row row1 = table.AddRow(); row1.Cells[0].AddParagraph("1"); row1.Cells[1].AddParagraph(quoteRequestName); row1.Cells[2].AddParagraph(quoteRequestItemName); row1.Cells[3].AddParagraph("$" + bidAmount.ToString("0.00")); //table.SetEdge(0, 0, 6, 6, Edge.Box, BorderStyle.Single, 0.75, Color.Empty); }
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ public bool QuoteRequestSMAttemptPending(int id) { bool success = false; try { QuoteRequestDomain model = GetQuoteRequestById(id); QuoteRequestStateService StateHandler = new QuoteRequestStateService(model); // Verify this is valid action StateHandler.StateMachine.Fire(QREvent.Review); // Update Status on THIS model model.Status = QRState.Pending; // Update status in DB QrUpdateStatusRequest QrUpdate = new QrUpdateStatusRequest { QrId = model.QrId, Status = model.Status }; UpdateQuoteRequestStatus(QrUpdate); //- Changing all Bids for QR to pending BidService BidService = new BidService(); QuoteRequestItemService QRIService = new QuoteRequestItemService(); List <QuoteRequestItemDomain> allQRItemsByQr = QRIService.GetAllQuoteRequestItems(model.QrId); if (allQRItemsByQr != null) { foreach (QuoteRequestItemDomain QRItem in allQRItemsByQr) { List <BidDomain> allBidsByQri = BidService.BidGetByQriId(QRItem.QrItemId); if (allBidsByQri != null) { foreach (BidDomain Bid in allBidsByQri) { BidDomain currentBid = Bid; QuoteRequestBidStatusRequest BidModel = BidService.GetQuoteRequestBidStatusId(currentBid.BidId); QuoteRequestBidStateService BidStateHandler = new QuoteRequestBidStateService(BidModel); BidStateHandler.StateMachine.Fire(QuoteRequestBidEvent.Review); currentBid.BidStatus = QuoteRequestBidState.Pending; QuoteRequestBidStatusRequest BidStateUpdate = new QuoteRequestBidStatusRequest { BidId = currentBid.BidId, BidStatus = currentBid.BidStatus }; BidService.UpdateQuoteRequestBidStatus(BidStateUpdate); } } } } } catch (InvalidOperationException) { return(success); } catch (Exception ex) { throw ex; } return(success); }