示例#1
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);
        }
示例#2
0
    public IList <DiscountItemsInfo> productDataSort(List <DiscountItemsInfo> itemsInfo)
    {
        IList <DiscountItemsInfo> list = new List <DiscountItemsInfo>();

        if (itemsInfo != null)
        {
            for (int i = 0; i < itemsInfo.get_Count(); i++)
            {
                list.Add(itemsInfo.get_Item(i));
            }
            List <string> list2 = new List <string>();
            list2.Add("id");
            list2.Add("num");
            bool[] expr_52 = new bool[2];
            expr_52[0] = true;
            bool[] sortBy = expr_52;
            list = new IListSort <DiscountItemsInfo>(list, list2, sortBy).Sort(null);
        }
        return(list);
    }