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.
226 lines
8.2 KiB
226 lines
8.2 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
using DBFactory;
|
|
using Microsoft.VisualBasic;
|
|
namespace SystemConfig
|
|
{
|
|
public partial class FrmItemTaskTypeEdit : Form
|
|
{
|
|
private static FrmItemTaskTypeEdit _formInstance;
|
|
bool IfUpdate = false;
|
|
DBOperator dbo = CStaticClass.dbo;
|
|
public static FrmItemTaskTypeEdit FormInstance
|
|
{
|
|
get
|
|
{
|
|
if (_formInstance==null)
|
|
{
|
|
_formInstance = new FrmItemTaskTypeEdit();
|
|
}
|
|
return _formInstance;
|
|
}
|
|
set { _formInstance = value; }
|
|
}
|
|
public FrmItemTaskTypeEdit()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void btQuery_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
string df, sql;
|
|
if (this.tbContent.Text.Trim() == "") return;
|
|
if (this.cbField.Text == "���������ij��������͵ı���")
|
|
{
|
|
df = "FCODE";
|
|
}
|
|
else//����·������
|
|
{
|
|
df = "FINTERCODE";
|
|
}
|
|
sql = "SELECT FCODE AS ���������ij��������͵ı���,FINTERCODE AS ����·������,FNAME AS " +
|
|
" ��������������,FSOFTCONFIRM AS ��Ҫ��ȷ�� FROM T_ITEMTASKTYPE where " +
|
|
df + "= " + Convert.ToInt32(this.tbContent.Text);
|
|
DataSet ds = dbo.ExceSQL(sql);
|
|
this.dataGridView1.DataSource = ds.Tables[0].DefaultView;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
private void btNullQuery_Click(object sender, EventArgs e)
|
|
{
|
|
this.cbField.Text = "";
|
|
this.tbContent.Text = "";
|
|
}
|
|
|
|
private void btSave_Click(object sender, EventArgs e)
|
|
{
|
|
if (MessageBox.Show("��ȷ��Ҫ�������������͵�������Ϣ����", "������ʾ��", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
|
|
{
|
|
return;
|
|
}
|
|
string sql = "";
|
|
string strsql;
|
|
if (Information.IsNumeric(this.textBox4.Text) == false)
|
|
{
|
|
MessageBox.Show("���������ij��������͵ı���ֻ�����������ͣ�", "��������ʾ��", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
|
|
if (this.comboBox1.Text.Trim().Length == 0)
|
|
{
|
|
MessageBox.Show("����·�����Ͳ������ǿ�ֵ��", "��������ʾ��", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
if (this.textBox1.Text.Trim().Length == 0)
|
|
{
|
|
MessageBox.Show("�������������Ʋ������ǿ�ֵ��", "��������ʾ��", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
string fc, fi, fn;
|
|
char fs;
|
|
char[] cc = new char[1] {':' };
|
|
fc = this.textBox4.Text;
|
|
string[] sp = this.comboBox1.Text.Split(cc);
|
|
fi = sp[0];
|
|
fn = textBox1.Text;
|
|
if (checkBox1.Checked == true)
|
|
{
|
|
fs = '1';
|
|
}
|
|
else
|
|
{
|
|
fs = '0';
|
|
}
|
|
DataSet ds;
|
|
strsql = "SELECT FCODE, FINTERCODE, FNAME, FSOFTCONFIRM FROM T_ITEMTASKTYPE WHERE FCODE = '" + this.textBox4.Text.Trim() + "'";
|
|
if (dbo.Exists(strsql) == false)
|
|
{
|
|
IfUpdate = false;
|
|
}
|
|
if (IfUpdate == true)
|
|
{
|
|
sql = "update T_ITEMTASKTYPE set FNAME='" + fn + "',FSOFTCONFIRM='" + fs + "', FINTERCODE= '" + fi + "' where FCODE='" + fc + "'";
|
|
ds = dbo.ExceSQL(sql);
|
|
MessageBox.Show("������������Ϣ�ijɹ���", "������ʾ��", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
IfUpdate = false;
|
|
}
|
|
else
|
|
{
|
|
strsql = "SELECT FCODE, FINTERCODE, FNAME, FSOFTCONFIRM FROM T_ITEMTASKTYPE WHERE FCODE = '" + fc + "'";
|
|
if (dbo.Exists(strsql) == true)
|
|
{
|
|
|
|
MessageBox.Show("���������ij��������͵ı��벻���������ظ���ֵ��", "��������ʾ��", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
|
|
sql = "INSERT INTO T_ITEMTASKTYPE (FCODE, FINTERCODE,FNAME,FSOFTCONFIRM)VALUES ('" + fc + "','" + fi + "','" + fn + "','" + fs + "')";
|
|
ds = dbo.ExceSQL(sql);
|
|
MessageBox.Show("�豸������Ϣ¼���ɹ���", "������ʾ��", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
}
|
|
ds.Clear();
|
|
strsql = "SELECT FCODE AS ���������ij��������͵ı���,FINTERCODE AS ����·������,FNAME AS " +
|
|
" ��������������,FSOFTCONFIRM AS ��Ҫ��ȷ�� FROM T_ITEMTASKTYPE where " +
|
|
" FCODE='"+fc+"'";
|
|
ds = dbo.ExceSQL(strsql);
|
|
this.dataGridView1.DataSource = ds.Tables[0].DefaultView;
|
|
}
|
|
|
|
private void btNull_Click(object sender, EventArgs e)
|
|
{
|
|
this.textBox1.Text = "";
|
|
this.textBox4.Text = "";
|
|
this.comboBox1.Text = "";
|
|
this.checkBox1.Checked = false;
|
|
|
|
}
|
|
|
|
private void button1_Click(object sender, EventArgs e)
|
|
{
|
|
IfUpdate = false;
|
|
}
|
|
|
|
private void FrmItemTaskTypeEdit_Load(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void tsmEdit_Click(object sender, EventArgs e)
|
|
{
|
|
string strname = "";
|
|
if (dataGridView1.RowCount <= 0)
|
|
{
|
|
return;
|
|
}
|
|
this.tabControl1.SelectTab("tabPage1");
|
|
this.textBox4.Text = this.dataGridView1.CurrentRow.Cells[0].Value.ToString() + "";
|
|
//1:����;2:����;3:����;9:���˻���;91:��������;92:���̳���
|
|
switch (this.dataGridView1.CurrentRow.Cells[1].Value.ToString())
|
|
{
|
|
case "1" :
|
|
strname = ":����";
|
|
break;
|
|
case "2":
|
|
strname = ":����";
|
|
break;
|
|
case "3":
|
|
strname = ":����";
|
|
break;
|
|
case "9":
|
|
strname = ":���˻���";
|
|
break;
|
|
case "91":
|
|
strname = ":��������";
|
|
break;
|
|
case "92":
|
|
strname = "::���̳���";
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
|
|
this.comboBox1.Text = this.dataGridView1.CurrentRow.Cells[1].Value.ToString() + strname ;
|
|
this.textBox1.Text = this.dataGridView1.CurrentRow.Cells[2].Value.ToString() + "";
|
|
if (this.dataGridView1.CurrentRow.Cells[3].Value.ToString()=="1")
|
|
this.checkBox1.Checked = true;
|
|
else
|
|
this.checkBox1.Checked = false;
|
|
|
|
IfUpdate = true;
|
|
}
|
|
|
|
private void tsmDel_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
if (dataGridView1.RowCount <= 0)
|
|
{
|
|
return;
|
|
}
|
|
if (MessageBox.Show("��ȷ��Ҫɾ��ѡ���еġ������������������ͣ�" + this.dataGridView1.CurrentRow.Cells[0].Value.ToString() + "��Ϣ����", "������ʾ��", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
|
|
{
|
|
return;
|
|
}
|
|
dbo.ExceSQL("delete from T_ITEMTASKTYPE where FCODE ='" + this.dataGridView1.CurrentRow.Cells[0].Value+"'" );
|
|
button2_Click(sender, e);
|
|
}
|
|
|
|
private void button2_Click(object sender, EventArgs e)
|
|
{
|
|
string sql = "SELECT FCODE AS ���������ij��������͵ı���,FINTERCODE AS ����·������,FNAME AS " +
|
|
" ��������������,FSOFTCONFIRM AS ��Ҫ��ȷ�� FROM T_ITEMTASKTYPE";
|
|
DataSet ds = dbo.ExceSQL(sql);
|
|
this.dataGridView1.DataSource = ds.Tables[0].DefaultView;
|
|
}
|
|
}
|
|
}
|