Example #1
0
        private void buttonAffecter_Click(object sender, EventArgs e)
        {
            string      idColis           = dataGriedViewColis.SelectedRows[0].Cells[0].Value.ToString();
            Colis       LeColisClient     = Colis.ReturnColis(int.Parse(idColis));
            Client      LeClientColis     = Colis.ReturnColis(int.Parse(idColis)).getLeClient();
            List <Boxs> lesBoxsPresClient = Boxs.getBoxsTrieesDistance(LeClientColis);

            foreach (Boxs laBoxeLaPlusProche in lesBoxsPresClient)
            {
                foreach (Compartiments unCompa in laBoxeLaPlusProche.LesCompartiment)
                {
                    if (unCompa.LesColis[0].LeClient == LeClientColis)
                    {
                        int volumeTotal = 0;
                        foreach (Colis unColis in unCompa.LesColis)
                        {
                            if (unColis.getLeVolume() == "Gros")
                            {
                                volumeTotal += 2;
                            }
                            else
                            {
                                volumeTotal++;
                            }
                        }
                        if (LeColisClient.getLeVolume() == "Gros")
                        {
                            volumeTotal += 2;
                        }
                        else
                        {
                            volumeTotal++;
                        }
                        if (volumeTotal <= 4)
                        {
                            unCompa.LesColis.Add(LeColisClient);
                            LeColisClient.Etat    = "Affecté";
                            textBox.Text          = laBoxeLaPlusProche.Adresse.Adresse;
                            textCompartiment.Text = "X= " + unCompa.PositionX + " Y= " + unCompa.PositionY;
                            foreach (Livreurs unLivreur in Livreurs.CollClassLivreur)
                            {
                                foreach (KeyValuePair <DateTime, Boxs> uneLivraison in unLivreur.getLivraison())
                                {
                                    if (uneLivraison.Key == DateTime.Now)
                                    {
                                        if (uneLivraison.Value == laBoxeLaPlusProche)
                                        {
                                            textLivreur.Text = unLivreur.Nom;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Example #2
0
        private void buttonNAffecter_Click(object sender, EventArgs e)
        {
            string idColis = dataGriedViewColis.SelectedRows[0].Cells[0].Value.ToString();

            Colis.ReturnColis(int.Parse(idColis)).Etat = "Non Affecté";
        }