You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
129 lines
4.1 KiB
129 lines
4.1 KiB
5 months ago
|
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 �ӹ����ı���,t.decription as ����,t.wcloc as �������ͻ�PCSվ��ַ 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 == "�ӹ����ı���")
|
||
|
{
|
||
|
df = "wcid";
|
||
|
}
|
||
|
else if (this.cbField.Text == "����")
|
||
|
{
|
||
|
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("��ȷ��Ҫ��PCS�ӹ����ģ���/�ã�վ��ַ��Ϣ����", "������ʾ��", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
|
||
|
{
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
|
||
|
if (this.tbWCID.Text.Trim().Length == 0)
|
||
|
{
|
||
|
MessageBox.Show("PCS�ӹ����ģ���/�ã����Ų�����������ֵ��", "��������ʾ��", 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�ӹ����ģ���/�ã�PCSվ��ַ�ijɹ���", "������ʾ��", 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;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
}
|