Пример #1
0
    public void Save()
    {
        string errorMessage = null;

        if (!HROne.CommonLib.FileIOProcess.IsFolderAllowWritePermission(AppDomain.CurrentDomain.BaseDirectory, out errorMessage))
        {
            throw new Exception(errorMessage);
        }
        string filename = getFilename();


        System.Configuration.ConfigXmlDocument config = new System.Configuration.ConfigXmlDocument();
        XmlElement   settings = config.CreateElement("Settings");
        XmlAttribute version  = config.CreateAttribute("Version");

        version.Value = "2.0";
        settings.Attributes.Append(version);
        config.AppendChild(settings);
        //SetDatabaseConfigList(settings);

        settings.AppendChild(config.CreateElement("HROneConfigFullPath"));
        settings["HROneConfigFullPath"].InnerText = HROneConfigFullPath;


        config.Save(filename);
    }
Пример #2
0
    public void Save()
    {
        string errorMessage = null;

        if (!HROne.CommonLib.FileIOProcess.IsFolderAllowWritePermission(AppDomain.CurrentDomain.BaseDirectory, out errorMessage))
        {
            throw new Exception(errorMessage);
        }
        string filename = getFilename();

        if (config == null)
        {
            config = new System.Configuration.ConfigXmlDocument();
        }
        else
        {
            filename = config.Filename;
        }

        XmlElement settings = GetOrCreateElement(config, "Settings");

        if (settings.Attributes["Version"] == null)
        {
            settings.RemoveAll();
        }
        settings.RemoveAttribute("Version");
        XmlAttribute version = config.CreateAttribute("Version");

        version.Value = "2.0";
        settings.Attributes.Append(version);
        config.AppendChild(settings);
        SetDatabaseConfigList(settings);

        XmlElement shutdownOption = GetOrCreateElement(settings, "ShutdownAfterUsed");

        shutdownOption.InnerText = ShutDownDomainAfterUsed ? "true" : "false";

        XmlElement multiDBOption = GetOrCreateElement(settings, "AllowMultiDB");

        multiDBOption.InnerText = AllowMultiDB ? "true" : "false";

        XmlElement EncryptedURLOption = GetOrCreateElement(settings, "EncryptedURLQueryString");

        EncryptedURLOption.InnerText = EncryptedURLQueryString ? "true" : "false";

        XmlElement UsePDFCreatorOption = GetOrCreateElement(settings, "UsePDFCreator");

        UsePDFCreatorOption.InnerText = UsePDFCreator ? "true" : "false";

        XmlElement PDFCreatorPrinterNameOption = GetOrCreateElement(settings, "PDFCreatorPrinterNameOption");

        PDFCreatorPrinterNameOption.InnerText = PDFCreatorPrinterName;

        config.Save(filename);
    }