// ++++++++++++++++++++++++++++++++++++++++++++++++ // 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 bool NotifyBuyerCompanyOfSubmittedQuote(int quoteId) { bool Success = false; QuoteDomain quote = _QuoteService.QuoteGetByQuoteId(quoteId); CompanyDomain buyerCompany = _CompanyService.GetByIdCompany(quote.BuyerCompanyId); CompanyDomain sellerCompany = _CompanyService.GetByIdCompany(quote.SellerCompanyId); string link = "/quote/manage/" + quote.QuoteId; try { NotificationInsertRequest model = new NotificationInsertRequest(); model.UserId = buyerCompany.OwnerId; model.Category = "Quote Submitted"; model.Message1 = sellerCompany.Name + " submitted a quote. Click "; model.Link = link; model.Message2 = "here"; model.Message3 = " to review."; model.Is_Read = false; NotificationInsert(model); NotificationInsertRequest toastrModel = new NotificationInsertRequest(); toastrModel.UserId = buyerCompany.OwnerId; toastrModel.Category = "Quote Submitted"; toastrModel.Message1 = "<a href='/quote/manage/" + quote.QuoteId + "'><div>" + sellerCompany.Name + " has submitted a quote! Click here!</div></a>"; UserProfileService UserProfile = new UserProfileService(); List <CompanyEmployeeDomain> notificationList = UserProfile.GetAllEmployees(quote.BuyerCompanyId); NotifyAllCompanyUsers(toastrModel, notificationList); Success = true; } catch (Exception ex) { throw ex; } return(Success); }
public bool NotifyBuyerCompanyOfApprovedContract(int quoteId) { bool Success = false; QuoteDomain quote = _QuoteService.QuoteGetByQuoteId(quoteId); CompanyDomain buyerCompany = _CompanyService.GetByIdCompany(quote.BuyerCompanyId); CompanyDomain sellerCompany = _CompanyService.GetByIdCompany(quote.SellerCompanyId); try { NotificationInsertRequest model = new NotificationInsertRequest(); model.UserId = buyerCompany.OwnerId; model.Category = "Quote Completed"; model.Message1 = sellerCompany.Name + " accepted the contract. Quote is completed!"; model.Is_Read = false; NotificationInsert(model); NotificationInsertRequest toastrModel = new NotificationInsertRequest(); toastrModel.UserId = buyerCompany.OwnerId; toastrModel.Category = "Contract Approved"; toastrModel.Message1 = sellerCompany.Name + " has accepted the contract. Quote is completed!</div></a>"; UserProfileService UserProfile = new UserProfileService(); List <CompanyEmployeeDomain> notificationList = UserProfile.GetAllEmployees(quote.BuyerCompanyId); NotifyAllCompanyUsers(toastrModel, notificationList); Success = true; } catch (Exception ex) { throw ex; } return(Success); }