Beispiel #1
0
        protected void exportDataSetByTemplateBtn_Click(object sender, EventArgs e)
        {
            XmlDocument xmlDoc = WebXmlDocumentCache.GetXmlDocument("Interco upload template.xml");

            xmlDoc.PreserveWhitespace = true;

            WorkbookNode workbook = new WorkbookNode();

            workbook.LoadXml(xmlDoc.OuterXml);

            DataTable table = CreateDemoDataTable();

            DataViewExportOptions options = new DataViewExportOptions()
            {
                ExportColumnHeader = false
            };

            table.DefaultView.FillIntoSpreadSheet(workbook, "Sheet1", options);

            Response.AppendHeader("CONTENT-DISPOSITION",
                                  string.Format("{0};filename={1}", "inline", HttpUtility.UrlEncode("test.xml")));

            Response.ContentType = "text/xml";
            Response.Clear();
            workbook.Save(Response.OutputStream);
            Response.End();
        }
Beispiel #2
0
        private string GetTemplateText()
        {
            string result      = string.Empty;
            string virtualPath = this.GetResolvedTemplatePath();

            if (virtualPath.IsNotEmpty())
            {
                result = WebXmlDocumentCache.GetDocument(virtualPath);
            }

            return(result);
        }
Beispiel #3
0
        protected string InitalJsonFor(string name)
        {
            var       doc  = WebXmlDocumentCache.GetDocument("~/App_Data/DraftingData.xml");
            ArrayList list = new ArrayList();

            if (string.IsNullOrEmpty(name) == false)
            {
                CategoryLinkAdapter.Instance.DoSearch(new string[] { "Root", name }, list, System.Xml.XmlReader.Create(new StringReader(doc)));
            }

            return(MCS.Web.Library.Script.JSONSerializerExecute.Serialize(list));
        }
Beispiel #4
0
        public static XmlReaderSettings GetDraftingLinkXmlReaderSettings()
        {
            var readerSettings = CategoryLinkAdapter.Settings;

            if (readerSettings == null)
            {
                readerSettings = new System.Xml.XmlReaderSettings()
                {
                    IgnoreWhitespace = true,
                    IgnoreComments   = true,
                };

                var schemaDoc = WebXmlDocumentCache.GetDocument("~/App_Data/CategorySchema.xsd");

                var schema = XmlSchema.Read(new StringReader(schemaDoc), null);
                CategoryLinkAdapter.Settings = readerSettings;
            }

            return(readerSettings);
        }
Beispiel #5
0
        /// <summary>
        /// 菜单
        /// </summary>
        private void RenderMenu()
        {
            XmlDocument xmlDoc = WebXmlDocumentCache.GetXmlDocument("../xml/functions.xml");

            Stopwatch sw = new Stopwatch();

            sw.Start();

            try
            {
                if (!xmlDoc.Equals(null))
                {
                    XmlNodeList captions = xmlDoc.DocumentElement.SelectNodes("Item");

                    foreach (XmlElement elemCaption in captions)
                    {
                        string strVisible = elemCaption.GetAttribute("visible").ToLower();

                        if ((strVisible != "false") && CheckUserPermissions(elemCaption))
                        {
                            HtmlGenericControl li = new HtmlGenericControl("li");

                            menuList.Controls.Add(li);

                            HtmlAnchor link = new HtmlAnchor();

                            link.InnerText = elemCaption.GetAttribute("name");
                            link.HRef      = elemCaption.GetAttribute("url");
                            link.Target    = elemCaption.GetAttribute("target");

                            li.Controls.Add(link);
                        }
                    }
                }
            }
            finally
            {
                sw.Stop();
                Debug.WriteLine(string.Format("RenderMenu: {0:#,##0}", sw.ElapsedMilliseconds));
            }
        }
Beispiel #6
0
        private ArrayList GetResult(string[] paths)
        {
            ArrayList result = new ArrayList();

            var doc       = WebXmlDocumentCache.GetDocument("~/App_Data/DraftingData.xml");
            var schemaDoc = WebXmlDocumentCache.GetDocument("~/App_Data/CategorySchema.xsd");

            for (int i = 0; i < paths.Length; i++)
            {
                var       path  = paths[i];
                var       parts = path.Split('.', '>');
                ArrayList list  = new ArrayList();
                if (parts.Length > 0 && parts[0] == "Root")
                {
                    CategoryLinkAdapter.Instance.DoSearch(parts, list, XmlReader.Create(new StringReader(doc), Util.GetDraftingLinkXmlReaderSettings()));
                }

                result.Add(list);
            }

            return(result);
        }
Beispiel #7
0
 protected void ctlUpload_LoadingDialogContent(object sender, LoadingDialogContentEventArgs e)
 {
     e.Content = WebXmlDocumentCache.GetDocument("~/inc/CommonMemberUploadTemplate.htm") + this.GetScript(this.ctlUpload.Tag);
 }
Beispiel #8
0
 protected void ctlUpload_LoadingDialogContent(object sender, LoadingDialogContentEventArgs e)
 {
     e.Content = WebXmlDocumentCache.GetDocument("~/inc/AllMembersUploadTemplate.htm");
 }