当前位置: 首页>>代码示例>>C#>>正文


C# IDataContainer.GetValue方法代码示例

本文整理汇总了C#中IDataContainer.GetValue方法的典型用法代码示例。如果您正苦于以下问题:C# IDataContainer.GetValue方法的具体用法?C# IDataContainer.GetValue怎么用?C# IDataContainer.GetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IDataContainer的用法示例。


在下文中一共展示了IDataContainer.GetValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetTitle

    /// <summary>
    /// Gets title text.
    /// </summary>
    /// <param name="data">Source data</param>
    /// <param name="isContentFile">If true, the file is a content file</param>
    private string GetTitle(IDataContainer data, bool isContentFile)
    {
        string title = null;
        switch (SourceType)
        {
            case MediaSourceEnum.Attachment:
            case MediaSourceEnum.DocumentAttachments:
                title = ValidationHelper.GetString(data.GetValue("AttachmentTitle"), null);
                break;

            case MediaSourceEnum.Content:
                if (isContentFile)
                {
                    title = ValidationHelper.GetString(data.GetValue("AttachmentTitle"), null);
                }
                break;

            case MediaSourceEnum.MediaLibraries:
                title = ValidationHelper.GetString(data.GetValue("FileTitle"), null);
                break;

            case MediaSourceEnum.MetaFile:
                title = ValidationHelper.GetString(data.GetValue("MetaFileTitle"), null);
                break;
        }

        return title;
    }
开发者ID:dlnuckolls,项目名称:pfh-paypalintegration,代码行数:33,代码来源:InnerMediaView.ascx.cs

示例2: GetFileName

    /// <summary>
    /// Gets file name according available columns.
    /// </summary>
    /// <param name="data">DataRow containing data</param>
    private string GetFileName(IDataContainer data)
    {
        string fileName = "";

        if (data != null)
        {
            if (data.ContainsColumn("FileExtension"))
            {
                fileName = String.Concat(data.GetValue("FileName"), data.GetValue("FileExtension"));
            }
            else
            {
                fileName = data.GetValue(FileNameColumn).ToString();
            }
        }

        return fileName;
    }
开发者ID:dlnuckolls,项目名称:pfh-paypalintegration,代码行数:22,代码来源:InnerMediaView.ascx.cs

示例3: GetSiteName

    /// <summary>
    /// Returns the sitename according to item info.
    /// </summary>
    /// <param name="data">Row containing information on the current item</param>
    /// <param name="isMediaFile">Indicates whether the file is media file</param>
    private string GetSiteName(IDataContainer data, bool isMediaFile)
    {
        int siteId = 0;
        string result = "";

        if (isMediaFile)
        {
            if (data.ContainsColumn("FileSiteID"))
            {
                // Imported media file
                siteId = ValidationHelper.GetInteger(data.GetValue("FileSiteID"), 0);
            }
            else
            {
                // Npt imported yet
                siteId = RaiseOnSiteIdRequired();
            }
        }
        else
        {
            if (data.ContainsColumn("SiteName"))
            {
                // Content file
                result = ValidationHelper.GetString(data.GetValue("SiteName"), "");
            }
            else
            {
                if (data.ContainsColumn("AttachmentSiteID"))
                {
                    // Non-versioned attachment
                    siteId = ValidationHelper.GetInteger(data.GetValue("AttachmentSiteID"), 0);
                }
                else if (TreeNodeObj != null)
                {
                    // Versioned attachment
                    siteId = TreeNodeObj.NodeSiteID;
                }
                else if (data.ContainsColumn("MetaFileSiteID"))
                {
                    // Metafile
                    siteId = ValidationHelper.GetInteger(data.GetValue("MetaFileSiteID"), 0);
                }
            }
        }

        if (result == "")
        {
            if (String.IsNullOrEmpty(siteName) || (mLastSiteId != siteId))
            {
                SiteInfo si = SiteInfoProvider.GetSiteInfo(siteId);
                if (si != null)
                {
                    mLastSiteId = si.SiteID;
                    result = si.SiteName;
                    siteName = result;
                }
            }
            else
            {
                result = siteName;
            }
        }

        return result;
    }
开发者ID:dlnuckolls,项目名称:pfh-paypalintegration,代码行数:70,代码来源:InnerMediaView.ascx.cs

