Ejemplo n.º 1
0
        public IActionResult JsonIndex(AdministratorJsonIndexModel model)
        {
            if (model.StationNo == "0")
            {
                model.StationNo = null;
            }


            var dal   = new AdministratorDal();
            var list  = dal.Query();
            var list2 = (from o in list
                         select new //AdministratorDefinition()
            {
                AdministratorId = o.AdministratorId,
                SysAdmin = o.SysAdmin ? "系统管理员" : "管理员",
                Name = o.Name,
                Accounts = o.Accounts,
                PassWord = o.PassWord,
                ReWritePassWord = o.ReWritePassWord,
                Phone = o.Phone,
                RoleId = o.RoleId,
            }).ToList();

            var grid = new
            {
                total = 0,
                rows  = list2,
            };

            return(Json(grid));
        }
Ejemplo n.º 2
0
        public IActionResult JsonIndex()
        {
            var administratorDal  = new AdministratorDal();
            var administratorList = administratorDal.Query();
            var func = new Func <string, string>((administratorId) => {
                if (string.IsNullOrEmpty(administratorId))
                {
                    return(string.Empty);
                }
                var p = administratorList.SingleOrDefault(o => o.AdministratorId == administratorId);
                if (p == null)
                {
                    return(string.Empty);
                }
                return(p.Name);
            });
            var dal = new EmployeeGroupDal();

            var list    = dal.Query();
            var dtoList = mapper.Map <List <EmployeeGroupJsonIndexModel> >(list);

            dtoList.ForEach(o =>
            {
                o.MonitorName         = func(o.MonitorId);
                o.OtherEmployeesName1 = func(o.OtherEmployeesId1);
                o.OtherEmployeesName2 = func(o.OtherEmployeesId2);
            });
            return(Json(dtoList));
        }
Ejemplo n.º 3
0
        public IActionResult Update(string employeeGroupId)
        {
            var dal              = new EmployeeGroupDal();
            var p                = dal.Find(employeeGroupId);
            var model            = mapper.Map <EmployeeGroupUpdateModel>(p);
            var administratorDal = new AdministratorDal();

            model.Administrators = administratorDal.Query();
            return(View(model));
        }
Ejemplo n.º 4
0
        public IActionResult Add()
        {
            var dal   = new AdministratorDal();
            var model = new EmployeeGroupAddModel()
            {
                Administrators = dal.Query(),
            };

            return(View(model));
        }
Ejemplo n.º 5
0
        public IActionResult Index2()
        {
            var dal   = new AdministratorDal();
            var model = new HomeIndexModel()
            {
                Count = dal.Query().Count,
            };

            return(View(model));
        }