示例#1
0
        /// <summary>
        /// returns all changed
        /// </summary>
        /// <returns></returns>
        private List <BrandMetadataSetting> GetInputSettings()
        {
            var result = new List <BrandMetadataSetting>();

            foreach (var selected in Selection)
            {
                //retrieve if this group had a different selection before
                var prevSelection = SelectableSettings.FirstOrDefault(s => s.SelectableSetting.FilterGroup == selected.Key);
                if (prevSelection != null && prevSelection.SelectableSetting.BrandMetadataSelectableSettingId != selected.Value)
                {//remove selection from a previously selected setting that is now changing and no longer selected
                    prevSelection.SelectableSetting.FilterGroup = 0;
                    result.Add(prevSelection);
                }

                if (selected.Value > 0)
                {    //selected - apply selection
                    var newSelected = SelectableSettings.FirstOrDefault(s => s.SelectableSetting.BrandMetadataSelectableSettingId == selected.Value);
                    newSelected.SelectableSetting.FilterGroup = selected.Key;
                    if (GroupSelectableTypeChanges.ContainsKey(selected.Key))
                    {
                        newSelected.SelectableSetting.FilterSelectableType = GroupSelectableTypeChanges[selected.Key];
                    }
                    if (GroupSelectableRowsCountChanges.ContainsKey(SelectedGroup))
                    {
                        newSelected.SelectableSetting.FilterDepth = GroupSelectableRowsCountChanges[SelectedGroup];
                    }
                    result.Add(newSelected);
                }
            }

            return(result);
        }
示例#2
0
        protected void MakeLiveButton_Click(object sender, EventArgs e)
        {
            var saveCandidates = GetInputSettings();

            foreach (var setting in saveCandidates)
            {
                BrandMetadataSelectableSetting.Update(setting.SelectableSetting);
            }

            var b = Brand.Get(BrandId);

            b.FilterMarkup = MarkupTextBox.Text;
            Brand.Update(b);

            MainMultiView.ActiveViewIndex = 0;
            GeneralFeedbackLabel.SetSuccessMessage("changes were saved.");

            GroupSelectableTypeChanges.Clear();
            GroupSelectableRowsCountChanges.Clear();

            LoadPreviewState();
        }
示例#3
0
        private void LoadPreviewState()
        {
            if (GroupSelectableTypeChanges.ContainsKey(SelectedGroup))
            {//apply the previously saved selection for the group
                //filter selectable type in case we have such i.e. if a group is selected
                //AND it's selectable type was changed
                var selection = (SelectableMetadataType)GroupSelectableTypeChanges[SelectedGroup];
                Option1RadioButton.Checked = selection == SelectableMetadataType.DropDown;
                Option2RadioButton.Checked = selection == SelectableMetadataType.ComboBox;
            }

            if (GroupSelectableRowsCountChanges.ContainsKey(SelectedGroup))
            {
                RowsDropDownList.SelectedValue = GroupSelectableRowsCountChanges[SelectedGroup].ToString();
            }

            var brandMetaSetting = GetSelectedMetaSetting();

            if (brandMetaSetting != null && GroupDetailsPanel.Visible)
            {
                LoadMetaPreview(PreviewMetaInputDropDown, brandMetaSetting, 1, SelectableMetadataType.DropDown);
                LoadMetaPreview(PreviewMetaInputList, brandMetaSetting, int.Parse(RowsDropDownList.SelectedValue), SelectableMetadataType.ComboBox);
            }
        }