private bool CheckAndSetAtt() { this.notes.Title = txtTitle.Text.Trim(); if (this.notes.Title.Length <= 0) { MessageBox.Show("标题必填"); return(false); } this.notes.Content = txtContent.Text.Trim(); if (chkDingDing.Checked) { this.notes.DingDingToken = txtDingDingToken.Text.Trim(); if (this.notes.DingDingToken.Length <= 0) { MessageBox.Show("钉钉Token必填"); return(false); } } else { this.notes.DingDingToken = ""; } if (chkUrl.Checked) { this.notes.NoticeUrl = txtUrl.Text.Trim(); if (this.notes.NoticeUrl.Length <= 0) { MessageBox.Show("回调通知URL必填"); return(false); } } else { this.notes.NoticeUrl = ""; } if (chkPhone.Checked) { this.notes.Phone = txtPhone.Text.Trim(); if (this.notes.Phone.Length <= 0) { MessageBox.Show("手机号必填"); return(false); } if (!StrHelper.IsMobile(this.notes.Phone)) { MessageBox.Show("11位手机号格式有误"); return(false); } } else { this.notes.Phone = ""; } return(true); }
public void Alert(Notes note) { if (string.IsNullOrEmpty(note.Phone) || !StrHelper.IsMobile(note.Phone)) { return; } var sender = GetSender(); if (sender == null) { return; } sender.Send(note.Phone, note.Title); }