コード例 #1
0
        private void radioButton2_MouseClick(object sender, MouseEventArgs e)
        {
            clsXMLData  settings1 = new clsXMLData();
            xmlSettings settings  = new xmlSettings();
            pathset     set3      = new pathset();

            flag = 0;

            if (var == "ePlus Basic Edition")
            {
                set3.xmlPath = @"C:\Users\Amritha\AppData\Roaming\ePlus Basic Edition";
                set3         = settings1.readPath(set3.xmlPath);
            }
            if (var == "ePlus Proffessional Edition")
            {
                set3.xmlPath = @"C:\Users\Amritha\AppData\Roaming\ePlus Professional Edition";
                set3         = settings1.readPath(set3.xmlPath);
            }
            if (var == "ePlus Standard Edition")
            {
                set3.xmlPath = @"C:\Users\Amritha\AppData\Roaming\ePlus Standard Edition";
                set3         = settings1.readPath(set3.xmlPath);
            }
            settings      = settings1.ReadSettings();
            textBox1.Text = settings.userName;
            textBox2.Text = settings.serverName;
            textBox3.Text = settings.dbName;
            textBox4.Text = settings.dbPort;
        }
コード例 #2
0
        public xmlSettings writesettings(string usr, string svr, string dbs, string prt, string pat)
        {
            string      xmlpath1      = pat;
            string      xsettingsfile = xmlpath1 + "\\Settings.xml";
            xmlSettings xsettings     = new xmlSettings();

            // MessageBox.Show(xsettingsfile);

            if (!File.Exists(xsettingsfile))
            {
                xsettings.success      = false;
                xsettings.errorMessage = "File not found (" + xsettingsfile + ")";
                return(xsettings);
            }
            else
            {
                XmlTextWriter writer = new XmlTextWriter(xsettingsfile, System.Text.Encoding.UTF8);
                writer.WriteStartDocument(true);
                writer.Formatting  = Formatting.Indented;
                writer.Indentation = 2;
                writer.WriteStartElement("?xml version");

                writer.WriteStartElement("Settings");


                writer.WriteStartElement("USER");
                xsettings.userName = usr;
                writer.WriteString(xsettings.userName);
                writer.WriteEndElement();

                writer.WriteStartElement("SERVER");
                xsettings.serverName = svr;
                writer.WriteString(xsettings.serverName);
                writer.WriteEndElement();

                writer.WriteStartElement("DATABASE");
                xsettings.dbName = dbs;
                writer.WriteString(xsettings.dbName);
                writer.WriteEndElement();

                writer.WriteStartElement("PORT");
                xsettings.dbPort = prt;
                writer.WriteString(xsettings.dbPort);
                writer.WriteEndElement();

                writer.WriteStartElement("MULTIDATABASE");
                writer.WriteString("False");
                writer.WriteEndElement();

                writer.WriteEndElement();
                writer.WriteEndElement();
                writer.WriteEndDocument();
                writer.Close();
            }
            xsettings.success      = true;
            xsettings.errorMessage = "";
            return(xsettings);
        }
コード例 #3
0
        public xmlSettings ReadSettings()
        {
            xmlSettings settings = new xmlSettings();

            if (!File.Exists(xmlSettingsFile))
            {
                settings.success      = false;
                settings.errorMessage = "File not found (" + xmlSettingsFile + ")";
                return(settings);
            }
            string        xmlElement = " ";
            XmlTextReader reader     = new XmlTextReader(xmlSettingsFile);

            while (reader.Read())
            {
                switch (reader.NodeType)
                {
                case XmlNodeType.Element:
                    xmlElement = reader.Name;

                    break;

                case XmlNodeType.Text:
                    switch (xmlElement)
                    {
                    case "USER":
                        settings.userName = reader.Value;
                        break;

                    case "SERVER":
                        settings.serverName = reader.Value;
                        break;

                    case "DATABASE":
                        settings.dbName = reader.Value;
                        break;

                    case "PORT":
                        settings.dbPort = reader.Value;
                        break;

                    case "MULTIDATABASE":
                        settings.multidb = reader.Value;
                        break;
                    }
                    break;
                }
            }

            reader.Close();
            settings.success      = true;
            settings.errorMessage = "";
            return(settings);
        }
