private void BindData()
    {
        pager.PageSize = PagingSize;

        HandleSortOrderDal handleSortOrderDal = new HandleSortOrderDal();

        string filter = null;
        if (ViewState["Filter"] != null)
            filter = ViewState["Filter"].ToString();

        pager.RecordCount = handleSortOrderDal.GetCount(filter);
        DataTable table = handleSortOrderDal.GetAll(pageIndex, PagingSize, filter);
        BindTable2GridView(gvMain, table);
    }
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        //保存修改到数据库
        try
        {
            HandleSortOrderDal handleSortOrderDal = new HandleSortOrderDal();
            if (ViewState["OP"].ToString() == "ADD")
            {
                handleSortOrderDal.Insert(txtOrderDate.Text,txtOrderId.Text);
            }
            else
            {
                handleSortOrderDal.Save(txtOrderDate.Text, txtOrderId.ToolTip,txtOrderId.Text);

            }
            JScript.Instance.ShowMessage(UpdatePanel1, "保存数据成功。");
        }
        catch (Exception ex)
        {
            JScript.Instance.ShowMessage(UpdatePanel1, string.Format("保存数据失败,原因:'{0}'", ex.Message));
        }
    }  
 protected void btnYes_Click(object sender, EventArgs e)
 {
     try
     {
         HandleSortOrderDal handleSortOrderDal=new HandleSortOrderDal();
         orderQuantity = handleSortOrderDal.GetQuantityByValue(orderId, orderDate,batchNo, cigaretteCode);
         if (Convert.ToInt32(quantity)>orderQuantity)
         {
             JScript.Instance.ShowMessage(UpdatePanel1, "实际分拣数量为:"+quantity+"不能大于订单数量:"+orderQuantity+"!");
         }
         else
         {
             handleSortOrderDal.updateSortQuantity(Convert.ToInt32(quantity),orderId,orderDate,batchNo,cigaretteCode);
             JScript.Instance.ShowMessage(UpdatePanel1, "已将" + Convert.ToDateTime(orderDate).ToShortDateString() + "批次:" + batchNo + "订单号:" + orderId + cigaretteName + "的分拣数量已成功修改为:" + quantity);
             pnlComfirm.Visible = false;
         }
         BindDetailData();
     }
     catch (Exception EX)
     {
         JScript.Instance.ShowMessage(UpdatePanel1,EX.Message.ToString());
     }
 }
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     HandleSortOrderDal handleSortOrderDal = new HandleSortOrderDal();
     int deleteCount = 0;
     foreach (GridViewRow row in gvMain.Rows)
     {
         if (row.Cells[0].Controls.Count != 0 && ((CheckBox)row.Cells[0].Controls[0]).Checked)
         {
             handleSortOrderDal.Delete(row.Cells[2].Text, row.Cells[3].Text);
             deleteCount++;
         }
     }
     if (deleteCount == 0)
         JScript.Instance.ShowMessage(UpdatePanel1, "请选择要删除的记录。");
     else
         JScript.Instance.ShowMessage(UpdatePanel1, "删除数据成功。");
     BindData();
 }