public void ProcessReportFilter_Called_AdoDisposed()
        {
            // Arrange, Act
            var result = ReportingData.ProcessReportFilter(
                _sharepointShims.ListShim,
                _sharepointShims.WebShim,
                string.Empty);

            // Assert
            result.ShouldSatisfyAllConditions(
                () => result.ShouldBe("<In><FieldRef Name=\"Title\"/><Values></Values></In>"),
                () => _adoShims.ConnectionsDisposed.Count.ShouldBe(1),
                () => _adoShims.CommandsDisposed.Count.ShouldBe(1),
                () => _adoShims.DataReadersDisposed.Count.ShouldBe(1));
        }
        public void GetReportingData_Called_AdoDisposed()
        {
            // Arrange
            ShimReportBiz.ConstructorGuid = (biz, guid) =>
            {
                new ShimReportBiz(biz)
                {
                    SiteExists = () => true
                };
            };

            ShimDbDataAdapter.AllInstances.FillDataSet = (adapter, set) =>
            {
                var table = new DataTable(SampleTable);
                set.Tables.Add(table);
                return(0);
            };

            // Act
            var result = ReportingData.GetReportingData(
                _sharepointShims.WebShim,
                string.Empty,
                true,
                string.Empty,
                string.Empty,
                SamplePageNum,
                SamplePageSize);

            // Assert
            result.ShouldSatisfyAllConditions(
                () => result.ShouldNotBeNull(),
                () => result.Tables.Count.ShouldBe(1),
                () => result.Tables[0].TableName.ShouldBe(SampleTable),
                () => _adoShims.CommandsDisposed.Count.ShouldBe(2),
                () => _adoShims.DataAdaptersDisposed.Count.ShouldBe(1));
        }
Пример #3
0
 protected string GetPreviewUrl(ReportingData data)
 {
     if (data.TemplateIsPageBuilder)
         return Page.ResolveClientUrl("~/" + data.TemplateFileName) + "?pageid=" + data.ContentId.ToString();
     else if (data.ContentType.ToString() == "101" || data.ContentType.ToString() == "103")
         return Page.ResolveClientUrl("~/workarea/downloadasset.aspx?id=" + data.ContentId.ToString());
     else
     {
         if (data.ContentType == EkEnumeration.CMSContentType.Forms)
             return Page.ResolveClientUrl("~/" + data.TemplateFileName) + "?ekfrm=" + data.ContentId.ToString();
         else
             return Page.ResolveClientUrl("~/" + data.TemplateFileName) + "?id=" + data.ContentId.ToString();
     }
 }
Пример #4
0
    protected string GetContentTypeIcon(ReportingData data)
    {
        StringBuilder sb = new StringBuilder("<img src=\"");
        string title = string.Empty;
        switch (data.ContentType)
        {
            case EkEnumeration.CMSContentType.Content:
                switch (data.ContentSubType)
                {
                    case EkEnumeration.CMSContentSubtype.PageBuilderData:
                    case EkEnumeration.CMSContentSubtype.PageBuilderMasterData:
                        sb.Append(Page.ResolveClientUrl("~/workarea/images/application/layout_content.png"));
                        title = "Page Layout";
                        break;
                    case EkEnumeration.CMSContentSubtype.Content:
                        sb.Append(Page.ResolveClientUrl("~/workarea/images/ui/icons/contenthtml.png"));
                        title = "HTML Content";
                        break;
                    default:
                        sb.Append(Page.ResolveClientUrl("~/workarea/images/UI/Icons/folderView.png"));
                        title = "Content";
                        break;
                }
                break;
            case EkEnumeration.CMSContentType.Forms:
                sb.Append(Page.ResolveClientUrl("~/workarea/images/ui/icons/contentform.png"));
                title = data.SmartformId > 0 ? ("Smartform: " + data.SmartformTitle) : "HTML Form/Survey";
                break;
            case EkEnumeration.CMSContentType.Archive_Content:
                sb.Append(Page.ResolveClientUrl("~/workarea/images/ui/icons/contentArchived.png"));
                title = "Archived Content";
                break;
            case EkEnumeration.CMSContentType.Archive_Forms:
                sb.Append(Page.ResolveClientUrl("~/workarea/images/ui/icons/contentFormArchived.png"));
                title = "Archived Form";
                break;
            case EkEnumeration.CMSContentType.CatalogEntry:
                switch ((int)data.ContentSubType)
                {
                    case (int)Ektron.Cms.Common.EkEnumeration.CatalogEntryType.Product:
                        sb.Append(Page.ResolveClientUrl("~/workarea/images/ui/icons/brick.png"));
                        title = GetMessage("lbl commerce products");
                        break;
                    case (int)Ektron.Cms.Common.EkEnumeration.CatalogEntryType.ComplexProduct:
                        sb.Append(Page.ResolveClientUrl("~/workarea/images/ui/icons/bricks.png"));
                        title = GetMessage("lbl commerce products");
                        break;
                    case (int)Ektron.Cms.Common.EkEnumeration.CatalogEntryType.Bundle:
                        sb.Append(Page.ResolveClientUrl("~/workarea/images/ui/icons/package.png"));
                        title = GetMessage("lbl commerce bundles");
                        break;
                    case (int)Ektron.Cms.Common.EkEnumeration.CatalogEntryType.Kit:
                        sb.Append(Page.ResolveClientUrl("~/workarea/images/ui/icons/box.png"));
                        title = GetMessage("lbl commerce kits");
                        break;
                    case -1: // Ektron.Cms.Common.EkEnumeration.CatalogEntryType.SubscriptionProduct
                        sb.Append(Page.ResolveClientUrl("~/workarea/images/ui/icons/bookGreen.png"));
                        title = GetMessage("lbl commerce subscriptions");
                        break;
                }
                break;
            default:
                switch ((byte)data.ContentType)
                {
                    case 101:
                        switch (System.IO.Path.GetExtension(data.AssetVersion).ToLower())
                        {
                            case ".xls":
                            case ".xlsx":
                                sb.Append(Page.ResolveClientUrl("~/assetmanagement/images/ms-excel.png"));
                                break;
                            case ".ppt":
                            case ".pptx":
                                sb.Append(Page.ResolveClientUrl("~/assetmanagement/images/ms-powerpoint.png"));
                                break;
                            case ".doc":
                            case ".docx":
                            default:
                                sb.Append(Page.ResolveClientUrl("~/workarea/images/ui/icons/filetypes/word.png"));
                                break;

                        }
                        title = "Office Document";
                        break;
                    case 102:
                        sb.Append(Page.ResolveClientUrl("~/workarea/images/ui/icons/contentmanagedfiles.png"));
                        title = "Managed File";
                        break;
                    case 103:
                        if (Ektron.Cms.Common.EkFunctions.IsImage(System.IO.Path.GetExtension(data.AssetVersion).ToLower()))
                        {
                            sb.Append(Page.ResolveClientUrl("~/assetmanagement/images/Image.png"));
                            title = "Image Type";
                        }
                        else if (System.IO.Path.GetExtension(data.AssetVersion).ToLower() == ".pdf")
                        {
                            sb.Append(Page.ResolveClientUrl("~/assetmanagement/images/adobe-pdf.png"));
                            title = "Adobe Acrobat Document";
                        }
                        else if (System.IO.Path.GetExtension(data.AssetVersion).ToLower() == ".zip")
                        {
                            sb.Append(Page.ResolveClientUrl("~/assetmanagement/images/WinZip.png"));
                            title = "Zip File";
                        }
                        else
                        {
                            sb.Append(Page.ResolveClientUrl("~/assetmanagement/images/ms-notepad.png"));
                            title = "Unknown Content Type";
                        }
                        break;
                    case 104:
                        sb.Append(Page.ResolveClientUrl("~/workarea/images/ui/icons/film.png"));
                        title = "Multimedia";
                        break;
                    default:
                        sb.Append(Page.ResolveClientUrl("~/workarea/images/UI/Icons/folderView.png"));
                        break;
                }
                break;
        }

        sb.Append("\" title=\"" + title + "\" />");

        return sb.ToString();
    }
