//统计合格率和CII protected ProjectStatInfo Stat(DM_Factory factory, ProjectInfo projectInfo) { projectInfo.ClearData(); //清除旧的数据 ProjectStatInfo statInfo = new ProjectStatInfo(); statInfo.Tags = projectInfo.Tags; statInfo.URL = GetImagURL(projectInfo.ImageURL); if (projectInfo.ProjectID == 0) { return(statInfo); } string strError = ""; ServerConnection conn = new ServerConnection(factory.ServerID, factory.DatabaseID); for (int i = 0; i < statInfo.Tags.Length; i++) { if (statInfo.Tags[i].TagName == "PassrateChart") { StatPassrate(conn, projectInfo, (PassrateChartTag)statInfo.Tags[i], ref strError); } else if (statInfo.Tags[i].TagName == "CIIChart") { StatCII(conn, projectInfo, (CIIChartTag)statInfo.Tags[i], ref strError); } else if (statInfo.Tags[i].TagName == "KeyPartPassrateChart") { StatKeyPartPassrate(conn, projectInfo, (KeyPartPassrateChartTag)statInfo.Tags[i], ref strError); } else if (statInfo.Tags[i].TagName == "KeyPartCIIChart") { StatKeyPartCII(conn, projectInfo, (KeyPartCIIChartTag)statInfo.Tags[i], ref strError); } else if (statInfo.Tags[i].TagName == "SortChart") { StatSortClass(conn, projectInfo, (SortChartTag)statInfo.Tags[i], ref strError); } else if (statInfo.Tags[i].TagName == "Image") { SetImage((ImageTag)statInfo.Tags[i]); } } for (int i = 0; i < statInfo.Tags.Length; i++) { if (statInfo.Tags[i].TagName == "Label") { StatLabel(conn, projectInfo, (LabelTag)statInfo.Tags[i], ref strError); } } return(statInfo); }
public string GetProjectInfo(HttpContext context, ref string strError) { int nProjectIndex = CommandTool.ReqInt(context, "ProjectIndex", 0); try { Export handler = new Export(); DM_Factory factory = GetFactory(); if (factory == null) { return(handler.Error("无法获取工厂信息")); } List <ProjectInfo> arrProject = LoadProjectInfo(factory); if (arrProject == null || arrProject.Count == 0) { return(handler.Error("无法获取该工厂车型信息")); } if (nProjectIndex < 0) { nProjectIndex = -1; } if (nProjectIndex > arrProject.Count - 1) { nProjectIndex = arrProject.Count - 1; } int nPrevIndex = nProjectIndex > 0 ? nProjectIndex - 1 : -1; int nNextIndex = nProjectIndex < arrProject.Count - 1 ? nProjectIndex + 1 : -1; ProjectStatInfo statInfo = Stat(factory, arrProject[nProjectIndex]); statInfo.ProjectIndex = nProjectIndex; statInfo.PrevProjectIndex = nPrevIndex; statInfo.NextProjectIndex = nNextIndex; string strInfo = handler.Success(statInfo); return(strInfo); } catch (System.Exception ex) { Export handler = new Export(); return(handler.Error("错误:" + ex.Message)); } }