コード例 #1
0
        /// <summary>
        /// Select appropriate database table and download the data to the client
        /// </summary>
        /// <param name="tool"></param>
        /// <param name="context"></param>
        protected void downloadContent(BaseCmsAdminTool tool, HttpContext context)
        {
            string   fileName  = tool.ToString() + "_" + DateTime.Now.ToString("yyyy-MM-dd") + ".xls";
            GridView gridview1 = new GridView();

            try
            {
                gridview1 = tool.RenderToGridViewForOutputToExcelFile();
                if (gridview1 != null)
                {
                    OutputDataSetToExcelFile.OutputToResponse(gridview1, fileName, "", "", context.Response);
                }
            }
            catch
            {} // fail silently.
        }
コード例 #2
0
        /// <summary>
        /// Select appropriate database table and download the data to the client
        /// </summary>
        /// <param name="tool"></param>
        /// <param name="context"></param>
        protected void downloadContent(BaseCmsAdminTool tool, HttpContext context)
        {
            string   fileName  = tool.ToString() + "_" + DateTime.Now.ToString("yyyy-MM-dd") + ".xls";
            GridView gridview1 = new GridView();

            if (tool.GetType().Name.EndsWith("ListUserFeedback"))
            {
                gridview1 = new UserFeedbackDb().FetchAllUserFeedbackSubmittedDataAsGrid();
            }
            else if (tool.GetType().Name.EndsWith("ListRegisteredProjects"))
            {
                gridview1 = new RegisterProjectDb().fetchAllAsGrid();
            }


            OutputDataSetToExcelFile.OutputToResponse(gridview1, fileName, "", "", context.Response);
        }
コード例 #3
0
        /// <summary>
        /// Read the adminTool option from URL and response with a spreadsheet
        /// </summary>
        /// <param name="context"></param>
        public void ProcessRequest(HttpContext context)
        {
            if (!CmsContext.currentUserIsLoggedIn)
            {
                context.Response.Write("Access Denied");
                return;
            }

            string adminToolName = PageUtils.getFromForm("adminTool", "");

            if (BaseCmsAdminTool.AdminToolExists(adminToolName))
            {
                try
                {
                    BaseCmsAdminTool tool = BaseCmsAdminTool.getAdminToolInstanceByName(adminToolName);
                    if (tool != null)
                    {
                        downloadContent(tool, context);
                    }
                }
                catch { }
            }
        }
コード例 #4
0
        public override string RenderToString(CmsControlDefinition controlDefnToRender, CmsLanguage langToRenderFor)
        {
            if (!CmsContext.currentPage.currentUserCanRead)
            {
                return("Access Denied");
            }


            StringBuilder html = new StringBuilder();
            // -- always render the admin menu
            AdminMenu adminMenu = new AdminMenu();

            html.Append(adminMenu.Render());

            BaseCmsAdminTool toolToRun = AdminMenu.getToolToRun();

            if (toolToRun.getToolInfo().Category != BaseCmsAdminTool.CmsAdminToolCategory._AdminMenu)
            {
                string toolHtml = toolToRun.Render();
                html.Append(toolHtml);
            }

            return(html.ToString());
        }