コード例 #1
0
        private static Programacion SetObject(MySqlDataReader reader)
        {
            var prog = new Programacion
            {
                n_id        = reader.GetInt32("n_id"),
                n_idemp     = reader.GetInt32("n_idemp"),
                n_idtipdoc  = reader.GetInt32("n_idtipdoc"),
                c_numser    = reader.GetString("c_numser"),
                c_numdoc    = reader.GetString("c_numdoc"),
                c_numdocdet = reader.GetString("c_numdocdet"),
                n_idpro     = reader.GetInt32("n_idpro"),
                n_anotra    = reader.GetInt32("n_anotra"),
                n_mestra    = reader.GetInt32("n_mestra"),
                d_fchini    = reader.GetDateTime("d_fchini"),
                d_fchfin    = reader.GetDateTime("d_fchfin"),
                d_fchemi    = reader.GetDateTime("d_fchemi"),
                n_numhordia = reader.GetInt32("n_numhordia"),
                c_despro    = reader.GetString("c_despro")
            };

            if (reader["c_obs"] != DBNull.Value)
            {
                prog.c_obs = reader.GetString("c_obs");
            }

            return(prog);
        }
コード例 #2
0
        public static List <Programacion> FetchList(int n_idemp, int n_anotra)
        {
            List <Programacion> m_listentidad = new List <Programacion>();

            using (MySqlConnection connection
                       = new MySqlConnection(
                             ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString))
            {
                using (MySqlCommand command = new MySqlCommand())
                {
                    command.Connection  = connection;
                    command.CommandType = System.Data.CommandType.StoredProcedure;
                    command.CommandText = "pro_programa_listar";
                    command.Parameters.Add(new MySqlParameter("@n_idemp", n_idemp));
                    command.Parameters.Add(new MySqlParameter("@n_anotra", n_anotra));
                    connection.Open();
                    using (MySqlDataReader reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            Programacion m_entidad = SetObject(reader);
                            m_listentidad.Add(m_entidad);
                        }
                    }
                }
            }
            return(m_listentidad);
        }
コード例 #3
0
        public static Programacion Fetch(int id)
        {
            Programacion m_entidad = new Programacion();

            using (MySqlConnection connection
                       = new MySqlConnection(
                             ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString))
            {
                using (MySqlCommand command = new MySqlCommand())
                {
                    command.Connection  = connection;
                    command.CommandType = System.Data.CommandType.StoredProcedure;
                    command.CommandText = "pro_programa_traerregistro";
                    command.Parameters.Add(new MySqlParameter("@n_id", id));
                    connection.Open();
                    using (MySqlDataReader reader = command.ExecuteReader())
                    {
                        if (reader.Read())
                        {
                            m_entidad = SetObject(reader);
                        }
                    }
                }
            }
            return(m_entidad);
        }
コード例 #4
0
        public static List <Programacion> TraerPorRangoFecha(int n_idemp, DateTime d_fchini, DateTime d_fchfin)
        {
            List <Programacion> m_listentidad = new List <Programacion>();

            using (MySqlConnection connection
                       = new MySqlConnection(
                             ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString))
            {
                using (MySqlCommand command = new MySqlCommand())
                {
                    command.Connection  = connection;
                    command.CommandType = System.Data.CommandType.StoredProcedure;
                    command.CommandText = "pro_programa_TraerPorRangoFecha";
                    command.Parameters.Add(new MySqlParameter("@n_idemp", n_idemp));
                    command.Parameters.Add(new MySqlParameter("@d_fchini", d_fchini));
                    command.Parameters.Add(new MySqlParameter("@d_fchfin", d_fchfin));
                    connection.Open();
                    using (MySqlDataReader reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            Programacion m_entidad = SetObject(reader);
                            m_listentidad.Add(m_entidad);
                        }
                    }
                }
            }
            return(m_listentidad);
        }