private string BindChildDepartment(string parentID) { List <DonViInfo> childList = new DM_DONVIController().GetEntityByParentID(parentID); if (childList.Count() == 0) { return(""); } string str = ""; string function = ""; foreach (var item in childList) { str += string.Format("<li id='{0}' item-expanded='true'>{1}{2}{3}</li>", item.MaDonVi, item.TenDonVi, BindChildDepartment(item.MaDonVi), function); } return(string.Format("<ul>{0}</ul>", str)); }
private void GenerateNhanSuTheoDonVi(int height, string dsDonVi) { try { hcFrutas.Title = new Title(GlobalResourceManager.GetInstance().GetDesktopValue("chart_by_unit")); hcFrutas.Height = height; //Danh sách giới tinh theo đơn vị List <NhanSu> nhansu = new ChartController().GetBaoCaoGioiTinhTheoDonVi(dsDonVi, userID, menuID); List <DM_DONVI> dvList = new DM_DONVIController().GetByDS(dsDonVi); int total = dvList.Count(); object[] dvdata = new object[total]; object[] MaleData = new object[total]; object[] FemaleData = new object[total]; for (int i = 0; i < dvList.Count(); i++) { dvdata[i] = dvList[i].TEN_DONVI; string[] dv = new DM_DONVIController().GetAllMaDonVi(dvList[i].MA_DONVI).Split(','); MaleData[i] = (from t in nhansu where dv.Contains(t.MaDonVi) && t.MaGioiTinh == "M" select t).ToList().Count(); //lấy số lượng nhân viên nam FemaleData[i] = (from p in nhansu where dv.Contains(p.MaDonVi) && p.MaGioiTinh == "F" select p).ToList().Count(); //lấy số lượng nhân viên nữ } //definições de eixos hcFrutas.YAxis.Add(new YAxisItem { title = new Title("Số lượng") }); hcFrutas.XAxis.Add(new XAxisItem { categories = dvdata }); //dados var series = new Collection <Serie>(); series.Add(new Serie { name = "Nam", data = MaleData }); series.Add(new Serie { name = "Nữ", data = FemaleData }); hcFrutas.PlotOptions = new PlotOptionsColumn() { borderColor = "#dedede", borderRadius = 4, dataLabels = new DataLabels() { enabled = true, }, }; hcFrutas.Legend = new Legend() { layout = Highcharts.Core.Layout.horizontal, align = Align.left, verticalAlign = Highcharts.Core.VerticalAlign.top, x = 70, y = -5, floating = true, shadow = true, backgroundColor = "#FFF", }; hcFrutas.Exporting.enabled = true; hcFrutas.DataSource = series; hcFrutas.DataBind(); } catch { throw; } }