public void SendEmailForEmployees() { try { string[] temp = _IShowCalendarDetail.EmployeeInfo.Split(';'); string employeeName = temp[1]; string status = ""; if (temp.Length > 2) { status = temp[3]; } int.TryParse(temp[0], out _EmployeeID); List <string> cc = new List <string>(); IBll.Accounts.IAccountBll _IGetEmployee = BllInstance.AccountBllInstance; Account account = _IGetEmployee.GetAccountById(_EmployeeID); if (account == null) { return; } List <string> to = new List <string>(); to.Add(account.Email1); if (!string.IsNullOrEmpty(account.Email2)) { to.Add(account.Email2); } if (!DateTime.TryParse(_IShowCalendarDetail.Date, out _Date)) { _IShowCalendarDetail.ResultMessage = "请选择一个日期!"; return; } List <AttendanceInAndOutRecord> _AttendanceInAndOutRecordList = _IAttendanceInOutRecordFacade.GetSelfAttendanceInAndOutRecordByCondition(_EmployeeID, _Date, _Date.AddDays(1).AddMinutes(-1)); DateTime e = AttendanceInAndOutRecord.FindEarlistTime(_AttendanceInAndOutRecordList); DateTime l = AttendanceInAndOutRecord.FindLatestTime(_AttendanceInAndOutRecordList); string inTime = e == Convert.ToDateTime("2999-12-31") ? "无" : e.ToString(); string outTime = l == Convert.ToDateTime("1900-1-1") ? "无" : l.ToString(); IAttendanceReadDataFacade _IAttendanceReadDataFacade = new AttendanceReadDataFacade(); _IAttendanceReadDataFacade.AttendanceSendEmailToEmployee(employeeName, inTime, outTime, status, new DateTime(_Date.Year, _Date.Month, _Date.Day, 0, 0, 0).ToString(), new DateTime(_Date.Year, _Date.Month, _Date.Day, 23, 59, 59).ToString(), to, cc, _LoginUser); _IShowCalendarDetail.ResultMessage = "邮件已发送"; } catch (Exception ex) { _IShowCalendarDetail.ResultMessage = ex.Message; } }