public static CostoProduccionDetIns Fetch(int id) { CostoProduccionDetIns m_entidad = new CostoProduccionDetIns(); 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_costoproddetins_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); }
public void ListarInsumosParteProduccion() { if (_CostoProduccionDetInss == null) { _CostoProduccionDetInss = new ObservableListSource <CostoProduccionDetIns>(); } _CostoProduccionDetInss.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_listarinsumosparte"; command.Parameters.Add(new MySqlParameter("@n_idpro", _n_idparteprod)); connection.Open(); using (MySqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { CostoProduccionDetIns m_entidad = CostoProduccionDetIns.SetObject(reader); _CostoProduccionDetInss.Add(m_entidad); } } } } }
public static ObservableListSource <CostoProduccionDetIns> FetchList(int n_idcostoproddet) { ObservableListSource <CostoProduccionDetIns> m_listentidad = new ObservableListSource <CostoProduccionDetIns>(); 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_costoproddetins_listar"; command.Parameters.Add(new MySqlParameter("@n_idcostoproddet", n_idcostoproddet)); connection.Open(); using (MySqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { CostoProduccionDetIns m_entidad = SetObject(reader); m_entidad.IsNew = false; m_listentidad.Add(m_entidad); } } } } return(m_listentidad); }
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; } }