private void ok_Click(object sender, EventArgs e) { bool flag = false; if (dateTime_startDate.Value <= dateTime_endDate.Value) { Account acc = new Account(); flag = acc.addMaintain(globleplanId, text_status.Text, dateTime_startDate.Text, dateTime_endDate.Text, richTextBox_memo.Text, text_principal.Text); if (flag) { MessageBox.Show("新增维护记录成功!"); this.DialogResult = DialogResult.OK; this.Close(); } else { MessageBox.Show("新增维护记录失败,请检查网络连接!"); } } else { MessageBox.Show("起始日期不可大于结束日期!"); } }