Пример #5
0
    protected string GetContentTypeIcon(ReportingData data, bool titleOnly)
    {
        StringBuilder sb = new StringBuilder("<img src=\"");
        string title = string.Empty;
        switch (data.ContentType)
        {
            case EkEnumeration.CMSContentType.Content:
                switch (data.ContentSubType)
                {
                    case EkEnumeration.CMSContentSubtype.PageBuilderData:
                    case EkEnumeration.CMSContentSubtype.PageBuilderMasterData:
                        sb.Append(Page.ResolveClientUrl("~/workarea/images/application/layout_content.png"));
                        title = "Page Layout";
                        break;
                    case EkEnumeration.CMSContentSubtype.Content:
                        sb.Append(Page.ResolveClientUrl("~/workarea/images/ui/icons/contenthtml.png"));
                        title = "HTML Content";
                        break;
                    default:
                        sb.Append(Page.ResolveClientUrl("~/workarea/images/UI/Icons/folderView.png"));
                        title = "Content";
                        break;
                }
                break;
            case EkEnumeration.CMSContentType.Forms:
                sb.Append(Page.ResolveClientUrl("~/workarea/images/ui/icons/contentform.png"));
                title = data.SmartformId > 0 ? ("Smartform: " + data.SmartformTitle) : "HTML Form/Survey";
                break;
            default:
                switch ((byte)data.ContentType)
                {
                    case 101:
                        sb.Append(Page.ResolveClientUrl("~/workarea/images/ui/icons/filetypes/word.png"));
                        title = "Office Document";
                        break;
                    case 102:
                        sb.Append(Page.ResolveClientUrl("~/workarea/images/ui/icons/contentmanagedfiles.png"));
                        title = "Managed File";
                        break;
                    case 103:
                        if (Ektron.Cms.Common.EkFunctions.IsImage(System.IO.Path.GetExtension(data.AssetVersion).ToLower()))
                        {
                            sb.Append(Page.ResolveClientUrl("~/assetmanagement/images/Image.png"));
                            title = "Image Type";
                        }
                        else if (System.IO.Path.GetExtension(data.AssetVersion).ToLower() == ".pdf")
                        {
                            sb.Append(Page.ResolveClientUrl("~/assetmanagement/images/adobe-pdf.png"));
                            title = "Adobe Acrobat Document";
                        }
                        else if (System.IO.Path.GetExtension(data.AssetVersion).ToLower() == ".zip")
                        {
                            sb.Append(Page.ResolveClientUrl("~/assetmanagement/images/WinZip.png"));
                            title = "Zip File";
                        }
                        else
                        {
                            sb.Append(Page.ResolveClientUrl("~/assetmanagement/images/ms-notepad.png"));
                            title = "Unknown Content Type";
                        }
                        break;
                    case 104:
                        sb.Append(Page.ResolveClientUrl("~/workarea/images/ui/icons/film.png"));
                        title = "Multimedia";
                        break;
                    default:
                        sb.Append(Page.ResolveClientUrl("~/workarea/images/UI/Icons/folderView.png"));
                        break;
                }
                break;
        }

        sb.Append("\" title=\"" + title + "\" />");

        return titleOnly ? title : sb.ToString();
    }