username@email.com
2021-10-28 0047bb0d2ba509f8a3cde4e06961edb19f9d1163
zhengcaioa/zhengcaioa/Controllers/ExpertTest/ExpertTestTopicController.cs
@@ -11,6 +11,7 @@
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using System.Transactions;
using zhengcaioa.IService;
@@ -876,6 +877,170 @@
            return new JsonResult(resultEntity);
        }
        public IActionResult shititongji()
        {
            var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
            ViewData["curentuser"] = curentuser;
            var expertTestTopicDTOs = new List<ExpertTestTopicDTO>();
            var expertTestTopicDTOs1 = _expertTestTopicService.GetList();
            var sysCodeDtls = _liaotianService.GetSYScode("expert_test_topic", "topictype");
            var sysCodeDtls1 = _liaotianService.GetSYScode("expert_test_topic", "zhishitype");
            foreach (var sysCodeDtl1 in sysCodeDtls1)
            {
                foreach (var sysCodeDtl in sysCodeDtls)
                {
                    var shuliang = expertTestTopicDTOs1.Count(x => x.Zhishitype == sysCodeDtl1.CodeSn && x.Topictype == sysCodeDtl.CodeSn);
                    var expertTestTopicDTO = new ExpertTestTopicDTO();
                    expertTestTopicDTO.Shuliang = shuliang;
                    var sysCodeDtl2 = sysCodeDtls1.Where(x => x.CodeSn == sysCodeDtl1.CodeSn).FirstOrDefault();
                    if (sysCodeDtl2 != null)
                    {
                        expertTestTopicDTO.ZhishitypeName = sysCodeDtl2.Comments;
                    }
                    expertTestTopicDTO.Zhishitype = sysCodeDtl1.CodeSn;
                    expertTestTopicDTO.Topictype = sysCodeDtl.CodeSn;
                    expertTestTopicDTOs.Add(expertTestTopicDTO);
                }
            }
            //ViewBag.topictype = sysCodeDtls;
            //ViewBag.zhishitype = sysCodeDtls1;
            //ViewBag.listExpertTestTopicDTO = expertTestTopicDTOs;
            StringBuilder stringBuilder = new StringBuilder();
            stringBuilder.Append("<table style=\"width:50%;\">");
            stringBuilder.Append(" <tr>");
            stringBuilder.Append("<td style=\"width:25%;\"> 知识点/题型</td>");
            foreach (var sysCodeDtl in sysCodeDtls)
            {
                stringBuilder.Append("<td style = \"width:25%;\" > " + sysCodeDtl.Comments + "</td >");
            }
            stringBuilder.Append(" </tr>");
            int i = 0;
            foreach(var ExpertTestTopicDTO in expertTestTopicDTOs)
            {
                if(i != 0 && i % 3 == 0)
                {
                    stringBuilder.Append(" </tr>");
                }
                if(i == 0 || i % 3 == 0)
                {
                    stringBuilder.Append("<tr>");
                    stringBuilder.Append(" <td>" + ExpertTestTopicDTO.ZhishitypeName + "</td>");
                }
                stringBuilder.Append("<td><a onclick=\"OpenWindow(' ','98%','100%', '/ExpertTestTopic/tongjiIndex?Topictype=" + ExpertTestTopicDTO.Topictype + "&Zhishitype=" + ExpertTestTopicDTO.Zhishitype + "')\"  >             " + ExpertTestTopicDTO.Shuliang +"</a></td>");
                if (i == expertTestTopicDTOs.Count - 1)
                {
                    stringBuilder.Append(" </tr>");
                }
                i++;
            }
            stringBuilder.Append("</table>");
            ViewBag.htmlstring = stringBuilder.ToString(); ;
            return View();
        }
        public IActionResult tongjiIndex(string Topictype="", string Zhishitype = "")
        {
            var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
            ViewData["curentuser"] = curentuser;
            List<ActionEntity> actionlist = new List<ActionEntity>();
            ActionEntity actionEntity = new ActionEntity();
            actionEntity.OpenType = 0;
            actionEntity.ActionUrl = "";
            actionEntity.ActionFun = "Search";
            actionEntity.PageIco = "fa fa-search";
            actionEntity.ActionName = "查询";
            actionlist.Add(actionEntity);
            //ActionEntity actionEntity1 = new ActionEntity();
            //actionEntity1.OpenType = 0;
            //actionEntity1.ActionUrl = "";
            //actionEntity1.ActionFun = "Add";
            //actionEntity1.PageIco = "fa fa-plus";
            //actionEntity1.ActionName = "新增";
            //actionlist.Add(actionEntity1);
            //ActionEntity actionEntity2 = new ActionEntity();
            //actionEntity2.OpenType = 0;
            //actionEntity2.ActionUrl = "";
            //actionEntity2.ActionFun = "Print";
            //actionEntity2.PageIco = "fa fa-print";
            //actionEntity2.ActionName = "打印";
            //actionlist.Add(actionEntity2);
            ViewData["ActionInfo"] = actionlist;
            ViewBag.Topictype1 = Topictype;
            ViewBag.Zhishitype1 = Zhishitype;
            ViewBag.topictype = _liaotianService.GetSYScode("expert_test_topic", "topictype").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList();
            ViewBag.zhishitype = _liaotianService.GetSYScode("expert_test_topic", "zhishitype").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList();
            ViewBag.zhongdian = _liaotianService.GetSYScode("system", "shifou").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList();
            ViewBag.jiexi_status = _liaotianService.GetSYScode("expert_test_topic", "jiexi_status").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList();
            ViewBag.shenpi_status = _liaotianService.GetSYScode("expert_test_topic", "shenpi_status").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList();
            var areaDTOs = _areaService.GetList().Where(x => x.ParentId == "0     ").ToList();
            foreach (var areaDTO in areaDTOs)
            {
                if (areaDTO.CodeId == "510000")
                {
                    areaDTOs.Remove(areaDTO);
                    break;
                }
            }
            var areaDTOsic = new AreaDTO();
            areaDTOsic.CodeId = "510000";
            areaDTOsic.Name = "四川省";
            areaDTOsic.ParentId = "0     ";
            areaDTOs.Insert(1, areaDTOsic);
            ViewBag.Area = areaDTOs.Select(x => new { code = x.CodeId, label = x.Name }).ToList(); ;
            return View();
        }
    }
}