private void crystalButton_Ok_Click(object sender, EventArgs e) { string msg = ""; if (checkBox_EveryDay.Checked) { _sendTime = dateTimePicker_hour.Value; _sendModel=EMailSendModel.Everyday; _sendMailWeek = DayOfWeek.Monday; } else if (checkBox_Weekly.Checked) { DayOfWeek weekType = SelectedWeek(); //if (weekType == WeekType.None) //{ // msg = CommonUI.GetCustomMessage(_hashtable, "NotificationModel", "��ѡ�����ڼ�!"); // CustomMessageBox.ShowCustomMessageBox(this, msg, "", MessageBoxButtons.OK, MessageBoxIconType.Error); // return; //} _sendTime = dateTimePicker_hour.Value; _sendModel=EMailSendModel.Weekly; _sendMailWeek = weekType; } else if(checkBox_Monthly.Checked) { int hour = DateTime.Now.Hour; DateTime time= dateTimePicker_Day.Value.Date; DateTime dateTime = time.AddHours(dateTimePicker_hour.Value.Hour).AddMinutes(dateTimePicker_hour.Value.Minute); _sendTime = dateTime; _sendModel=EMailSendModel.Mouthly; _sendMailWeek = DayOfWeek.Monday; } else { //if (!CustomTransform.GetLanguageString("NotificationModel", Frm_MonitorStatusDisplay.LangHashTable, out msg)) //{ // msg = "��ѡ��ģʽ��"; //} ShowCustomMessageBox(CommonUI.GetCustomMessage(_hashtable, "NotificationModel", "��ѡ��ģʽ!"), "", MessageBoxButtons.OK, MessageBoxIconType.Error); return; } DialogResult = DialogResult.OK; this.Close(); }
/// <summary> /// 获得发送邮件模式 /// </summary> private void SetIsSendEMail() { DateTime time = DateTime.Now; if (_emailConfig.SendMailModel == EMailSendModel.Everyday) { if (CompareIsOverTime(_emailConfig.SendTimer)) { SendEMailStatisticsFile(); } } else if (_emailConfig.SendMailModel == EMailSendModel.Weekly) { if (time.DayOfWeek == _emailConfig.SendMailWeek) { if (CompareIsOverTime(_emailConfig.SendTimer)) { SendEMailStatisticsFile(); } } } else if (_emailConfig.SendMailModel == EMailSendModel.Mouthly) { DateTime dateTime = _emailConfig.SendTimer.Date; if (time.Day == dateTime.Day) { if (CompareIsOverTime(dateTime)) { SendEMailStatisticsFile(); } } else if (DayIsOverDay(dateTime.Day)) { if (CompareIsOverTime(dateTime)) { SendEMailStatisticsFile(); } } } else { return; } _emailSendModel = _emailConfig.SendMailModel; }