コード例 #4
0
        private void radioButton1_MouseClick(object sender, MouseEventArgs e)
        {
            string      SFolder   = @"C:\ProgramData";
            clsXMLData  settings1 = new clsXMLData();
            xmlSettings settings  = new xmlSettings();
            pathset     set3      = new pathset();

            flag          = 1;
            set3.xmlPath  = SFolder + "\\" + comboBox1.Text;
            set3          = settings1.readPath(set3.xmlPath);
            settings      = settings1.ReadSettings();
            textBox1.Text = settings.userName;
            textBox2.Text = settings.serverName;
            textBox3.Text = settings.dbName;
            textBox4.Text = settings.dbPort;
        }
コード例 #5
0
        private void radioButton2_MouseClick(object sender, MouseEventArgs e)
        {
            string      SpecialFolder = @"C:\Users\";
            string      SpecialData   = @"AppData\Roaming";
            clsXMLData  settings1     = new clsXMLData();
            xmlSettings settings      = new xmlSettings();
            pathset     set3          = new pathset();

            flag          = 0;
            set3.xmlPath  = SpecialFolder + (Environment.UserName) + "\\" + SpecialData + "\\" + comboBox1.Text;
            set3          = settings1.readPath(set3.xmlPath);
            settings      = settings1.ReadSettings();
            textBox1.Text = settings.userName;
            textBox2.Text = settings.serverName;
            textBox3.Text = settings.dbName;
            textBox4.Text = settings.dbPort;
        }
コード例 #6
0
        private void Update_Button_Click(object sender, EventArgs e)
        {
            clsXMLData  xdata     = new clsXMLData();
            xmlSettings xsettings = new xmlSettings();

            xsettings.userName   = textBox1.Text;
            xsettings.serverName = textBox2.Text;
            xsettings.dbName     = textBox3.Text;
            xsettings.dbPort     = textBox4.Text;
            if (flag == 1)
            {
                if (var == "ePlus Basic Edition")
                {
                    xsettings.xmllPath = @"C:\ProgramData\ePlus Basic Edition";
                }
                else if (var == "ePlus Proffessional Edition")
                {
                    xsettings.xmllPath = @"C:\ProgramData\ePlus Professional Edition";
                }
                else
                {
                    xsettings.xmllPath = @"C:\ProgramData\ePlus Standard Edition";
                }
            }
            if (flag == 0)
            {
                if (var == "ePlus Basic Edition")
                {
                    xsettings.xmllPath = @"C:\Users\Amritha\AppData\Roaming\ePlus Basic Edition";
                }
                else if (var == "ePlus Proffessional Edition")
                {
                    xsettings.xmllPath = @"C:\Users\Amritha\AppData\Roaming\ePlus Professional Edition";
                }
                else
                {
                    xsettings.xmllPath = @"C:\Users\Amritha\AppData\Roaming\ePlus Standard Edition";
                }
            }
            xsettings = xdata.writesettings(xsettings.userName, xsettings.serverName, xsettings.dbName, xsettings.dbPort, xsettings.xmllPath);
        }
コード例 #7
0
        private void Update_Button_Click(object sender, EventArgs e)
        {
            string      SpecialFolder = @"C:\Users\";
            string      SpecialData   = @"AppData\Roaming";
            string      SFolder       = @"C:\ProgramData";
            clsXMLData  xdata         = new clsXMLData();
            xmlSettings xsettings     = new xmlSettings();

            xsettings.userName   = textBox1.Text;
            xsettings.serverName = textBox2.Text;
            xsettings.dbName     = textBox3.Text;
            xsettings.dbPort     = textBox4.Text;
            if (flag == 1)
            {
                xsettings.xmllPath = SFolder + "\\" + comboBox1.Text;
            }
            if (flag == 0)
            {
                xsettings.xmllPath = SpecialFolder + (Environment.UserName) + "\\" + SpecialData + "\\" + comboBox1.Text;
            }
            xsettings = xdata.writesettings(xsettings.userName, xsettings.serverName, xsettings.dbName, xsettings.dbPort, xsettings.xmllPath);
            MessageBox.Show("Successfully updated");
        }