Exemplo n.º 1
0
        public List <ModeloNegocio.Docente> getAllDocenteSchool(int idShool)
        {
            List <ModeloNegocio.Docente> lista = new List <ModeloNegocio.Docente>();

            Cmd            = new SqlCommand();
            Cmd.Connection = Conn;
            try
            {
                Cmd.CommandType = CommandType.StoredProcedure;
                Cmd.CommandText = "[otaku_bcp].PA_GET_DOCENTE_SCHOOL";
                Cmd.Parameters.Add("@idschool", SqlDbType.Int).Value = idShool;

                //Cmd.Parameters.Add("@tipoUser", SqlDbType.Int).Value = 7;
                Dtr = Cmd.ExecuteReader();

                while (Dtr.Read())
                {
                    ModeloNegocio.Docente docente = new ModeloNegocio.Docente();
                    docente.id       = Convert.ToInt32(Dtr["id"].ToString());
                    docente.Codigo   = Dtr["codigo"].ToString();
                    docente.FullName = Dtr["name"].ToString();


                    lista.Add(docente);
                }
                Conn.Close();
            }
            catch (Exception e)
            {
                Console.WriteLine("{0} Exception caught.", e);
            }
            return(lista);
        }
Exemplo n.º 2
0
        public List<ModeloNegocio.Docente> getAllDocenteSchool(int idShool)
        {
            List<ModeloNegocio.Docente> lista = new List<ModeloNegocio.Docente>();
            Cmd = new SqlCommand();
            Cmd.Connection = Conn;
            try
            {
                Cmd.CommandType = CommandType.StoredProcedure;
                Cmd.CommandText = "[otaku_bcp].PA_GET_DOCENTE_SCHOOL";
                Cmd.Parameters.Add("@idschool", SqlDbType.Int).Value = idShool;

                //Cmd.Parameters.Add("@tipoUser", SqlDbType.Int).Value = 7;
                Dtr = Cmd.ExecuteReader();

                while (Dtr.Read())
                {
                    ModeloNegocio.Docente docente = new ModeloNegocio.Docente();
                    docente.id = Convert.ToInt32(Dtr["id"].ToString());
                    docente.Codigo = Dtr["codigo"].ToString();
                    docente.FullName = Dtr["name"].ToString();

                    lista.Add(docente);
                }
                Conn.Close();
            }
            catch (Exception e)
            {
                Console.WriteLine("{0} Exception caught.", e);
            }
            return lista;
        }