private void Ingresar() { if (this.txtUsuario.Text.Trim() != "" && this.txtPass.Text.Trim() != "" && this.txtUsuario.Text.Trim().Length <= 20 && this.txtPass.Text.Trim().Length <= 20) { DataCenter objDC = new DataCenter(); if (objDC.abrirConexion(1) != System.Data.ConnectionState.Open) { MessageBox.Show("No se logró conectar a la base de datos, consulte con su administrador.", "CCYMovimientos", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); } else { DBSesion pobjSesion = new DBSesion(txtUsuario.Text.Trim(), txtPass.Text.Trim()); string msj = pobjSesion.Ingresar(); if (msj == "1") { this.status = true; this.objSesion = pobjSesion; this.Close(); } else { this.txtUsuario.Focus(); Alertas alert = new Alertas(msj, ""); alert.Show(); } } } else { this.txtUsuario.Focus(); Alertas alert = new Alertas("No se admiten valores vacios o mayores a 20 caracteres.", ""); alert.Show(); } }
private void setSesion(DBSesion pobjSesion) { this.objSesion = pobjSesion; }