public List <TreeView> DepartmentByUnit(int?UnitId) { if (UnitId.HasValue) { TreeView zTree = null; List <TreeView> dsTreeview = new List <TreeView>(); qtDepartmentService _department = new qtDepartmentService(); IEnumerable <qtDepartment> dsDepartment = _department.DanhSachDepartment_TheoDonVi(UnitId); foreach (var item in dsDepartment) { zTree = new TreeView(); zTree.name = item.DepartmentName; zTree.id = item.DepartmentId.ToString(); //zTree.pId = UnitId.ToString(); zTree.isParent = false; zTree.children = null; zTree.click = null; zTree.open = true; dsTreeview.Add(zTree); } return(dsTreeview); } return(null); }
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); }
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()); }
public void ThongTin(qtUser user) { qtDepartmentService _department = new qtDepartmentService(); qtUnitService _unit = new qtUnitService(); qtPositionService _position = new qtPositionService(); ViewBag.TenPhong = _department.FindByKey(user.DepartmentId).DepartmentName; ViewBag.TenDonVi = _unit.FindByKey(user.UnitId).UnitName; ViewBag.ChucVu = _position.FindByKey(user.PositionId).PositionName; }
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)); }
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; }
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 PartialViewResult ListDepartments(int?page, int?UnitId) { int pageCurrent = 1; if (page.HasValue) { pageCurrent = page.Value; } qtDepartmentService _department = new qtDepartmentService(); IPagedList <qtDepartment> dsDepartment = _department.DanhSachDepartment_PhanTrang(UnitId, pageCurrent, Config.PAGE_SIZE_10); ViewBag.ListDepartments = dsDepartment; return(PartialView("ListDepartments", dsDepartment)); }
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; }
public ActionResult Create(int?DepartmentId, string DepartmentName, string Address, string Phone, string Fax, string Email, int?UnitId, int?SortOrder, bool?Status) { if (!DepartmentId.HasValue) { DepartmentId = 0; } qtDepartmentService _department = new qtDepartmentService(); qtDepartment department = _department.ThemMoi_HieuChinhDepartment( DepartmentId.Value, DepartmentName, Address, Phone, Fax, Email, UnitId, SortOrder, Status, DateTime.Now); return(RedirectToAction("Index")); }
public ActionResult Create(int?id, int?UnitId) { qtDepartmentService _department = new qtDepartmentService(); qtDepartment department = new qtDepartment(); if (id.HasValue) { department = _department.FindByKey(id); if (department != null) { ViewBag.UnitId = department.UnitId; return(View(department)); } else { ModelState.AddModelError("", "Dữ liệu không tồn tại trong hệ thống. Vui lòng kiểm tra lại"); return(View(new qtDepartment())); } } ViewBag.UnitId = UnitId; return(View(department)); }
public static MvcHtmlString DepartmentName(this HtmlHelper helper, int?DepartmentId) { qtDepartmentService _departmentService = new qtDepartmentService(); return(new MvcHtmlString(_departmentService.DepartmentName(DepartmentId))); }