129 lines
4.1 KiB
C#
129 lines
4.1 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.ComponentModel;
|
|||
|
using System.Data;
|
|||
|
using System.Drawing;
|
|||
|
using System.Text;
|
|||
|
using System.Windows.Forms;
|
|||
|
using DBFactory;
|
|||
|
namespace SystemConfig
|
|||
|
{
|
|||
|
public partial class FrmPCSWC : Form
|
|||
|
{
|
|||
|
|
|||
|
DBOperator dboM = new DBOperator("ManConnString", "ManDBFactory");
|
|||
|
private static FrmPCSWC _formInstance;
|
|||
|
string CommomSql="select t.wcid as <20>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD>ı<EFBFBD><C4B1><EFBFBD>,t.decription as <20><><EFBFBD><EFBFBD>,t.wcloc as <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD>PCSվ<53><D5BE>ַ from wctab t";
|
|||
|
public static FrmPCSWC FormInstance
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
if (_formInstance == null)
|
|||
|
{
|
|||
|
_formInstance = new FrmPCSWC();
|
|||
|
}
|
|||
|
return _formInstance;
|
|||
|
}
|
|||
|
set { _formInstance = value; }
|
|||
|
}
|
|||
|
public FrmPCSWC()
|
|||
|
{
|
|||
|
InitializeComponent();
|
|||
|
_formInstance = this;
|
|||
|
}
|
|||
|
|
|||
|
private void btNull_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
this.tbWCID.Text = "";
|
|||
|
this.tbDescription.Text = "";
|
|||
|
this.nudWCLoc.Value = 0;
|
|||
|
}
|
|||
|
|
|||
|
private void btNullQuery_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
this.tbContent.Text = "";
|
|||
|
this.cbField.Text = "";
|
|||
|
}
|
|||
|
|
|||
|
private void button2_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
DataView dv = dboM.ExceSQL(CommomSql + " where monitor =1 ").Tables[0].DefaultView;
|
|||
|
dataGridView1.DataSource = dv;
|
|||
|
}
|
|||
|
|
|||
|
private void btQuery_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
string df, sql;
|
|||
|
if ((this.tbContent.Text.Trim() == "") || (this.cbField.Text.Trim() == "")) return;
|
|||
|
if (this.cbField.Text == "<22>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD>ı<EFBFBD><C4B1><EFBFBD>")
|
|||
|
{
|
|||
|
df = "wcid";
|
|||
|
}
|
|||
|
else if (this.cbField.Text == "<22><><EFBFBD><EFBFBD>")
|
|||
|
{
|
|||
|
df = "decription";
|
|||
|
}
|
|||
|
else//
|
|||
|
{
|
|||
|
df = "wcloc";
|
|||
|
}
|
|||
|
sql = CommomSql + " where monitor =1 and " + df + "= '" + this.tbContent.Text + "'";
|
|||
|
DataSet ds = dboM.ExceSQL(sql);
|
|||
|
this.dataGridView1.DataSource = ds.Tables[0].DefaultView;
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw ex;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void tsmEdit_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (dataGridView1.RowCount <= 0)
|
|||
|
{
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
this.tabControl1.SelectTab("tabPage1");
|
|||
|
|
|||
|
this.tbWCID.Text = this.dataGridView1.CurrentRow.Cells[0].Value.ToString() + "";
|
|||
|
this.tbDescription.Text = this.dataGridView1.CurrentRow.Cells[1].Value.ToString() + "";
|
|||
|
this.nudWCLoc.Text = this.dataGridView1.CurrentRow.Cells[2].Value.ToString() + "";
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
private void btSave_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (MessageBox.Show("<22><>ȷ<EFBFBD><C8B7>Ҫ<EFBFBD><EFBFBD>PCS<43>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD>/<2F>ã<EFBFBD>վ<EFBFBD><D5BE>ַ<EFBFBD><D6B7>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
|
|||
|
{
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
if (this.tbWCID.Text.Trim().Length == 0)
|
|||
|
{
|
|||
|
MessageBox.Show("PCS<43>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD>/<2F>ã<EFBFBD><C3A3><EFBFBD><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|||
|
this.tbWCID.Focus();
|
|||
|
return;
|
|||
|
}
|
|||
|
string sql = "";
|
|||
|
try
|
|||
|
{
|
|||
|
sql = "UPDATE wctab t SET wcloc = " + nudWCLoc.Value + " where t.wcid= '" + this.tbWCID.Text + "'";
|
|||
|
dboM.ExceSQL(sql);
|
|||
|
MessageBox.Show("PCS<43>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD>/<2F>ã<EFBFBD>PCSվ<53><D5BE>ַ<EFBFBD>ijɹ<C4B3><C9B9><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|||
|
sql = CommomSql + " where t.wcid= '"+this.tbWCID.Text+"'" ;
|
|||
|
DataSet ds = dboM.ExceSQL(sql);
|
|||
|
this.dataGridView1.DataSource = ds.Tables[0].DefaultView;
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw ex;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
}
|