/***************************************************************************************************************************************************** * Nombre del Creador: Victor Valente * Fecha de Creacion: ---- * Descripcion: Procedimiento para mostrar la ventana de la conexion de la base de datos para el caso de que no exista una configuracion *****************************************************************************************************************************************************/ private void btnLimpiarConfiEmpresa_Click(object sender, EventArgs e) { formConexionBD frm = new formConexionBD(); if (frm.ShowDialog() != DialogResult.OK) { frm.BringToFront(); } }
private void BtnConfBD_Click(object sender, EventArgs e) { if (ClaseComunes.chkPermiso(true, 4, claseControlUsuario.UserName, 40)) { Form g_ExisteFormulario = Application.OpenForms.OfType <SeleccionDeAreaDeTrabajo>().Where(pre => pre.Text == "Configurar Conexion con el Servidor de Base de Datos").SingleOrDefault <Form>(); if (g_ExisteFormulario != null) { if (g_ExisteFormulario.WindowState == FormWindowState.Minimized) { g_ExisteFormulario.WindowState = FormWindowState.Normal; } g_ExisteFormulario.BringToFront(); } else { formConexionBD frm = new formConexionBD(); frm.Show(); } } }
private void T_Splash_Tick(object sender, EventArgs e) { if (Tiempo > 0) { Tiempo -= 1; } else { t_Splash.Enabled = false; Form frm; claseControlBaseDeDatos DB = new claseControlBaseDeDatos(); string sParIni = ""; string sPath = ""; sPath = Directory.GetCurrentDirectory() + "\\parIni.ini"; // Lee archivo de parametros. Si no existe lo crea if (!System.IO.File.Exists(sPath)) { using (FileStream fs = File.Create(sPath)) { } } try { StreamReader file = new StreamReader(sPath); if ((sParIni = file.ReadLine()) != null) { file.Close(); } else { sParIni = ""; file.Close(); } } catch (Exception ex) { MessageBox.Show("No existe el archivo 'parIni.ini' de parámetros iniciales. \n" + ex.Message, "Sistema SCADA", MessageBoxButtons.OK); } if (sParIni.Trim() == "") { frm = new formConexionBD(true); } else { claseControlBaseDeDatos ControlBD = new claseControlBaseDeDatos(); claseControlUsuario ControlUsuario = new claseControlUsuario(); string sDatPar = ControlBD.DesEncriptar(sParIni); ControlBD.Guardar( ClaseComunes.getCampo(ref sDatPar), ClaseComunes.getCampo(ref sDatPar), ClaseComunes.getCampo(ref sDatPar), ClaseComunes.getCampo(ref sDatPar)); if (sDatPar != "") { ControlBD.GuardarERP( Convert.ToInt32(ClaseComunes.getCampo(ref sDatPar)), ClaseComunes.getCampo(ref sDatPar), ClaseComunes.getCampo(ref sDatPar), ClaseComunes.getCampo(ref sDatPar), ClaseComunes.getCampo(ref sDatPar)); } //Verificacion de datos de conexión if (!DB.ProbarConeccion() || !DB.ProbarConeccionERP()) { frm = new formConexionBD(true); } else { frm = new formLogin(); } } frm.Show(); Hide(); } }