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.
98 lines
3.3 KiB
98 lines
3.3 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
using DBFactory;
|
|
|
|
namespace wcfControlMonitorClient
|
|
{
|
|
public partial class FrmLanePile : Form
|
|
{
|
|
DBOperator dbo = CStaticClass.dbo;
|
|
|
|
private static FrmLanePile _formInstance;
|
|
public static FrmLanePile FormInstance
|
|
{
|
|
get
|
|
{
|
|
if (_formInstance == null)
|
|
{
|
|
_formInstance = new FrmLanePile();
|
|
}
|
|
return _formInstance;
|
|
}
|
|
set { _formInstance = value; }
|
|
}
|
|
|
|
public FrmLanePile()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void Form_Load(object sender, EventArgs e)
|
|
{
|
|
|
|
|
|
string CommomSql = "select F_LANEINDEX as 巷道编号, F_ZXY as 坐标, F_CUR_NUM as 当前数量, F_MAX_NUM as 最大数量 from T_LANE_PILE";
|
|
|
|
DataView dv = dbo.ExceSQL(CommomSql).Tables[0].DefaultView;
|
|
this.dataGridView1.DataSource = dv;
|
|
}
|
|
|
|
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[1].Value.ToString() + "";
|
|
this.tbCurCount.Text = this.dataGridView1.CurrentRow.Cells[2].Value.ToString() + "";
|
|
this.tbMaxCount.Text = this.dataGridView1.CurrentRow.Cells[3].Value.ToString() + "";
|
|
}
|
|
|
|
private void btSave_Click(object sender, EventArgs e)
|
|
{
|
|
if ((tbCurCount.Text.Trim() == "") || (tbMaxCount.Text.Trim() == "") || (tbUserID.Text == ""))
|
|
{
|
|
MessageBox.Show("保存失败!", "操作提示:", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
|
return;
|
|
}
|
|
string sql = "update T_LANE_PILE set F_CUR_NUM=" + tbCurCount.Text.Trim() + ",F_MAX_NUM=" + tbMaxCount.Text.Trim() + " where F_ZXY='" + tbUserID.Text + "'";
|
|
|
|
int i_ret = dbo.ExecuteSql(sql);
|
|
if (i_ret == 1)
|
|
{
|
|
MessageBox.Show("保存成功!", "操作提示:");
|
|
string CommomSql = "select F_LANEINDEX as 巷道编号, F_ZXY as 坐标, F_CUR_NUM as 当前数量, F_MAX_NUM as 最大数量 from T_LANE_PILE";
|
|
|
|
DataView dv = dbo.ExceSQL(CommomSql).Tables[0].DefaultView;
|
|
this.dataGridView1.DataSource = dv;
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("保存失败!", "操作提示:", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
|
}
|
|
}
|
|
|
|
private void FrmLanePile_FormClosing(object sender, FormClosingEventArgs e)
|
|
{
|
|
_formInstance = null;
|
|
}
|
|
}
|
|
}
|