/// <summary>
 /// 记录服务器设置
 /// </summary>
 private void AddServer()
 {
     string file = this.textBox_file.Text.Replace("/", "\\");
     string userpass = this.textBox_pwd.Text;
     Model.ConfigServers cs = new ConfigServers();
     cs.Name = string.Format("{0}({1})", file, dbType.ToString());
     cs.Port = "";
     cs.Database = file;
     cs.file = file;
     cs.Pwd = this.checkBox1.Checked ? userpass : "";
     cs.ServerName = file;
     cs.Type = dbType.ToString();
     cs.Uid = "";
     Form_AddDatabase.AddServerToXml(cs);
 }
 /// <summary>
 /// 记录服务器设置
 /// </summary>
 private void AddServer()
 {
     string server = this.sqlserver_server.Text;
     string userid = this.sqlserver_uid.Text;
     string userpass = this.sqlserver_pwd.Text;
     Model.ConfigServers cs = new ConfigServers();
     cs.Name = string.Format("{0}({1})", server, dbType.ToString());
     cs.Port = "";
     cs.Database = "";
     cs.file = "";
     cs.Pwd = this.checkBox1.Checked ? userpass : "";
     cs.ServerName = server;
     cs.Type = dbType.ToString();
     cs.Uid = userid;
     Form_AddDatabase.AddServerToXml(cs);
 }
        private void Form_AddDatabase_MySql_Load(object sender, EventArgs e)
        {
            Common.Config_Servers CS = new Common.Config_Servers();
            csList = CS.GetAll().Where(p => p.Type == this.dbType.ToString());
            foreach (var li in csList)
            {
                this.comboBox_mysql_server.Items.Add(li.ServerName);
            }

            Model.ConfigServers cs = CS.GetDefault(this.dbType);
            if (cs != null)
            {
                this.comboBox_mysql_server.Text = cs.ServerName;
                this.textBox_mysql_pwd.Text     = cs.Pwd;
                this.textBox_mysql_uid.Text     = cs.Uid;
                this.checkBox1.Checked          = !cs.Pwd.IsNullOrEmpty();
            }
        }
Exemple #4
0
 public static void AddServerToXml(Model.ConfigServers cs)
 {
     new Common.Config_Servers().Add(cs);
 }