示例4: GetWebDAVEditControl

    /// <summary>
    /// Initializes WebDAV edit control.
    /// </summary>
    /// <param name="webDAVElem">WebDAV edit control to initialize</param>
    /// <param name="data">Data row with data on related media file</param>
    public void GetWebDAVEditControl(ref WebDAVEditControl webDAVElem, IDataContainer data)
    {
        if (webDAVElem != null)
        {
            if (webDAVElem.ControlType == WebDAVControlTypeEnum.Media)
            {
                webDAVElem.MediaFileLibraryID = ValidationHelper.GetInteger(data.GetValue("FileLibraryID"), 0);
                webDAVElem.MediaFilePath = ValidationHelper.GetString(data.GetValue("FilePath"), null);
                webDAVElem.Enabled = true;
            }
            else if (webDAVElem.ControlType == WebDAVControlTypeEnum.Attachment)
            {
                webDAVElem.Enabled = (CMSContext.CurrentUser.IsAuthorizedPerDocument(TreeNodeObj, NodePermissionsEnum.Modify) == AuthorizationResultEnum.Allowed);

                string className = ValidationHelper.GetString(data.GetValue("ClassName"), "");

                if (className.ToLowerCSafe() == "cms.file")
                {
                    webDAVElem.FileName = ValidationHelper.GetString(data.GetValue("AttachmentName"), null);
                    webDAVElem.AttachmentFieldName = "FileAttachment";
                    webDAVElem.NodeAliasPath = ValidationHelper.GetString(data.GetValue("NodeAliasPath"), null);
                    webDAVElem.NodeCultureCode = ValidationHelper.GetString(data.GetValue("DocumentCulture"), null);
                }
                else
                {
                    webDAVElem.FileName = ValidationHelper.GetString(data.GetValue("AttachmentName"), null);
                    webDAVElem.NodeAliasPath = TreeNodeObj.NodeAliasPath;
                    webDAVElem.NodeCultureCode = TreeNodeObj.DocumentCulture;
                }

                // Set Group ID for live site
                webDAVElem.GroupID = IsLiveSite ? TreeNodeObj.GetIntegerValue("NodeGroupID") : 0;
            }

            webDAVElem.IsLiveSite = IsLiveSite;
            webDAVElem.UseImageButton = false;
            webDAVElem.Visible = true;
        }
    }
开发者ID:hollycooper,项目名称:Sportscar-Standings,代码行数:44,代码来源:InnerMediaView.ascx.cs

示例5: GetDescription

    /// <summary>
    /// Gets description text.
    /// </summary>
    /// <param name="data">Source data</param>
    /// <param name="isContentFile">If true, the file is a content file</param>
    private string GetDescription(IDataContainer data, bool isContentFile)
    {
        string desc = null;
        switch (SourceType)
        {
            case MediaSourceEnum.Attachment:
            case MediaSourceEnum.DocumentAttachments:
                desc = ValidationHelper.GetString(data.GetValue("AttachmentDescription"), null);
                break;

            case MediaSourceEnum.Content:
                if (isContentFile)
                {
                    desc = ValidationHelper.GetString(data.GetValue("AttachmentDescription"), null);
                }
                break;

            case MediaSourceEnum.MediaLibraries:
                desc = ValidationHelper.GetString(data.GetValue("FileDescription"), null);
                break;

            case MediaSourceEnum.MetaFile:
                desc = ValidationHelper.GetString(data.GetValue("MetaFileDescription"), null);
                break;
        }

        return desc;
    }
开发者ID:dlnuckolls,项目名称:pfh-paypalintegration,代码行数:33,代码来源:InnerMediaView.ascx.cs

示例6: WriteDataContainer

    /// <summary>
    /// Writes the data container to the output.
    /// </summary>
    /// <param name="dc">Container to write</param>
    protected void WriteDataContainer(IDataContainer dc)
    {
        StringBuilder sb = new StringBuilder();

        sb.Append("<table class=\"table table-hover\" style=\"margin-top: 16px;\">");

        // Add header
        sb.AppendFormat("<thead><tr class=\"unigrid-head\"><th>{0}</th><th class=\"main-column-100\">{1}</th></tr></thead><tbody>", GetString("General.FieldName"), GetString("General.Value"));

        // Add values
        foreach (string column in dc.ColumnNames)
        {
            try
            {
                object value = dc.GetValue(column);

                // Binary columns
                string content = null;
                if (value is byte[])
                {
                    byte[] data = (byte[])value;
                    content = "<" + GetString("General.BinaryData") + ", " + DataHelper.GetSizeString(data.Length) + ">";
                }
                else
                {
                    content = ValidationHelper.GetString(value, String.Empty);
                }

                if (!String.IsNullOrEmpty(content))
                {
                    sb.AppendFormat("<tr><td><strong>{0}</strong></td><td class=\"wrap-normal\">", column);

                    // Possible DataTime columns
                    if (value is DateTime)
                    {
                        DateTime dateTime = Convert.ToDateTime(content);
                        CultureInfo cultureInfo = CultureHelper.GetCultureInfo(MembershipContext.AuthenticatedUser.PreferredUICultureCode);
                        content = dateTime.ToString(cultureInfo);
                    }

                    // Process content
                    ProcessContent(sb, dc, column, ref content);

                    sb.Append("</td></tr>");
                }
            }
            catch
            {
            }
        }

        sb.Append("</tbody></table><br />\n");

        pnlContent.Controls.Add(new LiteralControl(sb.ToString()));
    }
