コード例 #1
0
        private string TreeUnit(int?unitId)
        {
            string html = string.Empty;

            qtUnitService        _unit    = new qtUnitService();
            qtUnitManagerService _manager = new qtUnitManagerService();

            IEnumerable <qtUnit> list = _unit.FindList().Where(m => m.Status == true).OrderBy(m => m.SortOrder);

            if (list != null && list.Count() > 0)
            {
                html += "<div class='treeview'>";
                foreach (qtUnit unit in list)
                {
                    string css = "";
                    //int soluong = _manager.SoluongNguoiDung(unit.UnitId);
                    int soluong = _manager.SoluongNguoiDung(unit.UnitId);
                    if (unitId.HasValue)
                    {
                        if (unitId == unit.UnitId)
                        {
                            css = " expanded";
                        }
                    }
                    html += "<ul class='ul-tree '><li class='" + css + "'><img class='toggler " + css + "'  /><a  href='/QuanTri/UnitManager/Index?UnitId=" + unit.UnitId + "'>" + unit.UnitName + "(" + soluong + ")</a>";

                    html += "</li></ul>";
                }
                html += "</div>";
            }
            return(html);
        }
コード例 #2
0
        private string TreeUnit(int?DepId)
        {
            string html = string.Empty;

            qtUnitService        _unit = new qtUnitService();
            IEnumerable <qtUnit> list  = _unit.FindList().Where(m => m.Status == true).OrderBy(m => m.SortOrder);

            if (list != null && list.Count() > 0)
            {
                html += "<div id='tree'>";
                foreach (qtUnit unit in list)
                {
                    qtDepartmentService        _dep = new qtDepartmentService();
                    IEnumerable <qtDepartment> dep  = _dep.FindList()
                                                      .Where(m => m.UnitId == unit.UnitId && m.Status == true).OrderBy(m => m.SortOrder);
                    html += "<ul><li>" + unit.UnitName + "</a>";

                    if (dep != null && dep.Count() > 0)
                    {
                        html += "<ul>";
                        foreach (qtDepartment item in dep)
                        {
                            html += "<li><a  href='/QuanTri/Substitute/Index?DepartmentId=" + item.DepartmentId + "'>" + item.DepartmentName +
                                    //"(" + item.Substitutes.Count() + ")" +
                                    "</a></li>";
                        }
                        html += "</ul>";
                    }
                    html += "</li></ul>";
                }
                html += "</div>";
            }
            return(html);
        }
コード例 #3
0
        public void GetUnit(int?userId)
        {
            qtUnitService _service = new qtUnitService();

            IEnumerable <qtUnit> list = _service.FindList().AsQueryable().Where(r => r.Status == true && r.ParentId != 0);
            string html = string.Empty;

            html += "<table class='grid' style='width: 100%;'>" +
                    "<thead>" +
                    "<tr>" +
                    "<th><input type='checkbox' name='cbxList' id='cbxList'></th>" +
                    "<th> Tên đơn vị </th>" +

                    "</thead>";
            foreach (qtUnit unit in list)
            {
                string check = checkUnit(userId, unit.UnitId);
                html += "<tr>" +
                        "<td style='text-align: center;'><input type='checkbox' value=" + unit.UnitId + " name='cbxUnit' id='cbxUnit' " + check + " ></td>" +
                        "<td>" + unit.UnitName + "</td>" +
                        "</tr>";
            }
            html            += "</table>";
            ViewBag.UnitList = html;
        }
コード例 #4
0
        private string TreeUnit(int?unitId)
        {
            string html = string.Empty;

            qtUnitService        _unit = new qtUnitService();
            IEnumerable <qtUnit> list  = _unit.FindList().Where(m => m.Status == true).OrderBy(m => m.SortOrder);

            if (list != null && list.Count() > 0)
            {
                html += "<div id='tree' class=''>";
                foreach (qtUnit unit in list)
                {
                    qtUserConfigService        _userconfig = new qtUserConfigService();
                    IEnumerable <qtUserConfig> userconfig  = _userconfig.FindList().Where(m => m.UnitId == unit.UnitId && m.IsActive == true);
                    html += "<ul><li><a  href='/QuanTri/UserConfig/Index?UnitId=" + unit.UnitId + "'>" + unit.UnitName + "(" + userconfig.Count() + ")</a>";
                    if (userconfig != null && userconfig.Count() > 0)
                    {
                        html += "<ul>";
                        foreach (qtUserConfig config in userconfig)
                        {
                            html += "<li>" + config.AppName + "</li>";
                        }
                        html += "</ul>";
                    }
                    html += "</li></ul>";
                }
                html += "</div>";
            }
            return(html);
        }
コード例 #5
0
        private void DropDownList(int?unitId)
        {
            qtUnitService        _unit    = new qtUnitService();
            IEnumerable <qtUnit> listUnit = _unit.FindList().Where(m => m.Status == true).OrderBy(m => m.SortOrder);

            ViewBag.UnitId = new SelectList(listUnit, "UnitId", "UnitName", unitId);
        }
コード例 #6
0
ファイル: RoleController.cs プロジェクト: Nghinv00/ShopOnLine
        private void DropDownListView(int?depId, int?posId, int?unitId)
        {
            string dep  = "";
            string pos  = "";
            string unit = "";

            if (depId.HasValue)
            {
                dep = depId.ToString();
            }
            if (posId.HasValue)
            {
                pos = posId.ToString();
            }
            if (unitId.HasValue)
            {
                unit = unitId.ToString();
            }


            qtPositionService        _position = new qtPositionService();
            IEnumerable <qtPosition> listPos   = _position.FindList().Where(m => m.Status == true);

            ViewBag.PositionID = new SelectList(listPos, "PositionID", "PositionName", pos);

            qtUnitService        _unit    = new qtUnitService();
            IEnumerable <qtUnit> listUnit = _unit.FindList().Where(m => m.Status == true).OrderBy(m => m.SortOrder);

            ViewBag.UnitId = new SelectList(listUnit, "UnitId", "UnitName", unit);
        }
