Exemplo n.º 1
0
        /// <summary>
        /// 发送消息给一个用户
        /// </summary>
        /// <param name="user">用户</param>
        /// <param name="e">Element</param>
        public void SendMessageToUser(User user, Element e)
        {
            if (user.ShowType == IMLibrary3.Enmu.ShowType.Offline && e is Message)
                DBHelper.addMessageToDB(e as Message);

            if (user != null && user.Tag is TCP_ServerSession)
            {
                msgServer.SendMessage(user.Tag as TCPServerSession, e);
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// 发送消息给一个用户
 /// </summary>
 /// <param name="user">用户</param>
 /// <param name="Message">消息文本</param>
 public void SendMessageToUser(User user, string XMLMsg)
 {
     if (user != null && user.Tag is TCPServerSession)
     {
         msgServer.SendMessage(user.Tag as TCPServerSession, XMLMsg);
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// 发送消息给一个用户
        /// </summary>
        /// <param name="user">用户</param>
        /// <param name="e">Element</param>
        public void SendMessageToUser(User user, Element e)
        {
            if (user.ShowType == IMLibrary3.Enmu.ShowType.Offline && e is Message)
                DBHelper.addMessageToDB(e as Message);

            if (user != null && user.Tag is TCP_ServerSession)
            {
                //tcpMessageServer.SendMessageToSession(user.Tag as TCPServerSession, Factory.CreateXMLMsg(e));
                msgServer.SendMessage(user.Tag as TCPServerSession, e);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 获得用户信息
        /// </summary>
        /// <param name="user"></param>
        private void onOrgUsers(User user)
        {
            exUser exuser = new exUser();
            exuser.UserID = user.UserID;
            exuser.UserName = user.UserName;
            exuser.GroupID = user.GroupID;
            exuser.OrderID = user.OrderID;
            Users.Add(exuser);

            if (frmOrg != null && !frmOrg.IsDisposed)
            {
                frmOrg.Times = 0;
                frmOrg.Value = this.Users.Count;
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// 将所有数据库中用户基本信息读入内存
        /// </summary>
        /// <returns></returns>
        private  static Dictionary<string, User> GetUsers()
        {
            Dictionary<string, User>   users = new Dictionary<string, User>();
            System.Data.SqlClient.SqlDataReader dr = DataAccess.GetReaderBySql("select * from users");
            if (dr != null)
            {
                while (dr.Read())
                {
                    User user = new User();

                    user.UserID = dr["UserID"].ToString().Trim();
                    user.UserName = dr["UserName"] is DBNull ? user.UserID : dr["UserName"].ToString().Trim();
                    //user.Sex = Convert.ToByte(dr["Sex"] is DBNull ? 0 : dr["Sex"]);
                    //user.FaceIndex = Convert.ToInt32(dr["FaceIndex"] is DBNull ? 0 : dr["FaceIndex"]);
                    user.GroupID = dr["GroupID"] is DBNull ? "" : dr["GroupID"].ToString().Trim();
                    user.OrderID = Convert.ToInt32(dr["OrderID"] is DBNull ? 0 : dr["OrderID"]);

                    users.Add(user.UserID, user);
                }
                dr.Close();
            } 
            dr.Dispose();
            return users;
        }