开发者ID:dlnuckolls,项目名称:pfh-paypalintegration,代码行数:59,代码来源:ViewObject.ascx.cs

示例7: GetArgumentSet

    /// <summary>
    /// Returns argument set for the passed file data row.
    /// </summary>
    /// <param name="data">Data row object holding all the data on current file</param>
    public string GetArgumentSet(IDataContainer data)
    {
        string className = ValidationHelper.GetString(data.GetValue("ClassName"), String.Empty).ToLowerCSafe();
        string name = string.Empty;

        // Get file name with extension
        switch (SourceType)
        {
            case MediaSourceEnum.DocumentAttachments:
                name = AttachmentHelper.GetFullFileName(Path.GetFileNameWithoutExtension(data.GetValue("AttachmentName").ToString()), data.GetValue("AttachmentExtension").ToString());
                break;
            case MediaSourceEnum.MetaFile:
                name = MetaFileInfoProvider.GetFullFileName(Path.GetFileNameWithoutExtension(data.GetValue("MetaFileName").ToString()), data.GetValue("MetaFileExtension").ToString());
                break;
            default:
                name = data.GetValue("DocumentName").ToString();
                break;
        }

        StringBuilder sb = new StringBuilder();

        // Common information for both content & attachments
        sb.Append("name|" + CMSDialogHelper.EscapeArgument(name));

        // Load attachment info only for CMS.File document type
        if (((SourceType != MediaSourceEnum.Content) && (SourceType != MediaSourceEnum.MetaFile)) || (className == "cms.file"))
        {
            sb.Append("|AttachmentExtension|" + CMSDialogHelper.EscapeArgument(data.GetValue("AttachmentExtension")));
            sb.Append("|AttachmentImageWidth|" + CMSDialogHelper.EscapeArgument(data.GetValue("AttachmentImageWidth")));
            sb.Append("|AttachmentImageHeight|" + CMSDialogHelper.EscapeArgument(data.GetValue("AttachmentImageHeight")));
            sb.Append("|AttachmentSize|" + CMSDialogHelper.EscapeArgument(data.GetValue("AttachmentSize")));
            sb.Append("|AttachmentGUID|" + CMSDialogHelper.EscapeArgument(data.GetValue("AttachmentGUID")));
        }
        else if (SourceType == MediaSourceEnum.MetaFile)
        {
            sb.Append("|MetaFileExtension|" + CMSDialogHelper.EscapeArgument(data.GetValue("MetaFileExtension")));
            sb.Append("|MetaFileImageWidth|" + CMSDialogHelper.EscapeArgument(data.GetValue("MetaFileImageWidth")));
            sb.Append("|MetaFileImageHeight|" + CMSDialogHelper.EscapeArgument(data.GetValue("MetaFileImageHeight")));
            sb.Append("|MetaFileSize|" + CMSDialogHelper.EscapeArgument(data.GetValue("MetaFileSize")));
            sb.Append("|MetaFileGUID|" + CMSDialogHelper.EscapeArgument(data.GetValue("MetaFileGUID")));
            sb.Append("|SiteID|" + CMSDialogHelper.EscapeArgument(data.GetValue("MetaFileSiteID")));
        }
        else
        {
            sb.Append("|AttachmentExtension||AttachmentImageWidth||AttachmentImageHeight||AttachmentSize||AttachmentGUID|");
        }

        // Get source type specific information
        if (SourceType == MediaSourceEnum.Content)
        {
            sb.Append("|NodeSiteID|" + CMSDialogHelper.EscapeArgument(data.GetValue("NodeSiteID")));
            sb.Append("|SiteName|" + CMSDialogHelper.EscapeArgument(data.GetValue("SiteName")));
            sb.Append("|NodeGUID|" + CMSDialogHelper.EscapeArgument(data.GetValue("NodeGUID")));
            sb.Append("|NodeID|" + CMSDialogHelper.EscapeArgument(data.GetValue("NodeID")));
            sb.Append("|NodeAlias|" + CMSDialogHelper.EscapeArgument(data.GetValue("NodeAlias")));
            sb.Append("|NodeAliasPath|" + CMSDialogHelper.EscapeArgument(data.GetValue("NodeAliasPath")));
            sb.Append("|DocumentUrlPath|" + CMSDialogHelper.EscapeArgument(data.GetValue("DocumentUrlPath")));
            sb.Append("|DocumentExtensions|" + CMSDialogHelper.EscapeArgument(data.GetValue("DocumentExtensions")));
            sb.Append("|ClassName|" + CMSDialogHelper.EscapeArgument(data.GetValue("ClassName")));
            sb.Append("|NodeLinkedNodeID|" + CMSDialogHelper.EscapeArgument(data.GetValue("NodeLinkedNodeID")));
        }
        else if (SourceType != MediaSourceEnum.MetaFile)
        {
            string formGuid = data.ContainsColumn("AttachmentFormGUID") ? data.GetValue("AttachmentFormGUID").ToString() : Guid.Empty.ToString();
            string siteId = data.ContainsColumn("AttachmentSiteID") ? data.GetValue("AttachmentSiteID").ToString() : "0";

            sb.Append("|SiteID|" + CMSDialogHelper.EscapeArgument(siteId));
            sb.Append("|FormGUID|" + CMSDialogHelper.EscapeArgument(formGuid));
            sb.Append("|AttachmentDocumentID|" + CMSDialogHelper.EscapeArgument(data.GetValue("AttachmentDocumentID")));
        }

        return sb.ToString();
    }
