Exemple #1
0
        public static void Commercial(ID3v2TagVersion tagVersion, bool useLogo)
        {
            if (tagVersion == ID3v2TagVersion.ID3v22)
            {
                throw new NotSupportedException();
            }

            IID3v2Tag   id3 = new ID3v2Tag();
            ICommercial aud = id3.CommercialInfoList.AddNew();

            using (MemoryStream ms = new MemoryStream())
            {
                ms.WriteByte(0); // text encoding
                Write(ms, Encoding.ASCII.GetBytes("usd10.00/cad15.00"));
                ms.WriteByte(0); // terminate
                Write(ms, Encoding.ASCII.GetBytes("20070610"));
                Write(ms, Encoding.ASCII.GetBytes("www.google.com"));
                ms.WriteByte(0); // terminate
                ms.WriteByte((byte)ReceivedAs.FileOverTheInternet);
                Write(ms, Encoding.ASCII.GetBytes("name of seller"));
                ms.WriteByte(0); // terminate
                Write(ms, Encoding.ASCII.GetBytes("description"));
                ms.WriteByte(0); // terminate
                if (useLogo)
                {
                    Write(ms, Encoding.ASCII.GetBytes("image/jpeg"));
                    ms.WriteByte(0); // terminate
                    Write(ms, new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04 });
                }

                TestFrame(aud, tagVersion, ms.ToArray());
            }
        }
Exemple #2
0
        public Note(DateTime dateNoteFrais, ICommercial c)
        {
            this.Rembourse       = false;
            this.DateNoteFrais   = dateNoteFrais;
            this.AgentCommercial = c;


            this.SetNoteInCommercial();
        }
Exemple #3
0
 public bool PayForItem(ICommercial commercialItem)
 {
     if (this.Cash >= commercialItem.Price)
     {
         this.Cash -= commercialItem.Price;
         return(true);
     }
     else
     {
         throw new ArgumentException("You don't have enough money to by it.");
     }
 }
Exemple #4
0
 private void BuyItem(CommercialBuilding building, ICommercial item, Button button)
 {
     try
     {
         int currentCash = ninja.Cash;
         building.Sell(item, ninja);
         if (currentCash == ninja.Cash)
         {
             MessageBox.Show("You rich the maximum of items that you can hold (10 items per category)!");
         }
     }
     catch (ArgumentException ex)
     {
         MessageBox.Show(ex.Message);
     }
     button.PerformClick();
 }
        public void Sell(ICommercial commercialItem, Ninja ninja)
        {
            // If ninja have enough money to pay, he pays
            if (ninja.PayForItem(commercialItem))
            {
                // If ninja accepts the item he takes it
                if (ninja.GetItem(commercialItem as Item))
                {
                    int index = this.goods.IndexOf(commercialItem);
                    this.goods.RemoveAt(index);

                    var itemRecharge = commercialItem.Clone();
                    this.goods.Insert(index, itemRecharge as ICommercial);
                }
                else
                {
                    // Return money
                    ninja.GetCash(commercialItem.Price);
                }
            }
        }
        public void Sell(ICommercial commercialItem, Ninja ninja)
        {
            // If ninja have enough money to pay, he pays
            if (ninja.PayForItem(commercialItem))
            {
                // If ninja accepts the item he takes it
                if (ninja.GetItem(commercialItem as Item))
                {
                    int index = this.goods.IndexOf(commercialItem);
                    this.goods.RemoveAt(index);

                    var itemRecharge = commercialItem.Clone();
                    this.goods.Insert(index, itemRecharge as ICommercial);
                }
                else
                {
                    // Return money
                    ninja.GetCash(commercialItem.Price);
                }
            }
        }
 public bool PayForItem(ICommercial commercialItem)
 {
     if (this.Cash >= commercialItem.Price)
     {
         this.Cash -= commercialItem.Price;
         return true;
     }
     else
     {
         throw new ArgumentException("You don't have enough money to by it.");
     }
 }
 private void BuyItem(CommercialBuilding building, ICommercial item, Button button)
 {
     try
     {
         int currentCash = ninja.Cash;
         building.Sell(item, ninja);
         if(currentCash == ninja.Cash)
         {
             MessageBox.Show("You rich the maximum of items that you can hold (10 items per category)!");
         }
     }
     catch (ArgumentException ex)
     {
         MessageBox.Show(ex.Message);
     }
     button.PerformClick();
 }
Exemple #9
0
 public RepasMidi(DateTime date, ICommercial commercial, double amount) : base(date, commercial)
 {
     this.MealCost = amount;
     this.SetMontantARembourser();
 }
Exemple #10
0
 public FraisTransport(DateTime date, ICommercial commercial, int distance) : base(date, commercial)
 {
     Distance = distance;
     this.SetMontantARembourser();
 }
 public void AjouterNote(ICommercial commercial, DateTime date, double amount, int region)
 {
     new FraisNuite(date, commercial, amount, region);
 }
 public void AjouterNote(ICommercial commercial, DateTime date, double amount)
 {
     new RepasMidi(date, commercial, amount);
 }
 public void AjouterNote(ICommercial commercial, DateTime date, int distance)
 {
     new FraisTransport(date, commercial, distance);
 }
 public void AjouterCommercial(ICommercial commercial)
 {
     Commercials.Add(commercial);
 }
Exemple #15
0
 public FraisNuite(DateTime date, ICommercial commercial, double amount, int region) : base(date, commercial)
 {
     this.MealCost = amount;
     Region        = region;
     this.SetMontantARembourser();
 }