Esempio n. 1
0
        public static Sexo Get(int id)
        {
            Sexo sexo = null;

            try
            {
                sexo = SexoDal.Get(id);
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(sexo);
        }
Esempio n. 2
0
        public static List <Sexo> Get()
        {
            List <Sexo> sexoList = null;

            try
            {
                sexoList = SexoDal.GetList();
            }
            catch (SqlException ex)
            {
                Methods.GenerateLogsRelease("SexoBrl", "ListSexo",
                                            string.Format("{0} {1} Error: {2}", DateTime.Now.ToShortDateString(),
                                                          DateTime.Now.ToShortTimeString(), ex.Message));
                throw ex;
            }
            catch (Exception ex)
            {
                Methods.GenerateLogsRelease("SexoBrl", "ListSexo", string.Format("{0} {1} Error: {2}",
                                                                                 DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), ex.Message));
                throw ex;
            }
            return(sexoList);
        }
Esempio n. 3
0
        /// <summary>
        /// Obtine  la informacion de un usuario
        /// </summary>
        /// <param name="id">identificador del usuario</param>
        /// <returns></returns>

        public static Usuario Get(int id)
        {
            Usuario       res   = new Usuario();
            SqlCommand    cmd   = null;
            SqlDataReader dr    = null;
            string        query = "Select * From Usuario where PacienteId = @id";

            try
            {
                cmd = Methods.CreateBasicCommand(query);
                cmd.Parameters.AddWithValue("@id", id);
                dr = Methods.ExecuteDataReaderCommand(cmd);
                while (dr.Read())
                {
                    res = new Usuario()
                    {
                        UsuarioId       = dr.GetInt32(0),
                        Nombre          = dr.GetString(1),
                        Apellido        = dr.GetString(2),
                        SexoId          = SexoDal.Get(dr.GetByte(3)),
                        FechaNacimiento = dr.GetDateTime(4),
                        Eliminado       = dr.GetByte(5)
                    };
                }
            }
            catch (Exception ex)
            {
                Methods.GenerateLogsRelease("UsuarioDal", "Obteber", string.Format("{0} {1} Error: {2}", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), ex.Message));
                throw ex;
            }
            finally
            {
                cmd.Connection.Close();
            }
            return(res);
        }