Ejemplo n.º 1
0
 /// <summary>
 /// 新消息
 /// </summary>
 /// <param name="me">用户</param>
 /// <param name="messageNote"></param>
 public void New(User me, MessageNote messageNote)
 {
     foreach (string msg in messageNote.MessageContent)
     {
         //label1.Paint += new PaintEventHandler(DrawBorder(label1,));
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 后台异步获取消息
        /// </summary>
        private void getMessageBackgroundWorker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
        {
            //string sql;
            //if (lastGetTime != null) sql = @"SELECT * FROM MessageNotes WHERE ReceiveUser='******' OR ReceiveDepartment='" + user.Dept + " WHERE SendTime>" + lastGetTime + "'";
            //else sql = @"SELECT * FROM MessageNotes WHERE ReceiveUser='******' OR ReceiveDepartment='" + user.Dept + "'";

            DataTable messageTable1 = SqlFunction.Select(@"SELECT * FROM MessageNotes WHERE ReceiveUser='******' OR ReceiveDepartment='" + user.Dept + "'");

            ///

            if (messageTable1.Rows.Count == 0)
            {
                getMessageBackgroundWorker.ReportProgress(100, "无任何消息:" + DateTime.Now.ToString());// 进度传出
                return;
            }

            for (int i = 0; i < messageTable1.Rows.Count; i++)// 拆解消息
            {
                MessageNote messageNote = new MessageNote();
                messageNote.SendUser          = messageTable1.Rows[i]["SendUser"].ToString();
                messageNote.SendTime          = messageTable1.Rows[i]["SendTime"].ToString();
                messageNote.SendComputer      = messageTable1.Rows[i]["SendComputer"].ToString();
                messageNote.ReceiveUser       = messageTable1.Rows[i]["ReceiveUser"].ToString();
                messageNote.ReceiveDepartment = messageTable1.Rows[i]["ReceiveDepartment"].ToString();
                messageNote.OrderTape         = messageTable1.Rows[i]["OrderTape"].ToString();
                string[] content = messageTable1.Rows[i]["MessageContent"].ToString().Split(';');
                foreach (string str in content)
                {
                    messageNote.MessageContent.Add(str);
                }
                messageNote.Reading      = Convert.ToBoolean(messageTable1.Rows[i]["Reading"]);
                messageNote.ReadTime     = messageTable1.Rows[i]["ReadTime"].ToString();
                messageNote.Complete     = Convert.ToBoolean(messageTable1.Rows[i]["Complete"]);
                messageNote.CompleteTime = messageTable1.Rows[i]["CompleteTime"].ToString();
                messagesNotes.Add(messageNote);
            }

            getMessageBackgroundWorker.ReportProgress(100, "消息刷新时间:" + DateTime.Now.ToString());// 进度传出
        }