protected void lnkBtnGetBatchNo_Click(object sender, EventArgs e) { BatchDal batchDal = new BatchDal(); ddlBatchNo.DataSource = batchDal.GetBatchNo(txtOrderDate.Text); ddlBatchNo.DataTextField = "BATCHNO"; ddlBatchNo.DataValueField = "BATCHNO"; ddlBatchNo.DataBind(); }
/// <summary> /// 获取指定日期的所有分拣批次 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void lnkBtnGetBatchNo_Click(object sender, EventArgs e) { BatchDal batchDal = new BatchDal(); ddlBatchNo.Items.Clear(); DataTable table = batchDal.GetBatchNo(txtOrderDate.Text); bool hasNoSchedul = false; foreach (DataRow row in table.Rows) { ddlBatchNo.Items.Add(new ListItem(row["BATCHNO"].ToString().Trim())); if (row["ISVALID"].ToString() == "0") hasNoSchedul = true; } if (!hasNoSchedul) { batchDal.AddBatch(txtOrderDate.Text, table.Rows.Count + 1); ddlBatchNo.Items.Add(new ListItem(Convert.ToString(table.Rows.Count + 1), "0")); } }