Exemple #1
0
        /// <summary>
        /// Redéfinition de la méthode ToString.
        /// </summary>
        /// <returns>rune chaîne de caractère</returns>
        public override string ToString()
        {
            string unit;

            if (Quantite <= 1)
            {
                return(string.Format("{0} : {1} {2}", Nom, Quantite.ToString(), Unite.ToString()));
            }
            else if (Unite == Unite.unite)
            {
                return(string.Format("{0} : {1}", Nom, Quantite.ToString()));
            }
            else
            {
                switch (Unite)
                {
                case Unite.baton:
                    unit = "batons";
                    break;

                case Unite.cuillere:
                    unit = "cuilleres";
                    break;

                case Unite.feuille:
                    unit = "feuilles";
                    break;

                case Unite.goutte:
                    unit = "gouttes";
                    break;

                case Unite.morceau:
                    unit = "morceaux";
                    break;

                case Unite.sachet:
                    unit = "sachets";
                    break;

                case Unite.trait:
                    unit = "traits";
                    break;

                case Unite.tranche:
                    unit = "tranches";
                    break;

                case Unite.zeste:
                    unit = "zestes";
                    break;

                default:
                    unit = Unite.ToString();
                    break;
                }
                return(string.Format("{0} : {1} {2}", Nom, Quantite.ToString(), unit));
            }
        }
Exemple #2
0
 public int CompareTo(Richesse other)
 {
     if (other.Monnaie != Monnaie)
     {
         throw new NotSupportedException(string.Format("impossible de comparer des {0} avec des {1}", Monnaie.Nom, other.Monnaie.Nom));
     }
     return(Quantite.CompareTo(other.Quantite));
 }
Exemple #3
0
 public string[] ToRow()
 {
     string[] Row =
     {
         Ref_Article, Description, Marque.Nom, SousFamille.Nom, PrixHT.ToString(CultureInfo.InvariantCulture),
         Quantite.ToString()
     };
     return(Row);
 }
Exemple #4
0
        public void renderToPDF(XGraphics graph, XPen penNormal, XFont fontR9, int i)
        {
            graph.DrawString(Reference, fontR9, XBrushes.Black, new XRect(15, 305 + i * 20, 110, 10), XStringFormats.Center);


            graph.DrawString(Designation, fontR9, XBrushes.Black, new XRect(117, 305 + i * 20, 280, 10), XStringFormats.TopLeft);


            graph.DrawString(Quantite.ToString(), fontR9, XBrushes.Black, new XRect(282, 305 + i * 20, 60, 10), XStringFormats.Center);

            graph.DrawString(Prix_Unitaire.ToString() + " €", fontR9, XBrushes.Black, new XRect(372, 305 + i * 20, 60, 10), XStringFormats.TopLeft);

            graph.DrawString((TVA * 100).ToString("#.") + " %", fontR9, XBrushes.Black, new XRect(442, 305 + i * 20, 60, 10), XStringFormats.TopLeft);

            graph.DrawString(Prix_TTC.ToString("#.##") + " €", fontR9, XBrushes.Black, new XRect(535, 305 + i * 20, 100, 10), XStringFormats.TopLeft);
        }
Exemple #5
0
        public override int GetHashCode()
        {
            var hashCode = -577979777;

            hashCode = hashCode * -1521134295 + IdArticle.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Ref);

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Libelle);

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Localisation);

            hashCode = hashCode * -1521134295 + Quantite.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <int?> .Default.GetHashCode(IdMagasin);

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(InfosSupplementaires);

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(LienFlu);

            hashCode = hashCode * -1521134295 + EqualityComparer <TypeEpi> .Default.GetHashCode(TypeEpi);

            return(hashCode);
        }
        private void spComm_DataReceived(object sender, SerialDataReceivedEventArgs e)
        {
            string Trame = ((SerialPort)sender).ReadTo(((char)03).ToString()) + (char)03;

            Invoke(new Action(() =>
            {
#if Encryption
                Ecriture(Trame, "reception.txt", FileMode.Create, true);
                string Texte = Lecture("reception.txt", true);
#else
                Ecriture(Trame, "reception.txt", FileMode.Create);
                string Texte = Lecture("reception.txt");
#endif
                ResultatTrame RTrame = new ResultatTrame(Texte);
                if (RTrame.Valide)
                {
                    spComm.Write(((char)06).ToString()); //Envoie un ACK
                    m_Abandon = 0;                       //s'assure que le compteur de trame invalide recue est a 0

                    //Le code pour la verification de la date est ici:

                    bool DateValide = true;
                    if (RTrame.Heure < 8 || RTrame.Heure > 17)
                    {
                        DateValide = false;
                    }
                    else
                    {
                        if ((RTrame.Mois == 1 && RTrame.Jour == 1) || (RTrame.Mois == 10 && RTrame.Jour == 14) || (RTrame.Mois == 12 && RTrame.Jour == 25))
                        {
                            DateValide = false;
                        }
                    }

                    if (DateValide)
                    {
                        int Quantite;
                        decimal Prix;
                        if (InventaireUpdate(RTrame.Data, out Quantite, out Prix))
                        {
                            txtCheckSum.Text     = RTrame.CheckSum;
                            txtDate.Text         = RTrame.DateHeure;
                            txtNomArt.Text       = RTrame.Data; //Changer pour des vrai nom
                            txtPrixArt.Text      = Prix.ToString("C");
                            txtQuantitéRest.Text = Quantite.ToString();
                            txtTaxe.Text         = Math.Round((Prix * 0.14975M), 2, MidpointRounding.AwayFromZero).ToString("C");
                            txtTotal.Text        = Math.Round((Prix * 1.14975M), 2, MidpointRounding.AwayFromZero).ToString("C");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Merci pour votre travail hors des heures rémunérées");
                    }
                }
                else
                {
                    //code NAK goes here
                    m_Abandon++; //incremente la variable qui compte le nombre de trame invalide recue
#if Encryption
                    Ecriture(Texte + '\n', "ArchiveErreur.txt", FileMode.Append, false);
#else
                    Ecriture(Texte + '\n', "ArchiveErreur.txt", FileMode.Append);
#endif
                    if (m_Abandon > 10)                      //Verifie combien de fois la trame recue est invalide
                    {
                        spComm.Write(((char)24).ToString()); //Envoie un Cancel
                        m_Abandon = 0;
                    }
                    else
                    {
                        spComm.Write(((char)21).ToString());//Garde espoire que le lecteur de barre code vas dire quelque chose qui va faire du sens et lui demande de repeter (envoie un NAK)
                    }
                }
            }));
        }