Beispiel #1
0
        public string GetCount(string deptid, DateTime atenddate)
        {
            DateTime        days    = atenddate.Date; //当天
            DateTime        enddate = atenddate.AddDays(1);
            List <newCount> clist   = new List <newCount>();
            string          sql     = ";";

            for (int i = 1; i < 49; i++)
            {
                sql = " select username from wg_attend where attenddate ;";
            }

            DataTable dt = this.BaseRepository().FindTable(sql);
            string    r  = string.Empty;
            var       m  = DateTime.Now.Month;

            var c = new newCount();

            foreach (DataRow row in dt.Rows)
            {
                c   = new newCount();
                sql = "select count(*) from wg_lllegalregister where ApproveResult ='0' and month(LllegalTime)='" + m + "' and LllegalTeamId ='" + row[0].ToString() + "'";
                dt  = this.BaseRepository().FindTable(sql);
                c.Name.Add(row[1].ToString());
                c.Count = Convert.ToInt32(dt.Rows[0][0].ToString());
                clist.Add(c);
                r += "{" + string.Format("category:'{0}',value:'{1}'", row[1].ToString(), dt.Rows[0][0].ToString()) + "},";
            }
            r = string.Format("[{0}]", r.TrimEnd(new char[] { ',' }));
            return(r);
        }
Beispiel #2
0
        public string GetCount(string deptid)
        {
            string          sql   = " select departmentid,fullname,encode from base_department where find_in_set(departmentid, fn_recursive('" + deptid + "')) > 0 and nature = '班组' group by encode desc;";
            DataTable       dt    = this.BaseRepository().FindTable(sql);
            string          r     = string.Empty;
            var             m     = DateTime.Now.Month;
            List <newCount> clist = new List <newCount>();
            var             c     = new newCount();

            foreach (DataRow row in dt.Rows)
            {
                c       = new newCount();
                sql     = "select count(*) from wg_lllegalregister where ApproveResult ='0' and month(LllegalTime)='" + m + "' and LllegalTeamId like '%" + row[0].ToString() + "%'";
                dt      = this.BaseRepository().FindTable(sql);
                c.Name  = row[1].ToString();
                c.Count = Convert.ToInt32(dt.Rows[0][0].ToString());
                c.Code  = row[2].ToString();
                clist.Add(c);
            }
            //排序字段
            string[] property = new string[] { "Code", "Count" };
            //对应排序字段的排序方式
            bool[] sort = new bool[] { false, false };

            //对 List 排序
            clist = new IListSort <newCount>(clist, property, sort).Sort().ToList();

            foreach (newCount o in clist)
            {
                r += "{" + string.Format("category:'{0}',value:'{1}'", o.Name, o.Count) + "},";
            }
            r = string.Format("[{0}]", r.TrimEnd(new char[] { ',' }));
            return(r);
        }