public PartialViewResult GetDepartment(string unitId, string depId)
        {
            string dep = "";

            if (depId != "" && depId != string.Empty)
            {
                dep = depId;
            }
            ViewBag.DepartmentId = "";
            qtDepartmentService _department = new qtDepartmentService();

            if (unitId != "" && unitId != string.Empty)
            {
                IEnumerable <qtDepartment> listDep = _department.FindList()
                                                     .Where(m => m.Status == true && m.UnitId.Value == TypeHelper.ToInt32(unitId))
                                                     .OrderBy(m => m.SortOrder);
                ViewBag.DepartmentId = new SelectList(listDep, "DepartmentId", "DepartmentName", dep);
            }
            else
            {
                List <SelectListItem> listItems = new List <SelectListItem>();
                ViewBag.DepartmentId = new SelectList(listItems, "Value", "Text", "");
            }
            return(PartialView());
        }
        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);
        }
Beispiel #3
0
        public PartialViewResult Departments(int?DepartmentId)
        {
            qtDepartmentService _department = new qtDepartmentService();

            IEnumerable <qtDepartment> danhSachPhongBan = _department.FindList();

            SelectList select = new SelectList(danhSachPhongBan, "UnitId", "UnitName", DepartmentId);

            return(PartialView("Departments", select));
        }
Beispiel #4
0
        private void DanhSachNguoiDung(int?donviId, int?UserConfigId)
        {
            string html = "";

            if (donviId.HasValue)
            {
                qtUserService              _user   = new qtUserService();
                qtDepartmentService        _dep    = new qtDepartmentService();
                IEnumerable <qtDepartment> listdep = _dep.FindList().Where(m => m.UnitId == donviId && m.Status == true);
                if (listdep.Count() > 0)
                {
                    html += "<table class='grid' style='width: 100%;'>" +
                            "<thead>" +
                            "<tr>" +
                            "<th width='15%' >#</th>" +
                            "<th width='35%'> Họ và tên </th>" +
                            "<th width='15%'> Thứ tự </th>" +
                            "<th width='40%'> Chức vụ </th>" +
                            "</thead>";
                    foreach (qtDepartment item in listdep)
                    {
                        html += "<tr>" +
                                "<td colspan='4'>" + item.DepartmentName + "</td>" +
                                "</tr>";
                        IEnumerable <qtUser> list = _user.FindList().Where(m => m.UnitId == donviId && m.DepartmentId == item.DepartmentId && m.Status == true);
                        if (list.Count() > 0)
                        {
                            foreach (C.Core.Model.qtUser user in list)
                            {
                                qtUserConfigDetail check = checkUser(UserConfigId, user.UserId, null);

                                string _checked = check != null ? "checked='checked'" : "";
                                string value    = check != null?check.OrderBy.ToString() : "";

                                html += "<tr>" +
                                        "<td><input type='checkbox' value=" + user.UserId + " name='cbxItem' id='cbxItem' " + _checked + " ></td>" +
                                        "<td>" + user.UserName + "</td>" +
                                        //"<td> </td>"+
                                        "<td>" + " <input type='text' class='width-10' id='OrderBy" + user.UserId + "' name='OrderBy" + user.UserId + "'  value='" + value + "' />" + "</td>" +
                                        "<td>" + user.qtPosition.PositionName + "</td>" +
                                        "</tr>";
                            }
                        }
                    }
                    html += "</table>";
                }
            }
            ViewBag.dsNguoiDung = html;
        }
Beispiel #5
0
        public PartialViewResult Departments(int?UnitId, int?DepartmentId)
        {
            qtDepartmentService _department = new qtDepartmentService();

            IEnumerable <qtDepartment> danhSachPhongBan = _department.FindList();

            if (UnitId.HasValue)
            {
                danhSachPhongBan = danhSachPhongBan.Where(x => x.UnitId == UnitId);
            }

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

            return(PartialView("Departments", ViewBag.DepartmentId));
        }
 public JsonResult GetDepartmentByUnitId(string UnitId)
 {
     if (UnitId != null && UnitId != "")
     {
         qtDepartmentService _department = new qtDepartmentService();
         List <qtDepartment> listDep     = _department.FindList()
                                           .Where(m => m.Status == true && m.UnitId.Value == TypeHelper.ToInt32(UnitId))
                                           .OrderBy(m => m.SortOrder).ToList();
         return(Json(listDep.Select(m => new {
             DepartmentId = m.DepartmentId,
             DepartmentName = m.DepartmentName
         }),
                     JsonRequestBehavior.AllowGet));
     }
     else
     {
         return(Json(null, JsonRequestBehavior.AllowGet));
     }
 }
        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;
        }