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 bool TakeControl(int memberID, string overrideNumber)
        {
            log.LogStart();
            User   u   = new MemberBLL().GetUserForMember(memberID);
            Member m   = new MemberBLL().Get(memberID);
            bool   ret = new ControllerBLL().DivertNumber(m, overrideNumber);

            if (ret)
            {
                log.Info("Informing controller . . .");
                new MessageBLL().SendSMSMessage(m.MobileNumber, string.Format("Hi {0}, You now have control", m.FirstName), u.UserID, true);
                new MessageBLL().PushBullet("servssl_controllers", "Controller On Shift", string.Format("{0} now has control", m.FirstName));
            }
            return(ret);
        }
Beispiel #3
0
 public SmsSendMessageResponse SendSMSMessage(string numbers, string message, int senderUserID, bool fromServ)
 {
     numbers = numbers.Trim().Replace(" ", "");
     if (numbers.EndsWith(","))
     {
         numbers = numbers.Substring(0, numbers.Length - 1);
     }
     new MessageDAL().LogSentSMSMessage(numbers, message, senderUserID);
     if (!fromServ)
     {
         var sender = new MemberBLL().GetByUserID(senderUserID);
         return(SERV.Utils.Messaging.SendTextMessage(numbers, message, sender.MobileNumber));
     }
     return(SERV.Utils.Messaging.SendTextMessage(numbers, message));
 }
Beispiel #4
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 #5
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 #6
0
 public bool SendSMSMessage(string numbers, string message, int senderUserID, bool fromServ)
 {
     numbers = numbers.Trim().Replace(" ", "");
     if (numbers.EndsWith(","))
     {
         numbers = numbers.Substring(0, numbers.Length - 1);
     }
     SERVDALFactory.Factory.MessageDAL().LogSentSMSMessage(numbers, message, senderUserID);
     if (!fromServ)
     {
         Member sender = new MemberBLL().GetByUserID(senderUserID);
         SERV.Utils.Messaging.SendTextMessage(numbers, message, sender.MobileNumber);
         return(true);
     }
     SERV.Utils.Messaging.SendTextMessage(numbers, message);
     return(true);
 }
Beispiel #7
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));
                    }
                }
            }
        }
Beispiel #8
0
 public bool SendMembershipEmail(Member m, int senderUserID, bool onlyNeverLoggedIn)
 {
     if (m != null)
     {
         User u = new MemberBLL().GetUserForMember(m.MemberID);
         if (u != null)
         {
             if (u.LastLoginDate == null || !onlyNeverLoggedIn)
             {
                 return(SendMemberUpdateEmail(m, u, senderUserID));
             }
             else
             {
                 log.Debug("Skipping as member has logged in");
                 return(true);
             }
         }
     }
     return(false);
 }
Beispiel #9
0
        public bool SendMemberUpdateEmail(Member m, User u, int senderUserID)
        {
            DateTime?lastLoginDate = u.LastLoginDate;

            m = new MemberBLL().Get(m.MemberID);
            string tags = "";

            foreach (Tag t in m.Tags)
            {
                tags += "\"" + t.TagName + "\"   ";
            }
            string body = "Hi " + m.FirstName + ",\r\n\r\n" +
                          "This is a periodical email from the SERV SSL Membership System to confirm the data we hold about you.\r\n\r\n" +
                          (
                lastLoginDate == null ?
                "We notice you have not yet logged into your account.  " +
                "It is essential that you do so to keep your contact details and volunteering preferences up to date.\r\n\r\n  " +
                $"Please goto https://{_domain} ASAP.\r\n" +
                "More information regarding the new Membership System and login instructions can be found in this SERV Forum topic: http://servssl.org.uk/members/index.php?/topic/1437-serv-system-action-required-by-all/\r\n\r\n"
                                                :
                "You last logged onto the system on " + ((DateTime)lastLoginDate).ToString("dd MMM yy HH:mm") + "\r\n\r\n"
                          ) +
                          "Here are the details we currently hold for you.  Please check them and update them in the system if they are incorrect.\r\n\r\n" +
                          "First Name: " + m.FirstName + "\r\n" +
                          "Last Name: " + m.LastName + "\r\n" +
                          "Email: " + m.EmailAddress + "\r\n" +
                          "Mobile: " + m.MobileNumber + "\r\n" +
                          "Home Phone: " + m.HomeNumber + "\r\n" +
                          "Birth Year: " + m.BirthYear + "\r\n" +
                          "Occupation: " + m.Occupation + "\r\n" +
                          "Address: " + m.Address1 + " " + m.Address2 + " " + m.Address3 + " " + m.Town + " " + m.County + "\n" +
                          "Post Code: " + m.PostCode + "\r\n" +
                          "Next of Kin (NOK): " + m.NextOfKin + "\r\n" +
                          "NOK Address: " + m.NextOfKinAddress + "\r\n" +
                          "NOK Phone: " + m.NextOfKinPhone + "\r\n\r\n" +
                          "Your preferences (Tags):\r\n\r\n" +
                          tags + "\r\n\r\n" +
                          "Thanks,\r\n\r\nSERV SL System" + FOOTER;

            return(SendEmail(m.EmailAddress, "SERV SL Member Update", body, senderUserID));
        }
Beispiel #10
0
        public bool SendAllActiveMembersMembershipEmail(int senderUserID, bool onlyNeverLoggedIn)
        {
            DateTime      s       = log.LogStart();
            List <Member> members = new MemberBLL().List("", true);

            foreach (Member m in members)
            {
                try
                {
                    log.Debug(string.Format("Sending membership update to {0}", m.EmailAddress));
                    SendMembershipEmail(m, senderUserID, onlyNeverLoggedIn);
                    Thread.Sleep(20);
                }
                catch (Exception e)
                {
                    log.Debug(string.Format("Membership update to {0} failed because {1}", m.EmailAddress, e.Message));
                }
            }
            log.LogEnd();
            log.LogPerformace(s);
            return(true);
        }
Beispiel #11
0
        public bool SendMembershipEmail(string emailAddress, int senderUserID, bool onlyNeverLoggedIn)
        {
            Member m = new MemberBLL().GetByEmail(emailAddress);

            return(SendMembershipEmail(m, senderUserID, onlyNeverLoggedIn));
        }