// // GET: /org_Department/ public ActionResult Index() { DepartmentListModel pageModel = new DepartmentListModel(); pageModel.DepartmentList = db.org_Departments.ToList(); return(View(pageModel)); }
public async Task <string> departmentQuaryByUserId(string userId) { if (string.IsNullOrEmpty(userId)) { userId = "083452125733424957"; } var result = await dtManager.GetDepartmentByUserId(userId); DepartmentListModel departmentListModel = JsonConvert.DeserializeObject <DepartmentListModel>(result); List <List <string> > ListString = departmentListModel.department; List <string> ListDepartmentId = new List <string>(); foreach (List <string> item in ListString) { if (ListString.IndexOf(item) == 0) { foreach (var Id in item) { if (item.IndexOf(Id) == (item.Count - 2)) { ListDepartmentId.Add(Id); } } } } //return JsonConvert.SerializeObject(ListDepartmentId); var results = await dtManager.SingleDepartment(Int32.Parse(ListDepartmentId[0])); return(results); }
public ActionResult Department(DepartmentModel model) { ViewBag.Company = _accountService.GetAllCompany(); if (ModelState.IsValid) { string currentUser = HttpContext.User.Identity.Name; bool departmentstatus = _accountService.CreateDepartment(model.FormSubmit.SelectedCompanyID, model.FormSubmit.DepartmentName, model.FormSubmit.DepartmentDirNme, model.FormSubmit.DepartmentFloorno, model.FormSubmit.DepartmentRoomno); if (departmentstatus == true) { ViewBag.SuccessMsg = 1; } else { ViewBag.FailMsg = 0; } } DepartmentModel Dd = new DepartmentModel(); List <DepartmentList> departmentData = _accountService.GetAllDepartment(); DepartmentListModel model2 = new DepartmentListModel(); model2.DepartmentList = departmentData; Dd.DisplayDepartment = model2; return(View(Dd)); }
/// <summary> /// 部门 /// </summary> /// <param name="page"></param> /// <returns></returns> public virtual ActionResult Department(int?page) { var model = new DepartmentListModel { Departments = GetDepartments() }; return(View("~/Views/Staff/_Department.cshtml", model)); }
private DepartmentListModel PopulateSaleCategory() { var departments1 = _departmentService.GetAll(); DepartmentListModel model = new DepartmentListModel { Departments = departments1 }; return(model); }
/// <summary> /// 得到类目 /// </summary> /// <returns></returns> protected virtual IList <DepartmentEntity> GetDepartments(DepartmentListModel model) { var query = new QueryInfo { IsReturnCount = false }; query.SetPageSize(model.PageSize).SetPageIndex(model.PageIndex) .Query <DepartmentEntity>().Where(it => it.Crm.Id == CrmId).OrderBy(it => it.Sequence) .Select(it => new object[] { it.Id, it.Name, it.Sequence }); return(this.GetEntities <DepartmentEntity>(query)); }
public IActionResult Index() { var model = new DepartmentListModel(); var g = _departmentGroupAppService.GetAll().Select(x => new SelectListItem { Value = x.Id, Text = x.Description }); model.DepartmentGroups = g.ToList(); model.Departments = _departmentAppService.GetAll().ToList(); return(View(model)); }
public ActionResult Department() { //GetAllCategory(); DepartmentModel Dd = new DepartmentModel(); List <DepartmentList> departmentData = _accountService.GetAllDepartment(); DepartmentListModel model2 = new DepartmentListModel(); model2.DepartmentList = departmentData; Dd.DisplayDepartment = model2; ViewBag.Company = _accountService.GetAllCompany(); return(View(Dd)); }
public virtual DepartmentListModel PrepareListModel(DepartmentSearchModel searchModel) { if (searchModel == null) { throw new ArgumentNullException(nameof(searchModel)); } var entities = _departmentService.GetAll(name: searchModel.SearchName, pageIndex: searchModel.Page - 1, pageSize: searchModel.PageSize, showHidden: true); //Get follow Path foreach (var template in entities) { var templateName = ""; if (template.Path != string.Empty) { var listPath = template.Path.Split(",").ToList(); List <int> listPathInt = listPath.Select(s => int.Parse(s)).ToList(); foreach (var listPathItem in listPathInt) { foreach (var templateItem in entities) { if (listPathItem == templateItem.Id) { templateName += templateItem.Name + " >> "; } } } } if (templateName != string.Empty) { templateName = templateName + template.Name; } else { templateName = template.Name; } template.PathName = templateName; } //prepare list model var model = new DepartmentListModel { //fill in model values from the entity Data = entities.Select(x => x.ToModel <DepartmentModel>()), Total = entities.Count }; return(model); }
/// <summary> /// 首页 /// </summary> /// <returns></returns> public ActionResult List(int?page) { var model = new DepartmentListModel { PageIndex = page.HasValue ? page.Value : 0 }; model.Departments = GetDepartments(model); if (model.Departments == null || model.Departments.Count == 0) { return(Content("")); } return(View("~/Views/Department/_Department.cshtml", model)); }
// GET api/Department public List <DepartmentListModel> Get() { List <DepartmentListModel> departmentModels = new List <DepartmentListModel>(); List <Department> departments = RepositoryFactory.DepartmentRepository.GetAllDepartment(); foreach (Department department in departments) { List <int> positionList = department.Positions.Select(p => p.PositionId).ToList(); int number = RepositoryFactory.UserRepository.CountUserInPositions(positionList); DepartmentListModel departmentModel = new DepartmentListModel(department, number); departmentModels.Add(departmentModel); } return(departmentModels); }
// GET api/Department/1 public DepartmentListModel Get(int id) { Department department = RepositoryFactory.DepartmentRepository.GetDepartmentByid(id); if (department != null) { List <int> positionList = department.Positions.Select(p => p.PositionId).ToList(); int number = RepositoryFactory.UserRepository.CountUserInPositions(positionList); DepartmentListModel departmentModel = new DepartmentListModel(department, number); return(departmentModel); } else { return(null); } }
/// <summary> /// 获取部门(指定部门以及子部门) /// </summary> /// <param name="departmenId">需要获取的部门</param> /// <returns></returns> public async Task <DepartmentListModel> GetDepartment(int?departmenId = null) { string url = $"https://api.exmail.qq.com/cgi-bin/department/list?access_token={this.Email_token}"; if (!departmenId.IsNotEmptyOrNull()) { url += $"&id={departmenId}"; } DepartmentListModel model = await HttpHelper.GetHttpAsync <DepartmentListModel>(url); if (model.Errcode != 0) { this.Errmsg = model.Errmsg; throw new Exception($"获取获取部门失败:{model.Errcode}-{this.Errmsg}"); } return(await Task.FromResult(model)); }
public async Task <Dictionary <int, string> > GetDeptAndChildUserListByDeptId([FromBody] List <int> deptIdList) { //获取部门列表 string departmentList = await DepartmentList(); DepartmentListModel departmentListModel = JsonConvert.DeserializeObject <DepartmentListModel>(departmentList); Dictionary <int, string> keyValuePairs = new Dictionary <int, string>(); List <int> deptIdListPro = new List <int>(); if (deptIdList != null) { if (departmentListModel.department.Count > 0) { QueryDeptChildId(deptIdList, departmentListModel.department); } } return(await GetDeptUserListByDeptId(deptIdListQuery)); }
public IActionResult ListData(DepartmentSearchModel searchModel) { if (!_permissionService.Authorize(EmployeePermissionProvider.ManageDepartments)) { return(AccessDeniedView()); } var departments = _employeeService.GetOrderedDepartments(showUnpublished: true, searchModel.Page - 1, searchModel.PageSize); var model = new DepartmentListModel().PrepareToGrid(searchModel, departments, () => { return(departments.Select(department => { var d = department.ToModel(); return d; })); }); return(Json(model)); }
public ActionResult BooksByDepartment() { if (!WebSecurity.IsAuthenticated) { RedirectToAction("Index", "Login"); } int userId = WebSecurity.GetUserId(User.Identity.Name); DepartmentListModel model = new DepartmentListModel(); var librarian = context.Librarians.FirstOrDefault(c => c.UserId == userId); if (librarian != null) { int librarianId = librarian.Id; int libId = librarian.Library; model = (DepartmentListModel)librarianContext.Departments(libId); } return(PartialView("~/Views/LibrarianPage/_BooksByDepartment.cshtml", model)); }
public ContentResult GetDepartmentList() { using (team4zooEntities DB = new team4zooEntities()) { List <DepartmentListModel> deptList = new List <DepartmentListModel>(); //Get Department List var results = DB.Departments.ToList(); //Convert all necessary data to List. foreach (Department department in results) { DepartmentListModel deptVM = new DepartmentListModel(); //Assign Values //Check if underscore if (department.department_name.Contains('_')) { string tmpname = department.department_name.Replace("_", " "); deptVM.department_name = tmpname; } else { deptVM.department_name = department.department_name; } deptVM.Department_ID = department.Department_ID; //Add to Chart Data deptList.Add(deptVM); } //Return serialised Json return(Content(JsonConvert.SerializeObject(deptList), "application/json")); } }
/// <summary> /// 首页 /// </summary> /// <returns></returns> public ActionResult Index() { var model = new DepartmentListModel(); return(View("~/Views/Department/index.cshtml", model)); }