/***************************************************************************************************************************************************** * Nombre del Creador: Victor Valente * Fecha de Creacion: ---- * Descripcion: Click del boton de Acceder, Inicializa la variable Tiempo en 2 y comprueba que los datos del usuario * existan y esten correctos usando el metodo "chkUsuario" de la clase "claseControlUsuario" de ser correctos dichos datos * cambia la propiedad visible del panel de login a "false" y activa el t_Acceder *****************************************************************************************************************************************************/ private void btn_Acceder_Click(object sender, EventArgs e) { tiempo = 2; //pic_Fondo.Image = Properties.Resources.gifFondo2; //pnlLogin.Visible = false; // t_Acceder.Enabled = true; try { Cursor.Current = Cursors.WaitCursor; Application.DoEvents(); claseControlUsuario InstanciaUsuario = new claseControlUsuario(); claseControlUsuario.UserName = txtUsusario.Text.ToString(); claseControlUsuario.Contraseña = txtContrasena.Text.ToString(); if (InstanciaUsuario.chkUsuario()) { pnlLogin.Visible = false; t_Acceder.Enabled = true; } else { return; } } catch { Cursor.Current = Cursors.Default; Application.DoEvents(); return; } finally { Cursor.Current = Cursors.Default; Application.DoEvents(); } }
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(); } }