Click here to Skip to main content
16,004,924 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi guys I need to make notification icon to any computers in Hr department when i added new Employee

because my employee in my company forget to tell each others about any new employee added

so that some process will by delayed

Meaning

IF i have 4 computers in HR Department and 4 computers connected by DOMAIN
computer 1 ip 192.168.1.105

computer 2 ip 192.168.1.106

computer 3 ip 192.168.1.107

computer 4 ip 192.168.1.108

and computer 1 his ip 192.168.1.105 added new Employee successfully

after added employee computer 2 AND computer 3 AND computer 4 must have notification from computer 1

that new employee added

C#
SqlConnection con = new SqlConnection();
cmd = new SqlCommand("INSERT_EmployeEa12", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@DriverID", textBox1.Text);
cmd.Parameters.AddWithValue("@DriverName", textBox2.Text);
cmd.Parameters.AddWithValue("@EmplyeeName", textBox18.Text);
cmd.Parameters.AddWithValue("@ResidentNo", textBox6.Text);
cmd.Parameters.AddWithValue("@PlaceOfBirth", textBox17.Text);
cmd.Parameters.AddWithValue("@PassportNo", textBox21.Text);
con.Open();
int n = cmd.ExecuteNonQuery();
con.Close();
if (n > 0)
 {
MessageBox.Show("record inserted Success");
}
else
{
MessageBox.Show("record inserted Failed");
}

Code insert OK working but my problem how to implement notification for new Employee added
Posted
Updated 20-Nov-14 16:35pm
v2
Comments
From Web or Windows App?
BillWoodruff 20-Nov-14 10:03am    
I believe your question is valuable and appropriate here, but, may I ask you why you don't just send an e-mail to notify the employees ?
Dave Kreskowiak 20-Nov-14 22:53pm    
Soooo you're saying your HR department is too lazy to send out an email?

Hello Ahmed,

Here are couple of options for you available right here on CodeProject.

Regards,
 
Share this answer
 
Hi,

I think that you can solve this problem in various ways. You need some communication protocol for your app. Few suggestions:

1. Create database table where you will store messages. Your client app will query this table asynchronously for new messages on app start and on some interval (i.e. 1,2 or 5 minutes) and save data to this table when some event occur to notify others. Add fields like:
- MessageType (string) and store messages like: EmployeeCreated, EmployeeUpdated etc..
- ObjectID which will contain ID from specific table, i.e. from Employess table
- MessageTime - when message was created
- UserID - ID of user who created this message

2. Use SqlDependency class. I didn't use this, but i think that can help you.
3. Use UDP to asynchronously send and receive packets in your network. Packets can be send as string, xml, json or whatever you want.

You can find many tutorials on CodeProject.
Good start for UDP: A Chat Application Using Asynchronous UDP sockets[^]
SQLDependency: Query Notification using SqlDependency and SqlCacheDependency[^]

I hope you find this answer useful :)
 
Share this answer
 
Comments
Prasad Khandekar 20-Nov-14 9:01am    
Nice!
Marcin Kozub 20-Nov-14 9:04am    
Thx!

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