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