Skip to content
Browse files

巡检信息OK

  • Loading branch information...
1 parent c28fa90 commit c49349de5c1d4c700ad2d8e7a9119552726e38f4 qicb committed
View
1 Application/Code/SqlHelper.cs
@@ -420,6 +420,7 @@ public static int ExecuteSqls(string[] strs)
SqlTransaction tran = conn.BeginTransaction();
SqlCommand command = new SqlCommand();
command.Connection = conn;
+ command.Transaction = tran;
try
{
foreach (string s in strs)
View
3 Application/frmAddItem.Designer.cs
@@ -221,6 +221,7 @@ private void InitializeComponent()
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.ClientSize = new System.Drawing.Size(716, 586);
this.Controls.Add(this.labID);
this.Controls.Add(this.dgvItems);
@@ -239,7 +240,9 @@ private void InitializeComponent()
this.Controls.Add(this.lblAlias);
this.Controls.Add(this.txtName);
this.Controls.Add(this.lblName);
+ this.MaximizeBox = false;
this.Name = "frmAddItem";
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "新建巡检项";
this.Load += new System.EventHandler(this.frmAddItem_Load);
((System.ComponentModel.ISupportInitialize)(this.dgvItems)).EndInit();
View
3 Application/frmAddItem.resx
@@ -120,7 +120,4 @@
<metadata name="chkColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
- <metadata name="chkColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
- <value>True</value>
- </metadata>
</root>
View
3 Application/frmAddPoint.Designer.cs
@@ -169,6 +169,7 @@ private void InitializeComponent()
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.ClientSize = new System.Drawing.Size(751, 550);
this.Controls.Add(this.labID);
this.Controls.Add(this.dgvPoint);
@@ -182,7 +183,9 @@ private void InitializeComponent()
this.Controls.Add(this.lblRelated);
this.Controls.Add(this.lblAlias);
this.Controls.Add(this.lblName);
+ this.MaximizeBox = false;
this.Name = "frmAddPoint";
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "新建巡检点";
this.Load += new System.EventHandler(this.frmAddPoint_Load);
((System.ComponentModel.ISupportInitialize)(this.dgvPoint)).EndInit();
View
3 Application/frmAddPoint.resx
@@ -120,7 +120,4 @@
<metadata name="chkColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
- <metadata name="chkColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
- <value>True</value>
- </metadata>
</root>
View
3 Application/frmAddRoutName.Designer.cs
@@ -132,6 +132,7 @@ private void InitializeComponent()
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.ClientSize = new System.Drawing.Size(313, 225);
this.Controls.Add(this.cboInOrder);
this.Controls.Add(this.label4);
@@ -145,7 +146,7 @@ private void InitializeComponent()
this.Controls.Add(this.cboSiteArea);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;
this.Name = "frmAddRoutName";
- this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
+ this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.Text = "路线详细信息";
this.Load += new System.EventHandler(this.frmAddRoutName_Load);
this.ResumeLayout(false);
View
3 Application/frmAddRoutName.cs
@@ -23,6 +23,7 @@ public frmAddRoutName()
private void frmAddRoutName_Load(object sender, EventArgs e)
{
+ this.cbo_init();
if (isEdit)
{
this.btnTrue.Text = "修改";
@@ -38,7 +39,7 @@ private void frmAddRoutName_Load(object sender, EventArgs e)
}
dr.Dispose();
}
- this.cbo_init();
+
}
private void btnTrue_Click(object sender, EventArgs e)
View
4 Application/frmAddRoute.Designer.cs
@@ -291,12 +291,16 @@ private void InitializeComponent()
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.ClientSize = new System.Drawing.Size(751, 526);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.menuStrip1);
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MainMenuStrip = this.menuStrip1;
+ this.MaximizeBox = false;
this.Name = "frmAddRoute";
+ this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.Text = "新建巡检路线";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.frmAddRoute_FormClosing);
this.Load += new System.EventHandler(this.frmAddRoute_Load);
View
40 Application/frmAddRoute.cs
@@ -119,16 +119,19 @@ private void btnAdd_Click(object sender, EventArgs e)
private void btnDel_Click(object sender, EventArgs e)
{
foreach (TreeNode node in listLogical)
- {
+ {
if (node.Parent == null)
{
Object obj_ID = SqlHelper.ExecuteScalar("Select ID From LogicalCheckPoint Where Route_ID=" + labRouteID.Text + " and PhysicalPoint_ID=" + node.Tag);
- SqlHelper.ExecuteNonQuery("Delete From LogicalCheckPoint where ID=" + obj_ID.ToString());
- if (node.Nodes.Count > 0)
+ if (obj_ID != null)
{
- foreach (TreeNode de in node.Nodes)
+ SqlHelper.ExecuteNonQuery("Delete From LogicalCheckPoint where ID=" + obj_ID.ToString());
+ if (node.Nodes.Count > 0)
{
- SqlHelper.ExecuteNonQuery("Delete From LogicalPoint_Item Where ID=" + obj_ID.ToString());
+ foreach (TreeNode de in node.Nodes)
+ {
+ SqlHelper.ExecuteNonQuery("Delete From LogicalPoint_Item Where ID=" + obj_ID.ToString());
+ }
}
}
}
@@ -244,6 +247,8 @@ private void btnSave_Click(object sender, EventArgs e)
private void 新建路线ToolStripMenuItem_Click(object sender, EventArgs e)
{
frmAddRoutName rn = new frmAddRoutName();
+ rn.Left=this.Left+(this.Width-rn.Width)/2;
+ rn.Top=this.Top+(this.Height-rn.Height)/2;
rn.tView = this.tvRoute;
rn.Show();
}
@@ -297,7 +302,6 @@ public static void tvRouteInit(TreeView tvRoute)
}
tvRoute.Nodes.Add(tnode);
}
- //tvRoute.ExpandAll();
dr.Close();
}
@@ -412,20 +416,28 @@ private void tvPhysicalPoint_NodeMouseDoubleClick(object sender, TreeNodeMouseCl
private void 删除路线ToolStripMenuItem_Click(object sender, EventArgs e)
{
- if (tvRoute.SelectedNode.Level != 2)
+ if (labRouteID.Text=="")
{
MessageBox.Show("请选择具体路线");
return;
}
- string strDel = "Delete From CheckRoute Where ID=" + tvRoute.SelectedNode.Tag;
- if (SqlHelper.ExecuteNonQuery(strDel) != 1)
+ string[] strsDel=new string[3];
+ strsDel[0]="Delete From LogicalPoint_Item Where ID in (Select ID From LogicalCheckPoint Where Route_ID=" + labRouteID.Text + ")";
+ strsDel[1] = "Delete From LogicalCheckPoint Where Route_ID=" + labRouteID.Text;
+ strsDel[2] = "Delete From CheckRoute Where ID=" + labRouteID.Text;
+
+ try
+ {
+ SqlHelper.ExecuteSqls(strsDel);
+ }
+ catch
{
- MessageBox.Show("删除失败");
- return;
+ MessageBox.Show("删除失败。请稍后再试");
}
- else
+ finally
{
tvRouteInit(tvRoute);
+ if (chkRoute.Checked) tvRoute.ExpandAll();
}
}
@@ -463,6 +475,8 @@ private void tvRoute_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEvent
if (e.Node.Level == 2)
{
frmAddRoutName fn = new frmAddRoutName();
+ fn.Left=this.Left+(this.Width-fn.Width)/2;
+ fn.Top = this.Top + (this.Height - fn.Height) / 2;
fn.tView = tvRoute;
fn.isEdit = true;
fn.routeID = e.Node.Tag;
@@ -476,6 +490,8 @@ private void toolStripMenuItem1_Click(object sender, EventArgs e)
{
frmAddRoutName fn = new frmAddRoutName();
fn.tView = tvRoute;
+ fn.Left=this.Left+(this.Width-fn.Width)/2;
+ fn.Top = this.Top + (this.Height - fn.Height) / 2;
fn.isEdit = true;
fn.routeID = tvRoute.SelectedNode.Tag;
fn.Show();
View
3 Application/frmAddRoute.resx
@@ -120,4 +120,7 @@
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
+ <metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>True</value>
+ </metadata>
</root>
View
4 Application/frmain.cs
@@ -199,7 +199,9 @@ private void tsmishebeixunjianxiang_Click(object sender, EventArgs e)
private void tsmixunjianluxian_Click(object sender, EventArgs e)
{
frmAddRoute frm = new frmAddRoute();
- frm.Show();
+ frm.Left = this.Left + (this.Width - frm.Width) / 2;
+ frm.Top = this.Top + (this.Height - frm.Height) / 2;
+ frm.Show() ;
}
}

0 comments on commit c49349d

Please sign in to comment.
Something went wrong with that request. Please try again.