团队项目——工大助手界面(查询部分)

2024-01-04 21:10

本文主要是介绍团队项目——工大助手界面(查询部分),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

工大助手

 

基本内容

  • 工大助手(桌面版)
  • 实现登陆、查成绩、计算加权平均分等功能

团队人员

  • 13070002 张雨帆
  • 13070003 张帆
  • 13070004 崔巍
  • 13070006 王奈
  • 13070045 汪天米
  • 13070046 孙宇辰

界面设计(查询部分)

  使用VS2013 C# WPF制作界面。

查询界面包括若干Label显示文字,4个ComboBox分别用于选择学年,学期,课程性质和学分,两个TextBox分别用于输入想要查找的课程的名称(支持模糊查询)和显示所查询的课程的加权平均分,一个DataGrid用于显示查询到的课程信息(用户可以对查询到的信息进行不同条件的排序),两个Button“查询”“退出”分别用于查询符合用户选择条件的课程和退出登录返回登陆界面。

界面代码如下:

<Window x:Class="WpfApplication2.Window1"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"Title="Window1" Height="600" Width="800"><Grid><Label Content="北工大easy教务" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="10,10,0,0" Height="49" Width="251" FontSize="36" FontFamily="STLiti"/><Button x:Name="exit" Content="退出" HorizontalAlignment="Left" Height="25" Margin="706,29,0,0" VerticalAlignment="Top" Width="50" Click="exit_Click"/><ComboBox x:Name="schoolYear" HorizontalAlignment="Left" Height="25" Margin="80,64,0,0" VerticalAlignment="Top" Width="100"><ComboBoxItem IsSelected="True" Height="19.2" Margin="0,0,0,0"></ComboBoxItem><ComboBoxItem>2015-2016</ComboBoxItem><ComboBoxItem>2014-2015</ComboBoxItem><ComboBoxItem>2013-2014</ComboBoxItem></ComboBox><ComboBox x:Name="credit" HorizontalAlignment="Left" Height="25" Margin="235,114,0,0" VerticalAlignment="Top" Width="100"><ComboBoxItem IsSelected="True" Height="19.2" Margin="0,0,0,0"></ComboBoxItem><ComboBoxItem>0.5</ComboBoxItem><ComboBoxItem>1.0</ComboBoxItem><ComboBoxItem>1.5</ComboBoxItem><ComboBoxItem>2.0</ComboBoxItem><ComboBoxItem>2.5</ComboBoxItem><ComboBoxItem>3.0</ComboBoxItem><ComboBoxItem>3.5</ComboBoxItem><ComboBoxItem>4.0</ComboBoxItem><ComboBoxItem>4.5</ComboBoxItem><ComboBoxItem>5.0</ComboBoxItem><ComboBoxItem>5.5</ComboBoxItem></ComboBox><ComboBox x:Name="courseType" HorizontalAlignment="Left" Height="25" Margin="410,64,0,0" VerticalAlignment="Top" Width="150"><ComboBoxItem IsSelected="True" Height="19.2" Margin="0,0,0,0"></ComboBoxItem><ComboBoxItem>公共必修课</ComboBoxItem><ComboBoxItem>实践环节</ComboBoxItem><ComboBoxItem>基础必修课</ComboBoxItem><ComboBoxItem>学科基础必修课一</ComboBoxItem><ComboBoxItem>学科基础必修课二</ComboBoxItem><ComboBoxItem>本专业选修课</ComboBoxItem><ComboBoxItem>本、跨专业选修课</ComboBoxItem><ComboBoxItem>校选修课</ComboBoxItem><ComboBoxItem>计算机基础选修课</ComboBoxItem><ComboBoxItem>专业认知</ComboBoxItem><ComboBoxItem>实践环节选修课</ComboBoxItem><ComboBoxItem>公共基础必修课</ComboBoxItem><ComboBoxItem>学科基础必修课</ComboBoxItem><ComboBoxItem>学科基础选修课</ComboBoxItem><ComboBoxItem>专业限选课</ComboBoxItem><ComboBoxItem>专业任选课</ComboBoxItem><ComboBoxItem>实践环节必修课</ComboBoxItem><ComboBoxItem>创新实践环节</ComboBoxItem><ComboBoxItem>通识教育选修课</ComboBoxItem><ComboBoxItem>学科基础必修课(辅)</ComboBoxItem><ComboBoxItem>专业必修课(辅)</ComboBoxItem><ComboBoxItem>实践环节(辅)</ComboBoxItem></ComboBox><ComboBox x:Name="semester" HorizontalAlignment="Left" Height="25" Margin="235,64,0,0" VerticalAlignment="Top" Width="100"><ComboBoxItem IsSelected="True" Height="19.2" Margin="0,0,0,0"></ComboBoxItem><ComboBoxItem>1</ComboBoxItem><ComboBoxItem>2</ComboBoxItem><ComboBoxItem>3</ComboBoxItem></ComboBox><Label Content="学    年:" HorizontalAlignment="Left" Height="25" Margin="10,64,0,0" VerticalAlignment="Top" Width="65"/><Label Content="学期:" HorizontalAlignment="Left" Height="25" Margin="185,64,0,0" VerticalAlignment="Top" Width="45"/><Label Content="课程性质:" HorizontalAlignment="Left" Height="25" Margin="340,64,0,0" VerticalAlignment="Top" Width="65"/><Label Content="学分:" HorizontalAlignment="Left" Height="25" Margin="185,114,0,0" VerticalAlignment="Top" Width="45"/><Label Content="课程名称:" HorizontalAlignment="Left" Height="25" Margin="10,114,0,0" VerticalAlignment="Top" Width="65"/><TextBox x:Name="courseName" HorizontalAlignment="Left" Height="25" Margin="80,114,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="100"/><Button Content="查询" HorizontalAlignment="Left" Height="25" Margin="631,113,0,0" VerticalAlignment="Top" Width="70" Click="Button_Click"/><DataGrid x:Name="dataGrid1" HorizontalAlignment="Left" Height="372" Margin="92,161,0,0" VerticalAlignment="Top" Width="609" IsReadOnly="True"></DataGrid><Label Content="加权:" HorizontalAlignment="Left" Height="25" Margin="422,113,0,0" VerticalAlignment="Top" Width="43"/><TextBox x:Name="weighting" HorizontalAlignment="Left" Height="25" Margin="470,114,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="90" IsReadOnly="True"/></Grid>
</Window>

