You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
87 lines
2.4 KiB
C#
87 lines
2.4 KiB
C#
using Mesnac.Basic;
|
|
using Mesnac.Codd.Session;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
|
|
namespace Mesnac.Gui.Edit.Dialog
|
|
{
|
|
public partial class FrmStation : Form
|
|
{
|
|
DbHelper dbHelper;
|
|
public FrmStation()
|
|
{
|
|
InitializeComponent();
|
|
Init();
|
|
}
|
|
|
|
public string StationName = "";
|
|
public string StationID = "";
|
|
private void Init()
|
|
{
|
|
dbHelper = DataSourceFactory.Instance.GetDbHelper(Mesnac.Basic.DataSourceFactory.MCDbType.Server);
|
|
|
|
DataTable table = getMachineList();
|
|
if (table == null || table.Rows.Count < 1)
|
|
{
|
|
MessageBox.Show("工位加载错误");
|
|
return;
|
|
}
|
|
this.comboBox1.DataSource = table;
|
|
this.comboBox1.DisplayMember = "StationName";
|
|
this.comboBox1.ValueMember = "ID";
|
|
this.comboBox1.SelectedIndex = 0;
|
|
}
|
|
|
|
private DataTable getMachineList()
|
|
{
|
|
try
|
|
{
|
|
if (dbHelper == null)
|
|
{
|
|
return null;
|
|
}
|
|
dbHelper.ClearParameter();
|
|
dbHelper.CommandType = CommandType.Text;
|
|
dbHelper.CommandText = "";
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.Append("SELECT ID,StationName FROM dbo.T_BD_SubStation ORDER BY ID");
|
|
dbHelper.CommandText = sb.ToString();
|
|
return dbHelper.ToDataTable();
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
ICSharpCode.Core.LoggingService.Error("网络服务器请求失败");
|
|
return null;
|
|
}
|
|
}
|
|
|
|
private void btnOk_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
this.StationName = this.comboBox1.Text.ToString();
|
|
this.StationID = this.comboBox1.SelectedValue.ToString();
|
|
}
|
|
catch
|
|
{ }
|
|
this.DialogResult = DialogResult.OK;
|
|
}
|
|
|
|
private void btnRefresh_Click(object sender, EventArgs e)
|
|
{
|
|
Init();
|
|
}
|
|
|
|
private void btnCancel_Click(object sender, EventArgs e)
|
|
{
|
|
this.DialogResult = DialogResult.Cancel;
|
|
}
|
|
}
|
|
}
|