public static AchievementSummary Create(ITLoanRepository tLoanRepository, DateTime month) { AchievementSummary summary = new AchievementSummary(); summary.Month = month; //get collector IList listCol = tLoanRepository.GetMaxCollector(month); if (listCol != null) { if (listCol.Count > 0) { object[] obj = (object[])listCol[0]; summary.CollectorName = obj[0].ToString(); summary.CollectorTarget = (decimal)obj[1]; summary.CollectorAchievement = (decimal)obj[2]; } } //get tls IList listTLS = tLoanRepository.GetMaxTLS(month); if (listTLS != null) { if (listTLS.Count > 0) { object[] obj = (object[])listTLS[0]; summary.LTSName = obj[0].ToString(); summary.LTSAchievement = (decimal)obj[1]; summary.LTSTarget = (decimal)obj[2]; } } //get sales IList listSalesman = tLoanRepository.GetMaxSalesman(month); if (listSalesman != null) { if (listSalesman.Count > 0) { object[] obj = (object[])listSalesman[0]; summary.SalesmanName = obj[0].ToString(); summary.SalesmanAchievement = (decimal)obj[1]; summary.SalesmanTarget = (decimal)obj[2]; } } return(summary); }