private void Form5_Load(object sender, EventArgs e) { MaximizeBox = false; try { DTconexion = XMLRW.Readxml("CONFIGURACION"); } catch (Exception conexerro) { MessageBox.Show(conexerro.ToString(), "Error en Configuracion XML"); } var ensablado = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; vercion_actual = ensablado.ToString(); label3.Text = vercion_actual; cont.conectar("DM"); SqlCommand cm2 = new SqlCommand("SELECT [VERCION] FROM [DM].[CORRECT].[VERCION_CORRECTX] WHERE ID_VERCION = '1'", cont.condm); SqlDataReader dr2 = cm2.ExecuteReader(); while (dr2.Read()) { vercion = Convert.ToString(dr2["VERCION"]); } dr2.Close(); cont.Desconectar("DM"); int ctn = vercion_actual.Length; actual = vercion_actual.Substring((ctn - 3), 3); int ctn2 = vercion.Length; nueva = vercion.Substring((ctn2 - 3), 3); if (Convert.ToInt32(actual) < Convert.ToInt32(nueva)) { MessageBoxButtons bt1 = MessageBoxButtons.YesNo; DialogResult result = MessageBox.Show("EXISTE UNA NUEVA VERSION DE CORRECT " + vercion + " ¿DESEA REALIZAR LA ACTUALIZACION ?", "ACTUALIZACION SISTEMA " + vercion_actual + "", bt1, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); if (result == DialogResult.Yes) { compiar_archivo(); instalar_actualizacion(); this.Close(); } } else { } cargaempresas(); combo_empresa(comboBox1, agencias, "NOMRE"); }
private void button4_Click(object sender, EventArgs e) { DataRow rowtp = DTSFTP.Rows[0]; if (textBox5.Text == string.Empty) { HOST = Convert.ToString(rowtp["HOST"]); } else { HOST = textBox5.Text; } if (textBox6.Text == string.Empty) { USER = Convert.ToString(rowtp["USER"]); } else { USER = textBox6.Text; } if (textBox7.Text == string.Empty) { SFTPKEY = Encripter.Encriptar(Convert.ToString(rowtp["SFTPKEY"])); } else { SFTPKEY = Encripter.Encriptar(textBox7.Text); } if (textBox8.Text == string.Empty) { PUERTO = Convert.ToString(rowtp["PUERTO"]); } else { PUERTO = textBox8.Text; } if (checkBox1.Checked) { AUTOMATICO = "YES"; } else { AUTOMATICO = "NO"; } XMLRW.write("SFTP", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", HOST, USER, SFTPKEY, PUERTO, AUTOMATICO); }
private void ingreso() { if (empresa != "") { usuario = textBox1.Text; contraseña = textBox2.Text; if (PermisoEmpresa(usuario, empresa)) { if (tipo_Usuario(usuario)) { Log_local(); } else { //conxion para validar string cad = "data source=192.168.1.25;initial catalog=EXACTUS ;user Id ='" + usuario + "' ; password = '******'"; SqlConnection con = new SqlConnection(cad); // valida usuarios y contraseña try { con.Open(); // MessageBox.Show("Bienvenido"+" "+usuario); con.Close(); // ID_EMPRESA(); if (Convert.ToInt32(actual) > Convert.ToInt32(nueva)) { UpdateVercion(); } XMLRW.writeLogin(usuario, vercion, empresa, tipo_user); Main_Menu fm6 = new Main_Menu(); this.Visible = false; fm6.ShowDialog(); fm6.Close(); fm6 = null; this.Close(); } catch (Exception erg) { string text = erg.ToString(); if (text.Contains("inicio de sesión")) { MessageBox.Show("Error en Usuario o Contraseña", "Error Inicio de Sesión "); this.textBox2.Text = null; } else { MessageBox.Show(text, "!!!! Error !!!! "); this.textBox2.Text = null; } } } } else { MessageBox.Show("Actualmente no cuenta con Permisos para la Empresa " + empresa + ""); } } }
private void button2_Click(object sender, EventArgs e) { DataRow row = DT.Rows[0]; if (comboBox1.Text == "192.168.1.25 [EXACTUS]") { SSQLserver = textBox1.Text; SWeb = Convert.ToString(row["SERVIDORWEB"]); SDMdatabase = Convert.ToString(row["DBSQLDM"]); SDBExactus = textBox4.Text; SDBWeb = Convert.ToString(row["DBWEB"]); SSQLogin = textBox2.Text; SMyqlogin = Convert.ToString(row["LOGINWEB"]); SSqlID = Encripter.Encriptar(textBox3.Text); SMsqlID = Convert.ToString(row["KEYIDWEB"]); SSQLserverseg = Convert.ToString(row["SERVIDORSQLSEG"]); SDBSeguridad = Convert.ToString(row["DBSQLSG"]); SSQLoginsg = Convert.ToString(row["LOGINSG"]); SSqlIDsg = Convert.ToString(row["KEYIDSG"]); PGSQLserver = Convert.ToString(row["SERVIDORPGSQL"]); pgdb = Convert.ToString(row["DBPG"]); pglogin = Convert.ToString(row["LOGINPG"]); pgID = Convert.ToString(row["KEYIDPG"]); XMLRW.write("CONFIGURACION", SSQLserver, SWeb, SSQLserverseg, PGSQLserver, SDMdatabase, SDBExactus, SDBSeguridad, pgdb, SDBWeb, SSQLogin, SSQLoginsg, SMyqlogin, pglogin, SSqlID, SSqlIDsg, SMsqlID, pgID, "", "", "", "", ""); } else if (comboBox1.Text == "mysql.dismonline") { SSQLserver = Convert.ToString(row["SERVIDORSQL"]); SWeb = textBox1.Text; SDMdatabase = Convert.ToString(row["DBSQLDM"]); SDBExactus = Convert.ToString(row["DBSQLEX"]); SDBWeb = textBox4.Text; SSQLogin = Convert.ToString(row["LOGIN"]); SMyqlogin = textBox2.Text; SSqlID = Convert.ToString(row["KEYID"]); SMsqlID = Encripter.Encriptar(textBox3.Text); SSQLserverseg = Convert.ToString(row["SERVIDORSQLSEG"]); SDBSeguridad = Convert.ToString(row["DBSQLSG"]); SSQLoginsg = Convert.ToString(row["LOGINSG"]); SSqlIDsg = Convert.ToString(row["KEYIDSG"]); PGSQLserver = Convert.ToString(row["SERVIDORPGSQL"]); pgdb = Convert.ToString(row["DBPG"]); pglogin = Convert.ToString(row["LOGINPG"]); pgID = Convert.ToString(row["KEYIDPG"]); XMLRW.write("CONFIGURACION", SSQLserver, SWeb, SSQLserverseg, PGSQLserver, SDMdatabase, SDBExactus, SDBSeguridad, pgdb, SDBWeb, SSQLogin, SSQLoginsg, SMyqlogin, pglogin, SSqlID, SSqlIDsg, SMsqlID, pgID, "", "", "", "", ""); } else if (comboBox1.Text == "192.168.1.25 [DM]") { SSQLserver = textBox1.Text; SWeb = Convert.ToString(row["SERVIDORWEB"]); SDMdatabase = textBox4.Text; SDBExactus = Convert.ToString(row["DBSQLEX"]); SDBWeb = Convert.ToString(row["DBWEB"]); SSQLogin = textBox2.Text; SMyqlogin = Convert.ToString(row["LOGINWEB"]); SSqlID = Encripter.Encriptar(textBox3.Text); SMsqlID = Convert.ToString(row["KEYIDWEB"]); SSQLserverseg = Convert.ToString(row["SERVIDORSQLSEG"]); SDBSeguridad = Convert.ToString(row["DBSQLSG"]); SSQLoginsg = Convert.ToString(row["LOGINSG"]); SSqlIDsg = Convert.ToString(row["KEYIDSG"]); PGSQLserver = Convert.ToString(row["SERVIDORPGSQL"]); pgdb = Convert.ToString(row["DBPG"]); pglogin = Convert.ToString(row["LOGINPG"]); pgID = Convert.ToString(row["KEYIDPG"]); XMLRW.write("CONFIGURACION", SSQLserver, SWeb, SSQLserverseg, PGSQLserver, SDMdatabase, SDBExactus, SDBSeguridad, pgdb, SDBWeb, SSQLogin, SSQLoginsg, SMyqlogin, pglogin, SSqlID, SSqlIDsg, SMsqlID, pgID, "", "", "", "", ""); } else if (comboBox1.Text == "192.168.1.11 [ACCESSCONTROL]") { SSQLserver = Convert.ToString(row["SERVIDORSQL"]); SSQLserverseg = textBox1.Text; SWeb = Convert.ToString(row["SERVIDORWEB"]); SDMdatabase = Convert.ToString(row["DBSQLDM"]); SDBSeguridad = textBox4.Text; SDBExactus = Convert.ToString(row["DBSQLEX"]); SDBWeb = Convert.ToString(row["DBWEB"]); SSQLoginsg = textBox2.Text; SSQLogin = Convert.ToString(row["LOGIN"]); SMyqlogin = Convert.ToString(row["LOGINWEB"]); SSqlID = Convert.ToString(row["KEYID"]); SSqlIDsg = Encripter.Encriptar(textBox3.Text); SMsqlID = Convert.ToString(row["KEYIDWEB"]); PGSQLserver = Convert.ToString(row["SERVIDORPGSQL"]); pgdb = Convert.ToString(row["DBPG"]); pglogin = Convert.ToString(row["LOGINPG"]); pgID = Convert.ToString(row["KEYIDPG"]); XMLRW.write("CONFIGURACION", SSQLserver, SWeb, SSQLserverseg, PGSQLserver, SDMdatabase, SDBExactus, SDBSeguridad, pgdb, SDBWeb, SSQLogin, SSQLoginsg, SMyqlogin, pglogin, SSqlID, SSqlIDsg, SMsqlID, pgID, "", "", "", "", ""); } else if (comboBox1.Text == "18.216.38.163 [ODOO]") { SSQLserver = Convert.ToString(row["SERVIDORSQL"]); SWeb = Convert.ToString(row["SERVIDORWEB"]); SDMdatabase = Convert.ToString(row["DBSQLDM"]); SDBExactus = Convert.ToString(row["DBSQLEX"]); SDBWeb = Convert.ToString(row["DBWEB"]); SSQLogin = Convert.ToString(row["LOGIN"]); SMyqlogin = Convert.ToString(row["LOGINWEB"]); SSqlID = Convert.ToString(row["KEYID"]); SMsqlID = Convert.ToString(row["KEYIDWEB"]); SSQLserverseg = Convert.ToString(row["SERVIDORSQLSEG"]); SDBSeguridad = Convert.ToString(row["DBSQLSG"]); SSQLoginsg = Convert.ToString(row["LOGINSG"]); SSqlIDsg = Convert.ToString(row["KEYIDSG"]); PGSQLserver = textBox1.Text; pgdb = textBox4.Text; pglogin = textBox2.Text; pgID = Encripter.Encriptar(textBox3.Text); XMLRW.write("CONFIGURACION", SSQLserver, SWeb, SSQLserverseg, PGSQLserver, SDMdatabase, SDBExactus, SDBSeguridad, pgdb, SDBWeb, SSQLogin, SSQLoginsg, SMyqlogin, pglogin, SSqlID, SSqlIDsg, SMsqlID, pgID, "", "", "", "", ""); } }