private static void QueryContent(FileStream fs, List<Result> resultElement, List<Result> resultElement2, int k) { FileOperation fileOp = new FileOperation(); DateOperation dateOp = new DateOperation(); DateTime StartDate = new DateTime(2013, 12, 11); DateTime EndDate = DateTime.Now.AddDays(-1); var db_ECS = new AAT_DTF_ecsEntities2(); foreach (DateTime date in dateOp.GetDateRange(StartDate, EndDate)) { var jobs_DTF = (from dtf in resultElement select dtf.JobID).ToList(); var jobs_ECS = (from ecs in resultElement2 select ecs.JobID).ToList(); int userInDTF5 = (from esc in resultElement2 where jobs_DTF.Contains(esc.JobID) // ecs.JobID belongs to custom job && esc.CreateDate < date.AddDays(1) && esc.CreateDate > date select esc.UserName).Distinct().Count(); int userInDTF4 = (from dtf in resultElement where !jobs_ECS.Contains(dtf.JobID) // dtf.JobID != ecs.JobID && dtf.CreateDate < date.AddDays(1) && dtf.CreateDate > date select dtf.UserName).Distinct().Count(); switch (k) { case 1: fileOp.AddText(fs, "\""); fileOp.AddText(fs, date.ToShortDateString().ToString()); fileOp.AddText(fs, "\","); break; case 2: fileOp.AddText(fs, userInDTF4.ToString()); fileOp.AddText(fs, ","); break; case 3: fileOp.AddText(fs, userInDTF5.ToString()); fileOp.AddText(fs, ","); break; } } fileOp.AddText(fs, "]}"); }
private static void QueryContent_JobType(FileStream fs, List<Result> resultElement, int k) { FileOperation fileOp = new FileOperation(); DateOperation dateOp = new DateOperation(); DateTime startTime = new DateTime(2013,1,1); do { int cusotomCount = (from item in resultElement where item.JobType == "Custom" && item.MFGT_CreateDate > startTime && item.MFGT_CreateDate < startTime.AddMonths(1) select item.UserName).Distinct().Count(); int officialCount = (from item in resultElement where item.JobType == "Official" && item.MFGT_CreateDate > startTime && item.MFGT_CreateDate < startTime.AddMonths(1) select item.UserName).Distinct().Count(); int icCount = (from item in resultElement where item.JobType == "CodeCoverage" && item.MFGT_CreateDate > startTime && item.MFGT_CreateDate < startTime.AddMonths(1) select item.UserName).Distinct().Count(); switch (k) { case 1: fileOp.AddText(fs, "\""); fileOp.AddText(fs, startTime.Month.ToString()); fileOp.AddText(fs, "\","); break; case 2: //custom fileOp.AddText(fs, cusotomCount.ToString()); fileOp.AddText(fs, ","); break; case 3: //official fileOp.AddText(fs, officialCount.ToString()); fileOp.AddText(fs, ","); break; case 4: //codecoverage fileOp.AddText(fs, icCount.ToString()); fileOp.AddText(fs, ","); break; } startTime = startTime.AddMonths(1); } while (startTime <= DateTime.Now); fileOp.AddText(fs, "]}"); }
private static void QueryContent_iTestVersionTrend(FileStream fs4, List<Result> resultElement, int q) { DateOperation dateOp = new DateOperation(); FileOperation fileOp = new FileOperation(); DateTime StartDate = new DateTime(2013, 8, 13); DateTime EndDate = DateTime.Now.AddDays(-1); foreach (DateTime date in dateOp.GetDateRange(StartDate, EndDate)) { int userCount_331 = (from rst in resultElement where rst.ApplicationVersion.Contains("9.5.331") && rst.CreateDate < date.AddDays(1) && rst.CreateDate > date select rst.UserName).Distinct().Count(); int userCount_334 = (from rst in resultElement where rst.ApplicationVersion.Contains("9.5.334") && rst.CreateDate < date.AddDays(1) && rst.CreateDate > date select rst.UserName).Distinct().Count(); int userCount_355 = (from rst in resultElement where rst.ApplicationVersion.Contains("9.6.355") && rst.CreateDate < date.AddDays(1) && rst.CreateDate > date select rst.UserName).Distinct().Count(); switch (q) { case 1: fileOp.AddText(fs4, "\""); fileOp.AddText(fs4, date.ToShortDateString().ToString()); fileOp.AddText(fs4, "\","); break; case 2: fileOp.AddText(fs4, userCount_331.ToString()); fileOp.AddText(fs4, ","); break; case 3: fileOp.AddText(fs4, userCount_334.ToString()); fileOp.AddText(fs4, ","); break; case 4: fileOp.AddText(fs4, userCount_355.ToString()); fileOp.AddText(fs4, ","); break; } } fileOp.AddText(fs4, "]}"); }