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.
86 lines
2.3 KiB
C#
86 lines
2.3 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 FrmMachine : Form
|
|
{
|
|
DbHelper dbHelper;
|
|
public FrmMachine()
|
|
{
|
|
InitializeComponent();
|
|
Init();
|
|
}
|
|
|
|
public string MachineName = "";
|
|
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 = "machinename";
|
|
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,machinename FROM dbo.T_BD_MachineInfo");
|
|
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.MachineName = 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;
|
|
}
|
|
}
|
|
}
|