示例#1
0
        public static ObservableListSource <CostoProduccionDetCif> FetchList(int n_idcostoproddet)
        {
            ObservableListSource <CostoProduccionDetCif> m_listentidad = new ObservableListSource <CostoProduccionDetCif>();

            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_costoproddetcif_listar";
                    command.Parameters.Add(new MySqlParameter("@n_idcostoproddet", n_idcostoproddet));
                    connection.Open();
                    using (MySqlDataReader reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            CostoProduccionDetCif m_entidad = SetObject(reader);
                            m_entidad.IsNew = false;
                            m_listentidad.Add(m_entidad);
                        }
                    }
                }
            }
            return(m_listentidad);
        }
示例#2
0
        public static CostoProduccionDetCif Fetch(int id)
        {
            CostoProduccionDetCif m_entidad = new CostoProduccionDetCif();

            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_costoproddetcif_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);
        }
示例#3
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;
            }
        }