Ejemplo n.º 1
0
 public StockBO(Herds herd, int forDay, decimal milkQ, int skinsQ)
     : this(herd, forDay)
 {
     if (this.ReturnMilkStock() >= milkQ && this.ReturnSkinStock() >= skinsQ)
     {
         // all good
         data[0] = 201;
         data[1] = this.GetJSONStock(forDay, milkQ, skinsQ);
     }
     else if (this.ReturnMilkStock() < milkQ && this.ReturnSkinStock() >= skinsQ)
     {
         // return partial skins
         data[0] = 206;
         data[1] = this.GetJSONSkinStock(forDay, skinsQ);
     }
     else if (this.ReturnMilkStock() >= milkQ && this.ReturnSkinStock() < skinsQ)
     {
         // return partial milk
         data[0] = 206;
         data[1] = this.GetJSONMilkStock(forDay, milkQ);
     }
     else
     {
         data[0] = 204;
         data[1] = "[]";
     }
 }
Ejemplo n.º 2
0
 public StockBO(Herds herd, int forDay, decimal milkQ, int skinsQ) : this(herd, forDay)
 {
     if (this.ReturnMilkStock() >= milkQ && this.ReturnSkinStock() >= skinsQ)
     {
         // all good
         data[0] = 201;
         data[1] = this.GetJSONStock(forDay, milkQ, skinsQ);
     }
     else if (this.ReturnMilkStock() < milkQ && this.ReturnSkinStock() >= skinsQ)
     {
         // return partial skins
         data[0] = 206;
         data[1] = this.GetJSONSkinStock(forDay, skinsQ);
     }
     else if (this.ReturnMilkStock() >= milkQ && this.ReturnSkinStock() < skinsQ)
     {
         // return partial milk
         data[0] = 206;
         data[1] = this.GetJSONMilkStock(forDay, milkQ);
     }
     else
     {
         data[0] = 204;
         data[1] = "[]";
     }
 }
Ejemplo n.º 3
0
 public HerdBO(Herds herd)
 {
     foreach (Animals anim in herd.Animals)
     {
         this.Herd.Add(new SheepBO(anim));
     }
 }
Ejemplo n.º 4
0
        static void TestSheep()
        {
            int dayNum;

            Console.WriteLine("Enter number of the day!!!");

            var            dayNumString = Console.ReadLine();
            List <Animals> aList        = new List <Animals>();
            Herds          herd;
            StockBO        stock;
            var            context = new ABusiness.ABEntities();

            if (int.TryParse(dayNumString, out dayNum))
            {
                herd = new Herds(HerdBO.GetXmlEntries());

                stock = new StockBO(herd, dayNum);

                Console.WriteLine();
                Console.WriteLine("In Stock:");
                Console.WriteLine("   " + string.Format("{0:0.000}", stock.ReturnMilkStock()) + " liters of milk");
                Console.WriteLine("   " + stock.ReturnSkinStock().ToString() + " skins of wool");
                Console.WriteLine("Herd: ");

                foreach (string str in stock.GetHerdAges())
                {
                    Console.WriteLine(str);
                }

                Console.WriteLine();
                Main();
            }
            else
            {
                Console.WriteLine("You entered a string!!! Try again");
                Console.WriteLine();
                TestSheep();
            }
        }
Ejemplo n.º 5
0
 public StockBO(Herds herd, int forDay)
 {
     this.Herd = new HerdBO(herd);
     this.ProcessStock(forDay);
 }
Ejemplo n.º 6
0
 public StockBO(Herds herd)
 {
     this.Herd = new HerdBO(herd);
 }
Ejemplo n.º 7
0
 public StockBO(Herds herd, int forDay)
 {
     this.Herd = new HerdBO(herd);
     this.ProcessStock(forDay);
 }
Ejemplo n.º 8
0
 public StockBO(Herds herd)
 {
     this.Herd = new HerdBO(herd);
 }
Ejemplo n.º 9
0
        static void TestSheep()
        {
            int dayNum;

            Console.WriteLine("Enter number of the day!!!");

            var dayNumString = Console.ReadLine();
            List<Animals> aList = new List<Animals>();
            Herds herd;
            StockBO stock;
            var context = new ABusiness.ABEntities();

            if (int.TryParse(dayNumString, out dayNum))
            {
                herd = new Herds(HerdBO.GetXmlEntries());

                stock = new StockBO(herd, dayNum);

                Console.WriteLine();
                Console.WriteLine("In Stock:");
                Console.WriteLine("   " + string.Format("{0:0.000}", stock.ReturnMilkStock()) + " liters of milk");
                Console.WriteLine("   " + stock.ReturnSkinStock().ToString() + " skins of wool");
                Console.WriteLine("Herd: ");

                foreach( string str in stock.GetHerdAges())
                    Console.WriteLine(str);

                Console.WriteLine();
                Main();
            }
            else
            {
                Console.WriteLine("You entered a string!!! Try again");
                Console.WriteLine();
                TestSheep();
            }
        }
Ejemplo n.º 10
0
 public HerdBO(Herds herd)
 {
     foreach (Animals anim in herd.Animals)
         this.Herd.Add(new SheepBO(anim));
 }