private void BindDetailData()
 {
     string filter = ViewState["DetailFilter"].ToString();
     OrderScheduleDal osDal = new OrderScheduleDal();
     pagerDetail.PageSize = PagingSize;
     pagerDetail.RecordCount = osDal.GetDetailCount(filter) ;
     DataTable table = osDal.GetDetailAll(detailPageIndex, PagingSize, filter);
     BindTable2GridView(gvDetail, table);
 }
    private void BindData()
    {
        pager.PageSize = PagingSize;

        OrderScheduleDal osDal = new OrderScheduleDal();
        string filter = null;
        if (ViewState["Filter"] != null)
            filter = ViewState["Filter"].ToString();
        pager.RecordCount = osDal.GetMasterCount(filter);
        DataTable table = osDal.GetMasterAll(pageIndex, PagingSize, filter);
        BindTable2GridView(gvMain, table);
    }
        /// <summary>
        /// 创建数据文件
        /// </summary>
        /// <param name="orderDate"></param>
        /// <param name="batchNo"></param>
        private void CreateDataFile(string orderDate, int batchNo)
        {

            FileStream file = new FileStream(parameter["NoOneProFilePath"] + txtFile, FileMode.Create);
            StreamWriter writer = new StreamWriter(file, Encoding.UTF8);
            OrderScheduleDal orderDal = new OrderScheduleDal();
            DataTable table;
            int columnCount;

            if (!this.isAbnormity)
            {
                //正常分拣打码
                table = orderDal.GetOrder(orderDate, batchNo, 1);
                columnCount = table.Columns.Count;
                foreach (DataRow row in table.Rows)
                {
                    string s = row["SORTNO"].ToString();
                    for (int i = 1; i < columnCount; i++)
                        s += ("," + row[i].ToString().Trim());
                    s += ";";
                    writer.WriteLine(s);
                    writer.Flush();
                }
            }

            if (!this.isAbnormity)
            {
                //手工分拣打码
                table = orderDal.GetOrder(orderDate, batchNo, 2);
                columnCount = table.Columns.Count;
                foreach (DataRow row in table.Rows)
                {
                    string s = row["SORTNO"].ToString();
                    for (int i = 1; i < columnCount; i++)
                        s += ("," + row[i].ToString().Trim());
                    s += ";";
                    writer.WriteLine(s);
                    writer.Flush();
                }
            }

            if (!this.isAbnormity)
            {
                //整件分拣打码
                table = orderDal.GetOrder(orderDate, batchNo, 3);
                columnCount = table.Columns.Count;
                foreach (DataRow row in table.Rows)
                {
                    string s = row["SORTNO"].ToString();
                    for (int i = 1; i < columnCount; i++)
                        s += ("," + row[i].ToString().Trim());
                    s += ";";
                    writer.WriteLine(s);
                    writer.Flush();
                }
            }

            if (this.isAbnormity)
            {
                //异形分拣打码
                table = orderDal.GetOrder(orderDate, batchNo, 4);
                columnCount = table.Columns.Count;
                int index_cigarette = 0;
                string cigaretteCode = "";
                foreach (DataRow row in table.Rows)
                {
                    if (cigaretteCode != row[4].ToString().Trim())
                    {
                        index_cigarette++;
                        cigaretteCode = row[4].ToString().Trim();
                    }
                    string s = row["SORTNO"].ToString();
                    s += ("," + index_cigarette.ToString());

                    for (int i = 2; i < columnCount; i++)
                        s += ("," + row[i].ToString().Trim());
                    s += ";";
                    writer.WriteLine(s);
                    writer.Flush();
                }
            }

            file.Close();
        }