Beispiel #1
0
        public bool SendMessage()
        {
            try
            {
                SetmailingList();

                var message = Fill();

                var mailer = new Emailer
                {
                    subject = message.Subject,
                    body    = ComposeFinalBody(message),
                };

                ToEmailList.ToList().ForEach(mailer.TOList.Add);
                CcEmailList.ToList().ForEach(mailer.CCList.Add);

                mailer.SendEmail();

                return(true);
            }
            catch (Exception exception)
            {
                //todo need to do some loggin here
                throw;
            }
        }
Beispiel #2
0
        protected override void SetmailingList()
        {
            ToEmailList.Add(LeaveModel.StaffMember.StaffEmail);

            GetStaffManagers()
            .ToList()
            .ForEach(m => CcEmailList.Add(m.StaffEmail));
        }
Beispiel #3
0
        protected sealed override void SetmailingList()
        {
            ToEmailList.Add(LeaveModel.StaffMember.StaffEmail);

            var managers =
                new DataContextEF().Staff.Where(
                    m =>
                    m.StaffId.Equals(LeaveModel.StaffMember.StaffManager1Id) ||
                    m.StaffId.Equals(LeaveModel.StaffMember.StaffManager2Id));

            if (!managers.Any())
            {
                throw new Exception("staff memmber has no managers");
            }

            //set to email list
            managers.ToList().ForEach(m => CcEmailList.Add(m.StaffEmail));
        }