private static String GetResultString(List <TestSingleResult> Results) { int Total = Results.Count; StringBuilder Result = new StringBuilder(""); //Tao Header Result.AppendLine(GenerateHeaderLine(120)); Result.Append(String.Format("|{0,-10}|{1,-11}|{2,-11}|{3,-11}|{4,-11}|{5,-11}|{6,-11}|{7,-11}|{8,-11}|{9,-11}|\n", "Result", "Eigen 2k", "Eigen 3k5", "Eigen 5k", "Fisher 500", "Fisher 1k", "Fisher 1k5", "LBPH 50", "LPBH 100", "LPBH 150")); Result.AppendLine(GenerateHeaderLine(120)); //Tao ra cac hang foreach (TestSingleResult SingleResult in Results) { Result.AppendLine(SingleResult.ToString()); } //Tao footer gach duoi Result.AppendLine(GenerateHeaderLine(120)); //Tinh toan cac gia tri va phan tram, tao them 2 rows, 1 row dem, 1 row % //Tinh so luot doan trung tren tong so luot List <int> HitList = new List <int>(); HitList.Add(Results.Count(result => result.Result.Equals(result.Eigen_2000_Result))); HitList.Add(Results.Count(result => result.Result.Equals(result.Eigen_3500_Result))); HitList.Add(Results.Count(result => result.Result.Equals(result.Eigen_5000_Result))); HitList.Add(Results.Count(result => result.Result.Equals(result.Fisher_500_Result))); HitList.Add(Results.Count(result => result.Result.Equals(result.Fisher_1000_Result))); HitList.Add(Results.Count(result => result.Result.Equals(result.Fisher_1500_Result))); HitList.Add(Results.Count(result => result.Result.Equals(result.LPBH_50_Result))); HitList.Add(Results.Count(result => result.Result.Equals(result.LPBH_100_Result))); HitList.Add(Results.Count(result => result.Result.Equals(result.LPBH_150_Result))); //Tao 1 row chua cac gia tri tren Result.Append(String.Format("|{0,-10}|", "Hit")); foreach (int Hit in HitList) { Result.Append(String.Format("{0,-11}|", Hit + "/" + Total)); } Result.AppendLine(); //Tao footer gach duoi Result.AppendLine(GenerateHeaderLine(120)); //Tinh toan % doan trung //Tao 1 row chua cac gia tri tren Result.Append(String.Format("|{0,-10}|", "Percent")); foreach (int Hit in HitList) { double Percent = Convert.ToDouble(Hit) / Total * 100; String PercentString = String.Format("{0:0.00}%", Percent); Result.Append(String.Format("{0,-11}|", PercentString)); } Result.AppendLine(); //Tao footer gach duoi Result.AppendLine(GenerateHeaderLine(120)); return(Result.ToString()); }