C#Winform菜鸟驿站管理系统-快递信息管理界面多条件查询实现方法

1,具体的页面设计如下,

2, 关于下拉框数据填充实现,站点选择代码实现如下,因为站点加载在很多界面需要用到,所以把加载站点的方法独立出来如下;

 /// <summary>/// 加载站点下拉框/// </summary>/// <param name="cboStations"></param>public static void LoadCboStations(ComboBox cboStations, StationBLL statBLL){List<StationInfo> stationList01 = statBLL.GetCboStationList();stationList01.Insert(0, new StationInfo(){StationId=0,StationName= "请选择站点"});cboStations.DisplayMember = "StationName";cboStations.ValueMember = "StationId";cboStations.DataSource = stationList01;}

 3,在快递信息管理页面调用加载站点的方法,然后在页面初始化的调用LoadCboStations 该方法

 /// <summary>/// 加载站点下拉框/// </summary>private void LoadCboStations(){FormUtility.LoadCboStations(cboStations, stationBLL);}

 4,快递状态和 取件方式 数据绑定如下;

5,点击查询按钮事件代码如下

/// <summary>/// 查询/// </summary>/// <param name="sender"></param>/// <param name="e"></param>private void btnFind_Click(object sender, EventArgs e){FindExpressList();}

6,FindExpressList 具体实现方法如下

 private void FindExpressList(){string keywords = txtkeywords.Text.Trim();string expType = tvExpTypes.SelectedNode.Text;//选择节点的文本if (expType == "快递类别")expType = "";int stationId = cboStations.SelectedValue.GetInt();string expState = cboStates.Text.Trim();if (expState == "全部")expState = "";string pickWay = cboPickWays.Text.Trim();if (pickWay == "全部")pickWay = "";string expNumber = txtExpNo.Text.Trim();string receiver = txtReceiver.Text.Trim();string recPhone = txtRecPhone.Text.Trim();bool showDel = chkShowDel.Checked;int startIndex = uPager1.StartIndex;//当页的开始索引int pageSize = uPager1.PageSize;//每页记录数dgvExpressList.AutoGenerateColumns = false;PageModel<ViewExpressInfo> pageModel = expressBLL.FindExpressList(keywords, expType, stationId, expState, expNumber, receiver, recPhone, pickWay, showDel, startIndex, pageSize);if (pageModel.TotalCount > 0){dgvExpressList.DataSource = pageModel.PageList;uPager1.Record = pageModel.TotalCount;uPager1.Enabled = true;}else{dgvExpressList.DataSource = null;uPager1.Enabled = false;}SetActBtnsVisible(showDel);}

7,左侧类别节点加载,在页面初始化调用

/// <summary>/// 类别节点树加载/// </summary>private void LoadTvExpTypes(){List<ExpressTypeInfo> expTypeList = expressTypeBLL.GetCboExpTypes(1);TreeNode rootNode = new TreeNode() { Name = "0", Text = "快递类别" };tvExpTypes.Nodes.Add(rootNode);//递归加载节点AddTvNode(expTypeList, rootNode, 0);tvExpTypes.ExpandAll();}

8,页面初始化

 9, DAL层如何实现多条件查询以及分页实现代码如下

 /// <summary>/// 分页查询快递列表/// </summary>/// <param name="keywords"></param>/// <param name="expType"></param>/// <param name="stationId"></param>/// <param name="expState"></param>/// <param name="expNumber"></param>/// <param name="receiver"></param>/// <param name="receivePhone"></param>/// <param name="pickWay"></param>/// <param name="isDeleted"></param>/// <param name="startIndex"></param>/// <param name="pageSize"></param>/// <returns></returns>public PageModel<ViewExpressInfo> FindExpressList(string keywords, string expType, int stationId, string expState, string expNumber, string receiver, string receivePhone, string pickWay, int isDeleted, int startIndex, int pageSize){string strWhere = $"IsDeleted={isDeleted}";if (!string.IsNullOrEmpty(keywords)){strWhere += " and (ExpNumber like @keywords  or SendAddress  like @keywords or ReceiveAddress   like @keywords  or ExpRemark like @keywords)";}if (!string.IsNullOrEmpty(expType)){strWhere += " and ExpType like @expType";}if (stationId > 0){strWhere += " and StationId=" + stationId;}if (!string.IsNullOrEmpty(expState)){strWhere += " and ExpState=@expState";}if (!string.IsNullOrEmpty(pickWay)){strWhere += " and PickWay=@pickWay";}if (!string.IsNullOrEmpty(expNumber)){strWhere += " and ExpNumber like @expNumber";}if (!string.IsNullOrEmpty(receiver)){strWhere += " and Receiver = @receiver";}if (!string.IsNullOrEmpty(receivePhone)){strWhere += " and ReceiverPhone = @receiverPhone";}string cols = "ExpId,ExpNumber,ExpType,Receiver,ReceiverPhone,StationName,Sender,SenderPhone,ExpState,EnterTime,PickWay";SqlParameter[] paras ={new SqlParameter("@keywords", $"%{keywords}%"),new SqlParameter("@expType", $"%{expType}%"),new SqlParameter("@expState", expState),new SqlParameter("@expNumber", $"%{expNumber}%"),new SqlParameter("@receiver", receiver),new SqlParameter("@receiverPhone", receivePhone),new SqlParameter("@pickWay", pickWay)};return GetRowsModelList<ViewExpressInfo>(strWhere, cols, "Id", "ExpId", startIndex, pageSize, paras);}}
}