开发者ID:hollycooper,项目名称:Sportscar-Standings,代码行数:77,代码来源:MediaView.ascx.cs

示例8: WriteDataContainer

    /// <summary>
    /// Writes the data container to the output.
    /// </summary>
    /// <param name="dc">Container to write</param>
    protected void WriteDataContainer(IDataContainer dc)
    {
        StringBuilder sb = new StringBuilder();

        sb.Append("<table class=\"UniGridGrid\" cellspacing=\"0\" cellpadding=\"3\" rules=\"rows\" border=\"1\" style=\"border-collapse:collapse;\" width=\"100%\">");

        // Add header
        sb.Append("<tr class=\"UniGridHead\"><th>" + GetString("General.FieldName") + "</th><th style=\"width: 100%;\">" + GetString("General.Value") + "</th></tr>");

        // Add values
        int i = 0;
        foreach (string column in dc.ColumnNames)
        {
            try
            {
                object value = dc.GetValue(column);

                // Binary columns
                string content = null;
                if (value is byte[])
                {
                    byte[] data = (byte[])value;
                    content = "<" + GetString("General.BinaryData") + ", " + DataHelper.GetSizeString(data.Length) + ">";
                }
                else
                {
                    content = ValidationHelper.GetString(value, "");
                }

                if (!String.IsNullOrEmpty(content))
                {
                    ++i;
                    string className = ((i % 2) == 0) ? "OddRow" : "EvenRow";
                    sb.Append("<tr class=\"" + className + "\"><td>");
                    sb.Append("<strong>" + column + "</strong>");
                    sb.Append("</td><td style=\"width: 100%;\">");

                    // Possible DataTime columns
                    if (value is DateTime)
                    {
                        DateTime dateTime = Convert.ToDateTime(content);
                        System.Globalization.CultureInfo cultureInfo = new System.Globalization.CultureInfo(CMSContext.CurrentUser.PreferredUICultureCode);
                        content = dateTime.ToString(cultureInfo);
                    }

                    // Process content
                    ProcessContent(sb, dc, column, ref content);

                    sb.Append("</td></tr>");
                }
            }
            catch
            {
            }
        }

        sb.Append("</table><br />\n");

        pnlContent.Controls.Add(new LiteralControl(sb.ToString()));
    }
开发者ID:KuduApps,项目名称:Kentico,代码行数:64,代码来源:ViewObject.ascx.cs

示例9: GetArgumentSet

    /// <summary>
    /// Returns argument set for the passed file data row.
    /// </summary>
    /// <param name="data">Data object holding all the data on the current file</param>
    public static string GetArgumentSet(IDataContainer data)
    {
        StringBuilder sb = new StringBuilder();

        if (data.ContainsColumn("FileGUID"))
        {
            sb.Append("FileName|" + CMSDialogHelper.EscapeArgument(data.GetValue("FileName")));
            sb.Append("|FileGUID|" + CMSDialogHelper.EscapeArgument(data.GetValue("FileGUID")));
            sb.Append("|FilePath|" + CMSDialogHelper.EscapeArgument(data.GetValue("FilePath")));
            sb.Append("|FileExtension|" + CMSDialogHelper.EscapeArgument(data.GetValue("FileExtension")));
            sb.Append("|FileImageWidth|" + CMSDialogHelper.EscapeArgument(data.GetValue("FileImageWidth")));
            sb.Append("|FileImageHeight|" + CMSDialogHelper.EscapeArgument(data.GetValue("FileImageHeight")));
            sb.Append("|FileTitle|" + CMSDialogHelper.EscapeArgument(data.GetValue("FileTitle")));
            sb.Append("|FileSize|" + CMSDialogHelper.EscapeArgument(data.GetValue("FileSize")));
            sb.Append("|FileID|" + CMSDialogHelper.EscapeArgument(data.GetValue("FileID")));
        }
        else
        {
            sb.Append("FileName|" + CMSDialogHelper.EscapeArgument(data.GetValue("FileName")));
            sb.Append("|Extension|" + CMSDialogHelper.EscapeArgument(data.GetValue("Extension")));
            sb.Append("|FileURL|" + CMSDialogHelper.EscapeArgument(data.GetValue("FileURL")));
            sb.Append("|Size|" + CMSDialogHelper.EscapeArgument(data.GetValue("Size")));
        }

        return sb.ToString();
    }
