コード例 #1
0
    protected void btnBack_Click(object sender, EventArgs e)
    {
        MemberSuiteObject mso;

        using (var api = GetServiceAPIProxy())
            mso = DocumentsLogic.GetFileCabinetContext(api, targetFolder);

        if (mso == null)
        {
            GoTo("/documents/DigitalLibrary.aspx");
        }

        GoTo(NavigationLogic.GetUrlFor(mso));
    }
コード例 #2
0
    public static void SetupContextAndParentFolders(IConciergeAPIService api, msFileFolder targetFolder, HyperLink hlFolderContext,
                                                    FolderInfo foldersAndFiles, Repeater rptParentFolders, bool includeTargetFolder)
    {
        var mso = GetFileCabinetContext(api, targetFolder);

        if (mso != null)
        {
            hlFolderContext.Text        = mso.SafeGetValue <string>("Name");
            hlFolderContext.NavigateUrl = NavigationLogic.GetUrlFor(mso);
        }
        else
        {
            hlFolderContext.Text        = "My Digital Library";
            hlFolderContext.NavigateUrl = "DigitalLibrary.aspx";
        }

        // now, the parent folders
        List <PartialFolderInfo> parentFolders = new List <PartialFolderInfo>();

        if (foldersAndFiles.ParentFolders != null)
        {
            // let's go through the parent folders and find the first one we have access to - and then
            // we'll start with that
            // we don't want to start with the root, because we may not have access
            bool accessEstablished = false;
            foreach (var folder in foldersAndFiles.ParentFolders)
            {
                if (!accessEstablished &&
                    !CanAccess(targetFolder.FileCabinet, folder.FolderID, ConciergeAPI.CurrentEntity.ID))
                {
                    // do we have access?
                    continue;             // no access yet
                }
                accessEstablished = true; // ok, we can access from now on
                parentFolders.Add(folder);
            }
        }

        if (includeTargetFolder)
        {
            parentFolders.Add(new PartialFolderInfo {
                FolderID = targetFolder.ID, FolderName = targetFolder.Name
            });
        }

        // bind
        rptParentFolders.DataSource = parentFolders;
        rptParentFolders.DataBind();
    }