Beispiel #1
0
        /// <summary>
        /// Loads the drop downs.
        /// </summary>
        private void LoadDropDowns(DataView dataView)
        {
            var entityTypeService = new EntityTypeService();

            ddlTransform.Items.Clear();
            if (dataView.EntityTypeId.HasValue)
            {
                var filteredEntityType = EntityTypeCache.Read(dataView.EntityTypeId.Value);
                foreach (var component in DataTransformContainer.GetComponentsByTransformedEntityName(filteredEntityType.Name).OrderBy(c => c.Title))
                {
                    var      transformEntityType = EntityTypeCache.Read(component.TypeName);
                    ListItem li = new ListItem(component.Title, transformEntityType.Id.ToString());
                    ddlTransform.Items.Add(li);
                }
            }
            ddlTransform.Items.Insert(0, new ListItem(string.Empty, string.Empty));

            // Get all entities
            ddlEntityType.DataSource = entityTypeService.GetEntities()
                                       .OrderBy(e => e.FriendlyName)
                                       .ToList();
            ddlEntityType.DataBind();

            ddlEntityType.Items.Insert(0, new ListItem(string.Empty, string.Empty));
        }
        private void BindTransformationTypes()
        {
            ddlTransformTypes.Items.Clear();

            foreach (var component in DataTransformContainer.GetComponentsByTransformedEntityName(PersonEntityType.Name).OrderBy(c => c.Title))
            {
                if (component.IsAuthorized(Authorization.VIEW, CurrentPerson))
                {
                    var      transformEntityType = EntityTypeCache.Get(component.TypeName);
                    ListItem li = new ListItem(component.Title, transformEntityType.Id.ToString());
                    ddlTransformTypes.Items.Add(li);
                }
            }

            ddlTransformTypes.Items.Insert(0, new ListItem("", ""));
        }
        public void BindDataTransformations()
        {
            ddlTransform.Items.Clear();
            int?entityTypeId = ddlEntityType.SelectedValueAsInt();

            if (entityTypeId.HasValue)
            {
                var filteredEntityType = EntityTypeCache.Read(entityTypeId.Value);
                foreach (var component in DataTransformContainer.GetComponentsByTransformedEntityName(filteredEntityType.Name).OrderBy(c => c.Title))
                {
                    var      transformEntityType = EntityTypeCache.Read(component.TypeName);
                    ListItem li = new ListItem(component.Title, transformEntityType.Id.ToString());
                    ddlTransform.Items.Add(li);
                }
            }
            ddlTransform.Items.Insert(0, new ListItem(string.Empty, string.Empty));
        }
Beispiel #4
0
        /// <summary>
        /// Binds the data transformations.
        /// </summary>
        /// <param name="rockContext">The rock context.</param>
        public void BindDataTransformations(RockContext rockContext)
        {
            ddlTransform.Items.Clear();
            int?entityTypeId = etpEntityType.SelectedEntityTypeId;

            if (entityTypeId.HasValue)
            {
                var filteredEntityType = EntityTypeCache.Get(entityTypeId.Value);
                foreach (var component in DataTransformContainer.GetComponentsByTransformedEntityName(filteredEntityType.Name).OrderBy(c => c.Title))
                {
                    if (component.IsAuthorized(Authorization.VIEW, this.CurrentPerson))
                    {
                        var      transformEntityType = EntityTypeCache.Get(component.TypeName);
                        ListItem li = new ListItem(component.Title, transformEntityType.Id.ToString());
                        ddlTransform.Items.Add(li);
                    }
                }
            }

            ddlTransform.Items.Insert(0, new ListItem(string.Empty, string.Empty));
        }
        private void DisplayDetails()
        {
            var values = GetAttributeValue(AttributeKey.EnabledCommunicationTypes).SplitDelimitedValues();
            var communicationDictionary = Enum
                                          .GetValues(typeof(CommunicationType))
                                          .Cast <CommunicationType>()
                                          .ToDictionary(t => (( int )t).ToString(), t => t.ToString())
                                          .Where(d => values.Contains(d.Key))
                                          .ToDictionary(k => k.Key, v => v.Value);

            rblCommunicationType.DataSource = communicationDictionary;
            rblCommunicationType.DataBind();

            dvpPhoneNumber.DefinedTypeId = DefinedTypeCache.Get(Rock.SystemGuid.DefinedType.COMMUNICATION_SMS_FROM.AsGuid()).Id;

            BindTransformationTypes();

            RecurringCommunication recurringCommunication = GetRecurringCommunication();

            tbName.Text = recurringCommunication.Name;
            dvpDataview.SetValue(recurringCommunication.DataView);
            if (recurringCommunication.Schedule != null)
            {
                sbScheduleBuilder.iCalendarContent = recurringCommunication.Schedule.iCalendarContent;
                DisplayScheduleDetails();
            }
            rblCommunicationType.SetValue(recurringCommunication.CommunicationType.ConvertToInt());

            if (recurringCommunication.TransformationEntityTypeId.HasValue)
            {
                if (ddlTransformTypes.Items.FindByValue(recurringCommunication.TransformationEntityTypeId.Value.ToString()) != null)
                {
                    ddlTransformTypes.SelectedValue = recurringCommunication.TransformationEntityTypeId.Value.ToString();
                }
                else
                {
                    var transformComponent = DataTransformContainer.GetComponentsByTransformedEntityName(PersonEntityType.Name)
                                             .SingleOrDefault(c => c.Id == recurringCommunication.TransformationEntityTypeId.Value);

                    if (transformComponent != null)
                    {
                        var li = new ListItem(transformComponent.Title, transformComponent.Id.ToString());
                        ddlTransformTypes.Items.Insert(1, li);
                        ddlTransformTypes.SelectedIndex = 1;
                    }
                }
            }

            UpdateCommunicationTypeUI(recurringCommunication.CommunicationType);

            tbFromName.Text  = recurringCommunication.FromName;
            tbFromEmail.Text = recurringCommunication.FromEmail;
            tbSubject.Text   = recurringCommunication.Subject;
            ceEmailBody.Text = recurringCommunication.EmailBody;

            dvpPhoneNumber.SetValue(recurringCommunication.PhoneNumberValueId);
            tbSMSBody.Text = recurringCommunication.SMSBody;

            tbPushNotificationTitle.Text = recurringCommunication.PushTitle;
            tbPushNotificationBody.Text  = recurringCommunication.PushMessage;
            cbPlaySound.Checked          = recurringCommunication.PushSound.IsNotNullOrWhiteSpace();
        }