开发者ID:dlnuckolls,项目名称:pfh-paypalintegration,代码行数:30,代码来源:MediaView.ascx.cs

示例10: CreateAttachment

    /// <summary>
    /// Creates attachment string.
    /// </summary>
    private string CreateAttachment(IDataContainer dc, int versionId)
    {
        string result = null;
        if (dc != null)
        {
            // Get attachment GUID
            Guid attachmentGuid = ValidationHelper.GetGuid(dc.GetValue("AttachmentGUID"), Guid.Empty);

            // Get attachment extension
            string attachmentExt = ValidationHelper.GetString(dc.GetValue("AttachmentExtension"), null);
            string iconUrl = GetFileIconUrl(attachmentExt, "List");

            // Get link for attachment
            string attachmentUrl = null;
            string attName = ValidationHelper.GetString(dc.GetValue("AttachmentName"), null);
            attachmentUrl = CMSContext.ResolveUIUrl(TreePathUtils.GetAttachmentUrl(attachmentGuid, URLHelper.GetSafeFileName(attName, CMSContext.CurrentSiteName), versionId, null));

            // Ensure correct URL
            attachmentUrl = URLHelper.AddParameterToUrl(attachmentUrl, "sitename", CMSContext.CurrentSiteName);

            // Optionally trim attachment name
            string attachmentName = TextHelper.LimitLength(attName, 90);
            bool isImage = ImageHelper.IsImage(attachmentExt);

            // Tooltip
            string tooltip = null;
            if (isImage)
            {
                int attachmentWidth = ValidationHelper.GetInteger(dc.GetValue("AttachmentImageWidth"), 0);
                if (attachmentWidth > 300)
                {
                    attachmentWidth = 300;
                }
                tooltip = "onmouseout=\"UnTip()\" onmouseover=\"TipImage(" + attachmentWidth + ", '" + URLHelper.AddParameterToUrl(attachmentUrl, "width", "300") + "', " + ScriptHelper.GetString(HTMLHelper.HTMLEncode(attachmentName)) + ")\"";
            }

            string attachmentSize = DataHelper.GetSizeString(ValidationHelper.GetLong(dc.GetValue("AttachmentSize"), 0));
            string title = ValidationHelper.GetString(dc.GetValue("AttachmentTitle"), string.Empty);
            string description = ValidationHelper.GetString(dc.GetValue("AttachmentDescription"), string.Empty);

            // Icon
            StringBuilder sb = new StringBuilder();
            sb.Append("<img class=\"Icon\" style=\"cursor: pointer;\"  src=\"", HTMLHelper.HTMLEncode(iconUrl), "\" alt=\"", HTMLHelper.HTMLEncode(attachmentName), "\" ", tooltip, " onclick=\"javascript: window.open(", ScriptHelper.GetString(attachmentUrl), "); return false;\" />");
            sb.Append(" ", HTMLHelper.HTMLEncode(attachmentName), " (", HTMLHelper.HTMLEncode(attachmentSize), ")<br />");
            sb.Append("<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"NoBorderTable\" ><tr><td style=\"padding:1px;\"><strong>", GetString("general.title"), ":</strong></td><td style=\"padding:1px;\">", HTMLHelper.HTMLEncode(title), "</td></tr>");
            sb.Append("<tr><td style=\"padding:1px;\"><strong>", GetString("general.description"), ":</strong></td><td style=\"padding:1px;\">", HTMLHelper.HTMLEncode(description), "</td></tr></table><br/>");
            result = sb.ToString();
        }

        return result;
    }
开发者ID:hollycooper,项目名称:Sportscar-Standings,代码行数:54,代码来源:ViewVersion.ascx.cs

