private void button1_Click(object sender, EventArgs e) { richTextBox1.Clear(); ComplainDao complainDao = new ComplainDao(); IEnumerable<Complain> ie = complainDao.getMessage(); foreach (Complain c in ie) { richTextBox1.AppendText("1" + "\t"); richTextBox1.AppendText(c.Dtime.ToString() + "\t"); richTextBox1.AppendText(c.Message + "\n"); richTextBox1.AppendText("--------------------------------------------------------------------------\n"); } }
private void button4_Click(object sender, EventArgs e) { if (richTextBox1.Text == "") { MessageBox.Show("请检查你是否已经输入投诉内容了.", "wrong", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } string message=richTextBox1.Text; ComplainDao complainDao = new ComplainDao(); if (complainDao.saveMessage(message)) MessageBox.Show("感谢你的留言,我们会认真处理相关问题的.", "wrong", MessageBoxButtons.OK, MessageBoxIcon.None); else MessageBox.Show("留言失败,很抱歉.", "wrong", MessageBoxButtons.OK, MessageBoxIcon.Warning); }