添加新员工时,通知所有员工计算机的图标 [英] Notify icon to all employee computer's when adding new employee

查看:98
本文介绍了添加新员工时,通知所有员工计算机的图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好我需要在人力资源部门的任何电脑上发出通知图标,当我添加新员工时,因为我公司的员工忘了告诉对方有关任何新员工都添加了



这样一些流程会被延迟



含义



如果我在HR部门有4台电脑和4台由DOMAIN连接的电脑

电脑1 ip 192.168.1.105



电脑2 ip 192.168.1.106



电脑3 ip 192.168.1.107



电脑4 ip 192.168.1.108



和电脑1他的ip 192.168.1.105成功添加新员工



添加后员工电脑2和电脑3和电脑4必须有来自电脑的通知1



新员工添加



 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( 记录插入成功) ;
}
else
{
MessageBox.Show( 记录插入失败);
}



代码插入OK工作但我的问题如何实现新员工的通知添加

解决方案

< blockquote> Hello Ahmed,



以下是CodeProject上的几个选项。



问候,






我认为你可以解决这个问题各种方式的问题。您的应用需要一些通信协议。几点建议:



1.创建数据库表,存储消息。您的客户端应用程序将异步查询此表以查找应用程序启动时的新消息以及某个时间间隔(即1,2或5分钟),并在发生某些事件时将数据保存到此表以通知其他人。添加如下字段:

- MessageType(字符串)和存储消息,如:EmployeeCreated,EmployeeUpdated等..

- ObjectID,它将包含来自特定表的ID,即来自Employess表

- MessageTime - 消息创建时

- UserID - 创建此消息的用户ID



2 。使用SqlDependency类。我没有使用它,但我认为这可以帮到你。

3.使用UDP在网络中异步发送和接收数据包。数据包可以以字符串,xml,json或任何你想要的方式发送。



你可以在CodeProject上找到很多教程。

好​​的开始UDP:使用异步UDP套接字的聊天应用程序 [ ^ ]

SQLDependency:使用SqlDependency和SqlCacheDependency查询通知 [ ^ ]



我希望你觉得这个答案很有用:)


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

解决方案

Hello Ahmed,

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

Regards,


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 :)


这篇关于添加新员工时,通知所有员工计算机的图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