192 lines
5.2 KiB
C#
192 lines
5.2 KiB
C#
using System;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Windows.Forms;
|
|
using AGVSystem.Cls;
|
|
|
|
namespace AGVSystem
|
|
{
|
|
// Token: 0x02000017 RID: 23
|
|
public partial class Linemanage : Form
|
|
{
|
|
// Token: 0x0600012A RID: 298 RVA: 0x00036A63 File Offset: 0x00034C63
|
|
public Linemanage()
|
|
{
|
|
this.InitializeComponent();
|
|
}
|
|
|
|
// Token: 0x0600012B RID: 299 RVA: 0x00036A94 File Offset: 0x00034C94
|
|
private void Linemanage_Load(object sender, EventArgs e)
|
|
{
|
|
this.ds = this.db.connDt("select id as 线体编号 , line_name as 线体名称 , area as 所属地图 from Assembly_Line");
|
|
bool flag = this.ds.Tables.Count > 0;
|
|
if (flag)
|
|
{
|
|
this.dataGridView1.DataSource = this.ds.Tables[0];
|
|
}
|
|
base.WindowState = FormWindowState.Maximized;
|
|
}
|
|
|
|
// Token: 0x0600012C RID: 300 RVA: 0x00036AF8 File Offset: 0x00034CF8
|
|
private void dataGridView1_DoubleClick(object sender, EventArgs e)
|
|
{
|
|
bool flag = this.dataGridView1.RowCount > 0;
|
|
if (flag)
|
|
{
|
|
this.txt_id.Text = this.dataGridView1.Rows[this.dataGridView1.CurrentRow.Index].Cells["线体编号"].Value.ToString();
|
|
this.txt_line_name.Text = this.dataGridView1.Rows[this.dataGridView1.CurrentRow.Index].Cells["线体名称"].Value.ToString();
|
|
this.comboBox1.SelectedIndex = (int)Convert.ToInt16(this.dataGridView1.Rows[this.dataGridView1.CurrentRow.Index].Cells["所属地图"].Value.ToString());
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600012D RID: 301 RVA: 0x00036BF4 File Offset: 0x00034DF4
|
|
private int Delete_Assembly_Line(string id)
|
|
{
|
|
int result = 0;
|
|
try
|
|
{
|
|
result = (int)Convert.ToInt16(this.db.Command("delete from Assembly_Line where id = " + id));
|
|
}
|
|
catch
|
|
{
|
|
}
|
|
return result;
|
|
}
|
|
|
|
// Token: 0x0600012E RID: 302 RVA: 0x00036C40 File Offset: 0x00034E40
|
|
private int Update_Assembly_Line(string id, string name, int map)
|
|
{
|
|
int result = 0;
|
|
try
|
|
{
|
|
result = (int)Convert.ToInt16(this.db.Command(string.Concat(new string[]
|
|
{
|
|
"update Assembly_Line set line_name='",
|
|
name,
|
|
"' , area = ",
|
|
map.ToString(),
|
|
" where id = ",
|
|
id
|
|
})));
|
|
}
|
|
catch
|
|
{
|
|
}
|
|
return result;
|
|
}
|
|
|
|
// Token: 0x0600012F RID: 303 RVA: 0x00036CB4 File Offset: 0x00034EB4
|
|
private int Add_Assembly_Line(string id, string name, int map)
|
|
{
|
|
int result = 0;
|
|
try
|
|
{
|
|
result = (int)Convert.ToInt16(this.db.Command(string.Concat(new string[]
|
|
{
|
|
"insert into Assembly_Line (id , line_name,area ) values (",
|
|
id,
|
|
",'",
|
|
name,
|
|
"',",
|
|
map.ToString(),
|
|
") "
|
|
})));
|
|
}
|
|
catch
|
|
{
|
|
}
|
|
return result;
|
|
}
|
|
|
|
// Token: 0x06000130 RID: 304 RVA: 0x00036D30 File Offset: 0x00034F30
|
|
private void toolStripButton1_Click(object sender, EventArgs e)
|
|
{
|
|
this.txt_id.Text = "";
|
|
this.txt_line_name.Text = "";
|
|
this.comboBox1.SelectedIndex = 0;
|
|
}
|
|
|
|
// Token: 0x06000131 RID: 305 RVA: 0x00036D64 File Offset: 0x00034F64
|
|
private void toolStripButton3_Click(object sender, EventArgs e)
|
|
{
|
|
bool flag = Param.UserName_temp == "";
|
|
if (flag)
|
|
{
|
|
MessageBox.Show("请登录管理员权限!", "AGV调度管理系统", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
|
|
}
|
|
else
|
|
{
|
|
bool flag2 = this.txt_id.Text.Trim() == "" || this.txt_line_name.Text.Trim() == "";
|
|
if (!flag2)
|
|
{
|
|
bool flag3 = this.Add_Assembly_Line(this.txt_id.Text, this.txt_line_name.Text, this.comboBox1.SelectedIndex) > 0;
|
|
if (flag3)
|
|
{
|
|
MessageBox.Show("添加成功!");
|
|
this.Linemanage_Load(null, null);
|
|
this.txt_id.Text = "";
|
|
this.txt_line_name.Text = "";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000132 RID: 306 RVA: 0x00036E4C File Offset: 0x0003504C
|
|
private void toolStripButton4_Click(object sender, EventArgs e)
|
|
{
|
|
bool flag = Param.UserName_temp == "";
|
|
if (flag)
|
|
{
|
|
MessageBox.Show("请登录管理员权限!", "AGV调度管理系统", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
|
|
}
|
|
else
|
|
{
|
|
bool flag2 = this.txt_id.Text.Trim() == "" || this.txt_line_name.Text.Trim() == "";
|
|
if (!flag2)
|
|
{
|
|
bool flag3 = this.Delete_Assembly_Line(this.txt_id.Text.Trim()) > 0;
|
|
if (flag3)
|
|
{
|
|
MessageBox.Show("删除成功!");
|
|
this.Linemanage_Load(null, null);
|
|
this.txt_id.Text = "";
|
|
this.txt_line_name.Text = "";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000133 RID: 307 RVA: 0x00036F20 File Offset: 0x00035120
|
|
private void toolStripButton6_Click(object sender, EventArgs e)
|
|
{
|
|
bool flag = Param.UserName_temp == "";
|
|
if (flag)
|
|
{
|
|
MessageBox.Show("请登录管理员权限!", "AGV调度管理系统", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
|
|
}
|
|
else
|
|
{
|
|
bool flag2 = this.txt_id.Text.Trim() == "" || this.txt_line_name.Text.Trim() == "";
|
|
if (!flag2)
|
|
{
|
|
bool flag3 = this.Update_Assembly_Line(this.txt_id.Text, this.txt_line_name.Text, this.comboBox1.SelectedIndex + 1) > 0;
|
|
if (flag3)
|
|
{
|
|
MessageBox.Show("修改成功!");
|
|
this.Linemanage_Load(null, null);
|
|
this.txt_id.Text = "";
|
|
this.txt_line_name.Text = "";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x0400041F RID: 1055
|
|
private ClsDBConn_sql db = new ClsDBConn_sql();
|
|
|
|
// Token: 0x04000420 RID: 1056
|
|
private DataSet ds = new DataSet();
|
|
}
|
|
}
|