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.
272 lines
8.5 KiB
272 lines
8.5 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;
|
|
|
|
namespace wcfControlMonitorClient
|
|
{
|
|
public partial class FrmTaskList : WeifenLuo.WinFormsUI.Docking.DockContent
|
|
{
|
|
#region Modified by DingXiaoxu for Dock TaskList on 20101219
|
|
|
|
#region Functions
|
|
public FrmTaskList()
|
|
{
|
|
InitializeComponent();
|
|
_formInstance = this;
|
|
this.dgvManager.DataSource = dbo.ExceSQL("select * from V_Manage_Task where " + CStaticClass.Manstatus).Tables[0].DefaultView;
|
|
this.dgvMonitor.DataSource = dbo.ExceSQL("select * from V_Monitor_Task where " + CStaticClass.Monstatus + " order by É豸ָÁîË÷Òý asc ").Tables[0].DefaultView;
|
|
}
|
|
|
|
public void ManagerRefresh(object dataSource)
|
|
{
|
|
try
|
|
{
|
|
if (this.dgvManager == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (this.dgvManager.DataSource == null || dataSource == null)
|
|
{
|
|
return;
|
|
}
|
|
if (!this.CompareDataTable((dataSource as DataView).Table, (this.dgvManager.DataSource as DataView).Table))
|
|
{
|
|
if (this.dgvManager == null)
|
|
{
|
|
return;
|
|
}
|
|
if (this.dgvManager.DataSource == null || dataSource == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
this.dgvManager.DataSource = dataSource;
|
|
|
|
|
|
}
|
|
//20100108
|
|
dataSource = null;
|
|
}
|
|
catch(Exception ex)
|
|
{
|
|
//CommonClassLib.CCarryConvert.WriteDarkCasket("Error", ex.StackTrace.ToString(), "", "", "");//ÏÔʾÐкÅ
|
|
throw ex;
|
|
}
|
|
|
|
}
|
|
|
|
public void MonitorRefresh(object dataSource)
|
|
{
|
|
try
|
|
{
|
|
if (this.dgvMonitor == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (this.dgvMonitor.DataSource == null || dataSource == null)
|
|
{
|
|
return;
|
|
}
|
|
if (!this.CompareDataTable((dataSource as DataView).Table, (this.dgvMonitor.DataSource as DataView).Table))
|
|
{
|
|
if (this.dgvMonitor == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (this.dgvMonitor.DataSource == null || dataSource == null)
|
|
{
|
|
return;
|
|
}
|
|
this.dgvMonitor.DataSource = dataSource;
|
|
}
|
|
|
|
//20100108
|
|
dataSource = null;
|
|
}
|
|
catch(Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
private void rbmanAll_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void rbmanRun_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void rbmanWait_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private bool CompareDataTable(DataTable newTable, DataTable oldTable)//Added by on 20101218 by DingXiaoxu for List refresh
|
|
{
|
|
if (newTable == null || oldTable == null)
|
|
{
|
|
return true;//20110513
|
|
}
|
|
if (newTable.Rows.Count != oldTable.Rows.Count)
|
|
{
|
|
return false;
|
|
}
|
|
if (newTable.Columns.Count != oldTable.Columns.Count)
|
|
{
|
|
return false;
|
|
}
|
|
for (int i = 0; i < newTable.Rows.Count; i++)
|
|
{
|
|
for (int j = 0; j < newTable.Columns.Count; j++)
|
|
{
|
|
if (!newTable.Rows[i][j].ToString().Equals(oldTable.Rows[i][j].ToString()))
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
|
|
|
|
private void button_StartSearch_Click(object sender, EventArgs e)
|
|
{
|
|
if (this.textBox_KeyWord.Text.Trim().Length == 0) return;
|
|
int index = 0;
|
|
bool isint = int.TryParse(this.textBox_KeyWord.Text.Trim(), out index);
|
|
|
|
if (this.comboBox_Kind.Text == "ÍÐÅÌÌõÂë")
|
|
{
|
|
CStaticClass.Monstatus = " ÍÐÅÌÌõÂë like'%" + this.textBox_KeyWord.Text.Trim() + "%' ";
|
|
}
|
|
if (this.comboBox_Kind.Text == "µ÷¶ÈÈÎÎñË÷Òý")
|
|
{
|
|
if (isint == false)
|
|
{
|
|
//MessageBox.Show("ÇëÊäÈëÊý×Ö£¡", "Îó²Ù×÷Ìáʾ£º", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
textBox_KeyWord.Text = string.Empty;
|
|
return;
|
|
}
|
|
CStaticClass.Monstatus = " µ÷¶ÈÈÎÎñË÷Òý='" + this.textBox_KeyWord.Text.Trim() + "' ";
|
|
}
|
|
if (this.comboBox_Kind.Text == "É豸ָÁîË÷Òý")
|
|
{
|
|
if (isint == false)
|
|
{
|
|
//MessageBox.Show("ÇëÊäÈëÊý×Ö£¡", "Îó²Ù×÷Ìáʾ£º", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
textBox_KeyWord.Text = string.Empty;
|
|
return;
|
|
}
|
|
CStaticClass.Monstatus = " É豸ָÁîË÷Òý='" + this.textBox_KeyWord.Text.Trim() + "' ";
|
|
}
|
|
|
|
this.MonitorTaskFilte();
|
|
}
|
|
|
|
private void MonitorTaskFilte()
|
|
{
|
|
//CStaticClass.RealRefresh = true;
|
|
MonitorRefresh(dbo.ExceSQL("select * from V_Monitor_Task where " + CStaticClass.Monstatus + " order by É豸ָÁîË÷Òý asc ").Tables[0].DefaultView);
|
|
}
|
|
|
|
private void ManageTaskFilte()
|
|
{
|
|
//CStaticClass.RealRefresh = true;
|
|
ManagerRefresh(dbo.ExceSQL("select * from V_Manage_Task where " + CStaticClass.Manstatus).Tables[0].DefaultView);
|
|
}
|
|
#endregion
|
|
|
|
#region Properties and Members
|
|
private DBOperator dbo = CStaticClass.dbo;
|
|
|
|
private static FrmTaskList _formInstance;
|
|
public static FrmTaskList FormInstance
|
|
{
|
|
get
|
|
{
|
|
if (_formInstance == null)
|
|
{
|
|
_formInstance = new FrmTaskList();
|
|
|
|
}
|
|
return _formInstance;
|
|
}
|
|
set { _formInstance = value; }
|
|
}
|
|
#endregion
|
|
|
|
private void button_DisplayAll_Click(object sender, EventArgs e)
|
|
{
|
|
CStaticClass.Monstatus = " F_Status<>-1 ";
|
|
MonitorTaskFilte();
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
private void rbmanAll_Click(object sender, EventArgs e)
|
|
{
|
|
RadioButton rb = sender as RadioButton;
|
|
if ((rb != null) && (rb.Checked == true))
|
|
{
|
|
CStaticClass.Manstatus = " F_Status<>-1 ";
|
|
}
|
|
this.ManageTaskFilte();
|
|
}
|
|
|
|
private void rbmanRun_Click(object sender, EventArgs e)
|
|
{
|
|
RadioButton rb = sender as RadioButton;
|
|
if ((rb != null) && (rb.Checked == true))
|
|
{
|
|
CStaticClass.Manstatus = " (F_Status>=1) ";
|
|
}
|
|
this.ManageTaskFilte();
|
|
}
|
|
|
|
private void rbmanWait_Click(object sender, EventArgs e)
|
|
{
|
|
RadioButton rb = sender as RadioButton;
|
|
if ((rb != null) && (rb.Checked == true))
|
|
{
|
|
CStaticClass.Manstatus = " F_Status=0 ";
|
|
}
|
|
this.ManageTaskFilte();
|
|
}
|
|
|
|
private void timerReflash_Tick(object sender, EventArgs e)
|
|
{
|
|
StringBuilder sql = new StringBuilder();
|
|
//Ë¢ÐÂÊý¾ÝÏÔʾ
|
|
this.dgvManager.BeginInvoke(new MethodInvoker(delegate()
|
|
{
|
|
sql.Remove(0, sql.Length);
|
|
sql.Append("select * from V_Manage_Task where ").Append(CStaticClass.Manstatus);
|
|
this.dgvManager.DataSource = dbo.ExceSQL(sql.ToString()).Tables[0].DefaultView;
|
|
}));
|
|
this.dgvMonitor.BeginInvoke(new MethodInvoker(delegate()
|
|
{
|
|
sql.Remove(0, sql.Length);
|
|
sql.Append("select * from V_Monitor_Task where ").Append(CStaticClass.Monstatus).Append(" order by É豸ָÁîË÷Òý asc ");
|
|
|
|
this.dgvMonitor.DataSource = dbo.ExceSQL(sql.ToString()).Tables[0].DefaultView;
|
|
}));
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|