健身管理系统源码设计和实现

简介

健身于二十世纪九十年代进入我国,随着经济的快速发展,人们的生活水平有了质的飞跃,老百姓的健身意识也有了较大程度的提高。在学习和工作之余,有更多的人愿意在闲暇的时间进行健身和体育锻炼,以达到缓解压力、放松心情、增强体质的目的。近年来,健身房已经进入我们寻常百姓的生活,它作为一个新兴的产业已经越来越得到大家的认可和欢迎[26]。然而,由于多方面的原因,健身房的管理长期以来处于人工管理为主的阶段,由于技术上的制约使健身房的管理及推广均得不到良好的发展,同时也制约了健身运动的推广。此外,对于人数众多的情况,健身房的管理更是困难重重,在增加管理成本的同时也使得健身房的管理效率较为低下,对整个健身房的运行也产生了极大的影响。当前,在北京、天津、石家庄等一、二线城市健身房的发展迅速,而湖南等三、四线城市现有的健身房大多采用老旧的模式,无法满足当前人民的需求。全国众多的中小城市健身房的发展建设蕴藏着巨大的潜力。随着互联网技术、嵌入式技术以及日益兴起的物联网技术的发展,网络化、数字化和智能化已经成为发展的趋势。因此,将健身房管理与计算机技术、网络技术相结合,设计出智能、高效的管理系统,才能更好的为广大用户服务。

1 开发环境介绍

1.1 IIS的安装

在开发前我们需要解析一下运行环境,Microsoft的windows系列都包含了可选安装的IIS组件,Windows2003和windows2000服务器版操作系统在安装时就已经默认安装了IIS,我们可以打开“我的电脑”/“控制面板”/“管理工具”即可以看到Internet信息服务的IIS管理器,如果系统没有安装那么我们就要自己安装了,首先我们先把系统盘放进光驱,然后进入“控制面板”,依次选“添加/删除程序→添加/删除Windows组件”,将“Internet信息服务(IIS)”前的小钩去掉(如有),重新勾选中后按提示操作即可完成IIS组件的添加。用这种方法添加的IIS组件中将包括Web、FTP、NNTP和SMTP等全部四项服务。当IIS添加成功之后,再进入“开始→程序→管理工具→Internet服务管理器”以打开IIS管理器。

1.2 asp.net开发技术

ASP.net是把基于通用语言的程序在服务器上运行,是将程序在服务器端首次运行时进行编译,这样的执行效果,当然比一条一条的解释强很多。它使运行一些很平常的任务如表单的提交客户端的身份验证、分布系统和网站配置变得非常简单。