BLL层代码如下;

/// <summary>/// 分页查询快递信息/// </summary>/// <param name="keywords"></param>/// <param name="expType"></param>/// <param name="stationId"></param>/// <param name="expState"></param>/// <param name="expNumber"></param>/// <param name="receiver"></param>/// <param name="receivePhone"></param>/// <param name="pickWay"></param>/// <param name="blShowDel"></param>/// <param name="startIndex"></param>/// <param name="pageSize"></param>/// <returns></returns>public PageModel<ViewExpressInfo> FindExpressList(string keywords, string expType, int stationId, string expState, string expNumber, string receiver, string receivePhone, string pickWay, bool blShowDel, int startIndex, int pageSize){int isDeleted = blShowDel ? 1 : 0;return viewExpressDAL.FindExpressList(keywords, expType, stationId, expState, expNumber, receiver, receivePhone, pickWay, isDeleted, startIndex, pageSize);}

以上就是综合查询的内容展示。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/225103.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

SaaS行业分析

文章目录 什么是SaaS ?SaaS的标准定义什么是软件即服务&#xff1f;SaaS与传统软件的区别 &#xff1f; SaaS行业分析你知道最赚钱的行业是什么&#xff1f;互联网带给企业的变化 SaaS与PaaS、IaaS的区别&#xff1f;IaaS&#xff08;Infrastructure as a Service&#xff09;…

配置VRRP负载分担示例

一、组网需求&#xff1a; HostA和HostC通过Switch双归属到SwitchA和SwitchB。为减轻SwitchA上数据流量的承载压力&#xff0c;HostA以SwitchA为默认网关接入Internet&#xff0c;SwitchB作为备份网关&#xff1b;HostC以SwitchB为默认网关接入Internet&#xff0c;SwitchA作为…

【面试】Java最新面试题资深开发-Spring篇(1)

问题八&#xff1a;Spring原理 解释一下什么是Spring框架以及它的核心思想是什么&#xff1f;Spring中的IoC&#xff08;控制反转&#xff09;是什么&#xff0c;它如何实现&#xff1f;什么是DI&#xff08;依赖注入&#xff09;&#xff1f;Spring是如何支持依赖注入的&…

基于YOLOv8深度学习的高精度车辆行人检测与计数系统【python源码+Pyqt5界面+数据集+训练代码】目标检测、深度学习实战

《博主简介》 小伙伴们好&#xff0c;我是阿旭。专注于人工智能、AIGC、python、计算机视觉相关分享研究。 ✌更多学习资源&#xff0c;可关注公-仲-hao:【阿旭算法与机器学习】&#xff0c;共同学习交流~ &#x1f44d;感谢小伙伴们点赞、关注&#xff01; 《------往期经典推…

介绍一款低代码数据可视化平台

一、前言 随着企业数字化拉开序幕&#xff0c;低代码( Low Code Development)开发的概念开始火起来&#xff0c;即用少量的代码就能开发复杂的业务系统。然后更进一步&#xff0c;由此又催生出一个新的概念&#xff1a;无代码开发( No Code Development)。 低代码和无代码开发平…

Docker单点部署 Elasticsearch + Kibana [8.11.3]

文章目录 一、Elasticsearch二、Kibana三、访问四、其他 Elasticsearch 和 Kibana 版本一般需要保持一致才能一起使用&#xff0c;但是从 8.x.x开始&#xff0c;安全验证不断加强&#xff0c;甚至8.x.x之间的版本安全验证方法都不一样&#xff0c;真的很恼火。 这里记录一次成…

娱乐新拐点:TikTok如何改变我们的日常生活?

在数字时代的浪潮中&#xff0c;社交媒体平台不断涌现&#xff0c;其中TikTok以其独特的短视频内容在全球范围内掀起了一场娱乐革命。本文将深入探讨TikTok如何改变我们的日常生活&#xff0c;从社交互动、文化传播到个人创意表达&#xff0c;逐步改写了娱乐的新篇章。 短视频潮…

go-zero开发入门之gateway深入研究1

创建一个 gateway 示例&#xff1a; // main.go package mainimport ("flag""fmt""gateway/middleware""github.com/zeromicro/go-zero/core/conf""github.com/zeromicro/go-zero/gateway" )var configFile flag.String(&…

