public ActionResult Index()
        {
            var types = TechService.LoadEntities(t => t.Id != 0).ToList();

            ViewData.Model = types;

            var techTypes = TechTypeService.LoadEntities(t => t.Id != 0);

            ViewData["techTypes"] = new SelectList(techTypes, "Id", "TypeName");
            return(View());
        }
예제 #2
0
        public ActionResult GetTechDataZZ()
        {
            List <string> legendData = new List <string>();

            legendData.Add("技术");
            StatisticsZZModel zz = new StatisticsZZModel()
            {
                legendData = legendData,
                text       = "技术统计",
                subText    = "统计时间:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
            };

            var tech = TechService.LoadEntities(r => r.Id != 0);
            Dictionary <string, string> dic = new Dictionary <string, string>();

            foreach (var item in tech)
            {
                int count = R_UserInfo_TechService.LoadEntities(r => r.TechId == item.Id).Count();
                //去重
                if (dic.ContainsKey(item.TechName))
                {
                    string value = dic[item.TechName];
                    dic[item.TechName] = (Convert.ToInt32(value) + count).ToString();
                }
                else
                {
                    dic.Add(item.TechName, count.ToString());
                }
            }
            List <string> keys = new List <string>();

            foreach (var key in dic.Keys)
            {
                keys.Add(key);
            }
            List <string> values = new List <string>();

            foreach (var value in dic.Values)
            {
                values.Add(value);
            }
            zz.yData      = keys;
            zz.seriesData = values;

            return(Json(zz, JsonRequestBehavior.AllowGet));
        }
        public ActionResult Delete(int id)
        {
            //如果下面存在Tech则不能删除。
            int techCount = TechService.LoadEntities(t => t.TechTypeId == id).Count();

            if (techCount > 0)
            {
                return(Content("必须先删除下面的所有Tech后方可删除!"));
            }
            else
            {
                var entity = TechTypeService.LoadEntities(t => t.Id == id).FirstOrDefault();
                if (entity != null)
                {
                    TechTypeService.Delete(entity);
                }
                return(Content("ok"));
            }
        }