Beispiel #1
0
        public void EmployInProject(int projectId, IEnumerable <int> ids)
        {
            var project   = projectDataAccessObject.GetSingle(projectId);
            var employees = employeeDataAccessObject.GetEmployeesByIds(ids);

            project.CurrentEmployees.Clear();
            project.CurrentEmployees = employees.ToList();

            foreach (var employee in project.CurrentEmployees)
            {
                employee.ActualProjects.Add(project);
            }
        }
Beispiel #2
0
        public void Broadcast(IEnumerable <int> ids, string message)
        {
            var employees = employeeDataAccessObject.GetEmployeesByIds(ids);
            var subject   = Settings.Default.subject;
            var from      = Settings.Default.from;
            var fromName  = Settings.Default.fromName;

            foreach (var employee in employees)
            {
                using (var client = new SmtpClient())
                {
                    client.DeliveryMethod = SmtpDeliveryMethod.Network;
                    client.EnableSsl      = true;
                    var destination = employee.Email;
                    var mail        = new MailMessage(new MailAddress(from, fromName), new MailAddress(destination));
                    mail.Subject    = subject;
                    mail.Body       = message;
                    mail.IsBodyHtml = true;
                    client.Send(mail);
                }
            }
        }