Example #1
0
        public static TAdministrador GetAdministradorFromDr(SqlCeDataReader dr)
        {
            TAdministrador adm = new TAdministrador();

            adm.administradorId = dr.GetInt32(0);
            adm.nombre          = dr.GetString(1);
            adm.login           = dr.GetString(2);
            adm.password        = dr.GetString(3);
            adm.email           = dr.GetString(4);
            adm.nivel           = dr.GetInt32(5);
            return(adm);
        }
Example #2
0
        public static TAdministrador GetTAdministrador(int id, SqlCeConnection conn)
        {
            TAdministrador administrador = null;

            using (SqlCeCommand cmd = conn.CreateCommand())
            {
                cmd.CommandType = System.Data.CommandType.Text;
                cmd.CommandText = String.Format("SELECT * FROM Administradores WHERE administradorId = {0}", id);
                using (SqlCeDataReader dr = cmd.ExecuteReader())
                {
                    while (dr.Read())
                    {
                        administrador = GetAdministradorFromDr(dr);
                    }
                    if (!dr.IsClosed)
                    {
                        dr.Close();
                    }
                }
            }
            return(administrador);
        }
Example #3
0
        public static TAdministrador GetLogin(string login, string password, SqlCeConnection conn)
        {
            TAdministrador administrador = null;

            using (SqlCeCommand cmd = conn.CreateCommand())
            {
                cmd.CommandType = System.Data.CommandType.Text;
                cmd.CommandText = String.Format("SELECT * FROM administradores WHERE login = '******' AND password = '******'", login, password);
                using (SqlCeDataReader dr = cmd.ExecuteReader())
                {
                    while (dr.Read())
                    {
                        administrador = GetAdministradorFromDr(dr);
                    }
                    if (!dr.IsClosed)
                    {
                        dr.Close();
                    }
                }
            }
            return(administrador);
        }