Click here to Skip to main content
15,890,506 members
Please Sign up or sign in to vote.
1.24/5 (3 votes)
Problem

I work on SQL server database 2012 working visual studio 2019 or visual studio 2017

I have Table parts have field status normal status is 0

I need when status changed for part id from 0 to 1 then give me notification alert

tell me which parts changed status from 0 to 1

my question How to make notification service work when any status changed from 0 to 1 .

I ask which technology for ASP.NET CORE 2.2 or SQL server 2012 can do that for me

What I have tried:

SQL
CREATE TABLE [dbo].[Parts](
	[PartId] [int] NOT NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_Parts] PRIMARY KEY CLUSTERED 
(
	[PartId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
Posted
Updated 17-Feb-20 1:28am
Comments
F-ES Sitecore 17-Feb-20 5:30am    
How do you want to be notified? Email? SMS? Fax? Automated phone call? Smoke signals? Carrier pigeon? Ouija board?
ahmed_sa 17-Feb-20 5:40am    
thank you for reply by email using asp.net core 2.2
[no name] 17-Feb-20 8:02am    
yeah cool, thanks!

1 solution

Sending email via .NET is well documented and easy to perform; the SmtpClient client class will take care of this need.

Officially this API is marked as obsolete, and has recommended alternatives linked to the referenced article. Please read all the information provided before making any decisions
SmtpClient Class (System.Net.Mail) | Microsoft Docs[^]
So now we know what is supposed to be done for certain conditions.
What happens if status is 2?
What changes this status? This is an important part to know as it kind of dictates what triggers the alert to be sent.

If this can change during normal through out the day routines I would recommend that whatever routine goes in and changes it should also fire the Send Alert method you have yet to write.

On the other hand, if this is changed during a bulk loading event; then I would write a routine to go in and check the values across the table after that import has been completed.
I would recommend that you create a blueprint/flowchart of this project, and have the logic available and shared when you have problems.
 
Share this answer
 
Comments
ahmed_sa 17-Feb-20 10:25am    
what you mean this line please
also fire the Send Alert method you have yet to write
are this meaning windows notifications or send by email
can you tell me what you mean by line above if possible ?
MadMyche 17-Feb-20 11:04am    
You want your application to send an alert; I just made up a name for it, SendAlert. What you put into it is up you; I would use the existing SmtpClient class to send an email.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900