示例11: CreateAttachment

    /// <summary>
    /// Creates attachment string.
    /// </summary>
    private string CreateAttachment(IDataContainer dc, int versionId)
    {
        string result = null;
        if (dc != null)
        {
            // Get attachment GUID
            Guid attachmentGuid = ValidationHelper.GetGuid(dc.GetValue("AttachmentGUID"), Guid.Empty);

            // Get attachment extension
            string attachmentExt = ValidationHelper.GetString(dc.GetValue("AttachmentExtension"), null);

            // Get link for attachment
            string attName = ValidationHelper.GetString(dc.GetValue("AttachmentName"), null);
            string attachmentUrl = AuthenticationHelper.ResolveUIUrl(AttachmentURLProvider.GetAttachmentUrl(attachmentGuid, URLHelper.GetSafeFileName(attName, SiteContext.CurrentSiteName), null, versionId));

            // Ensure correct URL
            attachmentUrl = URLHelper.AddParameterToUrl(attachmentUrl, "sitename", SiteContext.CurrentSiteName);

            // Optionally trim attachment name
            string attachmentName = TextHelper.LimitLength(attName, 90);
            bool isImage = ImageHelper.IsImage(attachmentExt);

            // Tooltip
            string tooltip = null;
            if (isImage)
            {
                int attachmentWidth = ValidationHelper.GetInteger(dc.GetValue("AttachmentImageWidth"), 0);
                if (attachmentWidth > 300)
                {
                    attachmentWidth = 300;
                }
                tooltip = "onmouseout=\"UnTip()\" onmouseover=\"TipImage(" + attachmentWidth + ", '" + URLHelper.AddParameterToUrl(attachmentUrl, "width", "300") + "', " + ScriptHelper.GetString(HTMLHelper.HTMLEncode(attachmentName)) + ")\"";
            }

            string attachmentSize = DataHelper.GetSizeString(ValidationHelper.GetLong(dc.GetValue("AttachmentSize"), 0));
            string title = ValidationHelper.GetString(dc.GetValue("AttachmentTitle"), string.Empty);
            string description = ValidationHelper.GetString(dc.GetValue("AttachmentDescription"), string.Empty);

            // Icon
            var additional = new StringBuilder();
            additional.Append(tooltip, "onclick=\"javascript: window.open(", ScriptHelper.GetString(attachmentUrl), "); return false;\" style=\"cursor: pointer;\"");

            var sb = new StringBuilder();
            sb.Append(UIHelper.GetFileIcon(Page, attachmentExt, tooltip: HTMLHelper.HTMLEncode(attachmentName), additionalAttributes: additional.ToString()));
            sb.Append(" ", HTMLHelper.HTMLEncode(attachmentName), " (", HTMLHelper.HTMLEncode(attachmentSize), ")<br />");
            sb.Append("<table class=\"table-blank\"><tr><td><strong>", GetString("general.title"), ":</strong></td><td>", HTMLHelper.HTMLEncode(title), "</td></tr>");
            sb.Append("<tr><td><strong>", GetString("general.description"), ":</strong></td><td>", HTMLHelper.HTMLEncode(description), "</td></tr></table>");
            result = sb.ToString();
        }

        return result;
    }
开发者ID:dlnuckolls,项目名称:pfh-paypalintegration,代码行数:55,代码来源:ViewVersion.ascx.cs

示例12: innermedia_GetTilesThumbsItemUrl

    /// <summary>
    /// Returns URL of item according specified conditions.
    /// </summary>
    /// <param name="dr">Data row holding information on item</param>
    /// <param name="isPreview">Indicates whether the URL is requested for item preview</param>
    /// <param name="maxSideSize">Specifies maximum size of the image</param>
    private string innermedia_GetTilesThumbsItemUrl(IDataContainer data, bool isPreview, int height, int width, int maxSideSize, bool notAttachment)
    {
        if (LibraryInfo != null)
        {
            // get argument set
            string arg = GetArgumentSet(data);

            // Get extension
            string ext = data.GetValue((data.ContainsColumn("FileExtension") ? "FileExtension" : "Extension")).ToString();

            // If image is requested for preview
            if (isPreview)
            {
                if (ext.ToLower() == "<dir>")
                {
                    return GetDocumentTypeIconUrl("CMS.Folder", "48x48");
                }
                else
                {
                    // Check if file has a preview
                    if (!ImageHelper.IsSupportedByImageEditor(ext))
                    {
                        // File isn't image and no preview exists - get the default file icon
                        return GetFileIconUrl(ext, "");
                    }
                    else
                    {
                        // Files are obtained from the FS
                        return !data.ContainsColumn("FileURL") ? GetItemUrl(arg, isPreview, height, width, maxSideSize) : GetFileIconUrl(ext, "");
                    }
                }
            }
            else
            {
                // Get item url
                return GetItemUrlInternal(arg, data, isPreview, height, width, maxSideSize, notAttachment);
            }
        }
        return null;
    }
