예제 #1
0
        private void ClearAlert(int alertNotificationId)
        {
            RockContext rockContext = new RockContext();

            AlertNotificationService alertNotificationService = new AlertNotificationService(rockContext);
            AlertMessageService      alertMessageService      = new AlertMessageService(rockContext);

            var alert = alertNotificationService
                        .Get(alertNotificationId);

            alert.IsActive = false;

            rockContext.SaveChanges();
        }
예제 #2
0
        protected void AllClear_Click(object sender, CommandEventArgs e)
        {
            if (e.CommandName == "AllClear_Click")
            {
                int  index;
                bool bIsConverted = int.TryParse(e.CommandArgument.ToString(), out index);

                RockContext rockContext = new RockContext();

                AlertNotificationService alertNotificationService = new AlertNotificationService(rockContext);
                AlertMessageService      alertMessageService      = new AlertMessageService(rockContext);

                var alert = alertNotificationService
                            .Get(index);

                alert.IsActive = false;


                rockContext.SaveChanges();

                BindRepeater();
            }
        }
예제 #3
0
        protected void mdSendUpdate_SendClick(object sender, EventArgs e)
        {
            int alertID = hfAlertID.Value.AsInteger();

            if (tbAlertMessage.Text.IsNotNullOrWhiteSpace())
            {
                RockContext              rockContext              = new RockContext();
                AlertMessageService      alertMessageService      = new AlertMessageService(rockContext);
                AlertNotificationService alertNotificationService = new AlertNotificationService(rockContext);


                var alert = alertNotificationService
                            .Get(alertID);

                var alertMessage = new AlertMessage
                {
                    AlertNotification = alert,
                    Message           = tbAlertMessage.Text,
                };

                alertMessageService.Add(alertMessage);

                rockContext.SaveChanges();

                alertMessage.SendCommunication(GlobalAttributesCache.Value("DefaultSMSFromNumber").AsGuid());
            }


            if (hfAllClear.Value.AsBoolean())
            {
                ClearAlert(alertID);
            }
            mdSendUpdate.Hide();

            BindRepeater();
        }