按钮代码如下:

查询:

            string queryString = "";string course_Name = courseName.Text;string school_Year = schoolYear.Text;string _Semester = semester.Text;string course_Type = courseType.Text;string _Credit = credit.Text;DataTable dt = new DataTable();bool flag = false;if (!school_Year.Equals("")){queryString += "学年='" + school_Year+"'";flag = true;}if (!course_Name.Equals("")){if (flag)queryString += " and 课程名称 like '%" + course_Name + "%'";else{queryString += "课程名称 like '%" + course_Name + "%'";flag = true;}}if (!_Semester.Equals("")){if (flag)queryString += " and 学期='" + _Semester + "'";else{queryString += "学期='" + _Semester + "'";flag = true;}}if (!course_Type.Equals("")){if (flag)queryString += " and 课程性质='" + course_Type + "'";else{queryString += "课程性质='" + course_Type + "'";flag = true;}}if (!_Credit.Equals("")){if (flag)queryString += " and 学分='" + _Credit + "'";else{queryString += "学分='" + _Credit + "'";flag = true;}}if(!flag)queryString = "*";flag = false;GradeHandler.LoadDataFromExcel();if(GradeHandler.QueryData(queryString,out dt)){dataGrid1.ItemsSource = dt.DefaultView;}double _weight;if(GradeHandler.CalculateWeightedMean(dt,out _weight))weighting.Text = Convert.ToString(Math.Round(_weight,2));elseweighting.Text = "";

查询部分制作一个string queryString 用于在调用查询函数GradeHandler.QueryData(该函数详见张帆的博客)时传递用户选择的查询条件,之后查询结果返回到DataTable dt中,随后将dt中的数据显示在dataGrid中。

退出:

        private void exit_Click(object sender, RoutedEventArgs e){MainWindow myWindow = new MainWindow();myWindow.Show();this.Close();}

程序查询效果图:

查询课程名称有计算机的1.0学分的课:

查询所有课程:

查询课程名称中有计算机的课程,查询结果按学分排序。

 

转载于:https://www.cnblogs.com/yufan-blog/p/5594649.html