开发者ID:puentepr,项目名称:kentico-site-example,代码行数:46,代码来源:MediaView.ascx.cs

示例13: GetContent

    /// <summary>
    /// Gets iCalendar file content.
    /// </summary>
    /// <param name="row">Datarow</param>
    protected byte[] GetContent(IDataContainer data)
    {
        if (data != null)
        {
            // Get server time zone
            TimeZoneInfo serverTimeZone = TimeZoneHelper.ServerTimeZone;
            // Shift current time (i.e. server time) to GMT
            DateTime currentDateGMT = DateTime.Now;
            currentDateGMT = TimeZoneHelper.ConvertTimeToUTC(currentDateGMT, serverTimeZone);

            // Get event start time (i.e. server time)
            DateTime eventStart = ValidationHelper.GetDateTime(data.GetValue("EventDate"), DateTimeHelper.ZERO_TIME);

            // Get if it is all day event
            bool isAllDay = ValidationHelper.GetBoolean(data.GetValue("EventAllDay"), false);

            // Create content
            StringBuilder content = new StringBuilder();
            content.AppendLine("BEGIN:vCalendar");
            content.AppendLine("METHOD:PUBLISH");
            content.AppendLine("BEGIN:vEvent");
            content.Append("DTSTAMP:").Append(currentDateGMT.ToString("yyyyMMdd'T'HHmmss")).AppendLine("Z");
            content.Append("DTSTART");
            if (isAllDay)
            {
                content.Append(";VALUE=DATE:").AppendLine(eventStart.ToString("yyyyMMdd"));
            }
            else
            {
                // Shift event start time to GMT
                eventStart = TimeZoneHelper.ConvertTimeToUTC(eventStart, serverTimeZone);
                content.Append(":").Append(eventStart.ToString("yyyyMMdd'T'HHmmss")).AppendLine("Z");
            }

            // Get event end time
            DateTime eventEnd = ValidationHelper.GetDateTime(data.GetValue("EventEndDate"), DateTimeHelper.ZERO_TIME);
            if (eventEnd != DateTimeHelper.ZERO_TIME)
            {
                content.Append("DTEND");
                if (isAllDay)
                {
                    content.Append(";VALUE=DATE:").AppendLine(eventEnd.AddDays(1).ToString("yyyyMMdd"));
                }
                else
                {
                    // Shift event end time to GMT
                    eventEnd = TimeZoneHelper.ConvertTimeToUTC(eventEnd, serverTimeZone);
                    content.Append(":").Append(eventEnd.ToString("yyyyMMdd'T'HHmmss")).AppendLine("Z");
                }
            }

            // Get location
            string location = ValidationHelper.GetString(data.GetValue("EventLocation"), string.Empty);

            // Include location if specified
            if (!String.IsNullOrEmpty(location))
            {
                content.Append("LOCATION:").AppendLine(HTMLHelper.StripTags(HttpUtility.HtmlDecode(location)));
            }

            content.Append("DESCRIPTION:").AppendLine(HTMLHelper.StripTags(HttpUtility.HtmlDecode(ValidationHelper.GetString(data.GetValue("EventDetails"), "")).Replace("\r\n", "").Replace("<br />", "\\n")) + "\\n\\n" + HTMLHelper.StripTags(HttpUtility.HtmlDecode(ValidationHelper.GetString(data.GetValue("EventLocation"), "")).Replace("\r\n", "").Replace("<br />", "\\n")));
            content.Append("SUMMARY:").AppendLine(HttpUtility.HtmlDecode(ValidationHelper.GetString(data.GetValue("EventName"), "")));
            content.AppendLine("PRIORITY:3");
            content.AppendLine("BEGIN:vAlarm");
            content.AppendLine("TRIGGER:P0DT0H15M");
            content.AppendLine("ACTION:DISPLAY");
            content.AppendLine("DESCRIPTION:Reminder");
            content.AppendLine("END:vAlarm");
            content.AppendLine("END:vEvent");
            content.AppendLine("END:vCalendar");

            // Return byte array
            return Encoding.UTF8.GetBytes(content.ToString());
        }

        return null;
    }
开发者ID:kbuck21991,项目名称:kentico-blank-project,代码行数:81,代码来源:AddToOutlook.aspx.cs

