public void Dispose() { CanEditCompletion?.Dispose(); MylistName?.Dispose(); MylistDescription?.Dispose(); MylistIsPublicIndex?.Dispose(); SelectedSort?.Dispose(); LastErrorMessage?.Dispose(); }
string CheckOrder() { var err = new List <string>(); if (dgvPassenger.Rows.Cast <DataGridViewRow>().Count(s => !s.IsNewRow) == 0) { err.Add("· 您至少需要添加一位乘客"); } for (int i = 0; i < dgvPassenger.Rows.Count; i++) { var row = dgvPassenger.Rows[i]; if (row.IsNewRow) { continue; } if ((row.Cells[0].Value as string).IsNullOrEmpty()) { err.Add("· 乘客 " + (i + 1) + " 还没有输入姓名"); } if (row.Cells[1].Value == null || row.Cells[2].Value == null || row.Cells[3].Value == null) { err.Add("· 乘客 " + (i + 1) + " 还没有选择票种和席别"); } if (row.Cells[4].Value == null || (row.Cells[5].Value as string).IsNullOrEmpty()) { err.Add("· 乘客 " + (i + 1) + " 还没有输入身份证信息"); } } if (PassengerInTickets != null) { var(valid, error) = SubmitOrderWorker.CheckIfSeatSubTypeValid(PassengerInTickets); if (!valid) { err.Add($"· {error}"); } } if (SubmitOrderWorker.NeedVc == true && VerifyCodeBox.Code.Length == 0) { err.Add("· 请输入验证码"); } var result = err.JoinAsString("\n"); gpError.Visible = true; if (err.Count > 0) { if (!LastErrorMessage.IsNullOrEmpty()) { err.Add("· 上次错误信息:" + LastErrorMessage); } lblError.ForeColor = Color.Red; lblError.Text = err.JoinAsString("\n"); } else { lblError.ForeColor = Color.Green; lblError.Text = "· 当前订单可以正常提交\n" + (LastErrorMessage.IsNullOrEmpty() ? "" : "上次错误信息:" + LastErrorMessage); } return(result); }