예제 #1
0
        public void SerializeAll()
        {    //rlm 2017/08/31
            Dictionary <String, String> templatesMap = new Dictionary <String, String>();
            string key = "", val = "";

            var       dt = new SDC.DAL.DataSets.FormDesignDataSets();
            DataTable templateDT = dt.dtGetTemplateList(0);  //the decimal parameter is not used

            foreach (DataRow dr in templateDT.Rows)
            {
                key = (string)dr.ItemArray[0];
                val = (string)dr.ItemArray[1] + "_SDC.xml";

                templatesMap.Add(key, val);
                Debug.Print(templatesMap[key].ToString());

                var ser = new XmlSerializer(typeof(FormDesignType));
                var fdd = new FormDesignDataSets();
                SDCTreeBuilderEcc stb;
                stb = new SDCTreeBuilderEcc(key, fdd, "srtemplate.xslt");

                String formDesignXml = stb.FormDesign.Serialize();
                string orig          = "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
                string fix           = orig + "\r\n" + "<?xml-stylesheet type=\"text/xsl\" href=\"sdctemplate.xslt\"?>";

                formDesignXml = formDesignXml.Replace(orig, fix);
                //Debug.WriteLine(formDesignXml);
                System.IO.File.WriteAllText("C:\\SDC\\" + val, formDesignXml, System.Text.Encoding.UTF8);
            }
        }
예제 #2
0
        public void SerializeAll()
        {    //rlm 2017/08/31
            Dictionary <String, String> templatesMap = new Dictionary <String, String>();
            string key = "", val = "";

            var       dt = new SDC.DAL.DataSets.FormDesignDataSets();
            DataTable templateDT = dt.dtGetTemplateList(key);  //the parameter is not used

            foreach (DataRow dr in templateDT.Rows)
            {
                key = (string)dr.ItemArray[0];
                val = (string)dr.ItemArray[1] + "_SDC.xml";

                templatesMap.Add(key, val);
                Debug.Print(templatesMap[key].ToString());

                var ser = new XmlSerializer(typeof(SDC.Schema.FormDesignType));
                var fdd = new FormDesignDataSets();
                SDCTreeBuilderEcc stb;
                stb = new SDCTreeBuilderEcc(key, fdd, "srtemplate.xslt");
                var filename = stb.FormDesign.filename;

                //var fd = stb.FormDesign;
                //var n = fd.IdentifiedTypes["11.1000043"];
                //move static classes to FormDesign instance



                String formDesignXml = stb.FormDesign.Serialize();
                string orig          = "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
                string fix           = orig + "\r\n" + "<?xml-stylesheet type=\"text/xsl\" href=\"sdctemplate.xslt\"?>";

                formDesignXml = formDesignXml.Replace(orig, fix);
                //formDesignXml = formDesignXml.Replace("&amp;", "&");
                //Debug.WriteLine(formDesignXml);
                System.IO.File.WriteAllText("C:\\SDC\\release\\" + filename, formDesignXml, System.Text.Encoding.UTF8);
            }
        }