示例#1
0
        private void SelectSelected_Click(object sender, EventArgs e)
        {
            string orderID = tbOrderID.Text.Trim();
            string phone   = tbPhone.Text.Trim();
            string amount  = tbAmount.Text.Trim();
            string status  = cbStatus.SelectedIndex == -1?"": cbStatus.SelectedIndex + 1 + "";

            MessageBox.Show(status);
            string dateStart = dtpDateStart.Value.ToString("yyyy-MM-dd").Trim();
            string dateEnd   = dtpDateEnd.Value.AddDays(1).ToString("yyyy-MM-dd").Trim();;
            string userID    = ConfigurationManager.AppSettings["acount"];

            StringBuilder sb = new StringBuilder();

            sb.Append("SELECT  id 供货商编号,orderid 订单号,account 手机号, money 金额, starttime 开始时间, endtime 结束时间, remark 备注, state 状态, userid 自己的编号  FROM orders WHERE starttime >= @starttime and endtime <= @endtime");
            List <MySqlParameter> list = new List <MySqlParameter>();

            list.Add(new MySqlParameter("@starttime", dateStart + "%"));
            list.Add(new MySqlParameter("@endtime", dateEnd + "%"));


            if (orderID.Length != 0)
            {
                sb.Append(" and orderid=@orderid");
                list.Add(new MySqlParameter("@orderid", orderID));
            }
            if (phone.Length != 0)
            {
                sb.Append(" and account=@account");
                list.Add(new MySqlParameter("@account", phone));
            }
            if (amount.Length != 0)
            {
                sb.Append(" and money=@money");
                list.Add(new MySqlParameter("@money", amount));
            }
            if (status.Length != 0)
            {
                sb.Append(" and state=@state");
                list.Add(new MySqlParameter("@state", status));
            }
            sb.Append(" and  userid=@userid");
            list.Add(new MySqlParameter("@userid", userID));

            // 开始查询
            DataSet ds = ConnHelper.GetDSParam(sb.ToString(), "orders", list.ToArray());

            reState(ds);
            BindToGridView(ds);
        }
示例#2
0
 protected void Bind()
 {
     BindToGridView(ConnHelper.SelectAllOrders());
 }