示例#1
0
    protected void ucDeleteButton_click(object sender, EventArgs e)
    {
        foreach (string key in Request.Form.Keys)
        {
            if (key.StartsWith("chkTargetContent_") && Request.Form[key] == "on")
            {
                long tcId = 0;
                long.TryParse(key.Substring(17), out tcId);

                if (tcId != 0)
                {
                    TargetedContent targetContentManager = new TargetedContent(_contentApi.RequestInformationRef);
                    targetContentManager.Delete(tcId);
                }
            }
        }

        Response.Redirect("TargetContentList.aspx");
    }
示例#2
0
    private void Bind()
    {
        TargetedContent targetContentManager = new TargetedContent(_contentApi.RequestInformationRef);
        Criteria<TargetedContentProperty> criteria = new Criteria<TargetedContentProperty>();
        criteria.AddFilter(TargetedContentProperty.IsGlobal, CriteriaFilterOperator.EqualTo, true);
        criteria.PagingInfo.RecordsPerPage = _contentApi.RequestInformationRef.PagingSize;
        criteria.PagingInfo.CurrentPage = ucPaging.SelectedPage + 1;

        List<TargetedContentData> targetContentList = targetContentManager.GetList(criteria);

        if (criteria.PagingInfo.TotalPages < 2)
        {
            ucPaging.Visible = false;
        }
        else
        {
           ucPaging.TotalPages = criteria.PagingInfo.TotalPages;
           ucPaging.CurrentPageIndex = ucPaging.SelectedPage;
        }

        ViewAllRepeater.DataSource = targetContentList;
        ViewAllRepeater.DataBind();
    }
示例#3
0
    private void Bind()
    {
        if (!IsPostBack)
        {
            hdnTargetContentSelectId.Value = "0";
        }

        TargetedContent targetContentManager = new TargetedContent(_contentApi.RequestInformationRef);
        Criteria<TargetedContentProperty> criteria = new Criteria<TargetedContentProperty>();
        criteria.PagingInfo.CurrentPage = ucPaging.SelectedPage;
        criteria.PagingInfo.RecordsPerPage = _contentApi.RequestInformationRef.PagingSize;

        criteria.AddFilter(TargetedContentProperty.IsGlobal, CriteriaFilterOperator.EqualTo, true);

        List<TargetedContentData> targetContentList = targetContentManager.GetList(criteria);
        ViewAllRepeater.DataSource = targetContentList;
        ViewAllRepeater.DataBind();

        if (criteria.PagingInfo.TotalPages < 2)
        {
            ucPaging.Visible = false;
        }
        else
        {
            ucPaging.CurrentPageIndex = criteria.PagingInfo.CurrentPage - 1;
            ucPaging.TotalPages = criteria.PagingInfo.TotalPages;
        }

        hdnTargetContentListUrl.Value = targetContentManager.RequestInformation.SitePath + "widgets/targetedcontent/controls/targetcontentlist.aspx";
    }
示例#4
0
    private void LoadTargetContentConfiguration(WidgetData targetContentWidget)
    {
        TargetedContent tcManager = new TargetedContent(_contentApi.RequestInformationRef);
        TargetedContentData targetContentData =
            (_targetContentId > 0 ? tcManager.GetItem(_targetContentId) : new TargetedContentData());

        if (_targetContentId == 0)
        {
            targetContentData.PageData = PageData.Restore(string.Format("<PageData xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"PB\"><IsMasterLayout>false</IsMasterLayout><masterID>0</masterID><pageID>0</pageID><languageID>0</languageID><Zones><DropZoneData><isMasterZone>false</isMasterZone><Columns><ColumnData><Guid>{0}</Guid><Display>false</Display><columnID>-1</columnID><width>100</width><unit>percent</unit></ColumnData></Columns></DropZoneData></Zones><Widgets /></PageData>", _columnGuid));
            targetContentData.Segments.Add(new SegmentData());
        }

        if (targetContentData != null)
        {

            txtName.Text = targetContentData.Name;
            PageBuilder pb = Page as PageBuilder;

            pb.Pagedata.Widgets.AddRange(targetContentData.PageData.Widgets);
            pb.Pagedata.Zones[0].Columns.AddRange(targetContentData.PageData.Zones[0].Columns);

            targetContentWidget.ChildColumns = targetContentData.PageData.Zones[0].Columns;

            pb.ClearView(layoutVersion.Staged, false);
            pb.Status = Mode.Editing;
            pb.viewType = layoutVersion.Staged;
            pb.View(pb.Pagedata);
        }
    }
示例#5
0
    private void Bind()
    {
        BindToolbars();

        if (txtName.Text == "" && _targetContentId != 0)
        {
            TargetedContent tcManager = new TargetedContent(_contentApi.RequestInformationRef);
            TargetedContentData targetContentData = tcManager.GetItem(_targetContentId);

            if (targetContentData != null)
            {
                txtName.Text = targetContentData.Name;
            }
        }
    }