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.
136 lines
4.8 KiB
136 lines
4.8 KiB
using DBFactory;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace wcfControlMonitorClient
|
|
{
|
|
public partial class FrmTaskManage : Form
|
|
{//20151120
|
|
DBOperator dbo = CStaticClass.dbo;
|
|
|
|
private static FrmTaskManage _formInstance;
|
|
public static FrmTaskManage FormInstance
|
|
{
|
|
get
|
|
{
|
|
if (_formInstance == null)
|
|
{
|
|
_formInstance = new FrmTaskManage();
|
|
}
|
|
return _formInstance;
|
|
}
|
|
set { _formInstance = value; }
|
|
}
|
|
|
|
public FrmTaskManage()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void Form1_Load(object sender, EventArgs e)
|
|
{
|
|
|
|
button_Refresh_Click(null, EventArgs.Empty);
|
|
|
|
}
|
|
|
|
private void dataGridView1_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
|
|
{
|
|
if ((e.ColumnIndex >= 0) && (e.RowIndex >= 0) && (e.Button == MouseButtons.Right))
|
|
{
|
|
dataGridView1.ClearSelection();
|
|
dataGridView1.Rows[e.RowIndex].Selected = true;
|
|
dataGridView1.CurrentCell = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex];
|
|
|
|
}
|
|
}
|
|
|
|
private void tsmEdit_Click(object sender, EventArgs e)
|
|
{
|
|
if (dataGridView1.RowCount <= 0)
|
|
{
|
|
return;
|
|
}
|
|
|
|
this.tbUserID.Text = this.dataGridView1.CurrentRow.Cells[0].Value.ToString() + "";
|
|
this.tbMaxCount.Text = this.dataGridView1.CurrentRow.Cells[1].Value.ToString() + "";
|
|
this.tbExeMaxCount.Text = this.dataGridView1.CurrentRow.Cells[2].Value.ToString() + "";
|
|
}
|
|
|
|
private void btSave_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
int GetCount, ExeCount;
|
|
if (tbUserID.Text == "")
|
|
{
|
|
|
|
MessageBox.Show("请先选定要修改的记录!", "操作提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
if (int.TryParse(tbMaxCount.Text.Trim(), out GetCount) == false
|
|
|| (int.TryParse(tbExeMaxCount.Text.Trim(), out ExeCount) == false))
|
|
{
|
|
|
|
MessageBox.Show("请输入有效的数字!", "操作提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
|
|
if (ExeCount > 5)
|
|
{
|
|
MessageBox.Show("站台最大执行数不能大大于 5 !", "操作提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|
tbExeMaxCount.Text = "5";
|
|
return;
|
|
}
|
|
//if (int.TryParse(tbMaxCount.Text.Trim(), out GetCount) == false)
|
|
//{
|
|
|
|
// MessageBox.Show("请输入有效的数字!", "操作提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|
// return;
|
|
//}
|
|
|
|
//string sql = string.Format("update T_Base_TaskCount set F_MAXCOUNT={0},F_SplitCount={1} where F_DeviceIndex={2}", GetCount, ExeCount, tbUserID.Text);
|
|
string sql = string.Format("update T_Base_TaskCount set F_MAXCOUNT={0},F_EXECUTIONCOUNT = {2} where F_DeviceIndex={1}", GetCount, tbUserID.Text, ExeCount);
|
|
|
|
int i_ret = dbo.ExecuteSql(sql);
|
|
if (i_ret == 1)
|
|
{
|
|
MessageBox.Show("保存成功!", "操作提示:");
|
|
button_Refresh_Click(null, EventArgs.Empty);
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("保存失败!", "操作提示:", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
private void FrmTaskManage_FormClosing(object sender, FormClosingEventArgs e)
|
|
{
|
|
_formInstance = null;
|
|
}
|
|
|
|
|
|
|
|
private void button_Refresh_Click(object sender, EventArgs e)
|
|
{
|
|
//string CommomSql = "select F_DeviceIndex as 终点设备编号, F_MAXCOUNT as 获取任务数量,F_SplitCount as 同层拆分任务数量,F_REMARK as 描述 from T_Base_TaskCount";
|
|
string CommomSql = "select F_DeviceIndex as 终点设备编号, F_MAXCOUNT as 获取任务数量,F_EXECUTIONCOUNT as 任务执行数量 from T_Base_TaskCount";
|
|
|
|
|
|
DataView dv = dbo.ExceSQL(CommomSql).Tables[0].DefaultView;
|
|
this.dataGridView1.DataSource = dv;
|
|
}
|
|
}
|
|
}
|