Пример #1
0
        public static InventarioInicialDet Fetch(int id)
        {
            InventarioInicialDet m_entidad = new InventarioInicialDet();

            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 = "alm_inventarioinidet_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);
        }
Пример #2
0
        public override void Delete()
        {
            using (MySqlConnection connection
                       = new MySqlConnection(
                             ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString))
            {
                connection.Open();
                using (MySqlTransaction transaction = connection.BeginTransaction())
                {
                    using (MySqlCommand command = connection.CreateCommand())
                    {
                        try
                        {
                            InventarioInicialDet.DeleteAll(n_id, connection, transaction);

                            command.Transaction = transaction;
                            command.CommandType = System.Data.CommandType.StoredProcedure;
                            command.CommandText = "alm_inventarioini_eliminar";
                            command.Parameters.Add(new MySqlParameter("@n_id", n_id));
                            int rows = command.ExecuteNonQuery();
                            transaction.Commit();
                        }
                        catch (Exception ex)
                        {
                            transaction.Rollback();
                            throw ex;
                        }
                    }
                }
            }
        }
Пример #3
0
        public static ObservableListSource <InventarioInicialDet> FetchList(int n_idinvini)
        {
            ObservableListSource <InventarioInicialDet> m_listentidad = new ObservableListSource <InventarioInicialDet>();

            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 = "alm_inventarioinidet_listar";
                    command.Parameters.Add(new MySqlParameter("@n_idinvini", n_idinvini));
                    connection.Open();
                    using (MySqlDataReader reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            InventarioInicialDet m_entidad = SetObject(reader);
                            m_listentidad.Add(m_entidad);
                        }
                    }
                }
            }
            return(m_listentidad);
        }