Beispiel #1
0
        private void _SendShiftSwapNeededPushNotification(object args)
        {
            CalendarEmailArgs cargs        = (CalendarEmailArgs)args;
            Member            shiftSwapper = new MemberBLL().Get(cargs.MemberId);
            Calendar          calendar     = new CalendarBLL().Get(cargs.CalendarId);

            new MessageBLL().PushBullet("servssl_calendar", "Swap Needed",
                                        string.Format("{0} cannot perform his/her {1} duty on {2:ddd dd MMM}. Can you help?", shiftSwapper.FirstName, calendar.Name, cargs.ShiftDate.ToString("ddd dd MMM")));
        }
Beispiel #2
0
        public Member GetCurrentController()
        {
            Member c = null;

            if (DateTime.Now.Hour > CONTROLLER_THRESHOLD_HOUR)
            {
                c = new CalendarBLL().GetCurrentNightController();
            }
            else
            {
                c = new CalendarBLL().GetCurrentDayController();
            }
            return(c);
        }
Beispiel #3
0
        private void _SendCalendarVolunteerNotificationEmail(object args)
        {
            CalendarEmailArgs cargs = (CalendarEmailArgs)args;
            Member            m     = new MemberBLL().Get(cargs.MemberId);
            CalendarEntry     c     = new CalendarBLL().GetCalendarEntry(cargs.CalendarEntryId);

            if (m == null || c == null)
            {
                throw new InvalidOperationException();
            }
            SendEmail(m.EmailAddress, "You have been given a shift on " + c.EntryDateShortStringWithDay,
                      "Hi " + m.FirstName + ",\n\n" +
                      "This is an email to let you know that you have been put down for a shift on the " + c.CalendarName + " calendar on " + c.EntryDateShortStringWithDay + ".  This is not a recurring shift.  Why not add this to your personal calendar now?\n\n" +
                      $"The SERV SL Calendar can be found here: https://{_domain}/Calendar\n\n" +
                      "Thanks,\n\n" +
                      "SERV SL System" + FOOTER, new MemberBLL().GetUserIdForMember(cargs.MemberId));
        }
Beispiel #4
0
        private void _SendCalendarVolunteeringThanksEmail(object args)
        {
            CalendarEmailArgs cargs = (CalendarEmailArgs)args;
            Member            m     = new MemberBLL().Get(cargs.MemberId);
            CalendarEntry     c     = new CalendarBLL().GetCalendarEntry(cargs.CalendarEntryId);

            if (m == null || c == null)
            {
                throw new InvalidOperationException();
            }
            SendEmail(m.EmailAddress, "You volunteered for a shift on " + c.EntryDateShortStringWithDay + ", Thanks!",
                      "Hi " + m.FirstName + ",\n\n" +
                      "You are a star!  Thank you very much for putting your name down on the " + c.CalendarName + " calendar on " + c.EntryDateShortStringWithDay + ".  Why not add this to your personal calendar now?\n\n" +
                      $"The SERV SL Calendar can be found here: https://{_domain}/Calendar\n\n" +
                      "Thanks,\n\n" +
                      "SERV SL System" + FOOTER, new MemberBLL().GetUserIdForMember(cargs.MemberId));
        }
Beispiel #5
0
        private void _SendShiftSwapNeededEmail(object args)
        {
            CalendarEmailArgs cargs        = (CalendarEmailArgs)args;
            Member            shiftSwapper = new MemberBLL().Get(cargs.MemberId);
            Calendar          calendar     = new CalendarBLL().Get(cargs.CalendarId);

            if (shiftSwapper == null || calendar == null)
            {
                throw new InvalidOperationException();
            }
            List <Member> distroList = new MemberBLL().ListMembersWithAnyTagsIn("Blood,AA,Water,Controller,Milk");

            foreach (Member recipient in distroList)
            {
                if (recipient.MemberID != shiftSwapper.MemberID)
                {
                    Member mailToMember = new MemberBLL().Get(recipient.MemberID);
                    if (mailToMember != null && !string.IsNullOrEmpty(mailToMember.EmailAddress) && mailToMember.EmailAddress.Trim() != "@")
                    {
                        SendEmail(mailToMember.EmailAddress, shiftSwapper.Name + " needs your help!",
                                  "Hi " + mailToMember.FirstName + ",\n\n" +
                                  "Sadly, " + shiftSwapper.FirstName + " cannot perform his/her " + calendar.Name + " duty on " + cargs.ShiftDate.ToString("ddd dd MMM") + ".\n\n" +
                                  "We really could use your help!  Are you free?  If you have a few hours spare please put your name down.\n\n" +
                                  $"The SERV SL Calendar can be found here: https://{_domain}/Calendar\n\n" +
                                  "Thanks very much in advance!\n\n" +
                                  "SERV SL System" + FOOTER, new MemberBLL().GetUserIdForMember(shiftSwapper.MemberID));
                    }
                }
                else
                {
                    if (!string.IsNullOrEmpty(shiftSwapper.EmailAddress) && shiftSwapper.EmailAddress.Trim() != "@")
                    {
                        SendEmail(shiftSwapper.EmailAddress, "A swap request has been sent out for you",
                                  "Hi " + shiftSwapper.FirstName + ",\n\n" +
                                  "As requested, you have been removed from " + calendar.Name + " duty on " + cargs.ShiftDate.ToString("ddd dd MMM") + ".\n\n" +
                                  "An email has been sent out to see if someone can cover for you.\n\n" +
                                  $"The SERV SL Calendar can be found here: https://{_domain}/Calendar\n\n" +
                                  "Thanks,\n\n" +
                                  "SERV SL System" + FOOTER, new MemberBLL().GetUserIdForMember(cargs.MemberId));
                    }
                }
            }
        }