示例#1
0
        public void Sortie(string id_commande, string id_magasinier, string id_binome)
        {
            Connexion       connexion  = new Connexion();
            MySqlConnection connection = connexion.GetConnection();

            connection.Open();
            MySqlCommand     command = connection.CreateCommand();
            MySqlTransaction transaction;

            transaction         = connection.BeginTransaction();
            command.Connection  = connection;
            command.Transaction = transaction;

            Duree    duree    = new Duree();
            Commande commande = new Commande();

            commande.IdCommande = Int32.Parse(id_commande);
            duree.Commande      = commande;
            duree.HeureSortie   = DateTime.Now;
            DureeDAO dureeDAO = new DureeDAO();

            try
            {
                this.SortieCommande(command, commande);
                this.SortieStock(command, id_magasinier, id_binome, commande);
                dureeDAO.UpdateDuree(command, duree, "SORTIE");
                if (transaction != null)
                {
                    transaction.Commit();
                }
            }
            catch (Exception exception)
            {
                transaction.Rollback();
                throw exception;
            }
            finally
            {
                connexion.CloseAll(command, transaction, connection);
            }
        }
示例#2
0
        public void Valider(string id_commande)
        {
            Connexion       connexion  = new Connexion();
            MySqlConnection connection = connexion.GetConnection();

            connection.Open();
            MySqlCommand     command = connection.CreateCommand();
            MySqlTransaction transaction;

            transaction         = connection.BeginTransaction();
            command.Connection  = connection;
            command.Transaction = transaction;

            Duree    duree    = new Duree();
            Commande commande = new Commande();

            commande.IdCommande  = Int32.Parse(id_commande);
            duree.Commande       = commande;
            duree.HeureLivraison = DateTime.Now;
            DureeDAO dureeDAO = new DureeDAO();

            try
            {
                this.ValiderCommande(command, id_commande);
                dureeDAO.UpdateDuree(command, duree, "LIVRAISON");
                if (transaction != null)
                {
                    transaction.Commit();
                }
            }
            catch (Exception exception)
            {
                transaction.Rollback();
                throw exception;
            }
            finally
            {
                connexion.CloseAll(command, transaction, connection);
            }
        }