Ejemplo n.º 1
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));
        }
Ejemplo n.º 2
0
        public ActionResult GetRoleDataZZ()
        {
            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 role = RoleService.LoadEntities(r => r.Id != 0);
            Dictionary <String, string> dic = new Dictionary <string, string>();

            foreach (var item in role)
            {
                int count = UserInfoService.LoadEntities(u => u.RoleId == item.Id).Count();
                dic.Add(item.Name, 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));
        }
Ejemplo n.º 3
0
        public ActionResult GetYearDataZZ()
        {
            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 users = UserInfoService.LoadEntities(u => u.IsDeleted == false);
            Dictionary <String, string> dic = new Dictionary <string, string>();
            int year1  = 0;
            int year3  = 0;
            int year5  = 0;
            int year10 = 0;
            int year   = 0;

            foreach (var user in users)
            {
                int y = CountWorkYear(user.HiredTime);
                if (y == 0)
                {
                    year1++;
                }
                if (y >= 1 && y < 3)
                {
                    year3++;
                }
                if (y >= 3 && y < 5)
                {
                    year5++;
                }
                if (y >= 5 && y < 10)
                {
                    year10++;
                }
                if (y >= 10)
                {
                    year++;
                }
            }

            dic.Add("一年以下", year1.ToString());
            dic.Add("1-3", year3.ToString());
            dic.Add("3-5", year5.ToString());
            dic.Add("5-10", year10.ToString());
            dic.Add("10年以上", year.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));
        }