public static bool getListadoVotacionPropuestaRespuesta(ref DataTable pobjDataTable) { bool retorno = false; YouCom.Service.BD.SQLHelper wobjSQLHelper = new YouCom.Service.BD.SQLHelper(); try { //Seteo Parámetros. //==================================================================================== //==================================================================================== //Ejecuto SP. //==================================================================================== if (wobjSQLHelper.Ejecutar("QRY_ListadoVotacionPropuestaRespuesta", "YouCom", pobjDataTable) <= 0) { retorno = false; } else { retorno = true; } //==================================================================================== } #region Catch catch (Exception eobjException) { throw eobjException; } #endregion return(retorno); }
public static YouCom.DTO.Seguridad.OperadorDTO AuntetificaUsuario(string usuario, string password) { YouCom.DTO.Seguridad.OperadorDTO theOperadorDTO = new YouCom.DTO.Seguridad.OperadorDTO(); DataTable pobjDataTable = new DataTable(); YouCom.Service.BD.SQLHelper wobjSQLHelper = new YouCom.Service.BD.SQLHelper(); wobjSQLHelper.SetParametro("@pUsuario", SqlDbType.VarChar, 50, usuario); try { //Seteo Parámetros. //==================================================================================== //==================================================================================== //Ejecuto SP. //==================================================================================== if (wobjSQLHelper.Ejecutar("QRY_Operador", "YouCom", pobjDataTable) <= 0) { } else { string operador_nro = string.Empty; foreach (DataRow wobjDataRow in pobjDataTable.Rows) { operador_nro = wobjDataRow["USU_RUT"].ToString(); theOperadorDTO.OperadorNro = int.Parse(operador_nro.ToString().Substring(0, operador_nro.ToString().Length - 1)); theOperadorDTO.Usuario = wobjDataRow["USU_RUT"].ToString(); theOperadorDTO.Password = wobjDataRow["Password"].ToString(); theOperadorDTO.FechaPassword = !string.IsNullOrEmpty(wobjDataRow["Fecha_Password"].ToString()) ? Convert.ToDateTime(wobjDataRow["Fecha_Password"].ToString()) : DateTime.MinValue; theOperadorDTO.IntentoFallidoFecha = !string.IsNullOrEmpty(wobjDataRow["Intento_Fallido_Fecha"].ToString()) ? Convert.ToDateTime(wobjDataRow["Intento_Fallido_Fecha"].ToString()) : DateTime.MinValue; theOperadorDTO.IntentoFallidoCant = !string.IsNullOrEmpty(wobjDataRow["Intento_Fallido_Cant"].ToString()) ? Int32.Parse(wobjDataRow["Intento_Fallido_Cant"].ToString()) : 0; theOperadorDTO.Nombres = wobjDataRow["nombre_usuario"].ToString(); theOperadorDTO.Paterno = wobjDataRow["paterno_usuario"].ToString(); theOperadorDTO.Materno = wobjDataRow["materno_usuario"].ToString(); YouCom.DTO.Seguridad.CondominioDTO myCondominio = new YouCom.DTO.Seguridad.CondominioDTO(); myCondominio.IdCondominio = decimal.Parse(wobjDataRow["idCondominio"].ToString()); theOperadorDTO.TheCondominioDTO = myCondominio; YouCom.DTO.Seguridad.ComunidadDTO myComunidadDTO = new YouCom.DTO.Seguridad.ComunidadDTO(); myComunidadDTO.IdComunidad = decimal.Parse(wobjDataRow["idComunidad"].ToString()); theOperadorDTO.TheComunidadDTO = myComunidadDTO; YouCom.DTO.Seguridad.PerfilDTO myPerfilDTO = new YouCom.DTO.Seguridad.PerfilDTO(); myPerfilDTO.IdPerfil = decimal.Parse(wobjDataRow["idPerfil"].ToString()); theOperadorDTO.ThePerfilDTO = myPerfilDTO; } if (theOperadorDTO.Password == password) { if (theOperadorDTO.IntentoFallidoCant >= 3) { throw new Exception("4|Estimado Cliente, Supero reintentos permitidos Usuario Bloqueado"); } else { ActIntentoFallidos(usuario, 0); } } else { theOperadorDTO.IntentoFallidoCant = theOperadorDTO.IntentoFallidoCant + 1; ActIntentoFallidos(usuario, Convert.ToInt16(theOperadorDTO.IntentoFallidoCant)); throw new Exception("2|El usuario o la contraseña son incorrectos."); ///usuario pass erroneas //return false } //==================================================================================== } } #region Catch catch (Exception eobjException) { throw eobjException; } #endregion return(theOperadorDTO); }