コード例 #7
0
        public PartialViewResult Units(int?UnitId)
        {
            qtUnitService _unit = new qtUnitService();

            IEnumerable <qtUnit> danhSachDonVi = _unit.FindList();

            SelectList select = new SelectList(danhSachDonVi, "UnitId", "UnitName", UnitId);

            return(PartialView("Units", select));
        }
コード例 #8
0
        public void DropNhapDuLieu(int?_LoaiPhieu, int?MaKho, int?TrangThai, int PhieuXuatNhap)
        {
            LoaiPhieuNhapService        _loai     = new LoaiPhieuNhapService();
            IEnumerable <LoaiPhieuNhap> LoaiPhieu = _loai.DanhSachPhieuNhap(PhieuXuatNhap);

            ViewBag.LoaiPhieu = new SelectList(LoaiPhieu, "LoaiPhieuNhapId", "TenLoaiPhieuNhap", _LoaiPhieu);

            qtUnitService        _unit  = new qtUnitService();
            IEnumerable <qtUnit> dsUnit = _unit.FindList().Where(x => x.ParentId != null && x.ParentId != 0);

            ViewBag.Kho = new SelectList(dsUnit, "UnitId", "UnitName", MaKho);

            ViewBag.SizeGuid = new SelectList(new List <shSetSize>(), "Value", "Text");

            ViewBag.TrangThai = new SelectList(GoodReceiptIsuueHelper.DanhSachTrangThaiNhapXuatKho(null), "Value", "Text", TrangThai);
        }
コード例 #9
0
        private void DropDownListView(int?unitId, int?departmentId)
        {
            qtUnitService        _unit    = new qtUnitService();
            IEnumerable <qtUnit> listUnit = _unit.FindList().Where(m => m.Status == true).OrderBy(m => m.SortOrder);

            ViewBag.UnitId = new SelectList(listUnit, "UnitId", "UnitName", unitId);

            qtDepartmentService        _dep    = new qtDepartmentService();
            IEnumerable <qtDepartment> listDep = _dep.FindList().Where(m => m.Status == true && m.UnitId == unitId)
                                                 .OrderBy(m => m.SortOrder);

            ViewBag.DepartmentId = new SelectList(listDep, "DepartmentId", "DepartmentName", departmentId);

            //List<Unit> list = _unit.FindList().Where(m => m.IsActive == true).OrderBy(m => m.SortOrder).ToList();
            //AutoComplete program = new AutoComplete();
            //SelectList select = new SelectList(list, "UnitId", "UnitName", unitId);
            //program.languanges = select;
            //ViewBag.UnitId = program.languanges;
        }
コード例 #10
0
        public List <TreeView> GetUnitTreeView(bool isShowDepartment)
        {
            qtUnitService _unit = new qtUnitService();

            IEnumerable <qtUnit> dsUnit = _unit.FindList()
                                          .Where(x => x.ParentId == null || x.ParentId == 0);

            List <TreeView> dsTreeView = new List <TreeView>();
            TreeView        zTree      = null;
            TreeView        childZtree = null;

            foreach (var item in dsUnit)
            {
                zTree          = new TreeView();
                zTree.name     = item.UnitName;
                zTree.isParent = true;
                zTree.id       = item.UnitId.ToString();
                zTree.pId      = (item.ParentId == null || item.ParentId == 0) ? "" : item.ParentId.ToString();

                IEnumerable <qtUnit> dsChildUnit = _unit.GetUnitsByParentId(item.UnitId);

                List <TreeView> dsChildTreeview = null;

                if (dsChildUnit.Count() > 0)
                {
                    dsChildTreeview = new List <TreeView>();

                    foreach (var childUnit in dsChildUnit)
                    {
                        childZtree      = new TreeView();
                        childZtree.id   = childUnit.UnitId.ToString();
                        childZtree.pId  = (childUnit.ParentId == null || childUnit.ParentId == 0) ? "" : childUnit.ParentId.ToString();
                        childZtree.name = childUnit.UnitName;

                        if (isShowDepartment)
                        {
                            childZtree.isParent = isShowDepartment;                             // TRUE Áp dụng cho hiển thị đơn vị có phòng ban  đi kèm
                            childZtree.children = DepartmentByUnit(childUnit.UnitId);
                            if (childZtree.children != null && childZtree.children.Count() > 0) // Kiểm tra nếu đơn vi CÓ phòng ban đi kèm thì hiển thị phòng ban
                            {
                                childZtree.open = true;
                            }
                            else // Kiểm tra nếu đơn vi KHÔNG phòng ban đi kèm thì KHÔNG hiển thị
                            {
                                childZtree.open = false;
                            }
                        }
                        else
                        {
                            childZtree.isParent = isShowDepartment;  // FALSE Áp dụng cho hiển thị đơn vị không phòng ban kèm theo
                            childZtree.children = null;
                            childZtree.open     = false;
                        }

                        childZtree.click = "unitchange(" + childUnit.UnitId + ")";


                        dsChildTreeview.Add(childZtree);
                    }

                    zTree.children = dsChildTreeview;
                    zTree.open     = true;
                    zTree.click    = "unitchange(" + item.UnitId + ")";
                }
                else
                {
                    zTree.click = "unitchange(" + item.UnitId + ")";
                    zTree.open  = false;
                }
                dsTreeView.Add(zTree);
            }
            return(dsTreeView);
        }