public static CostoProduccionDetMod Fetch(int id)
        {
            CostoProduccionDetMod m_entidad = new CostoProduccionDetMod();

            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 = "con_costoproddetmod_traerregistro";
                    command.Parameters.Add(new MySqlParameter("@n_id", id));
                    connection.Open();
                    using (MySqlDataReader reader = command.ExecuteReader())
                    {
                        if (reader.Read())
                        {
                            m_entidad       = SetObject(reader);
                            m_entidad.IsNew = false;
                        }
                    }
                }
            }
            return(m_entidad);
        }
Beispiel #2
0
        public void ListarModParteProduccion()
        {
            if (_CostoProduccionDetMods == null)
            {
                _CostoProduccionDetMods = new ObservableListSource <CostoProduccionDetMod>();
            }

            _CostoProduccionDetMods.Clear();

            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 = "con_costoproddet_listarmodparte";
                    command.Parameters.Add(new MySqlParameter("@n_idpro", _n_idparteprod));
                    connection.Open();
                    using (MySqlDataReader reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            CostoProduccionDetMod m_entidad = CostoProduccionDetMod.SetObject(reader);
                            _CostoProduccionDetMods.Add(m_entidad);
                        }
                    }
                }
            }
        }
        public static ObservableListSource <CostoProduccionDetMod> FetchList(int n_idcostoproddet)
        {
            ObservableListSource <CostoProduccionDetMod> m_listentidad = new ObservableListSource <CostoProduccionDetMod>();

            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 = "con_costoproddetmod_listar";
                    command.Parameters.Add(new MySqlParameter("@n_idcostoproddet", n_idcostoproddet));
                    connection.Open();
                    using (MySqlDataReader reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            CostoProduccionDetMod m_entidad = SetObject(reader);
                            m_entidad.IsNew = false;
                            m_listentidad.Add(m_entidad);
                        }
                    }
                }
            }
            return(m_listentidad);
        }
Beispiel #4
0
        public override void Delete(MySqlConnection connection, MySqlTransaction transaction)
        {
            //Se eliminan en primer lugar los hijos
            //_CostoProduccionDetInss
            CostoProduccionDetIns.DeleteAll(n_id, connection, transaction);

            //_CostoProduccionDetMods
            CostoProduccionDetMod.DeleteAll(n_id, connection, transaction);

            //_CostoProduccionDetCifs
            CostoProduccionDetCif.DeleteAll(n_id, connection, transaction);
            //
            try
            {
                using (MySqlCommand command = connection.CreateCommand())
                {
                    command.Transaction = transaction;
                    command.CommandType = System.Data.CommandType.StoredProcedure;
                    command.CommandText = "con_costoproddet_eliminar";
                    command.Parameters.Add(new MySqlParameter("@n_id", n_id));
                    int rows = command.ExecuteNonQuery();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }