Exemplo n.º 1
0
        //
        // GET: /Platform/iDepartment/

        public ActionResult Index(string keyword, string ordering, int pageIndex = 1, bool search = false)
        {
            var model =
                _iDepartmentService.GetAll()
                .Select(
                    a =>
                    new
            {
                a.Name,
                a.SystemId,
                a.Enable,
                a.CreatedDate,

                a.Remark,
                a.Id
            }).Search(keyword);

            if (search)
            {
                model = model.Search(Request.QueryString);
            }
            if (!string.IsNullOrEmpty(ordering))
            {
                model = model.OrderBy(ordering, null);
            }

            return(View(model.ToPagedList(pageIndex)));
        }
Exemplo n.º 2
0
        /// <summary>
        ///     编辑用户
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult Edit(string id)
        {
            var item = new SysUser();

            if (!string.IsNullOrEmpty(id))
            {
                item = _sysUserService.GetById(id);
            }
            ViewBag.SysEnterprisesId =
                new MultiSelectList(
                    _iSysEnterpriseService.GetAll(
                        a => a.SysEnterpriseSysUsers.Any(b => b.SysUserId == _iUserInfo.UserId)), "Id", "EnterpriseName",
                    item.SysEnterpriseSysUsers?.Select(a => a.SysEnterpriseId));
            ViewBag.SysRolesId = new MultiSelectList(_sysRoleService.GetAll(), "Id", "RoleName",
                                                     item.Roles?.Select(a => a.RoleId));

            ViewBag.DepartmentId =
                _iDepartmentService.GetAll()
                .ToSystemIdSelectList(
                    item.SysDepartmentSysUsers.FirstOrDefault(
                        c => c.SysDepartment.EnterpriseId == _iUserInfo.EnterpriseId)?.SysDepartmentId);

            var config = new MapperConfiguration(a => a.CreateMap <SysUser, SysUserEditModel>());

            var aa = config.CreateMapper().Map <SysUserEditModel>(item);


            return(View(aa));
        }
Exemplo n.º 3
0
        /// <summary>
        /// 查看用户详细信息
        /// </summary>
        /// <param name="id">
        /// </param>
        /// <returns>
        /// </returns>
        public async Task <IActionResult> DetailsAsync(string id)
        {
            var item = await _userManager.FindByIdAsync(id);

            var config = new MapperConfiguration(a => a.CreateMap <IdentityUser, SysUserDetailsModel>());

            var aa = config.CreateMapper().Map <SysUserDetailsModel>(item);

            ViewBag.DepartmentId = string.Join(",", _iDepartmentService.GetAll(a => a.SysDepartmentSysUsers.Any(b => b.SysUserId == item.Id)).Select(a => a.Name));

            ViewBag.SysRolesId = string.Join(",", await _userManager.GetRolesAsync(item));

            return(View(aa));
        }
        // 工作总结
        // GET: /Platform/PlanReport/

        public ActionResult Index()
        {
            SysUser sysUser = _ISysUserService.GetById(_IUserInfo.UserId);

            IEnumerable <string> systemIds = sysUser.SysDepartmentSysUsers.Select(a => a.SysDepartment.SystemId);

            IQueryable <SysDepartment> model = _iSysDepartmentService.GetAll();

            ParameterExpression c         = Expression.Parameter(typeof(SysDepartment), "c");
            Expression          condition = Expression.Constant(false);

            foreach (string s in systemIds)
            {
                string     systemId = s.Length > 3 ? s.Substring(0, s.Length - 3) : s;
                Expression con      = Expression.Call(
                    Expression.Property(c, typeof(SysDepartment).GetProperty("SystemId")),
                    typeof(string).GetMethod("StartsWith", new[] { typeof(string) }),
                    Expression.Constant(systemId));
                condition = Expression.Or(con, condition);
            }
            Expression <Func <SysDepartment, bool> > end = Expression.Lambda <Func <SysDepartment, bool> >(condition,
                                                                                                           new[] { c });

            model = model.Where(end);

            return(View(model));
        }
Exemplo n.º 5
0
        //
        // GET: /Platform/SysDepartment/

        public ActionResult Index(string keyword, string ordering, int pageIndex = 1)
        {
            var model =
                _sysDepartmentService.GetAll()
                .Select(
                    a =>
                    new
            {
                a.DepartmentName,
                a.DepartmentCode,
                a.SystemId,
                Population = a.SysDepartmentSysUsers.Count(),
                a.Ico,
                a.Enabled,
                a.CreatedDate,
                a.Remark,
                a.Id
            }).Search(keyword);


            if (!string.IsNullOrEmpty(ordering))
            {
                model = model.OrderBy(ordering, null);
            }

            if (!string.IsNullOrEmpty(Request["report"]))
            {
                //导出
                var reportModel = new Report(model.ToReportSource());
                return(new ReportResult(reportModel));
            }

            return(View(model.ToPagedList(pageIndex)));
        }
        /// <summary>
        /// </summary>
        /// <param name="keyword">
        /// </param>
        /// <param name="ordering">
        /// </param>
        /// <param name="pageIndex">
        /// </param>
        /// <param name="pageSize">
        /// </param>
        /// <param name="search">
        /// </param>
        /// <returns>
        /// </returns>
        public async Task <IActionResult> Index(string keyword, string ordering, int pageIndex = 1, int pageSize = 20, bool search = false, bool toExcelFile = false)
        {
            var model =
                _iSysDepartmentService.GetAll()
                .Select(
                    a =>
                    new
            {
                a.Name,
                a.SystemId,
                a.Enable,
                a.UserCreatedBy,
                a.CreatedDateTime,
                a.UserUpdatedBy,
                a.UpdatedDateTime,
                a.Remark,
                a.Id
            }).Search(keyword);

            if (search)
            {
                model = model.Search(Request.Query);
            }
            if (!string.IsNullOrEmpty(ordering))
            {
                model = model.OrderBy(ordering);
            }
            if (toExcelFile)
            {
                return(model.ToExcelFile());
            }

            return(View(model.PageResult(pageIndex, pageSize)));
        }
Exemplo n.º 7
0
 /// <summary>
 /// </summary>
 public AccountController()
 {
     _sysUserService       = AhnqIotContainer.Container.Resolve <ISysUserService>();
     _sysDepartmentService = AhnqIotContainer.Container.Resolve <ISysDepartmentService>();
     _sysRoleService       = AhnqIotContainer.Container.Resolve <ISysRoleService>();
     ViewBag.SysRole       = _sysRoleService.GetAll();
     ViewBag.SysDepart     = _sysDepartmentService.GetAll();
     //no code
 }
        //
        // GET: /Platform/SysDepartment/Edit/5

        public ActionResult Edit(Guid?id)
        {
            var item = new Customer();

            if (id.HasValue)
            {
                item = _iCustomerService.GetById(id.Value);
            }

            ViewBag.CustomerLevelId = _iCustomerLevelService.SelectList(item.CustomerLevelId);
            ViewBag.CustomerTypeId  = _iCustomerTypeService.SelectList(item.CustomerTypeId);


            ViewBag.BusinessStateId = _iBusinessStateService.SelectList(item.BusinessStateId);

            ViewBag.SysDepartment = _iSysDepartmentService.GetAll();

            ViewBag.BusinessChances = _iBusinessChanceService.GetAll(a => !a.Disable);

            return(View(item));
        }
        public ActionResult Index()
        {
            ViewBag.EntId          = _iUserInfo.EnterpriseId;
            ViewBag.UserId         = _iUserInfo.UserId;
            ViewBag.SysDepartments = _iSysDepartmentService.GetAll();

            var model = _iSysSignalRService.GetAll("chat");

            //筛选当前用户


            return(View(model.Take(100).OrderBy(a => a.CreatedDate)));
        }
        //
        // GET: /Platform/SysUser/Edit/5

        public ActionResult Edit(Guid?id)
        {
            var item = new SysUser();

            if (id.HasValue)
            {
                item = _sysUserService.GetById(id.Value);
            }

            ViewBag.SysDepartmentsId = new MultiSelectList(_sysDepartmentService.GetAll(), "Id", "DepartmentName", item.SysDepartmentSysUsers.Select(a => a.SysDepartmentId));

            ViewBag.SysRolesId = new MultiSelectList(_sysRoleService.GetAll(), "Id", "RoleName", item.SysRoleSysUsers.Select(a => a.SysRoleId));
            return(View(item));
        }
Exemplo n.º 11
0
        public ActionResult Edit(Guid?id)
        {
            var item = new ProjectInfo();

            if (id.HasValue)
            {
                item = _iProjectInfoService.GetById(id.Value);
            }
            ViewBag.UserId             = _iUserInfo.UserId;
            ViewBag.SysDepartment      = _iSysDepartmentService.GetAll();
            ViewBag.ProjectInfoStateId = _iProjectInfoStateService.SelectList(item.ProjectInfoStateId);
            ViewBag.CustomerId         = new SelectList(_iCustomerService.GetAll().Select(a => new { a.Id, a.CustomerName }), "Id",
                                                        "CustomerName", item.CustomerId);
            return(View(item));
        }
        public ActionResult Edit(Guid?id)
        {
            ViewBag.Id = id;

            var item = new ProjectTask();



            if (id.HasValue)
            {
                item = _iProjectTaskService.GetById(id.Value);
            }



            ViewBag.ProjectInfoId =
                new SelectList(
                    _iProjectInfoService.GetAll()
                    .Where(a => !a.Finish && a.ProjectUsers.Any(b => b.SysUserId == _iUserInfo.UserId && !b.Follow))
                    .Select(a => new { a.Id, a.ProjectName }), "Id", "ProjectName", item.ProjectInfoId);
            ViewBag.SysDepartment = _iSysDepartmentService.GetAll();

            return(View(item));
        }