Example #1
0
        /// <summary>
        /// 搜索新生注册信息
        /// </summary>
        /// <param name="webModel">列表页视图Model</param>
        /// <param name="context">数据库连接上下文对象</param>
        /// <returns></returns>
        public async Task <RegisterViewModel> SearchRegisterAsync(RegisterViewModel webModel, ApplicationDbContext context)
        {
            try
            {
                //Source Data List
                var list = await NewbornRepository.GetListAsync(webModel, context);

                //Return Data List
                var dataList = new List <RegisterData>();

                if (list != null && list.Any())
                {
                    dataList.AddRange(list.Select(item => new RegisterData
                    {
                        Id         = item.StudentId.ToString(),
                        Name       = item.Name,
                        Address    = item.Place,
                        Department = item.Department,
                        MajorClass = item.MajorClass,
                        Way        = item.Way,
                        DateTime   = item.ArriveTime,
                        Remark     = item.Remark
                    }));
                }

                webModel.RegisterList = dataList;
                webModel.Total        = await NewbornRepository.GetListCountAsync(webModel, context);
            }
            catch (Exception ex)
            {
                _logger.LogError("获取新生注册列表失败:{0},\r\n内部错误信息:{1}", ex.Message, ex.InnerException.Message);
            }
            return(webModel);
        }
Example #2
0
        /// <summary>
        /// 搜索宿舍预定信息
        /// </summary>
        /// <param name="webModel">列表页视图Model</param>
        /// <param name="context">数据库连接上下文对象</param>
        /// <returns></returns>
        public async Task <DormitoryViewModel> SearchDormitoryAsync(DormitoryViewModel webModel, ApplicationDbContext context)
        {
            try
            {
                //Source Data List
                var list = await NewbornRepository.GetListAsync(webModel, context);

                //Return Data List
                var dataList = new List <DormitoryData>();

                if (list != null && list.Any())
                {
                    dataList.AddRange(list.Select(item => new DormitoryData
                    {
                        Building   = item.BuildingName,
                        DateTime   = item.DateTime.ToString("yyyy-MM-dd HH:mm:ss"),
                        Dorm       = item.DormName,
                        Floor      = item.Floor,
                        MajorClass = item.MajorClassName,
                        Name       = item.StudentName,
                        StudentId  = item.StudentId.ToString()
                    }));
                }

                webModel.DormitoryList = dataList;
                webModel.Total         = await NewbornRepository.GetListCountAsync(webModel, context);
            }
            catch (Exception ex)
            {
                _logger.LogError("获取新生列表失败:{0},\r\n内部错误信息:{1}", ex.Message, ex.InnerException.Message);
            }
            return(webModel);
        }
Example #3
0
        /// <summary>
        /// 搜索新生信息
        /// </summary>
        /// <param name="webModel">列表页视图Model</param>
        /// <param name="context">数据库连接上下文对象</param>
        /// <returns></returns>
        public async Task <InformationViewModel> SearchStudentAsync(InformationViewModel webModel, ApplicationDbContext context)
        {
            try
            {
                //Source Data List
                var list = await NewbornRepository.GetListAsync(webModel, context);

                //Return Data List
                var dataList = new List <StudentData>();

                if (list != null && list.Any())
                {
                    dataList.AddRange(list.Select(item => new StudentData
                    {
                        Id         = item.Id.ToString(),
                        Name       = item.Name,
                        Address    = item.Province + " " + item.City,
                        Department = item.Department,
                        MajorClass = item.MajorClass,
                        Age        = item.Age,
                        Gender     = item.Gender
                    }));
                }

                webModel.StudentList = dataList;
                webModel.Total       = await NewbornRepository.GetListCountAsync(webModel, context);
            }
            catch (Exception ex)
            {
                _logger.LogError("获取新生列表失败:{0},\r\n内部错误信息:{1}", ex.Message, ex.InnerException.Message);
            }
            return(webModel);
        }