using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Web.UI.WebControls; using System.Windows.Forms; namespace InvoicingTool { public partial class ReceiveCenter : Form { private string strValue = ""; private string _type = "serverpart"; public string StrValue { get { return strValue; } set { strValue = value; } } public ReceiveCenter(string type) { InitializeComponent(); _type = type; ReceiveCenterCodeItems(); } private void ReceiveCenterCodeItems() { string _selectsql = string.Format("select receiveserverpart_id,receivecenter_code from {0} where receiveserverpart_state = 0 order by receiveserverpart_id desc", _type== "serverpart" ? "t_receiveserverpart": "t_receiveserverpart_ex"); DataTable _DateTable = DBHelper.QueryOdbc(_selectsql).Tables[0]; if (_DateTable.Rows.Count > 0) { for (int i = 0; i < _DateTable.Rows.Count; i++) { ReceiveCenterCodeList.Items.Add(new ListItem(_DateTable.Rows[i]["receivecenter_code"].ToString(), _DateTable.Rows[i]["receiveserverpart_id"].ToString())); } } ReceiveCenterCodeList.Items.Add(new ListItem("请选择入库单号", "-1")); ReceiveCenterCodeList.Text = "请选择入库单号"; } private void btnOK_Click(object sender, EventArgs e) { if (ReceiveCenterCodeList.Text == "请选择入库单号") { MessageBox.Show("请选择入库单号", "系统提示"); return; } StrValue = ReceiveCenterCodeList.Text; DialogResult = DialogResult.OK; Close(); } } }