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

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

Recommended Answers

All 2 Replies

Off the top of my head, I might approach it two ways:

  1. Simply have the application check periodically for new records. This would be the easiest to implement, but it may see derading performance over time.

  2. Use a notification service that pushes new records to client applications so that they can pop up a notification box or something. This would be my preference, probably using a WCF service.

You could create an additional table, called "NewUsers". Create a trigger that populates this table when a record is added (Alternatively, rather than using a trigger, your application could create an entry in "NewUsers" table when it adds a new user to the employee table.) You probably want to create one entry for each HR employee. So the primary key would be a combination of newUserEmpId and empId of each HR user (HREmpId). The application periodically checks this table. When an entry is found, a pop-up message occurs (or whatever other notification method you want to use. Maybe a form with a datagridview that shows new users). When the HR employee clicks "Acknowledge" (or "OK") delete the entry from "NewUsers" (for that particular HREmpId).

This should eliminate/reduce performance impact as it is checking a table with only a few rows, rather than the entire employee table.

Ex: NewUsers

EmpId HREmpId
------- ---------
255000 1234
255000 120001
255000 230122
255001 1234
255001 120001
255001 230122

In the above example, there are new new employees: 255000 and 255001. There are 3 HR employees that need to be notified: 1234, 120001, and 230122.

After HR employee 1234 acknowledges that he/she is now aware that new employee "255000" exists, the entry is deleted. The "NewUsers" table now looks like the following:

EmpId HREmpId
------- ---------
255000 120001
255000 230122
255001 1234
255001 120001
255001 230122

You could change HREmpId to an IP address. Which I wouldn't recommended, because an IP address change would break your application.

Note: If you use a trigger, issues may arise if for some reason the trigger didn't fire.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.