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);
        }

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

  • 15
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
非常好的主题!C# WinForm 人事管理系统可以帮助公司或组织管理员工的信息、薪资、考勤和福利等方面的内容。以下是一个简单的人事管理系统的设计思路: 1. 数据库设计:创建一个包含员工信息的数据库表,可以包括姓名、性别、出生日期、职位、部门、入职日期、联系方式等字段。另外还可以创建其他相关表,如部门表、职位表等,用于提高数据的组织性和可读性。 2. 登录界面:创建一个登录界面,要求用户输入用户名和密码来验证身份。可以使用数据库中的用户表来进行身份验证。 3. 主界面:登录成功后,显示主界面,其中包含菜单栏和工具栏。菜单栏可以包括员工信息管理、薪资管理、考勤管理、福利管理等功能模块。工具栏可以放置常用操作按钮,如添加员工、删除员工、编辑员工等。 4. 员工信息管理:提供添加、编辑、删除和查询员工信息的功能。可以通过表格或列表展示员工信息,并提供查询和排序功能。当点击某个员工时,可以显示其详细信息,并允许对其进行编辑或删除操作。 5. 薪资管理:提供设置员工薪资、调整薪资和查询薪资等功能。可以根据员工的职位和级别来设定基本工资,并允许进行个别调整。同时,可以根据时间范围查询员工的薪资历史记录。 6. 考勤管理:提供员工签到、签退和请假等功能。可以记录员工每天的上班时间和下班时间,并计算出勤情况。同时,可以记录员工的请假信息,并计算请假时长。 7. 福利管理:提供设置员工福利和查询福利信息的功能。可以设定各种福利,如补贴、奖金等,并为每个员工分配对应的福利。同时,可以查询员工的福利历史记录。 以上是一个简单的人事管理系统的设计思路,你可以根据需要进行功能的扩展和细化。希望这些信息对你有所帮助!如果你有任何其他问题,欢迎继续提问。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值