public static void PopulateInCollectionFromExcel(string FileName, int TeamId) { //get the path of the file passed as parameter string path = Path.GetFullPath(FileName); automateData.Clear(); //Start reading the data and populating the in memory list DataTable table = ReadDataFromExcel(FileName); for (int row = 0; row < table.Rows.Count; row++) { try { var record = new AutomateData(); record.ProductArea = table.Rows[row][0].ToString(); if (record.ProductArea == "") { continue; } record.NoOfTFSTestcase = int.Parse(table.Rows[row][1].ToString()); record.NoOfAutomatedTestcases = int.Parse(table.Rows[row][2].ToString()); record.NoOfTestCasesDebugged = int.Parse(table.Rows[row][3].ToString()); record.TeamId = TeamId; record.date = GetPreviousFriday(DateTime.Now).AddDays(7); if (TeamId == 1) { record.ExpectedTestCases = int.Parse(table.Rows[row][4].ToString()); } else { record.ExpectedTestCases = 0; } automateData.Add(record.ProductArea, record); } catch { Debug.WriteLine("DataRow Not in Correct Format"); } } }
public AutomationTeamModel(int TeamId) { var db = new AutomationDashboardEntities(); automateData = db.AutomateDatas.Where(e => e.TeamId == TeamId).First(); }