ASP.net使用一种字符基础的,分级的配置系统,使服务器环境和应用程序的设置更加简单。因为配置信息都保存在简单文本中,新的设置有可能都不需要启动本地的管理员工具就可以实现。这种被称为“Zero Local Administration”的哲学观念使Asp.net的基于应用的开发更加具体和快捷。一个ASP.net的应用程序在一台服务器系统的安装只需要简单的拷贝一些必须的文件,不需要系统的重新启动。多处理器环境的可靠性 ASP.net已经被刻意设计成为一种可以用于多处理器的开发工具,它在多处理器的环境下用特殊的无缝连接技术,将很大的提高运行速度。ASP.net可以加入自己定义的组件。安全性基于Windows认证技术和每应用程序配置,可以确定原程序时绝对安全的。ASP.NET 的语法在很大程度上与 ASP 兼容,同时它还提供一种新的编程模型和结构,可生成伸缩性和稳定性更好的应用程序,并提供更好的安全保护。可以通过在现有ASP应用程序中逐渐添加 ASP.NET功能,随时增强 ASP 应用程序的功能。ASP.NET 是一个已编译的、基于.NET的环境,把基于通用语言的程序在服务器上运行。将程序在服务器端首次运行时进行编译,比ASP即时解释程序速度上要快很多.而且是可以用任何与 .NET兼容的语言(包括Visual Basic.NET、C#和JScript.NET.)创作应用程序。另外,任何ASP.NET 应用程序都可以使用整个.NET Framework,可以无缝地与WYSIWYG HTML编辑器和其他编程工具(包括Microsoft Visual Studio .NET)一起工作。
————————————————

3.代码分析

用户登录

  public async Task<AppUserDto> AppUserLoginAsync(AppUserLoginInput input)
        {

            var appUser = await SqlSugarClient.Queryable<AppUser>().Where(x => x.UserName == input.UserName).FirstAsync();
            if (appUser is null) throw new YoungException("登录验证失败");
            if (!input.PassWord.Equals(appUser.Password)) throw new YoungException("登录验证失败!");
            var userInfoDto = Mapper.Map<AppUser, AppUserDto>(appUser);
            return userInfoDto;
        }

获取健身科目列表

 public async Task<PagedReuslt<ExerciseDto>> GetListAsync(ExercisePageInput input)
        {
            List<ExerciseDto> rs = new List<ExerciseDto>();
            RefAsync<int> totalCount = 0;
            var list = await SqlSugarClient.Queryable<Exercise>()

                .WhereIF(input.ClassifyTypeId.HasValue, x => x.ClassifyTypeId == input.ClassifyTypeId)
                 .WhereIF(input.Name.IsNotNullOrNotWhiteSpace(), x => x.Name == input.Name)
                .ToPageListAsync(input.Page, input.Size, totalCount);
            rs = Mapper.Map<List<ExerciseDto>>(list.ToList());

            return new PagedReuslt<ExerciseDto>(Mapper.Map<List<ExerciseDto>>(list), totalCount.Value);
        }

获取健身训练课题列表展示

  public async Task<PagedReuslt<ExerciseDto>> GetExerciseDtoInfoListAsync(ExercisePageInput input)
        {

            List<ExerciseDto> rs = new List<ExerciseDto>();
            RefAsync<int> totalCount = 0;
            var list = await SqlSugarClient.Queryable<Exercise>()
                .WhereIF(input.ClassifyTypeIds.Any(), x => input.ClassifyTypeIds.Contains(x.ClassifyTypeId.Value))
                .WhereIF(input.ClassifyTypeId.HasValue, x => x.ClassifyTypeId == input.ClassifyTypeId)
                 .WhereIF(input.Name.IsNotNullOrNotWhiteSpace(), x => x.Name == input.Name)
                .ToPageListAsync(input.Page, input.Size, totalCount);
            rs = Mapper.Map<List<ExerciseDto>>(list.ToList());
            var exerciseIds = rs.Select(x => x.Id).ToArray();
            var classifyTypeIds = rs.Select(x => x.ClassifyTypeId).ToArray();

            var classiftTypeDtoList = await _classifyTypeManager.GetListAsync(new ClassifyTypePagedInput() { TypeDirect = TypeDirect.健身类, RelativeIds = classifyTypeIds });


            var exerciseDetailList = await SqlSugarClient.Queryable<ExerciseDetail>().WhereIF(exerciseIds.Any(), x => exerciseIds.Contains(x.ExerciseId)).ToListAsync();
            var exerciseDetailDtoList = Mapper.Map<List<ExerciseDetailDto>>(exerciseDetailList);
            var exerciseDetailIds = exerciseDetailDtoList.Select(x => x.Id).ToArray();

            var recordsIds = exerciseIds.Union(exerciseDetailIds);

            //获取所有浏览数据
            var lookRecords = await _recordManager.GetGroupListAsync(new RecordPagedInput() { RecordType = RecordType.运动浏览, RelativeIds = exerciseDetailIds.Where(x => x.HasValue).Select(x => x.Value).ToArray() });

            ///统计所有活动参加人的次数
            var recordG = await SqlSugarClient.Queryable<ExerciseRecord>()
              .Where(x => recordsIds.Contains(x.ExerciseId) || recordsIds.Contains(x.ExerciseDetailId))
              .GroupBy(x => new { x.ExerciseId, x.ExerciseDetailId })
              .Select(x => new
              {
                  x.ExerciseId,
                  x.ExerciseDetailId,
                  Qty = SqlFunc.AggregateCount(x.ExerciseId)
              }).ToListAsync();
            //统计已经完成此项数据的次数
            var recordCompleteG = await SqlSugarClient.Queryable<ExerciseRecord>()
            .Where(x => x.CompleteTime.HasValue && recordsIds.Contains(x.ExerciseDetailId))
            .GroupBy(x => new { x.ExerciseId, x.ExerciseDetailId })
            .Select(x => new
            {
                x.ExerciseId,
                x.ExerciseDetailId,
                Qty = SqlFunc.AggregateCount(x.ExerciseId)
            }).ToListAsync();

            foreach (var item in exerciseDetailDtoList)
            {
                item.JoinCount = recordG.Where(x => x.ExerciseDetailId == item.Id).Sum(x => x.Qty);
                item.LookCount = lookRecords.Where(x => x.RelativeId == item.Id).Sum(x => x.Qty);
                item.CompleteCount = recordCompleteG.Where(x => x.ExerciseDetailId == item.Id).Sum(x => x.Qty);
            }
            foreach (var item in rs)
            {

                item.ClassifyTypeDto = classiftTypeDtoList.Items.FirstOrDefault(x => x.Id == item.ClassifyTypeId);
                item.ExerciseDetailDtoList = exerciseDetailDtoList.Where(x => x.ExerciseId == item.Id).ToList();
                item.TotalSecond = item.ExerciseDetailDtoList.Sum(x => x.TotalSecond);
                item.TotalEnergy = item.ExerciseDetailDtoList.Sum(x => x.TotalEnergy);
                item.JoinCount = item.ExerciseDetailDtoList.Sum(x => x.JoinCount);
                item.LookCount = item.ExerciseDetailDtoList.Sum(x => x.LookCount);
                item.CompleteCount = item.ExerciseDetailDtoList.Sum(x => x.CompleteCount);

            }
            return new PagedReuslt<ExerciseDto>(rs, totalCount.Value);

        }

健身小结

  public async Task<PagedReuslt<ExerciseDetailDto>> GetExerciseDetailDtoListAsync(ExercisePageInput input)
        {
            List<ExerciseDetailDto> rs = new List<ExerciseDetailDto>();
            RefAsync<int> totalCount = 0;
            var list = await SqlSugarClient.Queryable<ExerciseDetail>()

                .LeftJoin<Exercise>((ed, e) => ed.ExerciseId == e.Id)
                .WhereIF(input.Name.IsNotNullOrNotWhiteSpace(), (ed, e) => e.Name == input.Name)
                .WhereIF(input.ExerciseDetailId.HasValue, (ed, e) => ed.Id == input.ExerciseDetailId)
                .Select((ed, e) => new
                {
                    ExerciseDetail = ed,
                    Exercise = e
                })
                .ToPageListAsync(input.Page, input.Size, totalCount);
            var exerciseDetailIds = list.Select(x => x.ExerciseDetail.Id).ToArray();
            rs = Mapper.Map<List<ExerciseDetailDto>>(list.Select(x => x.ExerciseDetail));
            var exerciseDtos = Mapper.Map<List<ExerciseDto>>(list.Select(x => x.Exercise));

            //获取所有浏览数据
            var lookRecords = await _recordManager.GetGroupListAsync(new RecordPagedInput() { RecordType = RecordType.运动浏览, RelativeIds = exerciseDetailIds });


            ///统计所有活动参加人的次数
            var recordG = await SqlSugarClient.Queryable<ExerciseRecord>()
              .Where(x => exerciseDetailIds.Contains(x.ExerciseDetailId.Value))
              .GroupBy(x => new { x.ExerciseId, x.ExerciseDetailId })
              .Select(x => new
              {
                  x.ExerciseId,
                  x.ExerciseDetailId,
                  Qty = SqlFunc.AggregateCount(x.ExerciseId)
              }).ToListAsync();
            //统计已经完成此项数据的次数
            var recordCompleteG = await SqlSugarClient.Queryable<ExerciseRecord>()
            .Where(x => x.CompleteTime.HasValue && exerciseDetailIds.Contains(x.ExerciseDetailId.Value))
            .GroupBy(x => new { x.ExerciseId, x.ExerciseDetailId })
            .Select(x => new
            {
                x.ExerciseId,
                x.ExerciseDetailId,
                Qty = SqlFunc.AggregateCount(x.ExerciseId)
            }).ToListAsync();

            foreach (var item in rs)
            {
                item.ExerciseDto = exerciseDtos.FirstOrDefault(x => x.Id == item.ExerciseId);
                item.JoinCount = recordG.Where(x => x.ExerciseDetailId == item.Id).Sum(x => x.Qty);
                item.LookCount = lookRecords.Where(x => x.RelativeId == item.Id).Sum(x => x.Qty);
                item.CompleteCount = recordCompleteG.Where(x => x.ExerciseDetailId == item.Id).Sum(x => x.Qty);
            }

            return new PagedReuslt<ExerciseDetailDto>(rs, totalCount.Value);
        }

摘要

互联网是社会发展的必然趋势,很多人已经意识到网络的强大生命力和它在未来将处于的重要地位。他们钻研并且努力进入到这一个新的空间,新的领域。其中包括你和我。以个人为中心,淡化了传统中心地位,使得我们的世界向多元化加速发展,人人都有话语权,人人都是中心。

互联网是一个互动性极强的平台,它自由、宽容、平等、共享,并使来自民间的声音参与到了构建主流话语的行动中来。计算机技术的发展,特别是网络技术的飞速发展,给文档的保存和管理提供极大的方便。本论文中,将软件工程的基本原理和方法应用到整个网站系统,并对其进行需求分析,提出了解决问题的具体方法。在具体制作中,用ASP技术来实现B/S系统,ASP技术与数据库技术结合,用户在浏览器端可以随意查询自己需要的标本,这样提高了网页的互动性,使整个系统能更好的为用户服务。

Internet飞速发展使得网站不再仅仅为企业或公司等大型结构所拥有,互联网成为人们快速获取、发布和传递信息的重要渠道,它在人们政治、经济、生活等各个方面发挥着重要的作用。因此网站建设在Internet应用上的地位显而易见,一个家庭甚至个人都可以拥有属于自己的网站,而在这其中,个人网站已经日渐普及,而且发展到今天,创建一个能充分体现自我风格和特色的个人网站已经成为互联网用户的新追求。

关键词: 个人网站;ASP.net;SQL server 2008;互联网;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值