后台模块--订单管理

一、今日完成任务

1.梳理项目流程

2.完善后台订单管理模块

二、核心代码

管理员查看用户的订单信息,由于本系统为自动售票系统,所以管理员只能对订单信息进行查询,不需要作其它操作,订单信息集成了订单中的票务信息,数量,订单会员,电话,身份证等信息。

订单管理页面效果图

 

页面代码

<body>
    <form id="form1" runat="server">
        <nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 订单管理 <span class="c-gray en">&gt;</span> 订单管理 <a class="btn btn-success radius r mr-20" style="line-height: 1.6em; margin-top: 3px" href="javascript:location.replace(location.href);" title="刷新"><i class="Hui-iconfont">&#xe68f;</i></a></nav>
        <div class="pd-20">
            <div class="text-c">
                <asp:Label ID="Label1" runat="server" Text="订单号:"></asp:Label>
                <asp:TextBox ID="txt_orderid" runat="server" class="input-text" Style="width: 150px" placeholder="请输入订单号"></asp:TextBox>
                <asp:Button ID="btn_research" runat="server" Text="&#xe665;搜索" class="btn btn-success radius Hui-iconfont" OnClick="btn_research_Click" />
            </div>

            <div class="mt-20">
                <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" RowStyle-HorizontalAlign="Center" class="table table-border table-bordered table-hover table-bg" HorizontalAlign="Center">
                    <Columns>

                        <asp:BoundField DataField="ID" HeaderText="序号" />
                        <asp:BoundField DataField="orderid" HeaderText="订单号码" />
                        <asp:BoundField DataField="carNo" HeaderText="车次编号" />
                        <asp:BoundField DataField="filed1" HeaderText="起始站" />
                        <asp:BoundField DataField="filed2" HeaderText="到达站" />
                        <asp:BoundField DataField="beginDate" HeaderText="发车日期" />
                        <asp:BoundField DataField="beginTime" HeaderText="发车时间" />
                        <asp:BoundField DataField="price" HeaderText="票价" />
                        <asp:BoundField DataField="saveTime" HeaderText="订单日期" />
                        <asp:BoundField DataField="payStatus" HeaderText="付款状态" />
                        <asp:BoundField DataField="pName" HeaderText="乘车人" />
                        <asp:BoundField DataField="pTel" HeaderText="电话" />
                        <asp:BoundField DataField="pIDnum" HeaderText="身份证号" />
                    </Columns>
                    <RowStyle HorizontalAlign="Center"></RowStyle>
                </asp:GridView>
            </div>
        </div>
<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="lib/layer/1.9.3/layer.js"></script>
<script type="text/javascript" src="lib/laypage/1.2/laypage.js"></script> 
<script type="text/javascript" src="lib/My97DatePicker/WdatePicker.js"></script> 
<script type="text/javascript" src="lib/datatables/1.10.0/jquery.dataTables.min.js"></script> 
<script type="text/javascript" src="js/H-ui.js"></script> 
<script type="text/javascript" src="js/H-ui.admin.js"></script> 

页面后台代码

 public partial class Order_list : System.Web.UI.Page
    {
        BLL.orderInfoBLL bll = new orderInfoBLL();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                getInfo();
            }
        }

        //查询所有订单信息
        public void getInfo()
        {
            this.GridView1.DataSource = bll.selectOrder();
            this.GridView1.DataBind();
        }

        //根据订单编号查询订单信息
        protected void btn_research_Click(object sender, EventArgs e)
        {
            string orderid = txt_orderid.Text;
            this.GridView1.DataSource = bll.selectOrder(orderid);
            this.GridView1.DataBind();
        }
    }

 

 

DAL层代码

public class orderInfoDAL
    {
        carDBDataContext db = new carDBDataContext();
        /// <summary>
        /// 查询所有已付款订单信息
        /// </summary>
        /// <param name="orderid">订单id</param>
        /// <returns>订单信息</returns>
        public object selectOrder(string orderid = null)
        {
            object order = null;

            if (!string.IsNullOrEmpty(orderid))
            {
                //order = db.Tickets.Where(m => m.filed1 == filed1 && m.filed2 == filed2 && m.delstatus == false).ToList();
                order = (from s1 in db.orderInfo
                         join s2 in db.Tickets on s1.tID equals s2.ID
                         join s3 in db.Passenger on s1.pID equals s3.pID
                         where s1.payStatus == 3 && s1.orderid == orderid
                         select new
                         {
                             ID = s1.ID,  //序号,
                             orderid = s1.orderid,  // 订单号码,
                             carNo = s2.carNo,  // 车次,
                             filed1 = s2.filed1,  // 起始站,
                             filed2 = s2.filed2,  // 到达站,
                             beginDate = s2.beginDate,  // 发车日期,
                             beginTime = s2.beginTime,  // 发车时间,
                             price = s2.price,  // 票价,
                             saveTime = s1.saveTime,  // 订单日期,  
                             payStatus = s1.payStatus == 3 ? "已付款" : "未付款",// 付款状态,
                             pName = s3.pName,  // 乘车人,
                             pTel = s3.pTel,  // 电话,
                             pIDnum = s3.pIDnum  // 身份证号
                         }).ToList();
            }
            else
            {
                order = (from s1 in db.orderInfo
                         join s2 in db.Tickets on s1.tID equals s2.ID
                         join s3 in db.Passenger on s1.pID equals s3.pID
                         where s1.payStatus == 3
                         select new
                         {
                             ID = s1.ID,  //序号,
                             orderid = s1.orderid,  // 订单号码,
                             carNo = s2.carNo,  // 车次,
                             filed1 = s2.filed1,  // 起始站,
                             filed2 = s2.filed2,  // 到达站,
                             beginDate = s2.beginDate,  // 发车日期,
                             beginTime = s2.beginTime,  // 发车时间,
                             price = s2.price,  // 票价,
                             saveTime = s1.saveTime,  // 订单日期,  
                             payStatus = s1.payStatus == 3 ? "已付款" : "未付款",// 付款状态,
                             pName = s3.pName,  // 乘车人,
                             pTel = s3.pTel,  // 电话,
                             pIDnum = s3.pIDnum  // 身份证号
                         }).ToList();
            }
            return order;
        }

 

posted @ 2020-08-12 17:21  小花娟  阅读(651)  评论(0编辑  收藏  举报