private List <Dictionary <string, object> > GetRecordList() { int PageIndex = RequestHelper.GetForm <int>("pageIndex"); int PageSize = RequestHelper.GetForm <int>("pageSize"); int Count = 0; List <Dictionary <string, object> > ReturnResult = new List <Dictionary <string, object> >(); TestPaperInfo TestPaperModel = new TestPaperInfo(); TestPaperModel.UserId = base.UserID; List <TestPaperInfo> TestPaperList = TestPaperBLL.ReadList(TestPaperModel, PageIndex, PageSize, ref Count); if (TestPaperList.Count > 0) { foreach (TestPaperInfo Info in TestPaperList) { Dictionary <string, object> TempDic = new Dictionary <string, object>(); TempDic.Add("TestCateName", Info.PaperName); TempDic.Add("Scorse", Info.Scorse); TempDic.Add("PageCount", Count); ReturnResult.Add(TempDic); } } return(ReturnResult); }
protected void Button1_ServerClick(object sender, EventArgs e) { base.CheckAdminPower("DeleteTestPaper", PowerCheckType.Single); string intsForm = RequestHelper.GetIntsForm("SelectID"); if (!string.IsNullOrEmpty(intsForm)) { string[] Arr = intsForm.Split(','); for (int i = 0; i < Arr.Length; i++) { TestPaperInfo TestPaperModel = TestPaperBLL.ReadPaper(int.Parse(Arr[i])); string FilePath = ServerHelper.MapPath("~/xml/" + TestPaperModel.UserId.ToString() + "_" + TestPaperModel.CateId.ToString() + ".xml"); if (File.Exists(FilePath)) { File.Delete(FilePath); } FilePath = ServerHelper.MapPath("~/m/xml/" + TestPaperModel.UserId.ToString() + "_" + TestPaperModel.CateId.ToString() + ".xml"); if (File.Exists(FilePath)) { File.Delete(FilePath); } TestPaperBLL.DeletePaper(int.Parse(Arr[i])); } AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("DeleteRecord"), ShopLanguage.ReadLanguage("TestPaper"), intsForm); ScriptHelper.Alert(ShopLanguage.ReadLanguage("DeleteOK"), RequestHelper.RawUrl); } }
private List <Dictionary <string, object> > GetPerPaidCourseList() { Dictionary <int, DateTime> prepaidTestCateList = BLLMTestCate.ReadPrepaidTestCateList(base.UserID); List <Dictionary <string, object> > ReturnResult = new List <Dictionary <string, object> >(); if (prepaidTestCateList.Count > 0) { foreach (KeyValuePair <int, DateTime> Info in prepaidTestCateList) { Dictionary <string, object> TempDic = new Dictionary <string, object>(); ProductInfo product = ProductBLL.ReadProduct(Info.Key); if (product != null) { TempDic.Add("Title", product.Name); if (!string.IsNullOrEmpty(product.ProductNumber)) { TempDic.Add("IsVideo", true); } if (!string.IsNullOrEmpty(product.Accessory)) { TempDic.Add("IsTest", true); } } else { TempDic.Add("Title", "已删除课程"); } TempDic.Add("ClassID", Info.Key); TempDic.Add("PayDate", Info.Value); TempDic.Add("RemainderDays", 30 - (DateTime.Now - Info.Value).Days); TestPaperInfo testPaperModel = TestPaperBLL.ReadPaper(base.UserID, Info.Key); Dictionary <string, object> testPaperDic = new Dictionary <string, object>(); if (testPaperModel != null) { if (testPaperModel.IsPass == 1) { TempDic.Add("IsPass", true); } else { TempDic.Add("IsPass", false); testPaperDic.Add("TestTime", Math.Round(36 - (DateTime.Now - testPaperModel.TestDate).TotalHours, 1)); } testPaperDic.Add("Scorse", testPaperModel.Scorse); TempDic.Add("TestCount", 1); } TempDic.Add("TestPaperInfo", testPaperDic); ReturnResult.Add(TempDic); } } return(ReturnResult); }
protected void DeleteButton_Click(object sender, EventArgs e) { base.CheckAdminPower("DeleteUser", PowerCheckType.Single); string intsForm = RequestHelper.GetIntsForm("SelectID"); if (intsForm != string.Empty) { UserBLL.ChangeUserStatus(intsForm, (int)UserState.Del); TestPaperBLL.DeletePaperByUserID(intsForm); AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("DeleteRecord"), ShopLanguage.ReadLanguage("User"), intsForm); AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("DeleteRecord"), ShopLanguage.ReadLanguage("TestPaperRecord"), intsForm); ScriptHelper.Alert(ShopLanguage.ReadLanguage("DeleteOK"), RequestHelper.RawUrl); } }
protected override void PageLoad() { base.PageLoad(); TestPaperInfo testPaper = new TestPaperInfo(); if (action != "All") { testPaper.TestMinDate = DateTime.Parse(DateTime.Now.Year.ToString() + "-" + DateTime.Now.Month.ToString() + "-1"); } testPaper.UserId = base.UserID; base.PageSize = 15; testPaperList = TestPaperBLL.ReadList(testPaper, base.CurrentPage, base.PageSize, ref base.Count); base.BindPageControl(ref base.CommonPager); }
protected override void PageLoad() { if (StringHelper.CompareSingleString(base.ParentCompanyID, "667")) { Response.Redirect("/"); } base.PageLoad(); base.CheckUserPower("PostStudy", PowerCheckType.Single); //最新一条信息 int[] classIDArray = new int[] { 33, 37, 38 }; foreach (int item in classIDArray) { ArticleInfo article = ArticleBLL.ReadFirstAtricle(item); if (article.Date >= DateTime.Now.AddDays(-7)) { articleDc.Add(item, article); } } ProductSearchInfo productSearch = new ProductSearchInfo(); productSearch.IsNew = 1; //productSearch.IsTop = 1; productSearch.IsSale = 1; int count = -2147483648; this.newProductList = ProductBLL.SearchProductList(1, 10, productSearch, ref count); //每日快报 ArticleSearchInfo articleSearch = new ArticleSearchInfo(); articleSearch.ClassID = "|29|"; this.newsList = ArticleBLL.SearchArticleList(1, 12, articleSearch, ref base.Count); //证书 certList = PostPassBLL.GetTheLatestPostCert(10); attributeRecordList = AttributeRecordBLL.ReadList("1,2,3", ProductBLL.ReadProductIdStr(this.newProductList)); int studyPostID = int.Parse(CookiesHelper.ReadCookieValue("UserStudyPostId")); //this.studyPost = PostBLL.ReadPost(studyPostID); string postCourseID = PostBLL.ReadPostCourseID(base.UserCompanyID, studyPostID); companyBrandID = CookiesHelper.ReadCookieValue("UserCompanyBrandID"); passPostCourseID = string.IsNullOrEmpty(postCourseID) ? "" : TestPaperBLL.ReadCourseIDStr(TestPaperBLL.ReadList(base.UserID, postCourseID, 1)); }
private void AnswerSet(int productID, int styleID, int questionID, string userAnswer) { XmlHelper xmldoc = new XmlHelper(TestPaperBLL.ReadTestPaperPath(base.UserID, productID)); XmlNodeList NodeList = xmldoc.ReadChildNodes(TestPaperBLL.GetTestPaperStyleNodeName(styleID)); if (NodeList != null) { foreach (XmlNode node in NodeList) { if (node.Attributes["id"].Value == questionID.ToString()) { node.ChildNodes[6].InnerText = userAnswer; } } } xmldoc.Save(); }
protected override void PageLoad() { base.PageLoad(); base.Title = "最小学习量达成分析表"; base.CheckUserPower("ReadEMSReport", PowerCheckType.Single); TestPaperInfo testPaperSearch = new TestPaperInfo(); testPaperSearch.TestMinDate = startDate; testPaperSearch.TestMaxDate = ShopCommon.SearchEndDate(endDate); testPaperSearch.Scorse = score; testPaperSearch.IsPass = isPass; testPaperSearch.PaperName = courseName; if (companyID < 0) { testPaperSearch.CompanyIdCondition = base.ExistsSonCompany ? base.SonCompanyID : base.UserCompanyID.ToString(); } else { testPaperSearch.CompanyIdCondition = companyID.ToString(); } if (!string.IsNullOrEmpty(realName) || !string.IsNullOrEmpty(userName)) { UserSearchInfo user = new UserSearchInfo(); user.RealName = realName; user.UserName = userName; user.InCompanyID = testPaperSearch.CompanyIdCondition; testPaperSearch.UserIdCondition = UserBLL.ReadUserIdStr(UserBLL.SearchUserList(user)); if (string.IsNullOrEmpty(testPaperSearch.UserIdCondition)) { testPaperSearch.UserIdCondition = "0"; } } //if (!string.IsNullOrEmpty(courseName)) //{ // testPaperSearch.Condition = "[CateID] in (select ID from [_Product] where [Name] like '%" + courseName + "%')"; //} testPaperList = TestPaperBLL.ReadList(testPaperSearch, base.CurrentPage, base.PageSize, ref this.Count); base.BindPageControl(ref base.CommonPager); }
private string RecordTest() { int productID = RequestHelper.GetForm <int>("CateID"); int userID = base.UserID; int companyID = base.UserCompanyID; string answerList = RequestHelper.GetForm <string>("Answer"); //重新提交答案 if (!string.IsNullOrEmpty(answerList)) { //Dictionary<int, string> answerDic = new Dictionary<int, string>(); JArray answerDic = (JArray)JsonConvert.DeserializeObject(answerList); foreach (JToken item in answerDic) { if (!string.IsNullOrEmpty(item.Value <string>("Answer"))) { AnswerSet(productID, item.Value <int>("StyleID"), item.Value <int>("ID"), item.Value <string>("Answer")); } } } TestSettingInfo testSetting = TestSettingBLL.ReadTestSetting(companyID, productID); decimal score = Convert.ToDecimal(TestPaperBLL.CalcTestResult(companyID, userID, productID).Scorse); //判断是否通过各岗位 if (score >= testSetting.LowScore) { PostPassBLL.CheckPostPass(userID, productID); //孟特销售工具应用与说明 课程处理 //if (productID == 5368) // TestSettingBLL.SpecialTestHandle(userID, int.Parse(CookiesHelper.ReadCookieValue("UserStudyPostId"))); } string ReturnResult = "{\"Success\":\"true\",\"Url\":\"TestPaperShow.aspx?Action=TestPaperResult&ProductID=" + productID.ToString() + "&Scorse=" + score.ToString() + "\"}"; return(ReturnResult); }
/// <summary> /// 在线试卷总信息,每次从Xml取出后重构。 /// <para value=CateId></para> /// </summary> private Dictionary <string, object> GetQuestionsList() { int productID = RequestHelper.GetForm <int>("CateID"); string filePath = TestPaperBLL.ReadTestPaperPath(base.UserID, productID); XmlHelper XmlDoc = new XmlHelper(filePath); Dictionary <string, object> testPaper = new Dictionary <string, object>(); testPaper.Add("CateId", XmlDoc.ReadAttribute("TestPaper", "CateId")); testPaper.Add("QuestionNum", XmlDoc.ReadAttribute("TestPaper", "QuestionNum")); testPaper.Add("QuestionsStyle", "[{\"StyleName\":\"单项选择题\",\"StyleId\":1,\"QuestionsNum\":" + XmlDoc.ReadAttribute("TestPaper", "SingleNum") + "},{\"StyleName\":\"多项选择题\",\"StyleId\":2,\"QuestionsNum\":" + XmlDoc.ReadAttribute("TestPaper", "MultiNum") + "},{\"StyleName\":\"判断题\",\"StyleId\":3,\"QuestionsNum\":" + XmlDoc.ReadAttribute("TestPaper", "PanDunNum") + "}]"); List <QuestionJsonInfo> questionList = new List <QuestionJsonInfo>(); for (int styleID = 1; styleID <= 3; styleID++) { string NodeName = TestPaperBLL.GetTestPaperStyleNodeName(styleID); //判断题型库里是否有考题 XmlNode Node = XmlDoc.ReadNode(NodeName); if (Node != null && Node.HasChildNodes) { XmlNodeList NodeList = XmlDoc.ReadChildNodes(NodeName); int id = 0; //遍历节点 foreach (XmlNode node in NodeList) { id++; questionList.Add(this.GetQuestions(node.ChildNodes, id)); } } } testPaper.Add("QuestionsList", questionList); return(testPaper); }
protected override void PageLoad() { int companyID = base.UserCompanyID; int userID = base.UserID; string filePath = TestPaperBLL.ReadTestPaperPath(userID, productID); base.PageLoad(); base.ClearCache(); base.Title = "考试中心"; if (productID == int.MinValue) { ScriptHelper.Alert("请在“课程列表”中选择课程后,进行考试!"); } TestSettingInfo testSetting = TestSettingBLL.ReadTestSetting(companyID, productID); ProductInfo product = ProductBLL.ReadProduct(productID); //if (!CompanyBLL.IsTest) //{ // Response.Write("<script>alert('该公司不允许考试,请联系管理员!');var DG = frameElement.lhgDG;DG.cancel();</script>"); // Response.End(); //} RenZhengCateInfo renZhengProduct = RenZhengCateBLL.ReadTestCateByID(product.ID); if (renZhengProduct != null) { PostApprover postApprover = new PostApprover(PostPassBLL.ReadPostPassList(new PostPassInfo() { UserId = userID, IsRZ = 1 })); if (!postApprover.IsTest(renZhengProduct.PostId)) { Response.Write("<script>alert('请先完成 " + PostBLL.ReadPost(postApprover.NextPostID).PostName + " 的岗位综合认证!');window.close();</script>"); Response.End(); } } if (testSetting.TestStartTime.HasValue && testSetting.TestEndTime.HasValue) { //if (product.ClassID != 4387) //{ // if (Convert.ToDateTime(testSetting.TestStartTime) > DateTime.Now || Convert.ToDateTime(testSetting.TestEndTime) < DateTime.Now) // { // Response.Write("<script>alert('不在 该门课程 设定的考试时间内!');var DG = frameElement.lhgDG;DG.cancel();</script>"); // Response.End(); // } //} //else //{ if (testSetting.TestStartTime > DateTime.Now || testSetting.TestEndTime < DateTime.Now) //&& Convert.ToDateTime(testSetting.TestStartTime).Minute <= DateTime.Now.Minute && Convert.ToDateTime(testSetting.TestEndTime).Minute >= DateTime.Now.Minute { Response.Write("<script>alert('不在 该门课程 设定的考试时间内!');window.close();</script>"); Response.End(); } //} } TestPaperInfo PaperModel = new TestPaperInfo(); PaperModel.CateIdCondition = productID.ToString(); PaperModel.UserIdCondition = userID.ToString(); List <TestPaperInfo> PaperList = TestPaperBLL.NewReadList(PaperModel); if (PaperList.Count > 0) { foreach (TestPaperInfo Item in PaperList) { if (Item.IsPass == 1)// && Item.CateId != 5368孟特销售工具应用与说明 需要多次考试 { Response.Write("<script>alert('您已通过,请选择其它课程!');</script>"); Response.End(); } if ((DateTime.Now - Item.TestDate).TotalHours < testSetting.TestInterval) { if (testSetting.TestStartTime.HasValue || testSetting.TestEndTime.HasValue) { Response.Write("<script>alert('您已经参加过考试,暂不能重考!');window.close();</script>"); } else { Response.Write("<script>alert('考完" + testSetting.TestInterval + "小时后才能重考,请选择其它课程!');window.close();</script>"); } Response.End(); } } } if ((File.Exists(filePath) && (DateTime.Now - File.GetLastWriteTime(filePath)).TotalHours < testSetting.TestInterval))//TempPaperInfo != null && (DateTime.Now - TempPaperInfo.TestDate).TotalHours < 72 { bool HaveTest = false; XmlHelper XmlDoc1 = new XmlHelper(filePath); for (int StyleId = 1; StyleId <= 3; StyleId++) { string NodeName = "TestPaper"; if (StyleId == 1) { NodeName = NodeName + "/Single"; } else if (StyleId == 2) { NodeName = NodeName + "/Multi"; } else if (StyleId == 3) { NodeName = NodeName + "/PanDuan"; } //判断题型库里是否有考题 XmlNode Node = XmlDoc1.ReadNode(NodeName); if (Node != null && Node.HasChildNodes) { XmlNodeList NodeList = XmlDoc1.ReadChildNodes(NodeName); //遍历节点 foreach (XmlNode node in NodeList) { if (!string.IsNullOrEmpty(node.ChildNodes[6].InnerText)) { HaveTest = true; } } } } if (HaveTest) { AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("TestPaperRecord"), ShopLanguage.ReadLanguage("TestPaper"), productID); TestPaperInfo testpaper = TestPaperBLL.CalcTestResult(companyID, userID, productID); if (testpaper.IsPass == 1) { PostPassBLL.CheckPostPass(UserID, productID); //孟特销售工具应用与说明 课程处理 //if (productID == 5368) // TestSettingBLL.SpecialTestHandle(userID, int.Parse(CookiesHelper.ReadCookieValue("UserStudyPostId"))); } ResponseHelper.Write("<script>alert('您上次未完成交卷,此时系统自动为您补交!得分:" + testpaper.Scorse + "分。');window.close();</script>"); Response.End(); } } //开启防止多次开启同一课程考试 //TestSettingBLL.TestBegin(userID, productID); paperName = product.Name; testTime = (testSetting.TestTimeLength * 60).ToString(); QuestionBLL.ReadQuestionXmlList(productID, product.Accessory, companyID, userID); XmlHelper XmlDoc = new XmlHelper(filePath); paperInfoHtml.AppendLine("<p>考试时长:" + testSetting.TestTimeLength.ToString() + " 分钟</p>"); paperInfoHtml.AppendLine("<p>试卷总分:" + testSetting.PaperScore.ToString() + " 分</p>"); paperInfoHtml.AppendLine("<p>试题数量:共 " + XmlDoc.ReadAttribute("TestPaper", "QuestionNum") + " 道。其中 "); string TempNum = XmlDoc.ReadAttribute("TestPaper", "SingleNum"); if (int.Parse(TempNum) > 0) { paperInfoHtml.Append("单项选择题:" + TempNum + " 道;"); } TempNum = XmlDoc.ReadAttribute("TestPaper", "MultiNum"); if (int.Parse(TempNum) > 0) { paperInfoHtml.Append("多项选择题:" + TempNum + " 道;"); } TempNum = XmlDoc.ReadAttribute("TestPaper", "PanDunNum"); if (int.Parse(TempNum) > 0) { paperInfoHtml.Append("判断题:" + TempNum + " 道;"); } paperInfoHtml.Append("</p>"); int NoteCount = XmlDoc.ReadChildNodes("TestPaper/Single").Count; if (NoteCount > 0) { questionStyleHtml.AppendLine("<li data-id=\"1\"><a href=\"javascript:void(0);\">" + EnumHelper.ReadEnumChineseName <QuestionType>(1) + "</a></li>"); questionIndexHtml.AppendLine("<ul data-style=\"1\" class=\"clearfix\" id=\"radio\">"); for (int i = 1; i <= NoteCount; i++) { questionIndexHtml.AppendLine("<li><a href=\"javascript:void(0);\">" + (i) + "</a></li>"); } questionIndexHtml.AppendLine("</ul>"); } NoteCount = XmlDoc.ReadChildNodes("TestPaper/Multi").Count; if (NoteCount > 0) { questionStyleHtml.AppendLine("<li data-id=\"2\"><a href=\"javascript:void(0);\">" + EnumHelper.ReadEnumChineseName <QuestionType>(2) + "</a></li>"); questionIndexHtml.AppendLine("<ul data-style=\"2\" class=\"clearfix\" id=\"checkbox\">"); for (int i = 1; i <= NoteCount; i++) { questionIndexHtml.AppendLine("<li><a href=\"javascript:void(0);\">" + (i) + "</a></li>"); } questionIndexHtml.AppendLine("</ul>"); } NoteCount = XmlDoc.ReadChildNodes("TestPaper/PanDuan").Count; if (NoteCount > 0) { questionStyleHtml.AppendLine("<li data-id=\"3\"><a href=\"javascript:void(0);\">" + EnumHelper.ReadEnumChineseName <QuestionType>(3) + "</a></li>"); questionIndexHtml.AppendLine("<ul data-style=\"3\" class=\"clearfix\" id=\"judge\">"); for (int i = 1; i <= NoteCount; i++) { questionIndexHtml.AppendLine("<li><a href=\"javascript:void(0);\">" + (i) + "</a></li>"); } questionIndexHtml.AppendLine("</ul>"); } UserLogBLL.AddUserLog(ShopLanguage.ReadLanguage("StartTest"), ShopLanguage.ReadLanguage("TestPaper"), paperName); UserLogBLL.AddUserLog(Request.Browser.Browser + "|" + Request.Browser.Version, productID); }
protected void Page_Load(object sender, EventArgs e) { base.ClearCache(); int companyID = base.UserCompanyID; int userID = base.UserID; filePath = TestPaperBLL.ReadTestPaperPath(userID, productID); if (!IsPostBack) { if (productID < 0) { ScriptHelper.Alert("选择课程后,进行考试!"); Response.End(); } TestSettingInfo testSetting = TestSettingBLL.ReadTestSetting(companyID, productID); ProductInfo product = ProductBLL.ReadProduct(productID); RenZhengCateInfo renZhengProduct = RenZhengCateBLL.ReadTestCateByID(product.ID); if (renZhengProduct != null) { PostApprover postApprover = new PostApprover(PostPassBLL.ReadPostPassList(new PostPassInfo() { UserId = userID, IsRZ = 1 })); if (!postApprover.IsTest(renZhengProduct.PostId)) { Response.Write("<script>alert('请先完成 " + PostBLL.ReadPost(postApprover.NextPostID).PostName + " 的岗位综合认证!');history.go(-1);</script>"); Response.End(); } } if (testSetting.TestStartTime != null && testSetting.TestEndTime != null) { if (testSetting.TestStartTime > DateTime.Now || testSetting.TestEndTime < DateTime.Now) { Response.Write("<script>alert('不在 该门课程 设定的考试时间内!');history.go(-1);</script>"); Response.End(); } } TestPaperInfo PaperModel = new TestPaperInfo(); PaperModel.CateIdCondition = productID.ToString(); PaperModel.UserIdCondition = userID.ToString(); List <TestPaperInfo> PaperList = TestPaperBLL.NewReadList(PaperModel); if (PaperList.Count > 0) { foreach (TestPaperInfo Item in PaperList) { if (Item.IsPass == 1)// && Item.CateId != 5368//孟特销售工具应用与说明 需要多次考试 { Response.Write("<script>alert('您已通过,请选择其它课程!');</script>"); Response.End(); } if ((DateTime.Now - Item.TestDate).TotalHours < testSetting.TestInterval) { if (testSetting.TestStartTime != null || testSetting.TestEndTime != null) { Response.Write("<script>alert('您已经参加过考试,暂不能重考!');window.close();</script>"); } else { Response.Write("<script>alert('考完" + testSetting.TestInterval + "小时后才能重考,请选择其它课程!');history.go(-1);</script>"); } Response.End(); } } } if ((File.Exists(filePath) && (DateTime.Now - File.GetLastWriteTime(filePath)).TotalHours < testSetting.TestInterval))//TempPaperInfo != null && (DateTime.Now - TempPaperInfo.TestDate).TotalHours < 72 { bool HaveTest = false; XmlHelper XmlDoc1 = new XmlHelper(filePath); for (int StyleId = 1; StyleId <= 3; StyleId++) { string NodeName = "TestPaper"; if (StyleId == 1) { NodeName = NodeName + "/Single"; } else if (StyleId == 2) { NodeName = NodeName + "/Multi"; } else if (StyleId == 3) { NodeName = NodeName + "/PanDuan"; } //判断题型库里是否有考题 XmlNode Node = XmlDoc1.ReadNode(NodeName); if (Node != null && Node.HasChildNodes) { XmlNodeList NodeList = XmlDoc1.ReadChildNodes(NodeName); //遍历节点 foreach (XmlNode node in NodeList) { if (!string.IsNullOrEmpty(node.ChildNodes[6].InnerText)) { HaveTest = true; } } } } if (HaveTest) { AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("TestPaperRecord"), ShopLanguage.ReadLanguage("TestPaper"), productID); TestPaperInfo testpaper = TestPaperBLL.CalcTestResult(companyID, userID, productID); if (testpaper.IsPass == 1) { PostPassBLL.CheckPostPass(UserID, productID); //孟特销售工具应用与说明 课程处理 //if (productID == 5368) // TestSettingBLL.SpecialTestHandle(userID, int.Parse(CookiesHelper.ReadCookieValue("UserStudyPostId"))); } ResponseHelper.Write("<script>alert('您上次未完成交卷,此时系统自动为您补交!得分:" + testpaper.Scorse + "分。');window.location.href='CourseCenter.aspx';</script>"); Response.End(); } } TestName.Text = product.Name; endTimer = testSetting.TestTimeLength * 60; QuestionBLL.ReadQuestionXmlList(productID, product.Accessory, companyID, userID); AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("StartTest"), ShopLanguage.ReadLanguage("TestCate"), productID); AdminLogBLL.AddAdminLog(Request.Browser.Browser + "|" + Request.Browser.Version, productID); } }
protected override void PageLoad() { base.PageLoad(); base.Title = "综合情况统计表"; base.CheckUserPower("ReadEMSReport", PowerCheckType.Single); if (!base.ExistsSonCompany || Action == "Search" || !base.CompareUserPower("ManageGroupCompany", PowerCheckType.Single)) { if (EndDate == DateTime.MinValue) { EndDate = DateTime.Today; } List <CompanyInfo> sonCompanyList = new List <CompanyInfo>(); if (CompanyID <= 0) { CompanyID = base.UserCompanyID; } CompanyModel = CompanyBLL.ReadCompany(CompanyID); if (base.CompareUserPower("ManageGroupCompany", PowerCheckType.Single)) { //减少使用递归方法的频率 if (CompanyID != base.UserCompanyID) { sonCompanyList = CompanyBLL.ReadCompanyListByCompanyId(CompanyBLL.ReadCompanyIdList(CompanyID.ToString())); } else { sonCompanyList = base.SonCompanyList; } } else { sonCompanyList.Add(CompanyModel); } int AllPassCourseNum = 0, AllCourseNum = 0, AllUserNum = 0, TotalNum = 0, CompanyNum = 0; double PassAverage = 0.0, PerPassAverage = 0.0, PerAllAverage = 0.0; string NoPassCompanyName = string.Empty, AverageCourseNumCompanyName = string.Empty; StringBuilder MonthOut = new StringBuilder(); MonthOut.Append("<table class=\"evaluation_sheet\">"); MonthOut.Append("<tr><th colspan=\"11\">" + CompanyModel.CompanyName + " 在职人员数据统计 ["); if (StartDate != DateTime.MinValue) { MonthOut.Append("从" + StartDate.ToString("d")); } else { MonthOut.Append("从项目启动"); } MonthOut.Append("到" + EndDate.ToString("d") + "]</th></tr>"); MonthOut.Append("<tr>"); MonthOut.Append("<th>店名</th>"); MonthOut.Append("<th>项目启动时间</th>"); MonthOut.Append("<th>系统登记<br />人数</th>"); MonthOut.Append("<th>累计参加<br />考试人数</th>"); MonthOut.Append("<th>累计学习<br />考试次数</th>"); MonthOut.Append("<th>考试通过<br />课程数量</th>"); MonthOut.Append("<th>人均学习<br />课程数量</th>"); MonthOut.Append("<th>人均通过<br />课程数量</th>"); MonthOut.Append("<th>参考人员<br />人均学习<br />课程数量</th>"); MonthOut.Append("<th>参考人员<br />人均通过<br />课程数量</th>"); MonthOut.Append("<th>课程考试<br />通过率</th>"); MonthOut.Append("</tr>"); EndDate = EndDate.AddDays(1); foreach (CompanyInfo _CompanyModel in sonCompanyList) { if (_CompanyModel.CompanyId != CompanyID || !base.IsGroupCompany(_CompanyModel.GroupId)) { if (!string.IsNullOrEmpty(_CompanyModel.PostStartDate.ToString()) && Convert.ToDateTime(_CompanyModel.PostStartDate.ToString()) < EndDate) { string UserId = string.Empty; int PassCourseNum = 0, CourseNum = 0, UserNum = 0, Num = 0; UserSearchInfo userSearch = new UserSearchInfo(); userSearch.InCompanyID = _CompanyModel.CompanyId.ToString(); userSearch.StatusNoEqual = (int)UserState.Del; //userSearch.GroupId = 36; List <UserInfo> userList = UserBLL.SearchReportUserList(userSearch); Num = userList.Count; //应考人数(去除在待考分组的人) //int YKNum = userList.FindAll(delegate(UserInfo TempModel) { return TempModel.Status == (int)UserState.Normal; }).Count; //Num = YKNum; TestPaperInfo TestPaperModel = new TestPaperInfo(); TestPaperModel.TestMinDate = StartDate; TestPaperModel.TestMaxDate = EndDate; TestPaperModel.UserIdCondition = UserBLL.ReadUserIdStr(userList); TestPaperModel.CompanyIdCondition = _CompanyModel.CompanyId.ToString(); List <TestPaperInfo> TempList = TestPaperBLL.NewReadList(TestPaperModel); foreach (TestPaperInfo Info in TempList) { if (!StringHelper.CompareSingleString(UserId, Info.UserId.ToString())) { UserId += "," + Info.UserId.ToString(); } if (Info.IsPass == 1) { PassCourseNum += 1; } } if (UserId.StartsWith(",")) { UserId = UserId.Substring(1); } if (string.IsNullOrEmpty(UserId)) { UserNum = 0; } else { UserNum = UserId.Split(',').Length; } CourseNum = TempList.Count; double SinglePassRate; //单店课程通过率 if (CourseNum == 0) { SinglePassRate = 0; } else { SinglePassRate = (double)PassCourseNum / (double)CourseNum; } if (SinglePassRate >= 0.22 || _CompanyModel.CompanyId == CompanyID) { CompanyNum += 1; //通过率大于22%的公司数量 TotalNum += Num; //总人数 AllUserNum += UserNum; //总参加考试人数 AllCourseNum += CourseNum; //总考试课程数 AllPassCourseNum += PassCourseNum; //总通过考试课程数 } else { NoPassCompanyName += _CompanyModel.CompanySimpleName + " "; } MonthOut.Append("<tr>"); MonthOut.Append("<td>" + _CompanyModel.CompanySimpleName + "</td>"); MonthOut.Append("<td>" + Convert.ToDateTime(_CompanyModel.PostStartDate.ToString()).ToString("yyyy年M月") + "</td>"); MonthOut.Append("<td>" + Num.ToString() + "</td>"); MonthOut.Append("<td>" + UserNum.ToString() + "</td>"); MonthOut.Append("<td>" + CourseNum + "</td>"); MonthOut.Append("<td>" + PassCourseNum + "</td>"); if (Num == 0) { MonthOut.Append("<td>0</td>"); MonthOut.Append("<td>0</td>"); } else { if (StartDate == DateTime.MinValue || (EndDate - StartDate).Days > 7 || Math.Round(((double)CourseNum / Num), 1) >= 2.2) { MonthOut.Append("<td>" + Math.Round(((double)CourseNum / Num), 1) + "</td>"); } else { AverageCourseNumCompanyName += _CompanyModel.CompanySimpleName + " "; MonthOut.Append("<td style=\"background:#FF0000;\">" + Math.Round(((double)CourseNum / Num), 1) + "</td>"); } MonthOut.Append("<td>" + Math.Round(((double)PassCourseNum / Num), 1) + "</td>"); if (SinglePassRate >= 0.22 || _CompanyModel.CompanyId == CompanyID) { PerAllAverage += Math.Round(((double)CourseNum / Num), 1); PerPassAverage += Math.Round(((double)PassCourseNum / Num), 1); } } //计算参考人员人均值 if (UserNum == 0) { MonthOut.Append("<td>0</td>"); MonthOut.Append("<td>0</td>"); } else { MonthOut.Append("<td>" + Math.Round(((double)CourseNum / UserNum), 1) + "</td>"); MonthOut.Append("<td>" + Math.Round(((double)PassCourseNum / UserNum), 1) + "</td>"); } if (SinglePassRate >= 0.22 || _CompanyModel.CompanyId == CompanyID) { MonthOut.Append("<td>" + SinglePassRate.ToString("P") + "</td>"); PassAverage += SinglePassRate; } else { MonthOut.Append("<td style=\"background:#FF0000;\">" + SinglePassRate.ToString("P") + "</td>"); } MonthOut.Append("</tr>"); } } } MonthOut.Append("<tr>"); MonthOut.Append("<td colspan=\"2\">" + CompanyModel.CompanySimpleName + "有效学习合计</td>"); MonthOut.Append("<td>" + TotalNum.ToString() + "</td>"); MonthOut.Append("<td>" + AllUserNum.ToString() + "</td>"); MonthOut.Append("<td>" + AllCourseNum + "</td>"); MonthOut.Append("<td>" + AllPassCourseNum + "</td>"); if (TotalNum == 0) { MonthOut.Append("<td>0</td>"); MonthOut.Append("<td>0</td>"); } else { //MonthOut.Append("<td>" + Math.Round((PerAllAverage / CompanyNum), 1) + "</td>"); //MonthOut.Append("<td>" + Math.Round((PerPassAverage / CompanyNum), 1) + "</td>"); //MonthOut.Append("<td>" + (PassAverage / CompanyNum).ToString("P") + "</td>"); MonthOut.Append("<td>" + Math.Round(((double)AllCourseNum / TotalNum), 1) + "</td>"); MonthOut.Append("<td>" + Math.Round(((double)AllPassCourseNum / TotalNum), 1) + "</td>"); } if (AllUserNum == 0) { MonthOut.Append("<td>0</td>"); MonthOut.Append("<td>0</td>"); } else { MonthOut.Append("<td>" + Math.Round(((double)AllCourseNum / AllUserNum), 1) + "</td>"); MonthOut.Append("<td>" + Math.Round(((double)AllPassCourseNum / AllUserNum), 1) + "</td>"); } if (AllCourseNum == 0) { MonthOut.Append("<td>0</td>"); } else { MonthOut.Append("<td>" + ((double)AllPassCourseNum / (double)AllCourseNum).ToString("P") + "</td>"); } MonthOut.Append("</tr>"); MonthOut.Append("</table>"); MonthOut.Insert(0, "在孟特EMS考试系统中进行有效学习的人数为 <span style=\"color:#FF0000;\">" + TotalNum.ToString() + " 人</span></li><li>累计进行了 <span style=\"color:#FF0000;\">" + AllCourseNum.ToString() + " 次</span>课程的学习,人均进行了 <span style=\"color:#FF0000;\">" + Math.Round(((double)AllCourseNum / TotalNum), 1) + " 次</span>课程考试</li><li>其中学习通过 <span style=\"color:#FF0000;\">" + AllPassCourseNum + " 门</span>课程考试,人均通过 <span style=\"color:#FF0000;\">" + Math.Round(((double)AllPassCourseNum / TotalNum), 1) + " 门</span>课程</li><li>课程学习的考试通过率为 <span style=\"color:#FF0000;\">" + ((double)AllPassCourseNum / (double)AllCourseNum).ToString("P") + "</span></li></ul>"); MonthOut.Insert(0, "到" + EndDate.AddDays(-1).ToString("d")); if (StartDate != DateTime.MinValue) { MonthOut.Insert(0, "从" + StartDate.ToString("d")); } else { MonthOut.Insert(0, "从项目启动"); } if (CompanyModel.GroupId == 1 || CompanyModel.GroupId == 2) { MonthOut.Insert(0, "集团"); } else { MonthOut.Insert(0, "贵司"); } MonthOut.Insert(0, "<ul class=\"ReportList_count\"><li>"); MonthOut.Append("<ul class=\"ReportList_count\"><li><font color=\"red\">人均学习课程数量:</font>代表团队对学习重视的程度,越高代表越重视学习,建议<span style=\"color:#FF0000;\">不低于每周人均2.2门课程,每月人均8.5门课程</span>,低于指标者请部门领导对学习加大关注。</li>"); if (StartDate != DateTime.MinValue && (EndDate - StartDate).Days <= 7 && !string.IsNullOrEmpty(AverageCourseNumCompanyName) && (CompanyModel.GroupId == 1 || CompanyModel.GroupId == 2)) { MonthOut.Append("<li style=\"color:#3366ff;\">目前人均学习数量低于每周人均2.2门课程的团队有:<span style=\"color:#FF0000;\">" + AverageCourseNumCompanyName + "</span>;请相关领导予以关注。</li>"); // else if (string.IsNullOrEmpty(AverageCourseNumCompanyName) && (CompanyModel.GroupId == 1 || CompanyModel.GroupId == 2)) MonthOut.Append("<li style=\"color:#3366ff;\">目前有效人均学习数量为: <span style=\"color:#FF0000;\">" + Math.Round(((double)AllCourseNum / TotalNum), 1) + " 次</span>,"); if (Math.Round(((double)AllCourseNum / TotalNum), 1) >= 2.2) { MonthOut.Append("表现良好,请再接再厉。</li>"); } else { MonthOut.Append("请相关领导予以关注。</li>"); } } MonthOut.Append("<li><font color=\"red\">课程考试通过率:</font>通过率高代表团队学习认真,若<span style=\"color:#FF0000;\">通过率低于22%</span>,表示学员没有学习课程,只是通过不断考试来<span style=\"color:#FF0000;\">试图懵过考核</span>,请部门领导制止不当的学习行为。</li>"); if (!string.IsNullOrEmpty(NoPassCompanyName) && (CompanyModel.GroupId == 1 || CompanyModel.GroupId == 2)) { MonthOut.Append("<li style=\"color:#3366ff;\">目前通过率低于22%的团队有: <span style=\"color:#FF0000;\">" + NoPassCompanyName + "</span>,请相关领导予以关注,以上4S店视为无效学习,全部数据不列入集团学习效果统计。</li>"); } else if (string.IsNullOrEmpty(NoPassCompanyName) && (CompanyModel.GroupId == 1 || CompanyModel.GroupId == 2)) { MonthOut.Append("<li style=\"color:#3366ff; \">目前通过率为: <span style=\"color:#FF0000;\">" + ((double)AllPassCourseNum / (double)AllCourseNum).ToString("P") + "</span>,表现良好,请再接再厉。</li>"); } MonthOut.Append("</ul>"); //添加通过岗位报表 MonthOut.Append("<div class=\"split_line\"></div>"); MonthOut.Append("<table class=\"evaluation_sheet\">"); MonthOut.Append("<tr><th colspan=\"9\">" + CompanyModel.CompanyName + " 岗位资质认证统计 ["); if (StartDate != DateTime.MinValue) { MonthOut.Append("从" + StartDate.ToString("d")); } else { MonthOut.Append("从项目启动"); } MonthOut.Append("到" + EndDate.AddDays(-1).ToString("d") + "]</th></tr>"); MonthOut.Append("<tr>"); MonthOut.Append("<th>店名</th>"); MonthOut.Append("<th>姓名</th>"); MonthOut.Append("<th>在职岗位</th>"); MonthOut.Append("<th>已通过的<br />认证岗位</th>"); //MonthOut.Append("<th>岗位考核<br />课程数量</th>"); MonthOut.Append("<th>累计通过<br />岗位数量</th>"); MonthOut.Append("<th>目前正在<br />学习岗位</th>"); MonthOut.Append("</tr>"); foreach (CompanyInfo _CompanyModel in sonCompanyList) { if (_CompanyModel.State != 0) { continue; } if (_CompanyModel.CompanyId != CompanyID || !base.IsGroupCompany(_CompanyModel.GroupId)) { PostPassInfo PostPassModel = new PostPassInfo(); PostPassModel.SearchStartDate = StartDate; PostPassModel.CreateDate = EndDate; List <ReportPostPassInfo> PostPassList = PostPassBLL.PostPassReportList(PostPassModel, _CompanyModel.CompanyId.ToString()); foreach (ReportPostPassInfo Info in PostPassList) { MonthOut.Append("<tr>"); MonthOut.Append("<td>" + _CompanyModel.CompanySimpleName + "</td>"); MonthOut.Append("<td>" + Info.RealName + "</td>"); if (string.IsNullOrEmpty(Info.WorkingPostName)) { MonthOut.Append("<td>" + PostBLL.ReadPost(Info.WorkingPostId).PostName + "</td>"); } else { MonthOut.Append("<td>" + Info.WorkingPostName + "</td>"); } MonthOut.Append("<td>" + Info.PassPostName + "</td>"); MonthOut.Append("<td>" + Info.PassPostNum.ToString() + "</td>"); MonthOut.Append("<td>" + PostBLL.ReadPost(Info.StudyPostId).PostName + "</td>"); MonthOut.Append("</tr>"); } } } MonthOut.Append("</table>"); ReportContentHtml = MonthOut.ToString(); ReportContentHtml += HistoryData(sonCompanyList, EndDate); } }
protected string HtmlOut1(CompanyInfo company) { int ColNum = 8; StringBuilder TextOut = new StringBuilder(); string CompanyBrandId = company.BrandId; string rowspan = string.Empty; TextOut.Append("<table class=\"evaluation_sheet\">"); TextOut.AppendLine("<thead>"); TextOut.Append("<tr>"); TextOut.Append("<th colspan=\"" + ColNum + "\">" + company.CompanySimpleName + "</th>"); TextOut.Append("</tr>\r\n"); TextOut.Append("<tr>\r\n"); TextOut.Append("<th class=\"id\">序号</th>"); TextOut.Append("<th class=\"name\">姓名</th>"); TextOut.Append("<th class=\"post\" style=\"width:auto;\">工作岗位</th>"); TextOut.Append("<th class=\"post\" data-sort=\"string\" style=\"width:auto;\">当前学习岗位<i class=\"icon_arrow\"></i></th>"); TextOut.Append("<th>岗位课程数</th>"); TextOut.Append("<th data-sort=\"int\">已通过课程数<i class=\"icon_arrow\"></i></th>"); TextOut.Append("<th data-sort=\"int\">剩余课程数<i class=\"icon_arrow\"></i></th>"); TextOut.Append("<th data-sort=\"float\">完成进度<i class=\"icon_arrow\"></i></th>"); TextOut.Append("</tr>\r\n"); TextOut.AppendLine("</thead>"); TextOut.AppendLine("<tbody>"); TestPaperInfo testPaperSearch = new TestPaperInfo(); testPaperSearch.IsPass = 1; testPaperSearch.Condition = "[UserID] in (select [ID] from [_User] where [companyID]=" + company.CompanyId.ToString() + " and [status]=" + (int)UserState.Normal; if (!string.IsNullOrEmpty(groupID)) { testPaperSearch.Condition += " and [GroupID] in (" + groupID + ")"; } if (!string.IsNullOrEmpty(PostIdCondition)) { testPaperSearch.Condition += " and [WorkingPostID] in (" + PostIdCondition + ")"; } if (!string.IsNullOrEmpty(StudyPostIdCondition)) { testPaperSearch.Condition += " and [StudyPostId] in (" + StudyPostIdCondition + ")"; } testPaperSearch.Condition += ")"; List <TestPaperInfo> allTestPaperList = TestPaperBLL.NewReadList(testPaperSearch); UserSearchInfo userSearch = new UserSearchInfo(); userSearch.Status = (int)UserState.Normal; userSearch.InWorkingPostID = PostIdCondition; userSearch.InCompanyID = company.CompanyId.ToString(); userSearch.InStudyPostID = StudyPostIdCondition; //只显示该学习岗位下的人员 userSearch.InGroupID = groupID; List <UserInfo> userList = UserBLL.SearchReportUserList(userSearch); //记录岗位课程ID串 Dictionary <int, string> postCourseDic = new Dictionary <int, string>(); int peoperNum = 0; foreach (UserInfo Info in userList) { int PostId = Info.StudyPostID; PostInfo PostModel = PostBLL.ReadPost(PostId); if (PostModel != null) //排除掉没有设置岗位的人 { if (!postCourseDic.ContainsKey(PostId)) { postCourseDic.Add(PostId, PostBLL.ReadPostCourseID(company.CompanyId, PostId)); } string postCourseID = postCourseDic[PostId]; //筛选出当前用户ID的成绩列表 List <TestPaperInfo> currentUserPassPaperList = allTestPaperList.FindAll(delegate(TestPaperInfo TempModel) { return(TempModel.UserId == Info.ID && StringHelper.CompareSingleString(postCourseID, TempModel.CateId.ToString())); }); int postCourseNum = string.IsNullOrEmpty(postCourseID) ? 0 : postCourseID.Split(',').Length; int passCourseNum = DistinctList(currentUserPassPaperList).Count; peoperNum = peoperNum + 1; TextOut.Append("<tr>"); TextOut.Append("<td>" + peoperNum + "</td>"); TextOut.Append("<td>" + Info.RealName + "</td>"); if (!string.IsNullOrEmpty(Info.PostName)) { TextOut.Append("<td>" + Info.PostName + "</td>"); } else { TextOut.Append("<td>" + PostBLL.ReadPost(Info.WorkingPostID).PostName + "</td>"); } TextOut.Append("<td>" + PostModel.PostName + "</td>"); TextOut.Append("<td>" + postCourseNum + "</td>"); TextOut.Append("<td>" + passCourseNum + "</td>"); TextOut.Append("<td>" + (postCourseNum - passCourseNum) + "</td>"); TextOut.Append("<td>" + (postCourseNum > 0 ? ((double)passCourseNum / (double)postCourseNum).ToString("P") : "0.00%") + "</td>"); TextOut.Append("</tr>\r\n"); currentUserPassPaperList = null; } PostModel = null; } TextOut.AppendLine("</tbody>"); TextOut.AppendLine("</table>"); allTestPaperList = null; return(TextOut.ToString()); }
private string GetReportList() { ProductSearchInfo productSearch = new ProductSearchInfo(); productSearch.Key = searchCourseName; productSearch.NotInClassID = "3644|5235|5298"; productSearch.InCompanyID = CompanyBLL.SystemCompanyId.ToString() + "," + companyID.ToString(); List <ProductInfo> productList = ProductBLL.SearchProductList(productSearch); decimal[,] averageInfo = new decimal[productList.Count, 6]; StringBuilder TempStr = new StringBuilder(); TempStr.Append("<table class=\"evaluation_sheet\">\n\r"); TempStr.Append("<tr>\n\r"); TempStr.Append("<th colspan=\"" + (productList.Count + 3) + "\">" + companyName); if (startDate != DateTime.MinValue || endDate != DateTime.MinValue) { if (startDate != DateTime.MinValue && endDate != DateTime.MinValue) { TempStr.Append(" [ " + startDate.ToString("d") + "—" + endDate.ToString("d") + " ]"); } else if (startDate == DateTime.MinValue) { TempStr.Append(" [ 截止到:" + endDate.ToString("d") + " ]"); } if (endDate != DateTime.MinValue) { endDate = ShopCommon.SearchEndDate(endDate); } } //TempStr.Append(" <input id=\"Button2\" type=\"button\" value=\"导出报表\" Class=\"button\" OnClick=\"ExcelGetCatId();\" /></th>\n\r"); TempStr.Append("</th>\n\r"); TempStr.Append("</tr>\n\r"); TempStr.Append("<tr>\n\r"); TempStr.Append("<th style=\"min-width:60px\">序号</th>\n\r"); TempStr.Append("<th style=\"min-width:60px\">姓名</th>\n\r"); TempStr.Append("<th style=\"min-width:60px\">职位</th>\n\r"); for (int i = 0; i < productList.Count; i++) { TempStr.Append("<th style=\"min-width:100px;\">" + productList[i].Name + "</th>\n\r"); } //TempStr.Append("<td>平均分</td>\n\r"); TempStr.Append("</tr>\n\r"); UserSearchInfo userSearch = new UserSearchInfo(); userSearch.InCompanyID = companyID.ToString(); userSearch.Status = (int)UserState.Normal; userSearch.InGroupID = groupID; userSearch.InWorkingPostID = postIdCondition; userSearch.InStudyPostID = studyPostIdCondition; List <UserInfo> userList = UserBLL.SearchUserList(userSearch); int userNum = 0;//序号 if (userList.Count > 0) { //系统先调取公司月内的所有成绩,减少循环体中调用的对数据库操作的重复性 List <TestPaperInfo> testReportList = TestPaperBLL.ReadReportList(companyID.ToString(), ProductBLL.ReadProductIdStr(productList), startDate, endDate); foreach (UserInfo user in userList) { userNum = userNum + 1; TempStr.Append("<tr>\n\r"); TempStr.Append("<td width=\"35px\">" + userNum.ToString() + "</td>\n\r"); TempStr.Append("<td width=\"100px\">" + user.RealName + "</td>\n\r"); TempStr.Append("<td width=\"200px\">" + PostBLL.ReadPost(user.WorkingPostID).PostName + "</td>\n\r"); decimal userAverageScore = 0; int courseHasTest = 0; for (int i = 0; i < productList.Count; i++) { ProductInfo product = productList[i]; string courseState = "--"; //if (user.RegisterDate < CateIdEndDate[i]) //{ averageInfo[i, 5] = averageInfo[i, 5] + 1; //} //else //{ // courseState = "不作计算"; //} TestPaperInfo testPaperModel = TestPaperBLL.ReadReportInfo(testReportList, user.ID, product.ID); if (testPaperModel != null) { TempStr.Append("<td>" + testPaperModel.Scorse.ToString() + "</td>\n\r"); userAverageScore = userAverageScore + testPaperModel.Scorse; courseHasTest = courseHasTest + 1; //科目总分计算 averageInfo[i, 0] = averageInfo[i, 0] + testPaperModel.Scorse; //有成绩的人数计算 averageInfo[i, 1] = averageInfo[i, 1] + 1; if (testPaperModel.IsPass == 1) { averageInfo[i, 2] = averageInfo[i, 2] + 1; } } else { TempStr.Append("<td>" + courseState + "</td>\n\r"); } } //人均分 //if (courseHasTest > 0) //{ // TempStr.Append("<td>" + Math.Round(userAverageScore / courseHasTest, 2) + "</td>\n\r"); //} //else //{ // TempStr.Append("<td>--</td>\n\r"); //} TempStr.Append("</tr>\n\r"); } } TempStr.Append("<tr>\n\r"); TempStr.Append("<th colspan=\"3\"><B>应到人数</B></th>\n\r"); for (int i = 0; i < productList.Count; i++) { TempStr.Append("<th>" + averageInfo[i, 5].ToString() + "</th>\n\r"); } TempStr.Append("</tr>\n\r"); TempStr.Append("<tr>\n\r"); TempStr.Append("<th colspan=\"3\"><B>实际参加考试人数</B></th>\n\r"); for (int i = 0; i < productList.Count; i++) { TempStr.Append("<th>" + (averageInfo[i, 1] != 0 ? averageInfo[i, 1].ToString() : "0") + "</th>\n\r"); } TempStr.Append("</tr>\n\r"); TempStr.Append("<tr>\n\r"); TempStr.Append("<th colspan=\"3\"><B>到考率</B></th>\n\r"); for (int i = 0; i < productList.Count; i++) { TempStr.Append("<th>" + (averageInfo[i, 5] != 0 ? Math.Round(averageInfo[i, 1] / averageInfo[i, 5], 4).ToString("P") : "0") + "</th>\n\r"); } TempStr.Append("</tr>\n\r"); TempStr.Append("<tr>\n\r"); TempStr.Append("<th colspan=\"3\"><B>到考平均分</B></th>\n\r"); for (int i = 0; i < productList.Count; i++) { TempStr.Append("<th>" + (averageInfo[i, 1] != 0 ? Math.Round(averageInfo[i, 0] / averageInfo[i, 1], 2) : 0) + "</th>\n\r"); } TempStr.Append("</tr>\n\r"); TempStr.Append("<tr>\n\r"); TempStr.Append("<th colspan=\"3\"><B>考试通过人数</B></th>\n\r"); for (int i = 0; i < productList.Count; i++) { TempStr.Append("<th>" + averageInfo[i, 2] + "</th>\n\r"); } TempStr.Append("</tr>\n\r"); TempStr.Append("<tr class=\"listTableFoot\">\n\r"); TempStr.Append("<th colspan=\"3\"><B>课程通过率</B></th>\n\r"); for (int i = 0; i < productList.Count; i++) { TempStr.Append("<th>" + (averageInfo[i, 5] != 0 ? Math.Round(averageInfo[i, 2] / averageInfo[i, 5], 4).ToString("P") : "0") + "</th>\n\r"); } TempStr.Append("</tr>\n\r"); TempStr.Append("</table>\n\r"); return(TempStr.ToString()); }
protected string HistoryData(List <CompanyInfo> companyList, DateTime EndDate) { int AllPassCourseNum = 0, AllCourseNum = 0, AllUserNum = 0, TotalNum = 0; StringBuilder MonthOut = new StringBuilder(); MonthOut.Append("<br /><table class=\"listTable\">"); MonthOut.Append("<tr class=\"listTableHead\"><td colspan=\"5\">" + companyModel.CompanyName + " 历史所有数据 ["); MonthOut.Append("从项目启动"); MonthOut.Append("到" + EndDate.AddDays(-1).ToString("d") + "]</td></tr>"); MonthOut.Append("<tr class=\"listTableHead\">"); MonthOut.Append("<td>店名</td>"); MonthOut.Append("<td>系统登记<br />使用人数</td>"); MonthOut.Append("<td>累计参加<br />考试人数</td>"); MonthOut.Append("<td>累计学习<br />考试次数</td>"); MonthOut.Append("<td>考试通过<br />课程数量</td>"); MonthOut.Append("</tr>"); foreach (CompanyInfo _CompanyModel in companyList) { if (!string.IsNullOrEmpty(_CompanyModel.PostStartDate.ToString()) && Convert.ToDateTime(_CompanyModel.PostStartDate.ToString()) < EndDate) { string UserId = string.Empty; int PassCourseNum = 0, CourseNum = 0, UserNum = 0, Num = 0; UserSearchInfo userSearch = new UserSearchInfo(); userSearch.InCompanyID = _CompanyModel.CompanyId.ToString(); //userSearch.GroupId = 36; Num = UserBLL.SearchUserList(userSearch).Count; TestPaperInfo TestPaperModel = new TestPaperInfo(); TestPaperModel.TestMaxDate = EndDate; TestPaperModel.CompanyIdCondition = _CompanyModel.CompanyId.ToString(); TestPaperModel.Del = int.MinValue; List <TestPaperInfo> TempList = TestPaperBLL.NewReadList(TestPaperModel); foreach (TestPaperInfo Info in TempList) { if (!StringHelper.CompareSingleString(UserId, Info.UserId.ToString())) { UserId += "," + Info.UserId.ToString(); } if (Info.IsPass == 1) { PassCourseNum += 1; } } CourseNum = TempList.Count; AllPassCourseNum += PassCourseNum; AllCourseNum += CourseNum; if (UserId.StartsWith(",")) { UserId = UserId.Substring(1); } if (string.IsNullOrEmpty(UserId)) { UserNum = 0; } else { UserNum = UserId.Split(',').Length; } if (Num < UserNum) { Num = UserNum; //如果系统历史记录人数小于历史考试记录人数,以历史考试记录人数为准 } TotalNum += Num; AllUserNum += UserNum; MonthOut.Append("<tr class=\"listTableMain\">"); MonthOut.Append("<td>" + _CompanyModel.CompanySimpleName + "</td>"); MonthOut.Append("<td>" + Num.ToString() + "</td>"); MonthOut.Append("<td>" + UserNum.ToString() + "</td>"); MonthOut.Append("<td>" + CourseNum + "</td>"); MonthOut.Append("<td>" + PassCourseNum + "</td>"); MonthOut.Append("</tr>"); } } MonthOut.Append("<tr class=\"listTableHead\">"); MonthOut.Append("<td>" + companyModel.CompanySimpleName + "合计</td>"); MonthOut.Append("<td>" + TotalNum.ToString() + "</td>"); MonthOut.Append("<td>" + AllUserNum.ToString() + "</td>"); MonthOut.Append("<td>" + AllCourseNum + "</td>"); MonthOut.Append("<td>" + AllPassCourseNum + "</td>"); MonthOut.Append("</tr>"); MonthOut.Append("</table>"); return(MonthOut.ToString()); }
protected override void PageLoad() { if (StringHelper.CompareSingleString(base.ParentCompanyID, "667")) { Response.Redirect("/"); } base.PageLoad(); base.CheckUserPower("PostStudy", PowerCheckType.Single); ProductSearchInfo product = new ProductSearchInfo(); product.IsNew = 1; //product.IsTop = 1; product.IsSale = 1; int count = 0; this.newProductList = ProductBLL.SearchProductList(1, 10, product, ref count); this.newProductAttributeRecordList = AttributeRecordBLL.ReadList("3", ProductBLL.ReadProductIdStr(this.newProductList)); //默认加载视图模式 if (string.IsNullOrEmpty(view)) { view = "Grid"; } int studyPostID = int.Parse(CookiesHelper.ReadCookieValue("UserStudyPostId")); this.studyPost = PostBLL.ReadPost(studyPostID); this.productClassList = ProductClassBLL.ReadProductClassRootList(); string postCourseID = PostBLL.ReadPostCourseID(base.UserCompanyID, studyPostID); postCourseNum = string.IsNullOrEmpty(postCourseID) ? 0 : postCourseID.Split(',').Length; string passPostCourseID = string.IsNullOrEmpty(postCourseID) ? "" : TestPaperBLL.ReadCourseIDStr(TestPaperBLL.ReadList(base.UserID, postCourseID, 1)); passCourseNum = string.IsNullOrEmpty(passPostCourseID) ? 0 : passPostCourseID.Split(',').Length; //isTestAgain = TestSettingBLL.IsTestAgain(base.UserID, int.Parse(CookiesHelper.ReadCookieValue("UserStudyPostId"))); switch (studyPostID) { case 5: case 37: case 64: case 87: case 693: postImageName = "post1.jpg"; break; case 8: case 86: case 4: case 85: case 276: case 286: postImageName = "post2.jpg"; break; case 82: case 220: case 166: case 168: case 88: case 251: case 258: case 302: case 308: case 341: postImageName = "post3.jpg"; break; case 83: case 89: case 158: case 265: case 312: case 318: postImageName = "post4.jpg"; break; case 11: case 327: postImageName = "post5.jpg"; break; default: postImageName = "post1.jpg"; break; } //视图模式时加载分类目录 if (view == "Grid") { //公共课程 if (pc == 1) { ProductSearchInfo productSearch = new ProductSearchInfo(); productSearch.ClassID = "|5298|"; productSearch.IsSale = 1; postCourseID = ProductBLL.ReadProductIdStr(ProductBLL.SearchProductList(productSearch)); } //获取认证课程ID else if (rz == 1) { PostPassInfo passpost = new PostPassInfo(); passpost.UserId = base.UserID; passpost.IsRZ = int.MinValue; RenZhengCateInfo rzCate = new RenZhengCateInfo(); rzCate.InPostID = PostPassBLL.PassPostString(passpost); postCourseID = RenZhengCateBLL.ReadTestCateID(rzCate); } else { //默认加载未通过的课程 if (passType <= 0) { passType = 0; } if (passType == 1 || passType == 0) { if (passType == 1) { postCourseID = passPostCourseID;//StringHelper.EqualString(postCourseID, filterCourseID); } else if (passType == 0) { postCourseID = StringHelper.SubString(postCourseID, passPostCourseID); } } } if (!string.IsNullOrEmpty(postCourseID)) { this.postProductClassList = ProductClassBLL.ReadProductClassListByProductID(postCourseID, 1); } if (postProductClassList.Count > 1) { this.postProductClassList = productClassSort(this.postProductClassList); } //特定时间考试 if (pc != 1 && rz != 1) { string parentCompanyID = CookiesHelper.ReadCookieValue("UserCompanyParentCompanyID"); //if (string.IsNullOrEmpty(parentCompanyID)) parentCompanyID = base.UserCompanyID.ToString(); //else parentCompanyID += "," + base.UserCompanyID.ToString(); List <TestSettingInfo> specialTestList = TestSettingBLL.ReadSpecialTestList(parentCompanyID); if (specialTestList.Count > 0) { string specialCourseID = TestSettingBLL.ReadSpecialTestCourseID(specialTestList); if (!string.IsNullOrEmpty(specialCourseID)) { ProductSearchInfo productSearch = new ProductSearchInfo(); productSearch.InProductID = specialCourseID; productSearch.InBrandID = CookiesHelper.ReadCookieValue("UserCompanyBrandID"); productSearch.IsSale = 1; specialCourseID = ProductBLL.ReadProductIdStr(ProductBLL.SearchProductList(productSearch)); string passSpecialCourseID = TestPaperBLL.ReadCourseIDStr(TestPaperBLL.ReadList(base.UserID, specialCourseID, 1)); if (passType == 1) { specialCourseID = passSpecialCourseID; } else if (passType == 0) { specialCourseID = StringHelper.SubString(specialCourseID, passSpecialCourseID); } if (!string.IsNullOrEmpty(specialCourseID)) { hasSpecialTest = true; } } } } //三个岗位加载 竞品选修 if (passType >= 0 && StringHelper.CompareSingleString("4,5,64", studyPostID.ToString())) { ProductSearchInfo productSearch = new ProductSearchInfo(); productSearch.ClassID = "|6|"; productSearch.InBrandID = CookiesHelper.ReadCookieValue("UserCompanyBrandID"); productSearch.IsSale = 1; productSearch.NotLikeName = "必修"; string xxCourseID = ProductBLL.ReadProductIdStr(ProductBLL.SearchProductList(productSearch)); string passXXCourseID = TestPaperBLL.ReadCourseIDStr(TestPaperBLL.ReadList(base.UserID, xxCourseID, 1)); if (passType == 1) { xxCourseID = passXXCourseID; } else if (passType == 0) { xxCourseID = StringHelper.SubString(xxCourseID, passXXCourseID); } if (!string.IsNullOrEmpty(xxCourseID)) { this.xxProductClassList = ProductClassBLL.ReadProductClassListByProductID(xxCourseID, 1); } } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //设置默认值 if (string.IsNullOrEmpty(action)) { groupID = "36"; state = ((int)UserState.Normal).ToString(); } if (!string.IsNullOrEmpty(action) && companyID > 0) { ShowArea.Style.Add("display", ""); company = CompanyBLL.ReadCompany(companyID); companyName = company.CompanyName; startDate = Convert.ToDateTime(RequestHelper.GetQueryString <string>("SearchStartDate")); endDate = Convert.ToDateTime(RequestHelper.GetQueryString <string>("SearchEndDate")); SearchStartDate.Text = startDate.ToString("d"); SearchEndDate.Text = endDate.ToString("d"); endDate = ShopCommon.SearchEndDate(endDate); //计算周数 WeekNum = (endDate - startDate).Days / 7; if ((endDate - startDate).Days % 7 > 0) { WeekNum = WeekNum + 1; } if (base.IsGroupCompany(company.GroupId)) { StringBuilder TotalTable = new StringBuilder(); //调取所有用户列表 UserSearchInfo userSearch = new UserSearchInfo(); userSearch.InCompanyID = CompanyBLL.ReadCompanyIdList(companyID.ToString()); userSearch.Condition = "Order by [CompanyID] Desc"; List <UserInfo> userAllList = UserBLL.SearchUserList(userSearch); //调取所有考试记录 TestPaperInfo testPaperSearch = new TestPaperInfo(); testPaperSearch.CompanyIdCondition = userSearch.InCompanyID; testPaperSearch.Condition = "[UserID] in (select [ID] from [_User] where [CompanyID] in (" + userSearch.InCompanyID + "))"; List <TestPaperInfo> TestPaperAllList = TestPaperBLL.NewReadList(testPaperSearch); PostPassInfo postPassSearch = new PostPassInfo(); postPassSearch.CreateDate = endDate; postPassSearch.InCompanyID = userSearch.InCompanyID; List <PostPassInfo> postPassList = PostPassBLL.ReadPostPassList(postPassSearch); TotalTable.Append("<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"); TotalTable.Append("<thead>"); TotalTable.Append("<tr class=\"listTableHead\">"); TotalTable.Append("<th>单店</th>"); TotalTable.Append("<th>总人数</th>"); TotalTable.Append("<th>应学习人数</th>"); TotalTable.Append("<th>学习总人数</th>"); TotalTable.Append("<th>通过本岗位总人数</th>"); TotalTable.Append("<th>通过本岗位在职人数</th>"); TotalTable.Append("<th>正在学习他岗位人数</th>"); TotalTable.Append("<th>已通过认证人数</th>"); TotalTable.Append("<th>完成多岗位认证的人数</th>"); TotalTable.Append("<th>项目启动时间</th>"); TotalTable.Append("</tr>\r\n"); List <CompanyInfo> companyList = CompanyBLL.ReadCompanyListByParentID(companyID.ToString()); foreach (CompanyInfo companyItem in companyList) { Dictionary <int, int> userDic = new Dictionary <int, int>(); List <UserInfo> currentCompanyUserList = userAllList.FindAll(delegate(UserInfo tempUser) { return(tempUser.CompanyID == companyItem.CompanyId); }); int manyPostNum = 0; Dictionary <int, int> studyUserDic = new Dictionary <int, int>(); //有学习的人 Dictionary <int, int> passPostUserDic = new Dictionary <int, int>(); //通过认证的人 Dictionary <int, int> passSelfPostUserDic = new Dictionary <int, int>(); //通过本职岗位的人 Dictionary <int, int> passSelfPostAndInCompanyUserDic = new Dictionary <int, int>(); //通过本职岗位还在职的人 Dictionary <int, int> passOtherPostUserDic = new Dictionary <int, int>(); //通过其他岗位的人 foreach (UserInfo userItem in currentCompanyUserList) { foreach (TestPaperInfo testpaper in TestPaperAllList) { if (userItem.ID == testpaper.UserId && !studyUserDic.ContainsKey(userItem.ID)) { studyUserDic[userItem.ID] = userItem.ID; break; } } foreach (PostPassInfo postpass in postPassList) { if (postpass.UserId == userItem.ID) { if (passPostUserDic.ContainsKey(userItem.ID)) { passPostUserDic[userItem.ID] = passPostUserDic[userItem.ID] + 1; } else { passPostUserDic[userItem.ID] = 1; } if (postpass.PostId == userItem.WorkingPostID) { passSelfPostUserDic[userItem.ID] = userItem.ID; if (userItem.Status != (int)UserState.Del) { passSelfPostAndInCompanyUserDic[userItem.ID] = userItem.ID; } } if (postpass.PostId != userItem.WorkingPostID) { passOtherPostUserDic[userItem.ID] = userItem.ID; } } } } foreach (int item in passPostUserDic.Values) { if (item > 1) { manyPostNum++; } } TotalTable.Append("<tr class=\"listTableMain\">"); TotalTable.Append("<td>" + companyItem.CompanySimpleName + "</td>"); TotalTable.Append("<td>" + currentCompanyUserList.Count + "</td>"); TotalTable.Append("<td>" + currentCompanyUserList.FindAll(delegate(UserInfo tempUser) { return(tempUser.Status != (int)UserState.Del); }).Count + "</td>"); TotalTable.Append("<td>" + studyUserDic.Count + "</td>"); TotalTable.Append("<td>" + passSelfPostUserDic.Count + "</td>"); TotalTable.Append("<td>" + passSelfPostAndInCompanyUserDic.Count + "</td>"); TotalTable.Append("<td>" + passOtherPostUserDic.Count + "</td>"); TotalTable.Append("<td>" + passPostUserDic.Count + "</td>"); TotalTable.Append("<td>" + manyPostNum + "</td>"); TotalTable.Append("<td>" + (!string.IsNullOrEmpty(companyItem.PostStartDate.ToString()) ? Convert.ToDateTime(companyItem.PostStartDate).ToString("d") : "") + "</td>"); TotalTable.Append("</tr>\r\n"); } TotalTable.Append("</table>\r\n"); groupResult.Add(company.CompanySimpleName + "合计"); groupResult.Add(0); groupResult.Add(0); groupResult.Add(0); groupResult.Add(""); groupResult.Add(""); groupResult.Add(""); groupResult.Add(0); string dataHtml = GetTheadHtml(company); TotalTable.Append("<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"); TotalTable.Append("<tr class=\"listTableHead\">"); TotalTable.Append("<td colspan=\"7\">" + company.CompanySimpleName + " [" + startDate.ToString("d") + "—" + endDate.AddDays(-1).ToString("d") + "]"); TotalTable.Append("</td></tr>\r\n"); TotalTable.Append("<tr class=\"listTableHead\">\r\n"); TotalTable.Append("<td>公司名</td>"); TotalTable.Append("<td>参加岗位考试人数</td>"); TotalTable.Append("<td>最小学习量<br />学习达标人数</td>"); TotalTable.Append("<td>最小学习量<br />学习未达标人数</td>"); TotalTable.Append("<td>最小学习量<br />学习达成率</td>"); TotalTable.Append("<td>学霸</td>"); TotalTable.Append("<td>学习数量</td>"); TotalTable.Append("</tr>\r\n"); CompanyInfo companySearch = new CompanyInfo(); companySearch.Field = "CompanyId"; companySearch.Condition = CompanyBLL.ReadCompanyIdList(companyID.ToString()); companySearch.State = 0; companySearch.GroupIdCondition = "0,3"; List <CompanyInfo> sonCompanyList = CompanyBLL.ReadCompanyList(companySearch); //List<CompanyInfo> sonCompanyList = CompanyBLL.ReadCompanyListByCompanyId(CompanyBLL.ReadCompanyIdList(companyID.ToString())); foreach (CompanyInfo info in sonCompanyList) { if (info.CompanyId != companyID && !string.IsNullOrEmpty(info.PostStartDate.ToString()) && Convert.ToDateTime(info.PostStartDate) < endDate) { dataHtml += HtmlOut1(info, ref TotalTable); } } TotalTable.Append("<tr class=\"listTableFoot\">\r\n"); TotalTable.Append("<td>" + groupResult[0] + "</td>"); TotalTable.Append("<td>" + groupResult[1] + "</td>"); TotalTable.Append("<td>" + groupResult[2] + "</td>"); TotalTable.Append("<td>" + groupResult[3] + "</td>"); TotalTable.Append("<td>" + (double.Parse(groupResult[2].ToString()) / double.Parse(groupResult[1].ToString())).ToString("P") + "</td>"); TotalTable.Append("<td>" + groupResult[6] + "</td>"); TotalTable.Append("<td>" + groupResult[7] + "</td>"); TotalTable.Append("</tr>\r\n"); TotalTable.Append("</table>\r\n"); TotalTable.Append("<div style=\"line-height:25px; text-align:left; font-size:14px; margin-bottom:50px;\"><p style=\"text-align:left; font-size:14px; line-heigh:30px; margin-top:20px;\">4S店每人每周完成1-2小时的基础学习,将带动公司提升“百年老店”运营,建议高标为100%,低标为70%。"); if (!string.IsNullOrEmpty(groupResult[4].ToString())) { TotalTable.Append("<br /><br />目前:<span style=\"color:#00b050;\">" + groupResult[4] + "</span> 达至 <span style=\"color:#00b050;\">100%</span> ,表现良好,予以肯定。"); } if (!string.IsNullOrEmpty(groupResult[5].ToString())) { TotalTable.Append("<br /><br /><span style=\"color:#FF0000;\">" + groupResult[5] + "</span> 达成率尚不足 <span style=\"color:#FF0000;\">70%</span> ,请相关部门领导关注下属自主学习时间的妥善安排。"); } TotalTable.Append("</p></div>\r\n"); this.ReportList.InnerHtml = TotalTable.ToString() + dataHtml + GetTfootHtml(); } else { StringBuilder TotalTable = null; this.ReportList.InnerHtml = GetTheadHtml(company) + HtmlOut1(company, ref TotalTable) + GetTfootHtml(); } } } }
protected override void PageLoad() { base.PageLoad(); base.Title = "т╠╧╓ап╠М"; this.dt = UserBLL.CompanyIndexStatistics(base.UserCompanyID); this.currentCompany = CompanyBLL.ReadCompany(base.UserCompanyID); string companyPostSetting = CookiesHelper.ReadCookieValue("UserCompanyPostSetting"); workingPostList = PostBLL.ReadPostListByPostId(companyPostSetting); string action = RequestHelper.GetQueryString <string>("Action"); if (!string.IsNullOrEmpty(action)) { string selectID = RequestHelper.GetQueryString <string>("SelectID"); if (!string.IsNullOrEmpty(selectID)) { string alertMessage = string.Empty; if (action == "Delete") { base.CheckUserPower("DeleteUser", PowerCheckType.Single); UserBLL.ChangeUserStatus(selectID, (int)UserState.Del); TestPaperBLL.DeletePaperByUserID(selectID); alertMessage = ShopLanguage.ReadLanguage("DeleteOK"); AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("DeleteRecord"), ShopLanguage.ReadLanguage("User"), selectID); } else if (action == "Freeze") { base.CheckUserPower("FreezeUser", PowerCheckType.Single); UserBLL.ChangeUserStatus(selectID, (int)UserState.Frozen); TestPaperBLL.DeletePaperByUserID(selectID); alertMessage = ShopLanguage.ReadLanguage("FreezeOK"); AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("FreezeRecord"), ShopLanguage.ReadLanguage("User"), selectID); } else if (action == "UnFreeze") { base.CheckUserPower("UnFreezeUser", PowerCheckType.Single); UserBLL.ChangeUserStatus(selectID, (int)UserState.Normal); TestPaperBLL.RecoveryPaperByUserID(selectID); alertMessage = ShopLanguage.ReadLanguage("UnFreezeOK"); AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("UnFreezeRecord"), ShopLanguage.ReadLanguage("User"), selectID); AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("RecoveryRecord"), ShopLanguage.ReadLanguage("TestPaperRecord"), selectID); } else if (action == "Free") { base.CheckUserPower("FreezeUser", PowerCheckType.Single); UserBLL.ChangeUserStatus(selectID, (int)UserState.Free); alertMessage = ShopLanguage.ReadLanguage("FreeOK"); AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("FreeRecord"), ShopLanguage.ReadLanguage("User"), selectID); } ScriptHelper.Alert(alertMessage, Request.UrlReferrer.ToString()); } } else { base.CheckUserPower("ReadUser", PowerCheckType.Single); UserSearchInfo userSearch = new UserSearchInfo(); if (companyID > 0) { userSearch.InCompanyID = companyID.ToString(); } else { userSearch.InCompanyID = base.SonCompanyID; } //userSearch.OutUserID = base.UserID.ToString(); userSearch.UserName = RequestHelper.GetQueryString <string>("UserId"); userSearch.RealName = RequestHelper.GetQueryString <string>("RealName"); userSearch.Email = RequestHelper.GetQueryString <string>("Email"); userSearch.Mobile = RequestHelper.GetQueryString <string>("Mobile"); userSearch.InWorkingPostID = RequestHelper.GetQueryString <string>("WorkingPostID"); if (state < 0) { state = (int)UserState.Normal; } //userSearch.Status = state; if (state == (int)UserState.Free) { userSearch.InStatus = string.Concat(state, ",", (int)UserState.Other); } else { userSearch.Status = state; } //userSearch.GroupId = 36; //userSearch.Sex = RequestHelper.GetQueryString<int>("Sex"); //userSearch.StartRegisterDate = RequestHelper.GetQueryString<DateTime>("StartRegisterDate"); //userSearch.EndRegisterDate = ShopCommon.SearchEndDate(RequestHelper.GetQueryString<DateTime>("EndRegisterDate")); //if (UserDel > 0) user.Del = UserDel; userList = UserBLL.SearchUserList(base.CurrentPage, base.PageSize, userSearch, ref this.Count); base.BindPageControl(ref base.CommonPager); } }
protected override void PostBack() { user = UserBLL.ReadUser(userID); int oldCompanyID = user.CompanyID; int oldStudyPostID = user.StudyPostID; user.CompanyID = RequestHelper.GetForm <int>("CompanyID"); if (user.CompanyID < 0) { user.CompanyID = oldCompanyID == int.MinValue ? base.UserCompanyID : oldCompanyID; } user.Department = RequestHelper.GetForm <int>("Department"); if (user.Department < 0) { ScriptHelper.Alert("请选择部门"); } user.WorkingPostID = RequestHelper.GetForm <int>("WorkingPostID"); if (user.WorkingPostID < 0) { ScriptHelper.Alert("请选择岗位"); } user.PostName = StringHelper.AddSafe(RequestHelper.GetForm <string>("WorkingPostName")); if (user.WorkingPostID < 0 && string.IsNullOrEmpty(user.PostName)) { ScriptHelper.Alert("请填写店内岗位名称"); } user.StudyPostID = RequestHelper.GetForm <int>("StudyPostID"); if (user.StudyPostID < 0) { ScriptHelper.Alert("请选择学习岗位"); } user.Email = StringHelper.AddSafe(RequestHelper.GetForm <string>("Email")); user.Sex = RequestHelper.GetForm <int>("Sex"); user.QQ = StringHelper.AddSafe(RequestHelper.GetForm <string>("QQ")); user.Status = RequestHelper.GetForm <int>("Status"); if (user.Status < 0) { ScriptHelper.Alert("请选择状态"); } //新增会员或有更改姓名的权限 if (userID <= 0 || base.CompareUserPower("UpdateRealName", PowerCheckType.Single)) { user.RealName = StringHelper.AddSafe(RequestHelper.GetForm <string>("RealName")); } //新增会员或有更改手机号码的权限 if (userID <= 0 || base.CompareUserPower("UpdateMobile", PowerCheckType.Single)) { user.Mobile = StringHelper.AddSafe(RequestHelper.GetForm <string>("Mobile")); if (string.IsNullOrEmpty(user.Mobile)) { ScriptHelper.Alert("请正确填写手机号码!"); } } //验证手机号码是否存在 //if (UserBLL.IsExistMobile(user.Mobile, user.ID)) // ScriptHelper.Alert("手机号码已存在"); if (base.CompareUserPower("ShowIDCard", PowerCheckType.Single)) { user.IDCard = StringHelper.AddSafe(RequestHelper.GetForm <string>("IDCard")); } if (base.CompareUserPower("ShowIDCard", PowerCheckType.Single) && !string.IsNullOrEmpty(RequestHelper.GetForm <string>("EntryDate"))) { user.EntryDate = RequestHelper.GetForm <DateTime>("EntryDate"); } string alertMessage = ShopLanguage.ReadLanguage("AddOK"); if (userID < 0) { base.CheckUserPower("AddUser", PowerCheckType.Single); user.Status = (int)UserState.Normal; if (UserBLL.IsUserNumOverflow(user.CompanyID)) { ScriptHelper.Alert("超过用户数量,暂不能添加!"); } user.UserName = StringHelper.AddSafe(RequestHelper.GetForm <string>("UserName")); Regex regex = new Regex("^([a-zA-Z0-9_一-龥])+$"); if (!regex.IsMatch(user.UserName)) { ScriptHelper.Alert("用户名只能包含字母、数字、下划线、中文"); } if (UserBLL.CheckUserName(user.UserName) > 0) { ScriptHelper.Alert("用户名已存在,请更换用户名!"); } string userPassword = RequestHelper.GetForm <string>("UserPassword"); string userPassword2 = RequestHelper.GetForm <string>("UserPassword2"); if (string.IsNullOrEmpty(userPassword) || string.IsNullOrEmpty(userPassword2) || userPassword != userPassword2) { ScriptHelper.Alert("两次密码不一致"); } regex = new Regex("(?=^[0-9a-zA-Z._@#]{6,16}$)((?=.*[0-9])(?=.*[^0-9])|(?=.*[a-zA-Z])(?=.*[^a-zA-Z]))"); if (!regex.IsMatch(userPassword)) { ScriptHelper.Alert("密码为6-16位数字与字母的组合!"); } user.UserPassword = StringHelper.Password(userPassword, (PasswordType)ShopConfig.ReadConfigInfo().PasswordType); user.GroupID = RequestHelper.GetForm <int>("GroupID"); if (user.GroupID < 0) { user.GroupID = 36; } int id = UserBLL.AddUser(user); AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("AddRecord"), ShopLanguage.ReadLanguage("User"), id); } else { base.CheckUserPower("UpdateUser", PowerCheckType.Single); //变换学习岗位,如果岗位已通过则更新注册时间,以便岗位计划按新时间重新计数,否则不更改原有岗位计划统计时间 PostInfo studyPost = PostBLL.ReadPost(user.StudyPostID); PostInfo oldStudyPost = PostBLL.ReadPost(oldStudyPostID); if (oldCompanyID != user.CompanyID || (user.StudyPostID != oldStudyPostID && (studyPost.ParentId == 3 || oldStudyPost.ParentId == 3) && studyPost.ParentId != oldStudyPost.ParentId)) { user.PostStartDate = DateTime.Today; } UserBLL.UpdateUser(user); //如果公司ID更改,相应修改成绩列表 if (oldCompanyID != user.CompanyID) { TestPaperBLL.UpdatePaperCompanyId(user.ID, user.CompanyID); } AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("UpdateRecord"), ShopLanguage.ReadLanguage("User"), user.ID); alertMessage = ShopLanguage.ReadLanguage("UpdateOK"); } string returnURL = ServerHelper.UrlDecode(RequestHelper.GetQueryString <string>("ReturnURL")); if (string.IsNullOrEmpty(returnURL)) { ScriptHelper.Alert(alertMessage, RequestHelper.RawUrl); } else { ScriptHelper.Alert(alertMessage, returnURL); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int id = RequestHelper.GetQueryString <int>("ID"); string Action = RequestHelper.GetQueryString <string>("Action"); if (Action == "Delete") { if (id != int.MinValue) { base.CheckAdminPower("DeleteTestPaper", PowerCheckType.Single); TestPaperInfo TestPaperModel = TestPaperBLL.ReadPaper(id); string FilePath = ServerHelper.MapPath("~/xml/" + TestPaperModel.UserId.ToString() + "_" + TestPaperModel.CateId.ToString() + ".xml"); if (File.Exists(FilePath)) { File.Delete(FilePath); } FilePath = ServerHelper.MapPath("~/m/xml/" + TestPaperModel.UserId.ToString() + "_" + TestPaperModel.CateId.ToString() + ".xml"); if (File.Exists(FilePath)) { File.Delete(FilePath); } TestPaperBLL.DeletePaper(id); AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("DeleteRecord"), ShopLanguage.ReadLanguage("TestPaper"), id); ScriptHelper.Alert(ShopLanguage.ReadLanguage("DeleteOK"), Request.UrlReferrer.ToString()); } } if (Action == "Search") { string searchUserName = RequestHelper.GetQueryString <string>("username"); string searchRealName = RequestHelper.GetQueryString <string>("realname"); string searchCompanyName = StringHelper.SearchSafe(RequestHelper.GetQueryString <string>("companyname").Trim()); string searchCourseName = StringHelper.SearchSafe(RequestHelper.GetQueryString <string>("coursename").Trim()); DateTime startDate = RequestHelper.GetQueryString <DateTime>("StartDate"); DateTime endDate = RequestHelper.GetQueryString <DateTime>("EndDate"); int isPass = RequestHelper.GetQueryString <int>("IsPass"); CompanyName.Text = searchCompanyName; RealName.Text = searchRealName; UserName.Text = searchUserName; CourseName.Text = searchCourseName; if (startDate != DateTime.MinValue) { SearchStartDate.Text = startDate.ToString("d"); } if (endDate != DateTime.MinValue) { SearchEndDate.Text = endDate.ToString("d"); } if (isPass >= 0) { IsPass.Text = isPass.ToString(); } base.CheckAdminPower("ReadTestPaper", PowerCheckType.Single); deleteTestPaperPower = base.CompareAdminPower("DeleteTestPaper", PowerCheckType.Single); TestPaperInfo testPaperSearch = new TestPaperInfo(); testPaperSearch.TestMinDate = startDate; testPaperSearch.TestMaxDate = ShopCommon.SearchEndDate(endDate); testPaperSearch.IsPass = isPass; testPaperSearch.PaperName = searchCourseName; if (!string.IsNullOrEmpty(searchCompanyName)) { testPaperSearch.CompanyIdCondition = CompanyBLL.ReadCompanyIdStr(searchCompanyName, 1); } if (!string.IsNullOrEmpty(searchRealName) || !string.IsNullOrEmpty(searchUserName)) { UserSearchInfo user = new UserSearchInfo(); user.UserName = searchUserName; user.RealName = searchRealName; testPaperSearch.UserIdCondition = UserBLL.ReadUserIdStr(UserBLL.SearchUserList(user)); if (string.IsNullOrEmpty(testPaperSearch.UserIdCondition)) { testPaperSearch.UserIdCondition = "0"; } } base.BindControl(TestPaperBLL.ReadList(testPaperSearch, base.CurrentPage, base.PageSize, ref this.Count), this.RecordList, this.MyPager); } } }
private List <MCourseInfo> GetCoursesByKeyWord() { string Keyword = StringHelper.SearchSafe(RequestHelper.GetForm <string>("keyWord")); int PageIndex = RequestHelper.GetForm <int>("pageIndex"); int PageSize = RequestHelper.GetForm <int>("pageSize"); List <MCourseInfo> CourseList = new List <MCourseInfo>(); int i = 1; ProductSearchInfo productSearch = new ProductSearchInfo(); productSearch.Key = Keyword; productSearch.IsSale = 1; productSearch.InCompanyID = CompanyBLL.SystemCompanyId.ToString(); productSearch.InBrandID = CookiesHelper.ReadCookieValue("UserCompanyBrandID"); List <ProductInfo> productList = ProductBLL.SearchProductList(productSearch); if (productList.Count > 0) { //通过的课程ID string PassCourseId = TestPaperBLL.ReadCourseIDStr(TestPaperBLL.ReadList(base.UserID, 1)); string PostCourseId = PostBLL.ReadPostCourseID(base.UserCompanyID, int.Parse(CookiesHelper.ReadCookieValue("UserStudyPostId"))); string perpaidCourseId = BLLMTestCate.ReadPrepaidTestCate(base.UserID); foreach (ProductInfo Info in productList) { if (i >= PageSize * (PageIndex - 1) && i < PageSize * PageIndex) { MCourseInfo CourseModel = new MCourseInfo(); CourseModel.ClassID = Info.ID.ToString(); CourseModel.Title = Info.Name; TestPaperInfo Model = new TestPaperInfo(); Model.UserId = base.UserID; Model.CateIdCondition = Info.ID.ToString(); Model.GroupCondition = "CateId"; TestPaperInfo TestPaperModel = TestPaperBLL.ReadList(Model).Find(delegate(TestPaperInfo TempModel) { return(TempModel.CateId == Info.ID); }); if (TestPaperModel != null) { CourseModel.TestCount = TestPaperModel.TestNum; } else { CourseModel.TestCount = 0; } CourseModel.IsPass = StringHelper.CompareSingleString(PassCourseId, Info.ID.ToString()); CourseModel.PageCount = (int)Math.Ceiling((double)productList.Count / (double)PageSize); if (!string.IsNullOrEmpty(Info.ProductNumber)) { CourseModel.IsVideo = true; } if (!string.IsNullOrEmpty(Info.Accessory)) { CourseModel.IsTest = true; } CourseModel.IsPostCourse = StringHelper.CompareSingleString(PostCourseId, Info.ID.ToString()); if (!CourseModel.IsPostCourse && CourseModel.Title.ToLower().IndexOf("vs") < 0) { continue; } CourseModel.OriginalPrice = Info.MarketPrice.ToString(); List <AttributeRecordInfo> attributeRecordList = AttributeRecordBLL.ReadList("5", Info.ID.ToString()); if (attributeRecordList.Count > 0) { CourseModel.IsRC = true; CourseModel.RCUrl = attributeRecordList[0].Value; } //选修也列为可以查看对象 if (!CourseModel.IsPostCourse && Info.Name.ToUpper().Contains("VS")) { CourseModel.IsPostCourse = true; } CourseModel.IsPrepaidCourse = StringHelper.CompareSingleString(perpaidCourseId, Info.ID.ToString()); CourseList.Add(CourseModel); } if (i >= PageSize * PageIndex) { break; } i++; } } return(CourseList); }
public static string RecordTest(int CateId) { string FilePath = ServerHelper.MapPath("~/xml/" + Cookies.User.GetUserID(true).ToString() + "_" + CateId.ToString() + ".xml"); if (File.Exists(FilePath)) { XmlHelper XmlDoc = new XmlHelper(FilePath); int QuestionNum = int.Parse(XmlDoc.ReadAttribute("TestPaper", "QuestionNum")); decimal Scorse = 0; //试卷得分 int RightNum = 0; //正确的题目数量 //从xml里读取答案,进行校卷 string QuestionList = string.Empty; string UserAnswerList = string.Empty; for (int StyleId = 1; StyleId <= 3; StyleId++) { string NodeName = GetTestPaperStyleNodeName(StyleId); //判断题型库里是否有考题 XmlNode Node = XmlDoc.ReadNode(NodeName); if (Node != null && Node.HasChildNodes) { XmlNodeList NodeList = XmlDoc.ReadChildNodes(NodeName); //遍历节点 foreach (XmlNode node in NodeList) { QuestionList = QuestionList + "," + node.ChildNodes[9].InnerText; UserAnswerList = UserAnswerList + "," + node.ChildNodes[6].InnerText; if (node.ChildNodes[6].InnerText.ToLower() == node.ChildNodes[5].InnerText.ToLower()) { RightNum = RightNum + 1; } } } } TestSettingInfo Model = TestSettingBLL.ReadTestSetting(Cookies.User.GetCompanyID(true), CateId); if (QuestionNum == 0) { Scorse = 0; } else { Scorse = Convert.ToDecimal(Math.Round((decimal.Parse(Model.PaperScore.ToString()) * RightNum / QuestionNum), 1));//这样计算的总分更准备 } if (QuestionList != string.Empty && QuestionList.StartsWith(",")) { QuestionList = QuestionList.Substring(1); UserAnswerList = UserAnswerList.Substring(1); } TestPaperInfo PaperModel = new TestPaperInfo(); PaperModel.CateId = CateId; PaperModel.CompanyId = Cookies.User.GetCompanyID(true); PaperModel.UserId = Cookies.User.GetUserID(true); PaperModel.QuestionId = QuestionList; PaperModel.Answer = UserAnswerList; PaperModel.Scorse = Scorse; if (Scorse >= Model.LowScore) { PaperModel.Point = 2; } AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("ApplyTestPaper"), ShopLanguage.ReadLanguage("TestCate"), CateId); TestPaperBLL.AddPaper(PaperModel); File.SetLastWriteTime(FilePath, DateTime.Now); return("TestPaperShow.aspx?Action=TestPaperResult&CompanyId=" + ProductBLL.ReadProduct(CateId).CompanyID.ToString() + "&CateId=" + CateId.ToString() + "&Scorse=" + Scorse.ToString()); } return(string.Empty); }
protected void SubmitButton_Click(object sender, EventArgs e) { string text = this.UserName.Text; int queryString = RequestHelper.GetQueryString <int>("ID"); int groupID = RequestHelper.GetForm <int>(ShopConfig.ReadConfigInfo().NamePrefix + "GroupID"); int oldCompanyID = int.MinValue; int oldStudyPostID = int.MinValue; UserInfo user = new UserInfo(); if (queryString > 0) { user = UserBLL.ReadUser(queryString); oldCompanyID = user.CompanyID; oldStudyPostID = user.StudyPostID; } else { Regex regex = new Regex("^([a-zA-Z0-9_一-龥])+$"); if (!regex.IsMatch(text)) { ScriptHelper.Alert("用户名只能包含字母、数字、下划线、中文", RequestHelper.RawUrl); } user.UserPassword = StringHelper.Password(this.UserPassword.Text, (PasswordType)ShopConfig.ReadConfigInfo().PasswordType); } user.ID = queryString; companyID = RequestHelper.GetForm <int>("CompanyID"); if (companyID < 0) { ScriptHelper.Alert("请选择公司"); } user.CompanyID = companyID; user.RealName = RealName.Text; user.UserName = text; user.GroupID = groupID; if (user.GroupID <= 0) { ScriptHelper.Alert("请选择管理组"); } user.Email = this.Email.Text; user.Sex = Convert.ToInt32(this.Sex.Text); user.Tel = this.Tel.Text; user.Mobile = this.Mobile.Text; //验证手机号码是否存在 //if (UserBLL.IsExistMobile(user.Mobile, user.ID)) // ScriptHelper.Alert("手机号码已存在"); user.RegisterDate = RequestHelper.DateNow; user.LastLoginDate = RequestHelper.DateNow; user.FindDate = RequestHelper.DateNow; //判断是否需要恢复考试记录 bool isRecoveryTestPaper = false; int userState = Convert.ToInt32(this.Status.Text); if (user.Status == (int)UserState.Del && userState != (int)UserState.Del) { isRecoveryTestPaper = true; } user.Status = userState; string department = this.Department.SelectedValue; user.Department = RequestHelper.GetForm <int>(ShopConfig.ReadConfigInfo().NamePrefix + "Department"); if (user.Department <= 0) { ScriptHelper.Alert("请选择部门"); } user.WorkingPostID = RequestHelper.GetForm <int>(ShopConfig.ReadConfigInfo().NamePrefix + "PostList"); if (user.WorkingPostID <= 0) { ScriptHelper.Alert("请选择工作岗位"); } user.PostName = this.PostName.Text; user.StudyPostID = RequestHelper.GetForm <int>(ShopConfig.ReadConfigInfo().NamePrefix + "StudyPostId"); if (user.StudyPostID <= 0) { ScriptHelper.Alert("请选择学习岗位"); } //user.Introduce = this.Introduce.Text; //user.Photo = this.Photo.Text; //user.MSN = this.MSN.Text; //user.QQ = this.QQ.Text; //user.RegionID = this.UserRegion.ClassID; //user.Address = this.Address.Text; //user.Birthday = this.Birthday.Text; string alertMessage = ShopLanguage.ReadLanguage("AddOK"); if (user.ID == -2147483648) { user.PostStartDate = RequestHelper.DateNow; base.CheckAdminPower("AddUser", PowerCheckType.Single); if (UserBLL.IsUserNumOverflow(user.CompanyID)) { ScriptHelper.Alert("超过用户数量,暂不能添加!"); } int id = UserBLL.AddUser(user); AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("AddRecord"), ShopLanguage.ReadLanguage("User"), id); } else { base.CheckAdminPower("UpdateUser", PowerCheckType.Single); if (!string.IsNullOrEmpty(PostStartDate.Text)) { user.PostStartDate = Convert.ToDateTime(PostStartDate.Text); } //变换学习岗位,如果岗位已通过则更新注册时间,以便岗位计划按新时间重新计数,否则不更改原有岗位计划统计时间 PostInfo studyPost = PostBLL.ReadPost(user.StudyPostID); PostInfo oldStudyPost = PostBLL.ReadPost(oldStudyPostID); if (oldCompanyID != user.CompanyID || (user.StudyPostID != oldStudyPostID && (studyPost.ParentId == 3 || oldStudyPost.ParentId == 3) && studyPost.ParentId != oldStudyPost.ParentId)) { if (user.PostStartDate < DateTime.Today) { user.PostStartDate = DateTime.Today; } } UserBLL.UpdateUser(user); if (isRecoveryTestPaper) { TestPaperBLL.RecoveryPaperByUserID(user.ID.ToString()); } //如果公司ID更改,相应修改成绩列表 //if (oldCompanyID != user.CompanyID) //{ // TestPaperBLL.UpdatePaperCompanyId(user.ID, user.CompanyID); //} AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("UpdateRecord"), ShopLanguage.ReadLanguage("User"), user.ID); alertMessage = ShopLanguage.ReadLanguage("UpdateOK"); } AdminBasePage.Alert(alertMessage, RequestHelper.RawUrl); }
protected string HtmlOut1(CompanyInfo company, string Type) { int WeekNum = 0, ColNum = 10, PeoperNum = 0; string logPath = ServerHelper.MapPath(@"\Log\"); TxtLog log = new TxtLog(logPath); Stopwatch time1 = new Stopwatch(); time1.Start(); StringBuilder TextOut = new StringBuilder(); string CompanyBrandId = company.BrandId; DateTime PostPlanStartDate = DateTime.MinValue; if (string.IsNullOrEmpty(company.PostStartDate.ToString())) { PostPlanStartDate = Convert.ToDateTime("2013-7-1"); } else { PostPlanStartDate = Convert.ToDateTime(company.PostStartDate.ToString()); } string rowspan = string.Empty; TextOut.Append("<table class=\"evaluation_sheet\">"); TextOut.Append("<tr>"); if (StartDate != DateTime.MinValue) { WeekNum = (EndDate - StartDate).Days / 7; if ((EndDate - StartDate).Days % 7 > 0) { WeekNum = WeekNum + 1; } TextOut.Append("<th colspan=\"" + (ColNum + WeekNum * 3) + "\">" + company.CompanySimpleName + " [" + StartDate.ToString("d") + "—" + EndDate.AddDays(-1).ToString("d") + "]"); rowspan = " rowspan=\"3\""; } else { TextOut.Append("<th colspan=\"" + ColNum + "\">" + company.CompanySimpleName + " [ 截止到:" + EndDate.AddDays(-1).ToString("d") + " ]"); rowspan = " rowspan=\"3\""; } TextOut.Append("</th></tr>\r\n"); TextOut.Append("<tr>\r\n"); TextOut.Append("<th" + rowspan + " class=\"id\">序号</th>"); //if (base.IsGroupCompany(company.GroupId)) TextOut.Append("<th" + rowspan + ">公司名</th>"); TextOut.Append("<th" + rowspan + " class=\"name\">姓名</th>"); TextOut.Append("<th" + rowspan + " class=\"post\">工作岗位</th>"); TextOut.Append("<th" + rowspan + " class=\"post\">学习岗位</th>"); TextOut.Append("<th colspan=\"" + (WeekNum * 3).ToString() + "\">学习已通过</th>"); TextOut.Append("<th colspan=\"3\">合计<br />("); if (StartDate != DateTime.MinValue) { TextOut.Append(StartDate.ToString("d") + "—" + EndDate.AddDays(-1).ToString("d")); } else { TextOut.Append("截止到:" + EndDate.AddDays(-1).ToString("d")); StartDate = PostPlanStartDate; } TextOut.Append(")</th>"); TextOut.Append("<th colspan=\"3\">从项目启动开始</th>"); TextOut.Append("</tr>\r\n"); TextOut.Append("<tr>\r\n"); for (int j = 1; j <= WeekNum; j++) { TextOut.Append("<th colspan=\"3\">第" + j.ToString() + "周<br>" + StartDate.AddDays(7 * (j - 1)).ToString("M-d") + "—"); if (j == WeekNum) { TextOut.Append(EndDate.AddDays(-1).ToString("M-d") + "</th>"); } else { TextOut.Append(StartDate.AddDays((7 * j) - 1).ToString("M-d") + "</th>"); } } TextOut.Append("<th rowspan=\"2\" class=\"total\">累计学习<br />考试次数</th>"); TextOut.Append("<th rowspan=\"2\" class=\"total\">考试通过<br />课程数量</th>"); TextOut.Append("<th rowspan=\"2\" class=\"total\">课程考试<br />通过率</th>"); TextOut.Append("<th rowspan=\"2\" class=\"total\">累计<br>完成总数</th>"); TextOut.Append("<th rowspan=\"2\" class=\"total\">目标<br>完成总数<br>(实际数)</th>"); TextOut.Append("<th rowspan=\"2\" class=\"total\">学习进度<br>达成分析<br>(超前/落后)</th>"); TextOut.Append("</tr>\r\n"); TextOut.Append("<tr class=\"listTableHead\">\r\n"); for (int j = 1; j <= WeekNum; j++) { TextOut.Append("<th class=\"total\">累计学习<br />考试次数</th>"); TextOut.Append("<th class=\"total\">考试通过<br />课程数量</th>"); TextOut.Append("<th class=\"total\">课程考试<br />通过率</th>"); } TextOut.Append("</tr>\r\n"); //统计目标课程数 int TargetNum = 0, CompanyDelayNum = 0; //统计通过课程数量第一的数据信息 string PassCourseFirstUser = string.Empty, GoodStudent = string.Empty; int FirstPassCourseNum = 0; //单个岗位的岗位计划开始时间 DateTime PostStartDate = DateTime.MinValue; int PostSign = 0; //是否重新计算岗位总数的标记 int PostCourseNum = 0; //岗位课程数 string AllPostPlan = "0"; //岗位下所有级别的岗位课程 int RedNum = 0, YellowNum = 0, GreenNum = 0; //增加通过率所用补丁部分 TestPaperInfo TestPaperModel = new TestPaperInfo(); if (!string.IsNullOrEmpty(company.PostStartDate.ToString())) { TestPaperModel.TestMinDate = Convert.ToDateTime(company.PostStartDate); } TestPaperModel.TestMaxDate = EndDate; TestPaperModel.CompanyIdCondition = company.CompanyId.ToString(); TestPaperModel.Condition = "[UserID] in (select [ID] from [_User] where [companyID]=" + company.CompanyId.ToString() + " and [status]=" + (int)UserState.Normal; if (!string.IsNullOrEmpty(groupID)) { TestPaperModel.Condition += " and [GroupID] in (" + groupID + ")"; } if (!string.IsNullOrEmpty(PostIdCondition)) { TestPaperModel.Condition += " and [WorkingPostID] in (" + PostIdCondition + ")"; } if (!string.IsNullOrEmpty(StudyPostIdCondition)) { TestPaperModel.Condition += " and [StudyPostId] in (" + StudyPostIdCondition + ")"; } TestPaperModel.Condition += ")"; List <TestPaperInfo> TestPaperList = TestPaperBLL.NewReadList(TestPaperModel); UserSearchInfo userSearch = new UserSearchInfo(); userSearch.Status = (int)UserState.Normal; userSearch.InWorkingPostID = PostIdCondition; //if (base.IsGroupCompany(company.GroupId)) //{ // userSearch.InCompanyID = CompanyBLL.ReadCompanyIdList(company.CompanyId.ToString()); // ColNum = 11; // userSearch.InStudyPostID = "45";//集团打开默认显示学习岗位 //} //else { userSearch.InCompanyID = company.CompanyId.ToString(); userSearch.InStudyPostID = StudyPostIdCondition; //只显示该学习岗位下的人员 } userSearch.InGroupID = groupID; List <UserInfo> userList = UserBLL.SearchReportUserList(userSearch); //记录岗位课程ID串 Dictionary <int, string[]> postCourseDic = new Dictionary <int, string[]>(); time1.Stop(); log.Write("执行到会员开始循环的时间为:" + time1.Elapsed.TotalSeconds); time1.Reset(); foreach (UserInfo Info in userList) { time1.Reset(); time1.Start(); int PostId = int.MinValue, PerPassCourseNum = 0, PerCourseNum = 0; PostId = Info.StudyPostID; PostInfo PostModel = PostBLL.ReadPost(PostId); if (PostModel != null) //排除掉没有设置岗位的人 { //筛选出当前用户ID的成绩列表 List <TestPaperInfo> currentUserPaperList = TestPaperList.FindAll(delegate(TestPaperInfo TempModel) { return(TempModel.UserId == Info.ID); }); List <TestPaperInfo> currentUserPassPaperList = currentUserPaperList.FindAll(delegate(TestPaperInfo TempModel) { return(TempModel.IsPass == 1); }); int ResidueCourseNum = 0;//岗位内剩余岗位课程数 if (!postCourseDic.ContainsKey(PostId)) { //岗位数据信息 1:岗位课程ID串;2:岗位课程数量;3:岗位开始时间;4:目标课程数量 string[] postData = { "0", "0", DateTime.MinValue.ToString(), "0" }; AllPostPlan = PostBLL.ReadPostCourseID(company.CompanyId, PostId); postData[0] = AllPostPlan; if (!string.IsNullOrEmpty(AllPostPlan)) { PostCourseNum = AllPostPlan.Split(',').Length; postData[1] = PostCourseNum.ToString(); } //公司有事耽误的数量 由于岗位不一样,岗位计划开始的时间也不一样,所以有事耽误的数量也是不一致的,按岗位计算 PostStartDate = CompanyPostPlanBLL.ReadCompanyPostPlan(company.CompanyId, PostId); //如果没有设置岗位开始时间或者岗位开始时间比公司开始时间早,统一使用公司开始时间 if (PostStartDate == DateTime.MinValue || PostStartDate < PostPlanStartDate) { PostStartDate = PostPlanStartDate; } //根据统一的岗位开始时间调取数据 CompanyDelayNum = ChangeNumBLL.CompanyChangeNum(company.CompanyId, PostId, PostStartDate, EndDate); TargetNum = CompanyRuleBLL.GetCourseNum(company.CompanyId, PostId, PostStartDate, EndDate); //理论值是每周两门 TargetNum = TargetNum - CompanyDelayNum; postData[2] = PostStartDate.ToString(); postData[3] = TargetNum.ToString(); postCourseDic.Add(PostId, postData); } else { AllPostPlan = postCourseDic[PostId][0]; PostCourseNum = int.Parse(postCourseDic[PostId][1]); PostStartDate = Convert.ToDateTime(postCourseDic[PostId][2]); TargetNum = int.Parse(postCourseDic[PostId][3]); } //如果员工是后来的,要以员工进来的时间为起始点 if (PostStartDate < Info.PostStartDate)//Info.RegisterDate { PostStartDate = Info.PostStartDate; CompanyDelayNum = ChangeNumBLL.CompanyChangeNum(company.CompanyId, PostId, PostStartDate, EndDate); TargetNum = CompanyRuleBLL.GetCourseNum(company.CompanyId, PostId, PostStartDate, EndDate); //理论值是每周两门 TargetNum = TargetNum - CompanyDelayNum; } TargetNum = TargetNum - ChangeNumBLL.UserChangeNum(Info.ID, PostStartDate, EndDate); //PassCateId 跨岗位通过的课程 PostResidueCourse 岗位内剩余课程 string PassCateId = string.Empty, NoPassCateId = string.Empty, PostResidueCourse = string.Empty; if (!string.IsNullOrEmpty(company.PostStartDate.ToString())) { PassCateId = TestPaperBLL.ReadCourseIDStr(currentUserPassPaperList.FindAll(delegate(TestPaperInfo TempModel) { return(TempModel.TestDate >= PostStartDate && TempModel.TestDate <= EndDate); })); PostResidueCourse = StringHelper.SubString(AllPostPlan, TestPaperBLL.ReadCourseIDStr(currentUserPassPaperList.FindAll(delegate(TestPaperInfo TempModel) { return(TempModel.TestDate <= EndDate); }))); } else { PassCateId = TestPaperBLL.ReadCourseIDStr(currentUserPassPaperList.FindAll(delegate(TestPaperInfo TempModel) { return(TempModel.TestDate <= EndDate); })); PostResidueCourse = StringHelper.SubString(AllPostPlan, PassCateId); } //跨岗位通过的课程数(全岗位计划开始后,累计完成的课程数) int AllPassCourseNum = 0; if (!string.IsNullOrEmpty(PassCateId)) { AllPassCourseNum = PassCateId.Split(',').Length; } //获取岗位内剩余课程数 if (!string.IsNullOrEmpty(PostResidueCourse)) { ResidueCourseNum = PostResidueCourse.Split(',').Length; } string PastPassCourse = string.Empty; PeoperNum = PeoperNum + 1; TextOut.Append("<tr>\r\n"); TextOut.Append("<td>" + PeoperNum + "</td>"); //if (base.IsGroupCompany(company.GroupId)) TextOut.Append("<td>" + CompanyBLL.ReadCompany(Info.CompanyID).CompanySimpleName + "</td>"); TextOut.Append("<td>" + Info.RealName + "</td>"); if (!string.IsNullOrEmpty(Info.PostName)) { TextOut.Append("<td>" + Info.PostName + "</td>"); } else { TextOut.Append("<td>" + PostBLL.ReadPost(Info.WorkingPostID).PostName + "</td>"); } TextOut.Append("<td>" + PostModel.PostName + "</td>"); for (int j = 1; j <= WeekNum; j++) { int WeekCourseNum = 0; DateTime _StartDate = StartDate.AddDays(7 * (j - 1)); DateTime _EndDate = StartDate.AddDays(7 * j); if (j == WeekNum) { _EndDate = EndDate; } if (_StartDate < PostStartDate) { _StartDate = PostStartDate; } if (_EndDate > PostStartDate) { PastPassCourse = TestPaperBLL.ReadCourseIDStr(currentUserPassPaperList.FindAll(delegate(TestPaperInfo TempModel) { return(TempModel.TestDate >= _StartDate && TempModel.TestDate <= _EndDate); })); WeekCourseNum = currentUserPaperList.FindAll(delegate(TestPaperInfo TempModel) { return(TempModel.TestDate >= _StartDate && TempModel.TestDate <= _EndDate); }).Count; } int PastPassCourseNum = 0; if (!string.IsNullOrEmpty(PastPassCourse)) { PastPassCourseNum = PastPassCourse.Split(',').Length; } PerPassCourseNum += PastPassCourseNum; PerCourseNum += WeekCourseNum; TextOut.Append("<td>" + WeekCourseNum + "</td>"); TextOut.Append("<td>" + (PastPassCourseNum) + "</td>"); if (PastPassCourseNum == 0) { TextOut.Append("<td>0</td>"); } else { TextOut.Append("<td>" + ((double)PastPassCourseNum / (double)WeekCourseNum).ToString("P") + "</td>"); } } //统计好学生 学习课程超过30门的人 if (PerCourseNum >= 30) { GoodStudent += " " + Info.RealName; } //统计通过课程数量第一的数据 if (PerPassCourseNum > 0 && PerPassCourseNum >= FirstPassCourseNum) { if (PerPassCourseNum > FirstPassCourseNum) { PassCourseFirstUser = Info.RealName; FirstPassCourseNum = PerPassCourseNum; } else { PassCourseFirstUser = PassCourseFirstUser + " " + Info.RealName; } } TextOut.Append("<td>" + PerCourseNum + "</td>"); TextOut.Append("<td>" + PerPassCourseNum + "</td>"); if (PerCourseNum <= 0) { TextOut.Append("<td>0</td>"); } else { TextOut.Append("<td>" + ((double)PerPassCourseNum / (double)PerCourseNum).ToString("P") + "</td>"); } TextOut.Append("<td>" + (AllPassCourseNum) + "</td>"); TextOut.Append("<td>" + (TargetNum) + "</td>"); TargetNum = AllPassCourseNum - TargetNum; TextOut.Append("<td style=\""); if (TargetNum > 0) { TextOut.Append("background: #00b050;"); GreenNum += 1; } else if (TargetNum < 0) { TextOut.Append("background: #ff0000;"); RedNum += 1; } else { TextOut.Append("background: #ffff00;"); YellowNum += 1; } TextOut.Append(" color:#000;\">" + (TargetNum) + "</td>"); TextOut.Append("</tr>\r\n"); currentUserPaperList = null; currentUserPassPaperList = null; } PostModel = null; time1.Stop(); log.Write(Info.RealName + "执行时间为:" + time1.Elapsed.Milliseconds); } TestPaperList = null; if (FirstPassCourseNum > 0) { TextOut.Append("<tr><th colspan=\"" + (ColNum + WeekNum * 3) + "\">课程考试通过数量最多的学霸为: <font color=red>" + PassCourseFirstUser + "</font> ,数量为: <font color=red>" + FirstPassCourseNum.ToString() + "</font> 。</th></tr>"); } if (!string.IsNullOrEmpty(GoodStudent)) { TextOut.Append("<tr><th colspan=\"" + (ColNum + WeekNum * 3) + "\">月度考试数量超过30门的为好学生,此次好学生为: <font color=red>" + GoodStudent + "</font> 。</th></tr>"); } TextOut.Append("<tr><th colspan=\"" + (ColNum + WeekNum * 3) + "\">未达标人数:" + RedNum.ToString() + " 刚好达标人数:" + YellowNum.ToString() + " 超越目标人数:" + GreenNum.ToString() + "</th></tr>"); TextOut.Append("<tr><th colspan=\"" + (ColNum + WeekNum * 3) + "\">未达标人数:" + RedNum.ToString() + " 达标人数:" + (YellowNum + GreenNum).ToString() + " 达成率:" + ((double)(YellowNum + GreenNum) / (double)PeoperNum).ToString("P") + "</th></tr>"); TextOut.Append("</table>"); if (string.IsNullOrEmpty(Type)) { return(TextOut.ToString()); } else { GroupResult[1] = (int)GroupResult[1] + PeoperNum; GroupResult[2] = (int)GroupResult[2] + (YellowNum + GreenNum); GroupResult[3] = (int)GroupResult[3] + RedNum; if (((double)(YellowNum + GreenNum) / (double)PeoperNum) == 1.0) { GroupResult[4] = GroupResult[4] + "<span style=\"margin:0px 10px;\">" + company.CompanySimpleName + "</span>"; } else if (((double)(YellowNum + GreenNum) / (double)PeoperNum) < 0.7) { GroupResult[5] = GroupResult[5] + "<span style=\"margin:0px 10px;\">" + company.CompanySimpleName + "</span>"; } //GroupResult[4] += ((double)(YellowNum + GreenNum) / (double)PeoperNum); return("<tr><td>" + company.CompanySimpleName + "</td><td>" + PeoperNum + "</td><td>" + (YellowNum + GreenNum).ToString() + "</td><td>" + RedNum.ToString() + "</td><td>" + ((double)(YellowNum + GreenNum) / (double)PeoperNum).ToString("P") + "</td></tr>"); } }
//private List<PostCateInfo> ConvertToPostCate(List<PostInfo> PostList, bool ChildList) //{ // List<PostCateInfo> PostCateList = new List<PostCateInfo>(); // if (PostList != null) // { // foreach (PostInfo Info in PostList) // { // PostCateInfo PostCateModel = new PostCateInfo(); // PostCateModel.EncryptFcateID = Info.PostId.ToString(); // PostCateModel.Title = Info.PostName; // if (ChildList) PostCateModel.ChildCourseFCateView = ConvertToPostCate(PostBLL.ReadPostList(Info.PostId), false); // PostCateList.Add(PostCateModel); // } // } // return PostCateList; //} private List <MCourseInfo> GetCourseList() { int postID = RequestHelper.GetForm <int>("postID"); int page = RequestHelper.GetForm <int>("pageIndex"); int pageSize = RequestHelper.GetForm <int>("pageSize"); int classID = RequestHelper.GetForm <int>("classID"); if (pageSize <= 0) { pageSize = base.PageSize; } List <MCourseInfo> CourseList = new List <MCourseInfo>(); int userID = base.UserID; string prepaidCourseId = BLLMTestCate.ReadPrepaidTestCate(userID); if (postID < 0) { postID = int.Parse(CookiesHelper.ReadCookieValue("UserStudyPostId")); } List <ProductInfo> productList = new List <ProductInfo>(); string inProductID = PostBLL.ReadPostCourseID(base.UserCompanyID, postID); string passPostCourseID = string.IsNullOrEmpty(inProductID) ? "" : TestPaperBLL.ReadCourseIDStr(TestPaperBLL.ReadList(base.UserID, inProductID, 1)); inProductID = StringHelper.SubString(inProductID, passPostCourseID); ProductSearchInfo productSearch = new ProductSearchInfo(); if (!string.IsNullOrEmpty(inProductID)) { productSearch.InProductID = inProductID; productSearch.IsSale = 1; if (classID > 0) { productSearch.ClassID = "|" + classID + "|"; } productSearch.OrderField = "[IsTop],[ClassID],[Sort],[ID]"; productList = ProductBLL.SearchProductList(page, pageSize, productSearch, ref base.Count); } int pageCount = (int)Math.Ceiling((double)base.Count / pageSize); //加载选修课程(岗位课程罗列完成后,再加载选修) if ((classID < 0 || classID == 6) && (page == pageCount) && StringHelper.CompareSingleString("4,5,64", UserBLL.ReadUser(base.UserID).StudyPostID.ToString())) { productSearch.InProductID = string.Empty; productSearch.ClassID = "|6|"; productSearch.InBrandID = base.CompanyBrandID; productSearch.NotLikeName = "必修"; productSearch.IsSale = 1; productList.AddRange(ProductBLL.SearchProductList(productSearch)); } //加载认证考试 if ((classID < 0 && page == 1) || classID == 4387) { PostPassInfo passpost = new PostPassInfo(); passpost.UserId = base.UserID; passpost.IsRZ = 0; RenZhengCateInfo rzCate = new RenZhengCateInfo(); rzCate.InPostID = PostPassBLL.PassPostString(passpost); string rzProductID = RenZhengCateBLL.ReadTestCateID(rzCate); if (!string.IsNullOrEmpty(rzProductID)) { productSearch.InProductID = rzProductID; productSearch.ClassID = string.Empty; productSearch.InBrandID = base.CompanyBrandID; productSearch.NotLikeName = string.Empty; productSearch.IsSale = 1; productList.InsertRange(0, ProductBLL.SearchProductList(productSearch)); } } //加载大课件 if ((classID < 0 && page == 1) || classID == 5298) { productSearch.InProductID = string.Empty; productSearch.InBrandID = string.Empty; productSearch.NotLikeName = string.Empty; productSearch.IsSale = 1; productSearch.ClassID = "|5298|"; productList.InsertRange(0, ProductBLL.SearchProductList(productSearch)); } //加载指定时间考试 if (classID < 0 && page == 1) { string parentCompanyID = base.ParentCompanyID; if (string.IsNullOrEmpty(parentCompanyID)) { parentCompanyID = base.UserCompanyID.ToString(); } else { parentCompanyID += "," + base.UserCompanyID.ToString(); } List <TestSettingInfo> specialTestList = TestSettingBLL.ReadSpecialTestList(parentCompanyID); if (specialTestList.Count > 0) { string specialCourseID = TestSettingBLL.ReadSpecialTestCourseID(specialTestList); if (!string.IsNullOrEmpty(specialCourseID)) { productSearch.InProductID = specialCourseID; productSearch.ClassID = string.Empty; productSearch.InBrandID = base.CompanyBrandID; productSearch.NotLikeName = string.Empty; productSearch.IsSale = 1; List <ProductInfo> specialProductList = ProductBLL.SearchProductList(productSearch); productList.InsertRange(0, specialProductList); } } } //重新获取产品ID串 inProductID = ProductBLL.ReadProductIdStr(productList); passPostCourseID = string.IsNullOrEmpty(inProductID) ? "" : TestPaperBLL.ReadCourseIDStr(TestPaperBLL.ReadList(base.UserID, inProductID, 1)); //获取未通过的最新记录 string noPassCourseID = StringHelper.SubString(inProductID, passPostCourseID); List <TestPaperReportInfo> noPassTestPaperList = string.IsNullOrEmpty(noPassCourseID) ? new List <TestPaperReportInfo>() : TestPaperBLL.ReadThelatestList(base.UserID, noPassCourseID); List <AttributeRecordInfo> attributeRecordList = AttributeRecordBLL.ReadList("5", noPassCourseID); foreach (ProductInfo Info in productList) { //通过的课程不用显示 //if (!StringHelper.CompareSingleString(passPostCourseID, Info.ID.ToString())) { TestSettingInfo testSetting = TestSettingBLL.ReadTestSetting(base.UserCompanyID, Info.ID); MCourseInfo CourseModel = new MCourseInfo(); CourseModel.ClassID = Info.ID.ToString(); CourseModel.Title = Info.Name; CourseModel.IsPass = false; CourseModel.PageCount = pageCount; TestPaperReportInfo currentPaper = noPassTestPaperList.Find(delegate(TestPaperReportInfo tempPaper) { return(tempPaper.CourseID == Info.ID); }); if (currentPaper != null) { //剩余时间 int remainingTime = (testSetting.TestInterval - (int)(DateTime.Now - currentPaper.TestDate).TotalHours); CourseModel.ValidDateShow = remainingTime > 0 ? remainingTime.ToString() : ""; } CourseModel.OriginalPrice = Info.MarketPrice.ToString(); if (!string.IsNullOrEmpty(Info.ProductNumber)) { CourseModel.IsVideo = true; } if (!string.IsNullOrEmpty(Info.Accessory)) { CourseModel.IsTest = true; //通过的课程不用再考 if (StringHelper.CompareSingleString(passPostCourseID, Info.ID.ToString())) { CourseModel.IsTest = false; } if (testSetting != null && (testSetting.TestStartTime != null || testSetting.TestEndTime != null)) { //指定时间考试考过了就不要再考了 if (!string.IsNullOrEmpty(CourseModel.ValidDateShow)) { CourseModel.IsTest = false; } if (DateTime.Now < testSetting.TestStartTime || DateTime.Now > testSetting.TestEndTime) { CourseModel.IsTest = false; } } } CourseModel.IsPostCourse = true; CourseModel.IsPrepaidCourse = StringHelper.CompareSingleString(prepaidCourseId, Info.ID.ToString()); //产品知识 练车剧本地址 { CourseModel.RCUrl = AttributeRecordBLL.ReadAttributeRecord(attributeRecordList, 5, Info.ID).Value; if (!string.IsNullOrEmpty(CourseModel.RCUrl)) { CourseModel.IsRC = true; } } CourseList.Add(CourseModel); } } return(CourseList); }
protected string HtmlOut1(CompanyInfo company, ref StringBuilder TotalTable) { StringBuilder TextOut = new StringBuilder(); DateTime PostPlanStartDate = DateTime.MinValue; if (string.IsNullOrEmpty(company.PostStartDate.ToString())) { PostPlanStartDate = Convert.ToDateTime("2013-7-1"); } else { PostPlanStartDate = Convert.ToDateTime(company.PostStartDate.ToString()); } int PeoperNum = 0; //统计目标课程数 int TargetNum = 0, CompanyDelayNum = 0; //统计通过课程数量第一的数据信息 string PassCourseFirstUser = string.Empty, GoodStudent = string.Empty; int FirstPassCourseNum = 0; //单个岗位的岗位计划开始时间 DateTime PostStartDate = DateTime.MinValue; int PostCourseNum = 0; //岗位课程数 string AllPostPlan = "0"; //岗位下所有级别的岗位课程 int RedNum = 0, YellowNum = 0, GreenNum = 0; //把公司所有员工的考试记录都一起调起 TestPaperInfo TestPaperModel = new TestPaperInfo(); if (!string.IsNullOrEmpty(company.PostStartDate.ToString())) { TestPaperModel.TestMinDate = Convert.ToDateTime(company.PostStartDate); } TestPaperModel.TestMaxDate = endDate; TestPaperModel.CompanyIdCondition = company.CompanyId.ToString(); //TestPaperModel.Field = "UserID"; TestPaperModel.Condition = "[UserID] in (select [ID] from [_User] where [companyID]=" + company.CompanyId.ToString(); if (!string.IsNullOrEmpty(groupID)) { TestPaperModel.Condition += " and [GroupID] in (" + groupID + ")"; } if (!string.IsNullOrEmpty(postIdCondition)) { TestPaperModel.Condition += " and [WorkingPostID] in (" + postIdCondition + ")"; } if (!string.IsNullOrEmpty(studyPostIdCondition)) { TestPaperModel.Condition += " and [StudyPostId] in (" + studyPostIdCondition + ")"; } if (!string.IsNullOrEmpty(state)) { TestPaperModel.Condition += " and [Status] in (" + state + ")"; } TestPaperModel.Condition += ")"; List <TestPaperInfo> TestPaperList = TestPaperBLL.NewReadList(TestPaperModel); UserSearchInfo userSearch = new UserSearchInfo(); userSearch.InStatus = state; userSearch.InWorkingPostID = postIdCondition; //if (base.IsGroupCompany(company.GroupId)) //{ // userSearch.InCompanyID = CompanyBLL.ReadCompanyIdList(company.CompanyId.ToString()); // ColNum = 11; // userSearch.InStudyPostID = "45";//集团打开默认显示学习岗位 //} //else { userSearch.InCompanyID = company.CompanyId.ToString(); userSearch.InStudyPostID = studyPostIdCondition; //只显示该学习岗位下的人员 } userSearch.InGroupID = groupID; List <UserInfo> userList = UserBLL.SearchReportUserList(userSearch); //把公司所有员工的第一次考试记录都一起调起 List <TestPaperReportInfo> userFirstTestRecordList = TestPaperBLL.ReadTheFirstRecordList(userSearch.InCompanyID); //把所有员工的认证记录一起调用 PostPassInfo postPassSearch = new PostPassInfo(); postPassSearch.CreateDate = endDate; postPassSearch.InCompanyID = userSearch.InCompanyID; List <PostPassInfo> postPassList = PostPassBLL.ReadPostPassList(postPassSearch); //记录岗位课程ID串 Dictionary <int, string[]> postCourseDic = new Dictionary <int, string[]>(); foreach (UserInfo Info in userList) { int PostId = int.MinValue, PerPassCourseNum = 0, PerCourseNum = 0; PostId = Info.StudyPostID; PostInfo PostModel = PostBLL.ReadPost(PostId); if (PostModel != null) //排除掉没有设置岗位的人 { //筛选出当前用户ID的成绩列表 List <TestPaperInfo> currentUserPaperList = TestPaperList.FindAll(delegate(TestPaperInfo TempModel) { return(TempModel.UserId == Info.ID); }); List <TestPaperInfo> currentUserPassPaperList = currentUserPaperList.FindAll(delegate(TestPaperInfo TempModel) { return(TempModel.IsPass == 1); }); int ResidueCourseNum = 0;//岗位内剩余岗位课程数 if (!postCourseDic.ContainsKey(PostId)) { //岗位数据信息 1:岗位课程ID串;2:岗位课程数量;3:岗位开始时间;4:目标课程数量 string[] postData = { "0", "0", DateTime.MinValue.ToString(), "0" }; AllPostPlan = PostBLL.ReadPostCourseID(company.CompanyId, PostId); postData[0] = AllPostPlan; if (!string.IsNullOrEmpty(AllPostPlan)) { PostCourseNum = AllPostPlan.Split(',').Length; postData[1] = PostCourseNum.ToString(); } //公司有事耽误的数量 由于岗位不一样,岗位计划开始的时间也不一样,所以有事耽误的数量也是不一致的,按岗位计算 PostStartDate = CompanyPostPlanBLL.ReadCompanyPostPlan(company.CompanyId, PostId); //如果没有设置岗位开始时间或者岗位开始时间比公司开始时间早,统一使用公司开始时间 if (PostStartDate == DateTime.MinValue || PostStartDate < PostPlanStartDate) { PostStartDate = PostPlanStartDate; } //根据统一的岗位开始时间调取数据 CompanyDelayNum = ChangeNumBLL.CompanyChangeNum(company.CompanyId, PostId, PostStartDate, endDate); TargetNum = CompanyRuleBLL.GetCourseNum(company.CompanyId, PostId, PostStartDate, endDate); //理论值是每周两门 TargetNum = TargetNum - CompanyDelayNum; postData[2] = PostStartDate.ToString(); postData[3] = TargetNum.ToString(); postCourseDic.Add(PostId, postData); } else { AllPostPlan = postCourseDic[PostId][0]; PostCourseNum = int.Parse(postCourseDic[PostId][1]); PostStartDate = Convert.ToDateTime(postCourseDic[PostId][2]); TargetNum = int.Parse(postCourseDic[PostId][3]); } //如果员工是后来的,要以员工进来的时间为起始点 if (PostStartDate < Info.PostStartDate)//Info.RegisterDate { PostStartDate = Info.PostStartDate; CompanyDelayNum = ChangeNumBLL.CompanyChangeNum(company.CompanyId, PostId, PostStartDate, endDate); TargetNum = CompanyRuleBLL.GetCourseNum(company.CompanyId, PostId, PostStartDate, endDate); //理论值是每周两门 TargetNum = TargetNum - CompanyDelayNum; } TargetNum = TargetNum - ChangeNumBLL.UserChangeNum(Info.ID, PostStartDate, endDate); //PassCateId 跨岗位通过的课程 PostResidueCourse 岗位内剩余课程 string PassCateId = string.Empty, NoPassCateId = string.Empty, PostResidueCourse = string.Empty; if (!string.IsNullOrEmpty(company.PostStartDate.ToString())) { PassCateId = TestPaperBLL.ReadCourseIDStr(currentUserPassPaperList.FindAll(delegate(TestPaperInfo TempModel) { return(TempModel.TestDate >= PostStartDate && TempModel.TestDate <= endDate); })); PostResidueCourse = StringHelper.SubString(AllPostPlan, TestPaperBLL.ReadCourseIDStr(currentUserPassPaperList.FindAll(delegate(TestPaperInfo TempModel) { return(TempModel.TestDate <= endDate); }))); } else { PassCateId = TestPaperBLL.ReadCourseIDStr(currentUserPassPaperList.FindAll(delegate(TestPaperInfo TempModel) { return(TempModel.TestDate <= endDate); })); PostResidueCourse = StringHelper.SubString(AllPostPlan, PassCateId); } //跨岗位通过的课程数(全岗位计划开始后,累计完成的课程数) int AllPassCourseNum = 0; if (!string.IsNullOrEmpty(PassCateId)) { AllPassCourseNum = PassCateId.Split(',').Length; } //获取岗位内剩余课程数 if (!string.IsNullOrEmpty(PostResidueCourse)) { ResidueCourseNum = PostResidueCourse.Split(',').Length; } string PastPassCourse = string.Empty; PeoperNum = PeoperNum + 1; TotalPeoperNum += 1; TextOut.Append("<tr class=\"listTableMain\">\r\n"); TextOut.Append("<td>" + TotalPeoperNum + "</td>"); TextOut.Append("<td>" + company.CompanySimpleName + "</td>"); TextOut.Append("<td>" + Info.RealName + "</td>"); if (!string.IsNullOrEmpty(Info.PostName)) { TextOut.Append("<td>" + Info.PostName + "</td>"); } else { TextOut.Append("<td>" + PostBLL.ReadPost(Info.WorkingPostID).PostName + "</td>"); } TextOut.Append("<td>" + PostModel.PostName + "</td>"); TextOut.Append("<td>" + EnumHelper.ReadEnumChineseName <UserState>(Info.Status) + "</td>"); TestPaperReportInfo currentUserFirstTestRecord = userFirstTestRecordList.Find(delegate(TestPaperReportInfo tempModel) { return(tempModel.UserID == Info.ID); }); if (currentUserFirstTestRecord != null) { TextOut.Append("<td>" + currentUserFirstTestRecord.TestDate.ToString("d") + "</td>"); } else { TextOut.Append("<td> </td>"); } PostPassInfo selfPostRZ = postPassList.Find(delegate(PostPassInfo postpass) { return(postpass.UserId == Info.ID && postpass.PostId == Info.WorkingPostID); }); if (selfPostRZ != null) { TextOut.Append("<td>是</td>"); TextOut.Append("<td>" + selfPostRZ.CreateDate.ToString("d") + "</td>"); } else { TextOut.Append("<td> </td>"); TextOut.Append("<td> </td>"); } List <PostPassInfo> otherPostRZ = postPassList.FindAll(delegate(PostPassInfo postpass) { return(postpass.UserId == Info.ID && postpass.PostId != Info.WorkingPostID); }); if (otherPostRZ.Count > 0) { TextOut.Append("<td>是</td>"); //TextOut.Append("<td>"); //string otherPostName = string.Empty; //foreach (ReportPostPassInfo info in otherPostRZ) //{ // TextOut.Append(info.PassPostName + " "); //} //TextOut.Append("</td>"); } else { TextOut.Append("<td> </td>"); } for (int j = 1; j <= WeekNum; j++) { int WeekCourseNum = 0; DateTime _StartDate = startDate.AddDays(7 * (j - 1)); DateTime _EndDate = startDate.AddDays(7 * j); if (j == WeekNum) { _EndDate = endDate; } if (_StartDate < PostStartDate) { _StartDate = PostStartDate; } if (_EndDate > PostStartDate) { PastPassCourse = TestPaperBLL.ReadCourseIDStr(currentUserPassPaperList.FindAll(delegate(TestPaperInfo TempModel) { return(TempModel.TestDate >= _StartDate && TempModel.TestDate <= _EndDate); })); WeekCourseNum = currentUserPaperList.FindAll(delegate(TestPaperInfo TempModel) { return(TempModel.TestDate >= _StartDate && TempModel.TestDate <= _EndDate); }).Count; } int PastPassCourseNum = 0; if (!string.IsNullOrEmpty(PastPassCourse)) { PastPassCourseNum = PastPassCourse.Split(',').Length; } PerPassCourseNum += PastPassCourseNum; PerCourseNum += WeekCourseNum; TextOut.Append("<td>" + WeekCourseNum + "</td>"); TextOut.Append("<td>" + (PastPassCourseNum) + "</td>"); if (PastPassCourseNum == 0) { TextOut.Append("<td>0</td>"); } else { TextOut.Append("<td>" + ((double)PastPassCourseNum / (double)WeekCourseNum).ToString("P") + "</td>"); } } //统计好学生 学习课程超过30门的人 if (PerCourseNum >= 30) { GoodStudent += " " + Info.RealName; } //统计通过课程数量第一的数据 if (PerPassCourseNum > 0 && PerPassCourseNum >= FirstPassCourseNum) { if (PerPassCourseNum > FirstPassCourseNum) { PassCourseFirstUser = Info.RealName; FirstPassCourseNum = PerPassCourseNum; } else { PassCourseFirstUser = PassCourseFirstUser + " " + Info.RealName; } } TextOut.Append("<td>" + PerCourseNum + "</td>"); TextOut.Append("<td>" + PerPassCourseNum + "</td>"); if (PerCourseNum <= 0) { TextOut.Append("<td>0</td>"); } else { TextOut.Append("<td>" + ((double)PerPassCourseNum / (double)PerCourseNum).ToString("P") + "</td>"); } TextOut.Append("<td>" + (AllPassCourseNum) + "</td>"); TextOut.Append("<td>" + (TargetNum) + "</td>"); TargetNum = AllPassCourseNum - TargetNum; TextOut.Append("<td style=\""); if (TargetNum > 0) { TextOut.Append("background: #00b050;"); GreenNum += 1; } else if (TargetNum < 0) { TextOut.Append("background: #ff0000;"); RedNum += 1; } else { TextOut.Append("background: #ffff00;"); YellowNum += 1; } TextOut.Append(" color:#000;\">" + (TargetNum) + "</td>"); TextOut.Append("</tr>\r\n"); currentUserPaperList = null; currentUserPassPaperList = null; } PostModel = null; } TestPaperList = null; //集团性质不显示总结描述 if (TotalTable == null) { if (FirstPassCourseNum > 0) { TextOut.Append("<tr class=\"listTableHead\"><th colspan=\"" + (ColNum + WeekNum * 3) + "\">课程考试通过数量最多的学霸为: <font color=red>" + PassCourseFirstUser + "</font> ,数量为: <font color=red>" + FirstPassCourseNum.ToString() + "</font> 。</th></tr>"); } if (!string.IsNullOrEmpty(GoodStudent)) { TextOut.Append("<tr class=\"listTableHead\"><th colspan=\"" + (ColNum + WeekNum * 3) + "\">月度考试数量超过30门的为好学生,此次好学生为: <font color=red>" + GoodStudent + "</font> 。</th></tr>"); } TextOut.Append("<tr class=\"listTableHead\"><th colspan=\"" + (ColNum + WeekNum * 3) + "\">未达标人数:" + RedNum.ToString() + " 刚好达标人数:" + YellowNum.ToString() + " 超越目标人数:" + GreenNum.ToString() + "</th></tr>"); TextOut.Append("<tr class=\"listTableHead\"><th colspan=\"" + (ColNum + WeekNum * 3) + "\">未达标人数:" + RedNum.ToString() + " 达标人数:" + (YellowNum + GreenNum).ToString() + " 达成率:" + ((double)(YellowNum + GreenNum) / (double)PeoperNum).ToString("P") + "</th></tr>"); } //生成集团报表内容 if (TotalTable != null) { //集团报表内容开始 groupResult[1] = (int)groupResult[1] + PeoperNum; groupResult[2] = (int)groupResult[2] + (YellowNum + GreenNum); groupResult[3] = (int)groupResult[3] + RedNum; if (((double)(YellowNum + GreenNum) / (double)PeoperNum) == 1.0) { groupResult[4] = groupResult[4] + "<span style=\"margin:0px 10px;\">" + company.CompanySimpleName + "</span>"; } else if (((double)(YellowNum + GreenNum) / (double)PeoperNum) < 0.7) { groupResult[5] = groupResult[5] + "<span style=\"margin:0px 10px;\">" + company.CompanySimpleName + "</span>"; } //GroupResult[4] += ((double)(YellowNum + GreenNum) / (double)PeoperNum); if (FirstPassCourseNum > 0 && FirstPassCourseNum >= (int)groupResult[7]) { if (FirstPassCourseNum == (int)groupResult[7]) { groupResult[6] = string.IsNullOrEmpty(groupResult[6].ToString()) ? PassCourseFirstUser : groupResult[6] + " " + PassCourseFirstUser; } else { groupResult[6] = PassCourseFirstUser; groupResult[7] = FirstPassCourseNum; } } TotalTable.AppendLine("<tr class=\"listTableMain\"><td>" + company.CompanySimpleName + "</td><td>" + PeoperNum + "</td><td>" + (YellowNum + GreenNum).ToString() + "</td><td>" + RedNum.ToString() + "</td><td>" + ((double)(YellowNum + GreenNum) / (double)PeoperNum).ToString("P") + "</td><td>" + PassCourseFirstUser + "</td><td>" + FirstPassCourseNum.ToString() + "</td></tr>"); } return(TextOut.ToString()); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //设置默认值 if (string.IsNullOrEmpty(action)) { groupID = "36"; state = ((int)UserState.Normal).ToString(); } if (action == "search" && companyID > 0) { startDate = RequestHelper.GetQueryString <DateTime>("SearchStartDate"); endDate = RequestHelper.GetQueryString <DateTime>("SearchEndDate"); SearchStartDate.Text = startDate.ToString("d"); SearchEndDate.Text = endDate.ToString("d"); companyModel = CompanyBLL.ReadCompany(companyID); companyName = companyModel.CompanyName; CompanyInfo companySearch = new CompanyInfo(); companySearch.Field = "CompanyId"; companySearch.Condition = CompanyBLL.ReadCompanyIdList(companyID.ToString()); companySearch.State = 0; companySearch.GroupIdCondition = "0,3"; List <CompanyInfo> companyList = CompanyBLL.ReadCompanyList(companySearch); //有效学习统计开始 int AllPassCourseNum = 0, AllCourseNum = 0, AllUserNum = 0, TotalNum = 0, CompanyNum = 0; double PassAverage = 0.0, PerPassAverage = 0.0, PerAllAverage = 0.0; string NoPassCompanyName = string.Empty, AverageCourseNumCompanyName = string.Empty; StringBuilder MonthOut = new StringBuilder(); MonthOut.Append("<table class=\"listTable\">"); MonthOut.Append("<tr class=\"listTableHead\"><td colspan=\"11\">" + companyModel.CompanyName + " 人员数据统计["); if (startDate != DateTime.MinValue) { MonthOut.Append("从" + startDate.ToString("d")); } else { MonthOut.Append("从项目启动"); } MonthOut.Append("到" + endDate.ToString("d") + "]</td></tr>"); MonthOut.Append("<tr class=\"listTableHead\">"); MonthOut.Append("<td>店名</td>"); MonthOut.Append("<td>项目启动时间</td>"); MonthOut.Append("<td>系统登记<br />应考人数</td>"); MonthOut.Append("<td>累计参加<br />考试人数</td>"); MonthOut.Append("<td>累计学习<br />考试次数</td>"); MonthOut.Append("<td>考试通过<br />课程数量</td>"); MonthOut.Append("<td>人均学习<br />课程数量</td>"); MonthOut.Append("<td>人均通过<br />课程数量</td>"); MonthOut.Append("<td>参考人员<br />人均学习<br />课程数量</td>"); MonthOut.Append("<td>参考人员<br />人均通过<br />课程数量</td>"); MonthOut.Append("<td>课程考试<br />通过率</td>"); MonthOut.Append("</tr>"); endDate = endDate.AddDays(1); foreach (CompanyInfo _CompanyModel in companyList) { if (!string.IsNullOrEmpty(_CompanyModel.PostStartDate.ToString()) && Convert.ToDateTime(_CompanyModel.PostStartDate.ToString()) < endDate) { int PassCourseNum = 0, CourseNum = 0, UserNum = 0, Num = 0; UserSearchInfo userSearch = new UserSearchInfo(); userSearch.InCompanyID = _CompanyModel.CompanyId.ToString(); userSearch.InStatus = state; userSearch.InGroupID = groupID; userSearch.InWorkingPostID = postIdCondition; userSearch.InStudyPostID = studyPostIdCondition; List <UserInfo> userList = UserBLL.SearchUserList(userSearch); Num = userList.Count; TestPaperInfo TestPaperModel = new TestPaperInfo(); TestPaperModel.TestMinDate = startDate; TestPaperModel.TestMaxDate = endDate; TestPaperModel.UserIdCondition = UserBLL.ReadUserIdStr(userList); TestPaperModel.CompanyIdCondition = _CompanyModel.CompanyId.ToString(); List <TestPaperInfo> TempList = TestPaperBLL.NewReadList(TestPaperModel); string UserId = string.Empty; foreach (TestPaperInfo Info in TempList) { if (!StringHelper.CompareSingleString(UserId, Info.UserId.ToString())) { UserId += "," + Info.UserId.ToString(); } if (Info.IsPass == 1) { PassCourseNum += 1; } } if (UserId.StartsWith(",")) { UserId = UserId.Substring(1); } if (string.IsNullOrEmpty(UserId)) { UserNum = 0; } else { UserNum = UserId.Split(',').Length; } CourseNum = TempList.Count; double SinglePassRate; //单店课程通过率 if (CourseNum == 0) { SinglePassRate = 0; } else { SinglePassRate = (double)PassCourseNum / (double)CourseNum; } if (SinglePassRate >= 0.22 || _CompanyModel.CompanyId == companyID) { CompanyNum += 1; //通过率大于22%的公司数量 TotalNum += Num; //总人数 AllUserNum += UserNum; //总参加考试人数 AllCourseNum += CourseNum; //总考试课程数 AllPassCourseNum += PassCourseNum; //总通过考试课程数 } else { NoPassCompanyName += _CompanyModel.CompanySimpleName + " "; } MonthOut.Append("<tr class=\"listTableMain\">"); MonthOut.Append("<td>" + _CompanyModel.CompanySimpleName + "</td>"); MonthOut.Append("<td>" + Convert.ToDateTime(_CompanyModel.PostStartDate.ToString()).ToString("yyyy年M月") + "</td>"); MonthOut.Append("<td>" + Num.ToString() + "</td>"); MonthOut.Append("<td>" + UserNum.ToString() + "</td>"); MonthOut.Append("<td>" + CourseNum + "</td>"); MonthOut.Append("<td>" + PassCourseNum + "</td>"); if (Num == 0) { MonthOut.Append("<td>0</td>"); MonthOut.Append("<td>0</td>"); } else { if (startDate == DateTime.MinValue || (endDate - startDate).Days > 7 || Math.Round(((double)CourseNum / Num), 1) >= 2.2) { MonthOut.Append("<td>" + Math.Round(((double)CourseNum / Num), 1) + "</td>"); } else { AverageCourseNumCompanyName += _CompanyModel.CompanySimpleName + " "; MonthOut.Append("<td style=\"background:#FF0000;\">" + Math.Round(((double)CourseNum / Num), 1) + "</td>"); } MonthOut.Append("<td>" + Math.Round(((double)PassCourseNum / Num), 1) + "</td>"); if (SinglePassRate >= 0.22 || _CompanyModel.CompanyId == companyID) { PerAllAverage += Math.Round(((double)CourseNum / Num), 1); PerPassAverage += Math.Round(((double)PassCourseNum / Num), 1); } } //计算参考人员人均值 if (UserNum == 0) { MonthOut.Append("<td>0</td>"); MonthOut.Append("<td>0</td>"); } else { MonthOut.Append("<td>" + Math.Round(((double)CourseNum / UserNum), 1) + "</td>"); MonthOut.Append("<td>" + Math.Round(((double)PassCourseNum / UserNum), 1) + "</td>"); } if (SinglePassRate >= 0.22 || _CompanyModel.CompanyId == companyID) { MonthOut.Append("<td>" + SinglePassRate.ToString("P") + "</td>"); PassAverage += SinglePassRate; } else { MonthOut.Append("<td style=\"background:#FF0000;\">" + SinglePassRate.ToString("P") + "</td>"); } MonthOut.Append("</tr>"); } } MonthOut.Append("<tr class=\"listTableHead\">"); MonthOut.Append("<td colspan=\"2\">" + companyModel.CompanySimpleName + "有效学习合计</td>"); MonthOut.Append("<td>" + TotalNum.ToString() + "</td>"); MonthOut.Append("<td>" + AllUserNum.ToString() + "</td>"); MonthOut.Append("<td>" + AllCourseNum + "</td>"); MonthOut.Append("<td>" + AllPassCourseNum + "</td>"); if (TotalNum == 0) { MonthOut.Append("<td>0</td>"); MonthOut.Append("<td>0</td>"); } else { //MonthOut.Append("<td>" + Math.Round((PerAllAverage / CompanyNum), 1) + "</td>"); //MonthOut.Append("<td>" + Math.Round((PerPassAverage / CompanyNum), 1) + "</td>"); //MonthOut.Append("<td>" + (PassAverage / CompanyNum).ToString("P") + "</td>"); MonthOut.Append("<td>" + Math.Round(((double)AllCourseNum / TotalNum), 1) + "</td>"); MonthOut.Append("<td>" + Math.Round(((double)AllPassCourseNum / TotalNum), 1) + "</td>"); } if (AllUserNum == 0) { MonthOut.Append("<td>0</td>"); MonthOut.Append("<td>0</td>"); } else { MonthOut.Append("<td>" + Math.Round(((double)AllCourseNum / AllUserNum), 1) + "</td>"); MonthOut.Append("<td>" + Math.Round(((double)AllPassCourseNum / AllUserNum), 1) + "</td>"); } if (AllCourseNum == 0) { MonthOut.Append("<td>0</td>"); } else { MonthOut.Append("<td>" + ((double)AllPassCourseNum / (double)AllCourseNum).ToString("P") + "</td>"); } MonthOut.Append("</tr>"); MonthOut.Append("</table>"); if (AllCourseNum <= 0) { MonthOut.Insert(0, "<p>课程学习的考试通过率为 <span style=\"color:#FF0000;\"> 0 </span></p><br /></div>"); } else { MonthOut.Insert(0, "<p>课程学习的考试通过率为 <span style=\"color:#FF0000;\">" + ((double)AllPassCourseNum / (double)AllCourseNum).ToString("P") + "</span></p><br /></div>"); } MonthOut.Insert(0, "在孟特EMS考试系统中进行有效学习的人数为 <span style=\"color:#FF0000;\">" + TotalNum.ToString() + " 人</span></p><br /><p>累计进行了 <span style=\"color:#FF0000;\">" + AllCourseNum.ToString() + " 次</span>课程的学习,人均进行了 <span style=\"color:#FF0000;\">" + Math.Round(((double)AllCourseNum / TotalNum), 1) + " 次</span>课程考试</p><br /><p>其中学习通过 <span style=\"color:#FF0000;\">" + AllPassCourseNum + " 门</span>课程考试,人均通过 <span style=\"color:#FF0000;\">" + Math.Round(((double)AllPassCourseNum / TotalNum), 1) + " 门</span>课程</p><br />"); MonthOut.Insert(0, "到" + endDate.AddDays(-1).ToString("d")); if (startDate != DateTime.MinValue) { MonthOut.Insert(0, "从" + startDate.ToString("d")); } else { MonthOut.Insert(0, "从项目启动"); } if (companyModel.GroupId == 1 || companyModel.GroupId == 2) { MonthOut.Insert(0, "集团"); } else { MonthOut.Insert(0, "贵司"); } MonthOut.Insert(0, "<div style=\" text-align:left; font-size:14px;\"><p>"); MonthOut.Append("<div style=\"line-height:25px; text-align:left; font-size:14px;\"><p style=\"text-align:left; font-size:14px;\"><font color=\"red\">人均学习课程数量:</font>代表团队对学习重视的程度,越高代表越重视学习,建议<span style=\"color:#FF0000;\">不低于每周人均2.2门课程,每月人均8.5门课程</span>,低于指标者请部门领导对学习加大关注。</p>"); if (startDate != DateTime.MinValue && (endDate - startDate).Days <= 7 && !string.IsNullOrEmpty(AverageCourseNumCompanyName) && (companyModel.GroupId == 1 || companyModel.GroupId == 2)) { MonthOut.Append("<p style=\"text-align:left; color:#3366ff; font-size:14px;\">目前人均学习数量低于每周人均2.2门课程的团队有:<span style=\"color:#FF0000;\">" + AverageCourseNumCompanyName + "</span>;请相关领导予以关注。</p>"); // else if (string.IsNullOrEmpty(AverageCourseNumCompanyName) && (CompanyModel.GroupId == 1 || CompanyModel.GroupId == 2)) MonthOut.Append("<p style=\"text-align:left; color:#3366ff; font-size:14px;\">目前有效人均学习数量为: <span style=\"color:#FF0000;\">" + Math.Round(((double)AllCourseNum / TotalNum), 1) + " 次</span>,"); if (Math.Round(((double)AllCourseNum / TotalNum), 1) >= 2.2) { MonthOut.Append("表现良好,请再接再厉。</p>"); } else { MonthOut.Append("请相关领导予以关注。</p>"); } } MonthOut.Append("<br />"); MonthOut.Append("<p style=\"text-align:left; font-size:14px;\"><font color=\"red\">课程考试通过率:</font>通过率高代表团队学习认真,若<span style=\"color:#FF0000;\">通过率低于22%</span>,表示学员没有学习课程,只是通过不断考试来<span style=\"color:#FF0000;\">试图懵过考核</span>,请部门领导制止不当的学习行为。</p>"); if (!string.IsNullOrEmpty(NoPassCompanyName) && (companyModel.GroupId == 1 || companyModel.GroupId == 2)) { MonthOut.Append("<p style=\"text-align:left; color:#3366ff; font-size:14px;\">目前通过率低于22%的团队有: <span style=\"color:#FF0000;\">" + NoPassCompanyName + "</span>,请相关领导予以关注,以上4S店视为无效学习,全部数据不列入集团学习效果统计。</p>"); } else if (string.IsNullOrEmpty(NoPassCompanyName) && (companyModel.GroupId == 1 || companyModel.GroupId == 2)) { MonthOut.Append("<p style=\"text-align:left; color:#3366ff; font-size:14px;\">目前通过率为: <span style=\"color:#FF0000;\">" + ((double)AllPassCourseNum / (double)AllCourseNum).ToString("P") + "</span>,表现良好,请再接再厉。</p>"); } MonthOut.Append("</div>"); //有效学习统计结束 //有效学习统计开始 //AllPassCourseNum = 0; //AllCourseNum = 0; //AllUserNum = 0; //TotalNum = 0; //CompanyNum = 0; //MonthOut.Append("<br><br>"); //MonthOut.Append("<table class=\"listTable\">"); //MonthOut.Append("<tr class=\"listTableHead\"><td colspan=\"11\">" + companyModel.CompanyName + " 人员数据统计(除了删除人员以外的所有考试人员) ["); //if (startDate != DateTime.MinValue) MonthOut.Append("从" + startDate.ToString("d")); //else MonthOut.Append("从项目启动"); //MonthOut.Append("到" + endDate.AddDays(-1).ToString("d") + "]</td></tr>"); //MonthOut.Append("<tr class=\"listTableHead\">"); //MonthOut.Append("<td>店名</td>"); //MonthOut.Append("<td>项目启动时间</td>"); //MonthOut.Append("<td>系统登记<br />人数</td>"); //MonthOut.Append("<td>累计参加<br />考试人数</td>"); //MonthOut.Append("<td>累计学习<br />考试次数</td>"); //MonthOut.Append("<td>考试通过<br />课程数量</td>"); //MonthOut.Append("<td>人均学习<br />课程数量</td>"); //MonthOut.Append("<td>人均通过<br />课程数量</td>"); //MonthOut.Append("<td>参考人员<br />人均学习<br />课程数量</td>"); //MonthOut.Append("<td>参考人员<br />人均通过<br />课程数量</td>"); //MonthOut.Append("<td>课程考试<br />通过率</td>"); //MonthOut.Append("</tr>"); //foreach (CompanyInfo _CompanyModel in companyList) //{ // if (!string.IsNullOrEmpty(_CompanyModel.PostStartDate.ToString()) && Convert.ToDateTime(_CompanyModel.PostStartDate.ToString()) < endDate) // { // int PassCourseNum = 0, CourseNum = 0, UserNum = 0, Num = 0; // UserSearchInfo userSearch = new UserSearchInfo(); // userSearch.InCompanyID = _CompanyModel.CompanyId.ToString(); // userSearch.InStatus = state; // userSearch.InGroupID = groupID; // userSearch.InWorkingPostID = postIdCondition; // userSearch.InStudyPostID = studyPostIdCondition; // List<UserInfo> userList = UserBLL.SearchUserList(userSearch); // Num = userList.Count; // //应考人数(去除在待考分组的人) // //int YKNum = userList.FindAll(delegate(UserInfo TempModel) { return TempModel.Status == (int)UserState.Normal; }).Count; // //Num = YKNum; // TestPaperInfo TestPaperModel = new TestPaperInfo(); // TestPaperModel.TestMinDate = startDate; // TestPaperModel.TestMaxDate = endDate; // TestPaperModel.UserIdCondition = UserBLL.ReadUserIdStr(userList); // TestPaperModel.CompanyIdCondition = _CompanyModel.CompanyId.ToString(); // List<TestPaperInfo> TempList = TestPaperBLL.NewReadList(TestPaperModel); // string UserId = string.Empty; // foreach (TestPaperInfo Info in TempList) // { // if (!StringHelper.CompareSingleString(UserId, Info.UserId.ToString())) // { // UserId += "," + Info.UserId.ToString(); // } // if (Info.IsPass == 1) // { // PassCourseNum += 1; // } // } // if (UserId.StartsWith(",")) UserId = UserId.Substring(1); // if (string.IsNullOrEmpty(UserId)) // { // UserNum = 0; // } // else // { // UserNum = UserId.Split(',').Length; // } // CourseNum = TempList.Count; // double SinglePassRate; //单店课程通过率 // if (CourseNum == 0) // SinglePassRate = 0; // else // SinglePassRate = (double)PassCourseNum / (double)CourseNum; // if (SinglePassRate >= 0.22 || _CompanyModel.CompanyId == companyID) // { // CompanyNum += 1; //通过率大于22%的公司数量 // TotalNum += Num; //总人数 // AllUserNum += UserNum; //总参加考试人数 // AllCourseNum += CourseNum; //总考试课程数 // AllPassCourseNum += PassCourseNum; //总通过考试课程数 // } // else // { // NoPassCompanyName += _CompanyModel.CompanySimpleName + " "; // } // MonthOut.Append("<tr class=\"listTableMain\">"); // MonthOut.Append("<td>" + _CompanyModel.CompanySimpleName + "</td>"); // MonthOut.Append("<td>" + Convert.ToDateTime(_CompanyModel.PostStartDate.ToString()).ToString("yyyy年M月") + "</td>"); // MonthOut.Append("<td>" + Num.ToString() + "</td>"); // MonthOut.Append("<td>" + UserNum.ToString() + "</td>"); // MonthOut.Append("<td>" + CourseNum + "</td>"); // MonthOut.Append("<td>" + PassCourseNum + "</td>"); // if (Num == 0) // { // MonthOut.Append("<td>0</td>"); // MonthOut.Append("<td>0</td>"); // } // else // { // if (startDate == DateTime.MinValue || (endDate - startDate).Days > 7 || Math.Round(((double)CourseNum / Num), 1) >= 2.2) // { // MonthOut.Append("<td>" + Math.Round(((double)CourseNum / Num), 1) + "</td>"); // } // else // { // AverageCourseNumCompanyName += _CompanyModel.CompanySimpleName + " "; // MonthOut.Append("<td style=\"background:#FF0000;\">" + Math.Round(((double)CourseNum / Num), 1) + "</td>"); // } // MonthOut.Append("<td>" + Math.Round(((double)PassCourseNum / Num), 1) + "</td>"); // if (SinglePassRate >= 0.22 || _CompanyModel.CompanyId == companyID) // { // PerAllAverage += Math.Round(((double)CourseNum / Num), 1); // PerPassAverage += Math.Round(((double)PassCourseNum / Num), 1); // } // } // //计算参考人员人均值 // if (UserNum == 0) // { // MonthOut.Append("<td>0</td>"); // MonthOut.Append("<td>0</td>"); // } // else // { // MonthOut.Append("<td>" + Math.Round(((double)CourseNum / UserNum), 1) + "</td>"); // MonthOut.Append("<td>" + Math.Round(((double)PassCourseNum / UserNum), 1) + "</td>"); // } // if (SinglePassRate >= 0.22 || _CompanyModel.CompanyId == companyID) // { // MonthOut.Append("<td>" + SinglePassRate.ToString("P") + "</td>"); // PassAverage += SinglePassRate; // } // else // { // MonthOut.Append("<td style=\"background:#FF0000;\">" + SinglePassRate.ToString("P") + "</td>"); // } // MonthOut.Append("</tr>"); // } //} //MonthOut.Append("<tr class=\"listTableHead\">"); //MonthOut.Append("<td colspan=\"2\">" + companyModel.CompanySimpleName + "有效学习合计</td>"); //MonthOut.Append("<td>" + TotalNum.ToString() + "</td>"); //MonthOut.Append("<td>" + AllUserNum.ToString() + "</td>"); //MonthOut.Append("<td>" + AllCourseNum + "</td>"); //MonthOut.Append("<td>" + AllPassCourseNum + "</td>"); //if (TotalNum == 0) //{ // MonthOut.Append("<td>0</td>"); // MonthOut.Append("<td>0</td>"); //} //else //{ // //MonthOut.Append("<td>" + Math.Round((PerAllAverage / CompanyNum), 1) + "</td>"); // //MonthOut.Append("<td>" + Math.Round((PerPassAverage / CompanyNum), 1) + "</td>"); // //MonthOut.Append("<td>" + (PassAverage / CompanyNum).ToString("P") + "</td>"); // MonthOut.Append("<td>" + Math.Round(((double)AllCourseNum / TotalNum), 1) + "</td>"); // MonthOut.Append("<td>" + Math.Round(((double)AllPassCourseNum / TotalNum), 1) + "</td>"); //} //if (AllUserNum == 0) //{ // MonthOut.Append("<td>0</td>"); // MonthOut.Append("<td>0</td>"); //} //else //{ // MonthOut.Append("<td>" + Math.Round(((double)AllCourseNum / AllUserNum), 1) + "</td>"); // MonthOut.Append("<td>" + Math.Round(((double)AllPassCourseNum / AllUserNum), 1) + "</td>"); //} //if (AllCourseNum == 0) // MonthOut.Append("<td>0</td>"); //else // MonthOut.Append("<td>" + ((double)AllPassCourseNum / (double)AllCourseNum).ToString("P") + "</td>"); //MonthOut.Append("</tr>"); //MonthOut.Append("</table>"); //MonthOut.Append("<br><br>"); //有效学习统计结束 //岗位资质认证统计开始 MonthOut.Append("<table class=\"listTable\">"); MonthOut.Append("<tr class=\"listTableHead\"><td colspan=\"9\">" + companyModel.CompanyName + " 岗位资质认证统计 ["); if (startDate != DateTime.MinValue) { MonthOut.Append("从" + startDate.ToString("d")); } else { MonthOut.Append("从项目启动"); } MonthOut.Append("到" + endDate.AddDays(-1).ToString("d") + "]</td></tr>"); MonthOut.Append("<tr class=\"listTableHead\">"); MonthOut.Append("<td>店名</td>"); MonthOut.Append("<td>姓名</td>"); MonthOut.Append("<td>在职岗位</td>"); MonthOut.Append("<td>已通过的<br />认证岗位</td>"); //MonthOut.Append("<td>岗位考核<br />课程数量</td>"); MonthOut.Append("<td>累计通过<br />岗位数量</td>"); MonthOut.Append("<td>目前正在<br />学习岗位</td>"); MonthOut.Append("</tr>"); foreach (CompanyInfo _CompanyModel in companyList) { PostPassInfo PostPassModel = new PostPassInfo(); PostPassModel.SearchStartDate = startDate; PostPassModel.CreateDate = endDate; List <ReportPostPassInfo> PostPassList = PostPassBLL.PostPassReportList(PostPassModel, _CompanyModel.CompanyId.ToString()); foreach (ReportPostPassInfo Info in PostPassList) { MonthOut.Append("<tr class=\"listTableMain\">"); MonthOut.Append("<td>" + _CompanyModel.CompanySimpleName + "</td>"); MonthOut.Append("<td>" + Info.RealName + "</td>"); if (string.IsNullOrEmpty(Info.WorkingPostName)) { MonthOut.Append("<td>" + PostBLL.ReadPost(Info.WorkingPostId).PostName + "</td>"); } else { MonthOut.Append("<td>" + Info.WorkingPostName + "</td>"); } MonthOut.Append("<td>" + Info.PassPostName + "</td>"); MonthOut.Append("<td>" + Info.PassPostNum.ToString() + "</td>"); MonthOut.Append("<td>" + PostBLL.ReadPost(Info.StudyPostId).PostName + "</td>"); MonthOut.Append("</tr>"); } } MonthOut.Append("</table>"); //岗位资质认证统计结束 ReportList.InnerHtml = MonthOut.ToString(); ReportList.InnerHtml += HistoryData(companyList, endDate); } } }
private PostCateInfo GetPostClassList() { string QuestType = RequestHelper.GetForm <string>("questType"); int classID = RequestHelper.GetForm <int>("ClassID"); int studyPostID = int.Parse(CookiesHelper.ReadCookieValue("UserStudyPostId")); Dictionary <string, Dictionary <string, string> > postProductClassList = new Dictionary <string, Dictionary <string, string> >(); string postCourseID = PostBLL.ReadPostCourseID(base.UserCompanyID, studyPostID); string passPostCourseID = string.IsNullOrEmpty(postCourseID) ? "" : TestPaperBLL.ReadCourseIDStr(TestPaperBLL.ReadList(base.UserID, postCourseID, 1)); postCourseID = StringHelper.SubString(postCourseID, passPostCourseID); //加载认证考试 PostPassInfo passpost = new PostPassInfo(); passpost.UserId = base.UserID; passpost.IsRZ = 0; RenZhengCateInfo rzCate = new RenZhengCateInfo(); rzCate.InPostID = PostPassBLL.PassPostString(passpost); string rzProductID = RenZhengCateBLL.ReadTestCateID(rzCate); postCourseID = string.IsNullOrEmpty(rzProductID) ? postCourseID : string.IsNullOrEmpty(postCourseID) ? rzProductID : postCourseID + "," + rzProductID; //加载大课件 ProductSearchInfo productSearch = new ProductSearchInfo(); productSearch.IsSale = 1; productSearch.ClassID = "|5298|"; List <ProductInfo> dkjProductList = ProductBLL.SearchProductList(productSearch); if (dkjProductList.Count > 0) { string dkjCourseID = ProductBLL.ReadProductIdStr(dkjProductList); postCourseID = string.IsNullOrEmpty(postCourseID) ? dkjCourseID : postCourseID + "," + dkjCourseID; } if (!string.IsNullOrEmpty(postCourseID)) { postProductClassList = ProductClassBLL.ReadProductClassListByProductID(postCourseID, 1); } if (postProductClassList.Count > 1) { postProductClassList = ProductClassBLL.productClassSort(postProductClassList); } List <Dictionary <string, string> > productClassList = new List <Dictionary <string, string> >(); foreach (string key in postProductClassList.Keys) { Dictionary <string, string> productClassDic = new Dictionary <string, string>(); productClassDic.Add("ID", key); productClassDic.Add("Name", ProductClassBLL.ReadProductClassCache(int.Parse(key)).ClassName); productClassList.Add(productClassDic); } PostCateInfo studyPost = new PostCateInfo(); studyPost.EncryptFcateID = studyPostID.ToString(); studyPost.Title = PostBLL.ReadPost(studyPostID).PostName; studyPost.ChildCourseFCateView = productClassList; return(studyPost); //三个岗位加载 竞品选修 //if (StringHelper.CompareSingleString("4,5,64", studyPostID.ToString())) //{ // ProductSearchInfo productSearch = new ProductSearchInfo(); // productSearch.ClassID = "|6|"; // productSearch.InBrandID = base.CompanyBrandID; // productSearch.IsSale = 1; // productSearch.NotLikeName = "必修"; // string xxCourseID = ProductBLL.ReadProductIdStr(ProductBLL.SearchProductList(productSearch)); // string passXXCourseID = TestPaperBLL.ReadCourseIDStr(TestPaperBLL.ReadList(base.UserID, xxCourseID, 1)); // //if (passType == 1) // // xxCourseID = passXXCourseID; // //else if (passType == 0) // xxCourseID = StringHelper.SubString(xxCourseID, passXXCourseID); // if (!string.IsNullOrEmpty(xxCourseID)) // this.xxProductClassList = ProductClassBLL.ReadProductClassListByProductID(xxCourseID, 1); //} //if (!string.IsNullOrEmpty(QuestType)) //{ // List<PostInfo> PostCateList = new List<PostInfo>(); // PostCateList.Add(PostBLL.ReadPost(PostId)); // return ConvertToPostCate(PostCateList, true); //} //else //{ // return ConvertToPostCate(PostBLL.ReadPostCateRootList(), true); //} }
protected void HtmlOut() { startDate = Convert.ToDateTime(RequestHelper.GetQueryString <string>("SearchStartDate")); endDate = Convert.ToDateTime(RequestHelper.GetQueryString <string>("SearchEndDate")).AddDays(1); SearchStartDate.Text = startDate.ToString("d"); SearchEndDate.Text = endDate.AddDays(-1).ToShortDateString(); int WeekNum = 0, ColNum = 14; int PeoperNum = 0; StringBuilder TextOut = new StringBuilder(); CompanyInfo company = CompanyBLL.ReadCompany(companyID); companyName = company.CompanyName; //string CompanyBrandId = company.BrandId; bool isGroupCompany = base.IsGroupCompany(company.GroupId); if (isGroupCompany) { ColNum = 15; } string rowspan = string.Empty; TextOut.Append("<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"); TextOut.Append("<thead>"); TextOut.Append("<tr class=\"listTableHead\">"); //循环开始日期 DateTime loopStartDate = startDate; if (SelectMonth == "Other") { //目前只要一周的数据 loopStartDate = endDate.AddDays(-7); WeekNum = (endDate - loopStartDate).Days / 7; if ((endDate - loopStartDate).Days % 7 > 0) { WeekNum = WeekNum + 1; } TextOut.Append("<th colspan=\"" + (ColNum + WeekNum) + "\">" + company.CompanySimpleName);//+ " [" + loopStartDate.ToString("d") + "—" + EndDate.AddDays(-1).ToString("d") + "]" rowspan = " rowspan=\"2\""; } TextOut.Append("</th></tr>\r\n"); TextOut.Append("<tr class=\"listTableHead\">\r\n"); TextOut.Append("<th" + rowspan + ">序号</th>"); if (isGroupCompany) { TextOut.Append("<td" + rowspan + ">公司名</th>"); } TextOut.Append("<th" + rowspan + " data-sort=\"string\">姓名</th>"); TextOut.Append("<th" + rowspan + " data-sort=\"string\">工作岗位</th>"); TextOut.Append("<th" + rowspan + " data-sort=\"string\">学习岗位</th>"); TextOut.Append("<th" + rowspan + " data-sort=\"string\">状态</th>"); TextOut.Append("<th" + rowspan + ">初考时间</th>"); TextOut.Append("<th" + rowspan + ">岗位课程数</th>"); TextOut.Append("<th" + rowspan + " data-sort=\"int\">岗位课程<br>完成总数</th>"); TextOut.Append("<th" + rowspan + " data-sort=\"int\">岗位剩余<br>课程总数</th>"); TextOut.Append("<th" + rowspan + " data-sort=\"int\">学习完成率</th>"); TextOut.Append("<th" + rowspan + ">所有已过岗位</th>"); TextOut.Append("<th" + rowspan + " data-sort=\"int\">已过岗位数量<i class=\"icon_arrow\"></i></th>"); TextOut.Append("<th" + rowspan + ">岗位已学习<br>考试未通过</th>"); TextOut.Append("<th" + rowspan + ">已通过数量</th>"); if (SelectMonth == "Other") { TextOut.Append("<th colspan=\"" + WeekNum.ToString() + "\">学习已通过</th></tr>\r\n"); TextOut.Append("<tr class=\"listTableHead\">\r\n"); for (int j = 1; j <= WeekNum; j++) { TextOut.Append("<th>第" + j.ToString() + "周<br>" + loopStartDate.AddDays(7 * (j - 1)).ToString("M-d") + "—"); if (j == WeekNum) { TextOut.Append(endDate.AddDays(-1).ToString("M-d") + "</th>"); } else { TextOut.Append(loopStartDate.AddDays((7 * j) - 1).ToString("M-d") + "</th>"); } } TextOut.Append("</tr>\r\n"); } TextOut.Append("</thead>"); TextOut.Append("<tbody>"); UserSearchInfo user = new UserSearchInfo(); user.InStatus = state; user.InGroupID = groupID; user.InWorkingPostID = postIdCondition; user.InStudyPostID = studyPostIdCondition; //只显示该学习岗位下的人员 if (isGroupCompany) { user.InCompanyID = CompanyBLL.ReadCompanyIdList(companyID.ToString()); //user.StudyPostIdCondition = "45";//集团打开默认显示学习岗位 } else { user.InCompanyID = companyID.ToString(); } if (rzDate == 1) { if (rz == 0) { user.Condition = "[id] not in (select [userid] from [_passpost] where [CreateDate]<='" + endDate + "' and [isrz]=1 and [_passpost].[postid] in (select [postid] from [_post]))"; } else if (rz == 1) { user.Condition = "[id] in (select [userid] from [_passpost] where [CreateDate]<='" + endDate + "' and [isrz]=1 and [_passpost].[postid] in (select [postid] from [_post]))"; } } else if (rzDate == 0) { if (rz == 0) { user.Condition = "[id] not in (select [userid] from [_passpost] where [CreateDate]>='" + startDate + "' And [CreateDate]<='" + endDate + "' and [isrz]=1 and [_passpost].[postid] in (select [postid] from [_post]))"; } else if (rz == 1) { user.Condition = "[id] in (select [userid] from [_passpost] where [CreateDate]>='" + startDate + "' And [CreateDate]<='" + endDate + "' and [isrz]=1 and [_passpost].[postid] in (select [postid] from [_post]))"; } } //user.Condition = string.IsNullOrEmpty(user.Condition) ? "Order by [CompanyID] Desc" : user.Condition + " Order by [CompanyID] Desc"; //user.PostIdCondition = PostIdStr; List <UserInfo> userList = UserBLL.SearchReportUserList(user);//UserBLL.SearchUserList(user); //把公司所有员工的第一次考试记录都一起调起 List <TestPaperReportInfo> userFirstTestRecordList = TestPaperBLL.ReadTheFirstRecordList(user.InCompanyID); //把公司所有员工的考试记录都一起调起 TestPaperInfo TestPaperModel = new TestPaperInfo(); //if (!string.IsNullOrEmpty(company.PostStartDate.ToString())) // TestPaperModel.TestMinDate = Convert.ToDateTime(company.PostStartDate); TestPaperModel.TestMaxDate = endDate; TestPaperModel.CompanyIdCondition = user.InCompanyID; //TestPaperModel.Field = "UserID"; TestPaperModel.Condition = "[UserID] in (select [ID] from [_User] where [CompanyID] in (" + user.InCompanyID + ")"; if (!string.IsNullOrEmpty(groupID)) { TestPaperModel.Condition += " and [GroupID] in (" + groupID + ")"; } if (!string.IsNullOrEmpty(postIdCondition)) { TestPaperModel.Condition += " and [WorkingPostID] in (" + postIdCondition + ")"; } if (!string.IsNullOrEmpty(studyPostIdCondition)) { TestPaperModel.Condition += " and [StudyPostId] in (" + studyPostIdCondition + ")"; } if (!string.IsNullOrEmpty(state)) { TestPaperModel.Condition += " and [Status] in (" + state + ")"; } TestPaperModel.Condition += ")"; List <TestPaperInfo> TestPaperList = TestPaperBLL.NewReadList(TestPaperModel); foreach (UserInfo Info in userList) { int PostId = int.MinValue; PostId = Info.StudyPostID; PostInfo PostModel = PostBLL.ReadPost(Info.StudyPostID); if (PostModel != null) //排除掉没有设置岗位的人 { //string PassCateId = TestPaperBLL.ReadListStr(Info.ID, endDate, 1); //string NoPassCateId = TestPaperBLL.ReadListStr(Info.ID, endDate, 0); //筛选出当前用户ID的成绩列表 List <TestPaperInfo> currentUserPaperList = TestPaperList.FindAll(delegate(TestPaperInfo TempModel) { return(TempModel.UserId == Info.ID); }); List <TestPaperInfo> currentUserPassPaperList = currentUserPaperList.FindAll(delegate(TestPaperInfo TempModel) { return(TempModel.IsPass == 1); }); List <TestPaperInfo> currentUserNoPassPaperList = currentUserPaperList.FindAll(delegate(TestPaperInfo TempModel) { return(TempModel.IsPass == 0); }); string PassCateId = TestPaperBLL.ReadCourseIDStr(currentUserPassPaperList); string NoPassCateId = TestPaperBLL.ReadCourseIDStr(currentUserNoPassPaperList); //从未通过的记录中去除后期又补考通过的记录 NoPassCateId = StringHelper.SubString(NoPassCateId, PassCateId); int PostCourseNum = 0; int PassCourseNum = 0; int NoPassCourseNum = 0; //岗位下所有已过级别的岗位课程 //if (isGroupCompany) // CompanyBrandId = CompanyBLL.ReadCompany(Info.CompanyID).BrandId; string AllPostPlan = PostBLL.ReadPostCourseID(Info.CompanyID, Info.StudyPostID);//PostBLL.ReadPostCourseID(Info.StudyPostID, CompanyBrandId); if (string.IsNullOrEmpty(AllPostPlan)) { PostCourseNum = 0; } else { PostCourseNum = AllPostPlan.Split(',').Length; } string PassPostCateId = StringHelper.EqualString(PassCateId, AllPostPlan); string NoPassPostCateId = StringHelper.EqualString(AllPostPlan, NoPassCateId); if (string.IsNullOrEmpty(PassPostCateId)) { PassCourseNum = 0; } else { PassCourseNum = PassPostCateId.Split(',').Length; } //选取时间段内 if (rzDate == 0) { //时间段内的学习中的岗位课程补丁,去掉即为到截止时间所有的学习中的岗位课程 if (SelectMonth == "Other") { NoPassPostCateId = StringHelper.EqualString(NoPassPostCateId, TestPaperBLL.ReadCourseIDStr(currentUserNoPassPaperList.FindAll(delegate(TestPaperInfo TempModel) { return(TempModel.TestDate >= startDate && TempModel.TestDate <= endDate); }))); } //补丁结束 } if (string.IsNullOrEmpty(NoPassPostCateId)) { NoPassCourseNum = 0; } else { NoPassCourseNum = NoPassPostCateId.Split(',').Length; } //如果公司ID不同,再次获取公司信息,减少重复操作 if (Info.CompanyID != company.CompanyId) { company = CompanyBLL.ReadCompany(Info.CompanyID); } string PastPassCourse = string.Empty; PeoperNum = PeoperNum + 1; TextOut.Append("<tr class=\"listTableMain\">\r\n"); TextOut.Append("<td>" + PeoperNum + "</td>"); if (isGroupCompany) { TextOut.Append("<td>" + company.CompanySimpleName + "</td>"); } TextOut.Append("<td>" + Info.RealName + "</td>"); if (!string.IsNullOrEmpty(Info.PostName)) { TextOut.Append("<td>" + Info.PostName + "</td>"); } else { TextOut.Append("<td>" + PostBLL.ReadPost(Info.WorkingPostID).PostName + "</td>"); } TextOut.Append("<td>" + PostModel.PostName + "</td>"); TextOut.Append("<td>" + EnumHelper.ReadEnumChineseName <UserState>(Info.Status) + "</td>"); //DateTime firstTestDate = TestPaperBLL.ReadTheOldTestPaperInfo(Info.ID).TestDate; TestPaperReportInfo currentUserFirstTestRecord = userFirstTestRecordList.Find(delegate(TestPaperReportInfo tempModel) { return(tempModel.UserID == Info.ID); }); if (currentUserFirstTestRecord != null) { TextOut.Append("<td>" + currentUserFirstTestRecord.TestDate.ToString("d") + "</td>"); } else { TextOut.Append("<td> </td>"); } TextOut.Append("<td>" + PostCourseNum.ToString() + "</td>"); TextOut.Append("<td>" + PassCourseNum.ToString() + "</td>"); TextOut.Append("<td>" + (PostCourseNum - PassCourseNum) + "</td>"); if (PostCourseNum > 0) { TextOut.Append("<td>" + (Math.Round((double)PassCourseNum / PostCourseNum, 4) * 100) + "%</td>"); } else { TextOut.Append("<td>0</td>"); } int passPostNum = 0; if (rzDate == 1) { TextOut.Append("<td>" + PostPassBLL.ReadPassPostName(Info.ID, endDate, ref passPostNum) + "</td>"); } else { TextOut.Append("<td>" + PostPassBLL.ReadPassPostName(Info.ID, startDate, endDate, ref passPostNum) + "</td>"); } TextOut.Append("<td>" + passPostNum + "</td>"); TextOut.Append("<td>" + (NoPassCourseNum) + "</td>"); if (rzDate == 0) { List <TestPaperInfo> tempList = currentUserPassPaperList.FindAll(m => m.TestDate >= startDate && m.TestDate <= endDate); if (tempList.Count > 0) { TextOut.Append("<td>" + TestPaperBLL.ReadCourseIDStr(tempList).Split(',').Length + "</td>"); } else { TextOut.Append("<td>0</td>"); } } else { TextOut.Append("<td>" + (string.IsNullOrEmpty(PassCateId) ? 0 : PassCateId.Split(',').Length) + "</td>"); } if (SelectMonth == "Other") { for (int j = 1; j <= WeekNum; j++) { if (j == WeekNum) { PastPassCourse = StringHelper.EqualString(AllPostPlan, TestPaperBLL.ReadCourseIDStr(currentUserPassPaperList.FindAll(delegate(TestPaperInfo TempModel) { return(TempModel.TestDate >= loopStartDate.AddDays(7 * (j - 1)) && TempModel.TestDate <= endDate); }))); //TestPaperBLL.ReadListStr(Info.ID, loopStartDate.AddDays(7 * (j - 1)), endDate, 1) } else { PastPassCourse = StringHelper.EqualString(AllPostPlan, TestPaperBLL.ReadCourseIDStr(currentUserPassPaperList.FindAll(delegate(TestPaperInfo TempModel) { return(TempModel.TestDate >= loopStartDate.AddDays(7 * (j - 1)) && TempModel.TestDate <= loopStartDate.AddDays(7 * j)); }))); //TestPaperBLL.ReadListStr(Info.ID, loopStartDate.AddDays(7 * (j - 1)), loopStartDate.AddDays(7 * j), 1) } int PastPassCourseNum = 0; if (!string.IsNullOrEmpty(PastPassCourse)) { PastPassCourseNum = PastPassCourse.Split(',').Length; } TextOut.Append("<td>" + (PastPassCourseNum) + "</td>"); } } else { //计算到上个时间学过的课程数 //算法(到现在所有通过的课程-到上个时间点所有完成的课程=时间段内新增课程) //时间段内新增课程与岗位计划相同的部分=时间段内新增课程 PastPassCourse = StringHelper.EqualString(AllPostPlan, StringHelper.SubString(PassCateId, TestPaperBLL.ReadCourseIDStr(currentUserPassPaperList.FindAll(delegate(TestPaperInfo TempModel) { return(TempModel.TestDate <= startDate); })))); //TestPaperBLL.ReadListStr(Info.ID, startDate, 1) int PastPassCourseNum = 0; if (!string.IsNullOrEmpty(PastPassCourse)) { PastPassCourseNum = PastPassCourse.Split(',').Length; } TextOut.Append("<td>" + (PastPassCourseNum) + "</td>"); } TextOut.Append("</tr>\r\n"); } } TextOut.Append("</tbody>"); TextOut.Append("</table>"); this.ReportList.InnerHtml = TextOut.ToString(); }