idea2023解决右键没有Servlet的问题

复制Servlet Class.java中的文件。 回到文件&#xff0c;然后点击小加号 然后输入刚刚复制的东西&#xff1a; 3. 此时右键有servlet。 4. 然后他让你输入下面两个框&#xff1a; JAVAEE TYPE中输入Servlet Class Name 表示你要创建的Servlet类的名称是什么。自己起名字。然后…

手动添加Git Bash Here到右键菜单(超详细)

通过WindowsR快捷键可以打开“运行窗口”&#xff0c;在“窗口”中输入“regedit”&#xff0c;点击“确定”打开注册表。 依次进入HKEY_CLASSES_ROOT —-》 Directory —-》Background —-》 shell 路径为Computer\HKEY_CLASSES_ROOT\Directory\Background\shell 3.在“s…

Python中Requests的深入了解

Requests的深入了解 基本POST请求&#xff08;data参数&#xff09; 1. 最基本post方法 response requests.post("http://www.baidu.com/", data data)2. 传入data数据 对于 POST 请求来说&#xff0c;我们一般需要为它增加一些参数。那么最基本的传参方法可以…

状态的一致性和FlinkSQL

状态一致性 一致性其实就是结果的正确性。精确一次是指数据有可能被处理多次&#xff0c;但是结果只有一个。 三个级别&#xff1a; 最多一次&#xff1a;1次或0次&#xff0c;有可能丢数据至少一次&#xff1a;1次或n次&#xff0c;出错可能会重试 输入端只要可以做到数据重…

mongo分组查询问题以及mongo根据Date类型查询

一、mongo分组查询 mongo中如果只是根据条件查询数据&#xff0c;则只需要&#xff1a; db.getCollection(表名).find({source:{$eq:5}}) 如果根据字段进行分组查询&#xff0c;那么需要用aggregate传一个数组进行查询&#xff0c;如 db.getCollection(表名).find({ "…

[每周一更]-(第27期):HTTP压测工具之wrk

[补充完善往期内容] wrk是一款简单的HTTP压测工具,托管在Github上,https://github.com/wg/wrkwrk 的一个很好的特性就是能用很少的线程压出很大的并发量. 原因是它使用了一些操作系统特定的高性能 io 机制, 比如 select, epoll, kqueue 等. 其实它是复用了 redis 的 ae 异步事…

Android APP 常见概念与 adb 命令

adb 的概念 adb 即 Android Debug Bridge 。在窗口输入 adb 即可显示帮助文档。adb 实际上就是在后台开启一个 server&#xff0c;会接收 adb 的命令然后帮助管理&#xff0c;控制&#xff0c;查看设备的状态、信息等&#xff0c;是开发、测试 Android 相关程序的最常用手段。…

Centos系统pnpm升级报错 ERR_PNPM_NO_GLOBAL_BIN_DIR

在 CentOS 系统中使用 pnpm i -g pnpm 报错&#xff1a;ERR_PNPM_NO_GLOBAL_BIN_DIR Unable to find the global bin directory&#xff0c;折腾半天终于解决了。 完整报错信息 [rootVM-8 test]# pnpm i -g pnpm Nothing to stop. No server is running for the store at /roo…

linux20day 排序sort 字符处理cut cpu使用占比排序 awk文本数据处理

目录 1、排序sort参数用法排序&#xff08;-n&#xff09;从大到小 倒叙&#xff08;-r&#xff09; cpu使用占比排序&#xff08;ps aux --sort -%cpu&#xff09; 2、截取到某个字符串 cut3、awk处理文本文件用法&#xff1a;打印等于 和不等于 1、排序sort 经常用于排序 参…

Spring 的 @Configuration 和 @Component 注解区别

&#x1f680; 作者主页&#xff1a; 有来技术 &#x1f525; 开源项目&#xff1a; youlai-mall &#x1f343; vue3-element-admin &#x1f343; youlai-boot &#x1f33a; 仓库主页&#xff1a; Gitee &#x1f4ab; Github &#x1f4ab; GitCode &#x1f496; 欢迎点赞…

数据分析的基本步骤

了解过数据分析的概念之后&#xff0c;我们再来说下数据分析的常规步骤。 明确目标 首先我们要确定一个目标&#xff0c;即我们要从数据中得到什么。比如我们要看某个指标A随时间的变化趋势&#xff0c;以期进行简单的预测。 数据收集 当确定了目标之后&#xff0c;就有了取…

js逆向-JS加密破解进阶

目录 一、JS逆向进阶一&#xff1a;破解AES加密 &#xff08;一&#xff09;AES对称加密算法原理 &#xff08;二&#xff09;破解AES加密 &#xff08;三&#xff09;实战&#xff1a;发现报告网 二、JS逆向进阶二&#xff1a;破解RSA加密 &#xff08;一&#xff09;RS…