public void SendEmailForEmployees(string employeeID, string employeeName, string inTime, string outTime, string status) { try { List <string> cc = new List <string>(); int _EmployeeID; if (!int.TryParse(employeeID, out _EmployeeID)) { return; } 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); } _IAttendanceReadDataFacade.AttendanceSendEmailToEmployee(employeeName, inTime, outTime, status, _SearchFrom.ToString(), _SearchTo.ToString(), to, cc, _LoginUser); _ItsView.ErrorMessage = "邮件已发送"; } catch (Exception ex) { _ItsView.ErrorMessage = ex.Message; } }
private void SendMessageForEmployees(Employee employee, DateTime theDay) { try { employee.Account = _IAccountBll.GetAccountById(employee.Account.Id); string employeeName = employee.Account.Name; DateTime fromDateTime = new DateTime(theDay.Year, theDay.Month, theDay.Day, 0, 0, 0); sendMessage.AttendanceSendErrorMessage(employeeName, employee.Account.MobileNum, fromDateTime); } catch { //view.MessageFromBll = ex.Message; } }
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; } }