这篇关于团队项目——工大助手界面(查询部分)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/570614

相关文章

这15个Vue指令,让你的项目开发爽到爆

1. V-Hotkey 仓库地址: github.com/Dafrok/v-ho… Demo: 戳这里 https://dafrok.github.io/v-hotkey 安装: npm install --save v-hotkey 这个指令可以给组件绑定一个或多个快捷键。你想要通过按下 Escape 键后隐藏某个组件,按住 Control 和回车键再显示它吗?小菜一碟: <template

如何用Docker运行Django项目

本章教程,介绍如何用Docker创建一个Django,并运行能够访问。 一、拉取镜像 这里我们使用python3.11版本的docker镜像 docker pull python:3.11 二、运行容器 这里我们将容器内部的8080端口,映射到宿主机的80端口上。 docker run -itd --name python311 -p

活用c4d官方开发文档查询代码

当你问AI助手比如豆包,如何用python禁止掉xpresso标签时候,它会提示到 这时候要用到两个东西。https://developers.maxon.net/论坛搜索和开发文档 比如这里我就在官方找到正确的id描述 然后我就把参数标签换过来

让树莓派智能语音助手实现定时提醒功能

最初的时候是想直接在rasa 的chatbot上实现,因为rasa本身是带有remindschedule模块的。不过经过一番折腾后,忽然发现,chatbot上实现的定时,语音助手不一定会有响应。因为,我目前语音助手的代码设置了长时间无应答会结束对话,这样一来,chatbot定时提醒的触发就不会被语音助手获悉。那怎么让语音助手也具有定时提醒功能呢? 我最后选择的方法是用threading.Time

在cscode中通过maven创建java项目

在cscode中创建java项目 可以通过博客完成maven的导入 建立maven项目 使用快捷键 Ctrl + Shift + P 建立一个 Maven 项目 1 Ctrl + Shift + P 打开输入框2 输入 "> java create"3 选择 maven4 选择 No Archetype5 输入 域名6 输入项目名称7 建立一个文件目录存放项目,文件名一般为项目名8 确定

ASIO网络调试助手之一:简介

多年前,写过几篇《Boost.Asio C++网络编程》的学习文章,一直没机会实践。最近项目中用到了Asio,于是抽空写了个网络调试助手。 开发环境: Win10 Qt5.12.6 + Asio(standalone) + spdlog 支持协议: UDP + TCP Client + TCP Server 独立的Asio(http://www.think-async.com)只包含了头文件,不依

poj 2976 分数规划二分贪心(部分对总体的贡献度) poj 3111

poj 2976: 题意: 在n场考试中,每场考试共有b题,答对的题目有a题。 允许去掉k场考试,求能达到的最高正确率是多少。 解析: 假设已知准确率为x,则每场考试对于准确率的贡献值为: a - b * x,将贡献值大的排序排在前面舍弃掉后k个。 然后二分x就行了。 代码: #include <iostream>#include <cstdio>#incl

Vue3项目开发——新闻发布管理系统(六)

文章目录 八、首页设计开发1、页面设计2、登录访问拦截实现3、用户基本信息显示①封装用户基本信息获取接口②用户基本信息存储③用户基本信息调用④用户基本信息动态渲染 4、退出功能实现①注册点击事件②添加退出功能③数据清理 5、代码下载 八、首页设计开发 登录成功后,系统就进入了首页。接下来,也就进行首页的开发了。 1、页面设计 系统页面主要分为三部分,左侧为系统的菜单栏,右侧

SpringBoot项目是如何启动

启动步骤 概念 运行main方法,初始化SpringApplication 从spring.factories读取listener ApplicationContentInitializer运行run方法读取环境变量,配置信息创建SpringApplication上下文预初始化上下文,将启动类作为配置类进行读取调用 refresh 加载 IOC容器,加载所有的自动配置类,创建容器在这个过程

Maven创建项目中的groupId, artifactId, 和 version的意思

文章目录 groupIdartifactIdversionname groupId 定义:groupId 是 Maven 项目坐标的第一个部分,它通常表示项目的组织或公司的域名反转写法。例如,如果你为公司 example.com 开发软件,groupId 可能是 com.example。作用:groupId 被用来组织和分组相关的 Maven artifacts,这样可以避免