예제 #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] = "[]";
     }
 }
예제 #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] = "[]";
     }
 }
예제 #3
0
 public HerdBO(Herds herd)
 {
     foreach (Animals anim in herd.Animals)
     {
         this.Herd.Add(new SheepBO(anim));
     }
 }
예제 #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();
            }
        }
예제 #5
0
 public StockBO(Herds herd, int forDay)
 {
     this.Herd = new HerdBO(herd);
     this.ProcessStock(forDay);
 }
예제 #6
0
 public StockBO(Herds herd)
 {
     this.Herd = new HerdBO(herd);
 }
예제 #7
0
 public StockBO(Herds herd, int forDay)
 {
     this.Herd = new HerdBO(herd);
     this.ProcessStock(forDay);
 }
예제 #8
0
 public StockBO(Herds herd)
 {
     this.Herd = new HerdBO(herd);
 }
예제 #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();
            }
        }
예제 #10
0
 public HerdBO(Herds herd)
 {
     foreach (Animals anim in herd.Animals)
         this.Herd.Add(new SheepBO(anim));
 }