//Generate report private void button1_Click(object sender, EventArgs e) { richTextBox1.Clear(); richTextBox1.AppendText("Total profitability/loose: " + RatesAndPrices.totalProfit(Connect.allLivestock).ToString() + "\r\n"); richTextBox1.AppendText("Total Tax paid to government: " + RatesAndPrices.totalTax(Connect.allLivestock).ToString() + "\r\n"); richTextBox1.AppendText("Total amount of milk: " + RatesAndPrices.totalAmtMilk.ToString() + "\r\n"); richTextBox1.AppendText("Average age excluded dogs: " + RatesAndPrices.avgAgeNoDogs().ToString() + "\r\n"); richTextBox1.AppendText("Ratio of dog's cost compared to total cost : " + RatesAndPrices.ratioCalc().ToString() + "\r\n"); richTextBox1.AppendText("Average profitability of \"Goats and Cow\" Vs. Sheep: " + RatesAndPrices.goatsAvgProfitVsCowSheep().ToString() + "\r\n"); richTextBox1.AppendText("Ratio of livestock with the color red: " + RatesAndPrices.ratioRed().ToString() + "\r\n"); RatesAndPrices.jerseyStuff(Connect.allCows, richTextBox1); }
//Generate the text file private void button2_Click(object sender, EventArgs e) { var ids = RatesAndPrices.SortByProfit(); StreamWriter File = new StreamWriter("File.txt", false); foreach (var obj in ids) { File.WriteLine(obj.id); } File.Close(); MessageBox.Show("File Generated!"); }
private void age(int age) { label2.Text = "The ratio is: " + RatesAndPrices.ratioAge(age).ToString() + "/" + RatesAndPrices.countAll.ToString(); }