示例14: innermedia_GetThumbsItemUrl

    private IconParameters innermedia_GetThumbsItemUrl(IDataContainer data, bool isPreview, int height, int width, int maxSideSize, bool notAttachment)
    {
        IconParameters parameters = new IconParameters();

        string ext = (SourceType != MediaSourceEnum.MetaFile) ? data.GetValue("AttachmentExtension").ToString() : data.GetValue("MetaFileExtension").ToString();
        string arg = GetArgumentSet(data);

        // If image is requested for preview
        if (isPreview)
        {
            if (!ImageHelper.IsImage(ext) || notAttachment)
            {
                string className = (SourceType == MediaSourceEnum.Content) ? data.GetValue("ClassName").ToString().ToLowerCSafe() : "";
                if (className == "cms.file")
                {
                    // File isn't image and no preview exists - get default file icon
                    parameters.IconClass = UIHelper.GetFileIconClass(ext);
                }
                else if (((SourceType == MediaSourceEnum.DocumentAttachments) || (SourceType == MediaSourceEnum.Attachment) || (SourceType == MediaSourceEnum.MetaFile)) && !String.IsNullOrEmpty(ext))
                {
                    // Get file icon for attachment
                    parameters.IconClass = UIHelper.GetFileIconClass(ext);
                }
                else
                {
                    var dataClass = DataClassInfoProvider.GetDataClassInfo(className);
                    parameters.Url = UIHelper.GetDocumentTypeIconUrl(Page, className, "48x48");

                    if (dataClass != null)
                    {
                        parameters.IconClass = (string)dataClass.GetValue("ClassIconClass");
                    }
                }

                // Set font icon size
                if (!string.IsNullOrEmpty(parameters.IconClass))
                {
                    parameters.IconSize = FontIconSizeEnum.Dashboard;
                }
            }
            else
            {
                // Try to get preview or image itself
                parameters.Url = GetItemUrl(arg, height, width, maxSideSize, notAttachment);
            }
        }
        else
        {
            parameters.Url = GetItemUrl(arg, 0, 0, 0, notAttachment);
        }

        return parameters;
    }
开发者ID:dlnuckolls,项目名称:pfh-paypalintegration,代码行数:53,代码来源:MediaView.ascx.cs

示例15: GetLibraryUpdateControl

    /// <summary>
    /// Initializes upload control.
    /// When data is null, the control can be rendered as disabled only.
    /// </summary>
    /// <param name="dfuElem">Upload control to initialize</param>
    /// <param name="data">Data row with data on related media file</param>
    public void GetLibraryUpdateControl(ref DirectFileUploader dfuElem, IDataContainer data)
    {
        if (dfuElem != null)
        {
            if (data != null)
            {
                string siteName = GetSiteName(data, true);
                int fileId = ValidationHelper.GetInteger(data.GetValue("FileID"), 0);
                string fileName = EnsureFileName(Path.GetFileName(ValidationHelper.GetString(data.GetValue("FilePath"), "")));
                string folderPath = Path.GetDirectoryName(ValidationHelper.GetString(data.GetValue("FilePath"), ""));
                int libraryId = ValidationHelper.GetInteger(data.GetValue("FileLibraryID"), 0);

                AllowedExtensions = SettingsKeyInfoProvider.GetStringValue(siteName + ".CMSMediaFileAllowedExtensions");

                // Initialize library info
                dfuElem.LibraryID = libraryId;
                dfuElem.MediaFileID = fileId;
                dfuElem.MediaFileName = fileName;
                dfuElem.LibraryFolderPath = folderPath;
            }

            // Initialize general info
            dfuElem.CheckPermissions = true;
            dfuElem.SourceType = MediaSourceEnum.MediaLibraries;
            dfuElem.ID = "dfuElemLib";
            dfuElem.ForceLoad = true;
            dfuElem.DisplayInline = true;
            dfuElem.ControlGroup = "MediaView";
            dfuElem.ResizeToWidth = ResizeToWidth;
            dfuElem.ResizeToHeight = ResizeToHeight;
            dfuElem.ResizeToMaxSideSize = ResizeToMaxSideSize;
            dfuElem.AllowedExtensions = AllowedExtensions;
            dfuElem.ShowIconMode = true;
            dfuElem.InsertMode = false;
            dfuElem.ParentElemID = "LibraryUpdate";
            dfuElem.IncludeNewItemInfo = true;
            dfuElem.RaiseOnClick = true;
            dfuElem.IsLiveSite = IsLiveSite;

            // Setting of the direct single mode
            dfuElem.UploadMode = MultifileUploaderModeEnum.DirectSingle;
            dfuElem.Width = 16;
            dfuElem.Height = 16;
            dfuElem.MaxNumberToUpload = 1;
        }
    }
开发者ID:dlnuckolls,项目名称:pfh-paypalintegration,代码行数:52,代码来源:InnerMediaView.ascx.cs


注:本文中的IDataContainer.GetValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。