Ejemplo n.º 1
0
        public static void ShiftCancelRequest(string toAddress, string firstName, string employeeName, string busLocation, DateTime shiftStart, DateTime shiftFinish)
        {
            if (MessagingService.IsNotificationsEnabled)
            {
                var userPrefs = MessagingService.GetUserPreferences(toAddress);

                if (userPrefs.NotifyByEmail)
                {
                    MailHelper.SendShiftCancelRequestMail(toAddress, firstName, employeeName, busLocation, shiftStart, shiftFinish);
                }
            }
        }
Ejemplo n.º 2
0
        public static void BusinessRegisteredEmployee(string firstName, string busName, bool isExistingUser, string toAddress = null, string mobileNumber = null)
        {
            if (MessagingService.IsNotificationsEnabled)
            {
                if (isExistingUser)
                {
                    UserPreferencesDTO userPrefs = null;
                    if (!String.IsNullOrEmpty(toAddress))
                    {
                        userPrefs = MessagingService.GetUserPreferences(toAddress);
                    }

                    if (userPrefs.NotifyByEmail)
                    {
                        MailHelper.SendBusRegEmplMail(toAddress, firstName, busName, isExistingUser);
                    }
                    if (userPrefs.NotifyBySMS && !String.IsNullOrEmpty(mobileNumber))
                    {
                        SmsHelper.SendBusRegEmplSms(mobileNumber);
                    }
                    if (userPrefs.NotifyByApp)
                    {
                        using (NotificationsAPIController notificationController = new NotificationsAPIController())
                        {
                            //Send push notification
                            notificationController.Post(String.Format(ConfigurationManager.AppSettings.Get("mailBusRegExistingBody"), firstName, busName, ConfigurationManager.AppSettings.Get("ApiBaseURL")), toAddress)
                            .ContinueWith(t => Trace.TraceError("ERROR:" + t.Exception.ToString()), TaskContinuationOptions.OnlyOnFaulted);
                        }
                    }
                }
                else //New user, does not already exist in Rooster
                {
                    if (!String.IsNullOrEmpty(toAddress))
                    {
                        MailHelper.SendBusRegEmplMail(toAddress, firstName, busName, isExistingUser);
                    }

                    if (!String.IsNullOrEmpty(mobileNumber))
                    {
                        SmsHelper.SendBusRegEmplSms(mobileNumber);
                    }
                }
            }
        }
Ejemplo n.º 3
0
        public static void ShiftBroadcast(string toAddress, string firstName)
        {
            if (MessagingService.IsNotificationsEnabled)
            {
                var userPrefs = MessagingService.GetUserPreferences(toAddress);

                if (userPrefs.NotifyByEmail)
                {
                    MailHelper.SendShiftBroadcastMailAsync(toAddress, firstName);
                }
                if (userPrefs.NotifyByApp)
                {
                    using (NotificationsAPIController notificationController = new NotificationsAPIController())
                    {
                        //Send push notification
                        notificationController.Post(String.Format(ConfigurationManager.AppSettings.Get("mailShiftBroadcastBody"), firstName), toAddress)
                        .ContinueWith(t => Trace.TraceError("ERROR:" + t.Exception.ToString()), TaskContinuationOptions.OnlyOnFaulted);
                    }
                }
            }
        }
Ejemplo n.º 4
0
        public static void ShiftCancelled(string toAddress, string firstName, string busLocation, DateTime shiftStart, DateTime shiftFinish)
        {
            if (MessagingService.IsNotificationsEnabled)
            {
                var userPrefs = MessagingService.GetUserPreferences(toAddress);

                if (userPrefs.NotifyByEmail)
                {
                    MailHelper.SendShiftCancelledMail(toAddress, firstName, busLocation, shiftStart, shiftFinish);
                }
                if (userPrefs.NotifyByApp)
                {
                    using (NotificationsAPIController notificationController = new NotificationsAPIController())
                    {
                        //Send push notification
                        notificationController.Post(String.Format(ConfigurationManager.AppSettings.Get("mailShiftCancelledBody"), firstName, busLocation, shiftStart.ToString(), shiftFinish.ToString()), toAddress)
                        .ContinueWith(t => Trace.TraceError("ERROR:" + t.Exception.ToString()), TaskContinuationOptions.OnlyOnFaulted);
                    }
                }
            }
        }