public frmTaskbarNotifier(MessageModel message) { InitializeComponent(); Screen screen = Screen.PrimaryScreen;//获取屏幕变量 this.Height = 300; this.Width = 410; this.Location = new Point(screen.WorkingArea.Width - 425, screen.WorkingArea.Height - 320); this.Opacity = 0; fillNotifierContent(message); }
private void fillNotifierContent(MessageModel messageModel) { this.lblDate.Text = "创建日期: " + messageModel.CreateTime; this.lnkTitle.Text = messageModel.Title; this.lnkTitle.Enabled = true; this.lnkTitle.LinkArea = new LinkArea(0, this.lnkTitle.Text.Length); this.lnkTitle.Links[0].LinkData = ApplicationContext.ServerHost() + "index.php?&sid=" + ApplicationContext.Credential.SessionId; // update message state MysqlHelper.UpdateMessageState(messageModel.Id); }
public static List<MessageModel> GetNewMessage(string userId) { MySqlCommand command = new MySqlCommand(); command.Connection = getConnection(); conn.Open(); MySqlTransaction transaction = conn.BeginTransaction(); command.Transaction = transaction; List<MessageModel> resultList = new List<MessageModel>(); try { command.CommandText = "SET NAMES latin1; SELECT `id`, `title`, `link`, `createtime` FROM eip_message WHERE `read`=0 and `notice`=0 and `state`=1 and `to_emp`=" + userId + " ORDER BY `createtime` ASC"; MySqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { MessageModel message = new MessageModel() { Id = Convert.IsDBNull(reader["id"]) ? 0 : Convert.ToInt32(reader["id"]), Title = Convert.IsDBNull(reader["title"]) ? "" : EncodingTitle(reader["title"].ToString()), Link = Convert.IsDBNull(reader["link"]) ? "" : reader["link"].ToString(), CreateTime = Convert.IsDBNull(reader["createtime"]) ? "" : DateConvertor(Convert.ToInt32(reader["createtime"])), HasRead = 0 }; resultList.Add(message); } reader.Close(); transaction.Commit(); } catch (MySqlException e) { transaction.Rollback(); } finally { transaction.Dispose(); conn.Close(); conn.Dispose(); } return resultList; }