private void NewItem_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(PriorityText.Text) || string.IsNullOrWhiteSpace(MatchText.Text) || string.IsNullOrWhiteSpace(AnswerText.Text)) { MessageBox.Show("不可有空项目"); return; } OrderModel model = new OrderModel { id = 0, answer = AnswerText.Text, keyword = MatchText.Text, priority = Convert.ToInt32(PriorityText.Text), type = MatchMode.SelectedIndex, state = 0 }; OrderGridMain.Rows.Add(true, GetMatchModeText(model.type) , model.priority, model.keyword, model.answer); model.id = SQLHelper.AddItem(model); MainSave.OrderModels.Add(model); Helper.OrderListInit(); }