📄 waitdeal_orderform.cs
字号:
//
this.label5.Font = new System.Drawing.Font("宋体", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.label5.Location = new System.Drawing.Point(24, 152);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(64, 16);
this.label5.TabIndex = 6;
this.label5.Text = "目 的 地";
//
// label2
//
this.label2.Font = new System.Drawing.Font("宋体", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.label2.Location = new System.Drawing.Point(24, 112);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(64, 16);
this.label2.TabIndex = 5;
this.label2.Text = "始 发 地";
//
// label4
//
this.label4.Font = new System.Drawing.Font("宋体", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.label4.Location = new System.Drawing.Point(24, 72);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(64, 16);
this.label4.TabIndex = 4;
this.label4.Text = "客户编号";
//
// label3
//
this.label3.Font = new System.Drawing.Font("宋体", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.label3.Location = new System.Drawing.Point(24, 32);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(64, 16);
this.label3.TabIndex = 3;
this.label3.Text = "订单编号";
//
// groupBox2
//
this.groupBox2.Controls.AddRange(new System.Windows.Forms.Control[] {
this.dataGrid1,
this.toolBar1});
this.groupBox2.Location = new System.Drawing.Point(0, 32);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(472, 280);
this.groupBox2.TabIndex = 6;
this.groupBox2.TabStop = false;
this.groupBox2.Enter += new System.EventHandler(this.groupBox2_Enter);
//
// label8
//
this.label8.Font = new System.Drawing.Font("宋体", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.label8.Location = new System.Drawing.Point(88, 344);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(304, 24);
this.label8.TabIndex = 7;
this.label8.Text = "根据客户对运输的要求,进行运输路线的设计:";
//
// button1
//
this.button1.Location = new System.Drawing.Point(384, 336);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(232, 40);
this.button1.TabIndex = 8;
this.button1.Text = "运输路线设计";
this.button1.Click += new System.EventHandler(this.button1_Click_1);
//
// textBox7
//
this.textBox7.Location = new System.Drawing.Point(24, 400);
this.textBox7.Multiline = true;
this.textBox7.Name = "textBox7";
this.textBox7.Size = new System.Drawing.Size(752, 88);
this.textBox7.TabIndex = 9;
this.textBox7.Text = "";
//
// sqlDataAdapter1
//
this.sqlDataAdapter1.DeleteCommand = this.sqlDeleteCommand1;
this.sqlDataAdapter1.InsertCommand = this.sqlInsertCommand1;
this.sqlDataAdapter1.SelectCommand = this.sqlSelectCommand1;
this.sqlDataAdapter1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
new System.Data.Common.DataTableMapping("Table", "city_trans", new System.Data.Common.DataColumnMapping[] {
new System.Data.Common.DataColumnMapping("城市编码", "城市编码"),
new System.Data.Common.DataColumnMapping("城市名称", "城市名称")})});
this.sqlDataAdapter1.UpdateCommand = this.sqlUpdateCommand1;
this.sqlDataAdapter1.RowUpdated += new System.Data.SqlClient.SqlRowUpdatedEventHandler(this.sqlDataAdapter1_RowUpdated);
//
// sqlDeleteCommand1
//
this.sqlDeleteCommand1.CommandText = "DELETE FROM city_trans WHERE (城市编码 = @Original_城市编码) AND (城市名称 = @Original_城市名称)";
this.sqlDeleteCommand1.Connection = this.sqlConnection1;
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_城市编码", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "城市编码", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_城市名称", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "城市名称", System.Data.DataRowVersion.Original, null));
//
// sqlConnection1
//
this.sqlConnection1.ConnectionString = "initial catalog=logistics;integrated security=SSPI;persist security info=False;wo" +
"rkstation id=SOFT54;packet size=4096";
//
// sqlInsertCommand1
//
this.sqlInsertCommand1.CommandText = "INSERT INTO city_trans(城市名称) VALUES (@城市名称); SELECT 城市编码, 城市名称 FROM city_trans WH" +
"ERE (城市编码 = @@IDENTITY)";
this.sqlInsertCommand1.Connection = this.sqlConnection1;
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@城市名称", System.Data.SqlDbType.VarChar, 10, "城市名称"));
//
// sqlSelectCommand1
//
this.sqlSelectCommand1.CommandText = "SELECT 城市编码, 城市名称 FROM city_trans";
this.sqlSelectCommand1.Connection = this.sqlConnection1;
//
// sqlUpdateCommand1
//
this.sqlUpdateCommand1.CommandText = "UPDATE city_trans SET 城市名称 = @城市名称 WHERE (城市编码 = @Original_城市编码) AND (城市名称 = @Ori" +
"ginal_城市名称); SELECT 城市编码, 城市名称 FROM city_trans WHERE (城市编码 = @城市编码)";
this.sqlUpdateCommand1.Connection = this.sqlConnection1;
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@城市名称", System.Data.SqlDbType.VarChar, 10, "城市名称"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_城市编码", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "城市编码", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_城市名称", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "城市名称", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@城市编码", System.Data.SqlDbType.Int, 4, "城市编码"));
//
// transDataset1
//
this.transDataset1.DataSetName = "transDataset";
this.transDataset1.Locale = new System.Globalization.CultureInfo("zh-CN");
this.transDataset1.Namespace = "http://www.tempuri.org/transDataset.xsd";
//
// sqlDataAdapter2
//
this.sqlDataAdapter2.DeleteCommand = this.sqlDeleteCommand2;
this.sqlDataAdapter2.InsertCommand = this.sqlInsertCommand2;
this.sqlDataAdapter2.SelectCommand = this.sqlSelectCommand2;
this.sqlDataAdapter2.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
new System.Data.Common.DataTableMapping("Table", "trans_network", new System.Data.Common.DataColumnMapping[] {
new System.Data.Common.DataColumnMapping("路段遍号", "路段遍号"),
new System.Data.Common.DataColumnMapping("起点", "起点"),
new System.Data.Common.DataColumnMapping("终点", "终点"),
new System.Data.Common.DataColumnMapping("距离", "距离")})});
this.sqlDataAdapter2.UpdateCommand = this.sqlUpdateCommand2;
//
// sqlDeleteCommand2
//
this.sqlDeleteCommand2.CommandText = "DELETE FROM trans_network WHERE (路段遍号 = @Original_路段遍号) AND (终点 = @Original_终点) A" +
"ND (起点 = @Original_起点) AND (距离 = @Original_距离)";
this.sqlDeleteCommand2.Connection = this.sqlConnection1;
this.sqlDeleteCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_路段遍号", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "路段遍号", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_终点", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "终点", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_起点", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "起点", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_距离", System.Data.SqlDbType.Float, 8, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "距离", System.Data.DataRowVersion.Original, null));
//
// sqlInsertCommand2
//
this.sqlInsertCommand2.CommandText = "INSERT INTO trans_network(起点, 终点, 距离) VALUES (@起点, @终点, @距离); SELECT 路段遍号, 起点, 终点" +
", 距离 FROM trans_network WHERE (路段遍号 = @@IDENTITY)";
this.sqlInsertCommand2.Connection = this.sqlConnection1;
this.sqlInsertCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@起点", System.Data.SqlDbType.VarChar, 10, "起点"));
this.sqlInsertCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@终点", System.Data.SqlDbType.VarChar, 10, "终点"));
this.sqlInsertCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@距离", System.Data.SqlDbType.Float, 8, "距离"));
//
// sqlSelectCommand2
//
this.sqlSelectCommand2.CommandText = "SELECT 路段遍号, 起点, 终点, 距离 FROM trans_network";
this.sqlSelectCommand2.Connection = this.sqlConnection1;
//
// sqlUpdateCommand2
//
this.sqlUpdateCommand2.CommandText = "UPDATE trans_network SET 起点 = @起点, 终点 = @终点, 距离 = @距离 WHERE (路段遍号 = @Original_路段遍" +
"号) AND (终点 = @Original_终点) AND (起点 = @Original_起点) AND (距离 = @Original_距离); SELE" +
"CT 路段遍号, 起点, 终点, 距离 FROM trans_network WHERE (路段遍号 = @路段遍号)";
this.sqlUpdateCommand2.Connection = this.sqlConnection1;
this.sqlUpdateCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@起点", System.Data.SqlDbType.VarChar, 10, "起点"));
this.sqlUpdateCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@终点", System.Data.SqlDbType.VarChar, 10, "终点"));
this.sqlUpdateCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@距离", System.Data.SqlDbType.Float, 8, "距离"));
this.sqlUpdateCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_路段遍号", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "路段遍号", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_终点", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "终点", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_起点", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "起点", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_距离", System.Data.SqlDbType.Float, 8, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "距离", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@路段遍号", System.Data.SqlDbType.Int, 4, "路段遍号"));
//
// transDataset21
//
this.transDataset21.DataSetName = "transDataset2";
this.transDataset21.Locale = new System.Globalization.CultureInfo("zh-CN");
this.transDataset21.Namespace = "http://www.tempuri.org/transDataset2.xsd";
//
// button2
//
this.button2.Location = new System.Drawing.Point(440, 536);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(168, 40);
this.button2.TabIndex = 10;
this.button2.Text = "清空重新进行路线设计";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// sqlDataAdapter3
//
this.sqlDataAdapter3.DeleteCommand = this.sqlDeleteCommand3;
this.sqlDataAdapter3.InsertCommand = this.sqlInsertCommand3;
this.sqlDataAdapter3.SelectCommand = this.sqlSelectCommand3;
this.sqlDataAdapter3.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
new System.Data.Common.DataTableMapping("Table", "short_pragh", new System.Data.Common.DataColumnMapping[] {
new System.Data.Common.DataColumnMapping("内码", "内码"),
new System.Data.Common.DataColumnMapping("订单编号", "订单编号"),
new System.Data.Common.DataColumnMapping("最短路径", "最短路径")})});
this.sqlDataAdapter3.UpdateCommand = this.sqlUpdateCommand3;
//
// sqlDeleteCommand3
//
this.sqlDeleteCommand3.CommandText = "DELETE FROM short_pragh WHERE (内码 = @Original_内码) AND (最短路径 = @Original_最短路径 OR @" +
"Original_最短路径 IS NULL AND 最短路径 IS NULL) AND (订单编号 = @Original_订单编号 OR @Original_" +
"订单编号 IS NULL AND 订单编号 IS NULL)";
this.sqlDeleteCommand3.Connection = this.sqlConnection1;
this.sqlDeleteCommand3.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_内码", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "内码", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand3.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_最短路径", System.Data.SqlDbType.VarChar, 1000, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "最短路径", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand3.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_订单编号", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "订单编号", System.Data.DataRowVersion.Original, null));
//
// sqlInsertCommand3
//
this.sqlInsertCommand3.CommandText = "INSERT INTO short_pragh(订单编号, 最短路径) VALUES (@订单编号, @最短路径); SELECT 内码, 订单编号, 最短路径 " +
"FROM short_pragh WHERE (内码 = @@IDENTITY)";
this.sqlInsertCommand3.Connection = this.sqlConnection1;
this.sqlInsertCommand3.Parameters.Add(new System.Data.SqlClient.SqlParameter("@订单编号", System.Data.SqlDbType.Int, 4, "订单编号"));
this.sqlInsertCommand3.Parameters.Add(new System.Data.SqlClient.SqlParameter("@最短路径", System.Data.SqlDbType.VarChar, 1000, "最短路径"));
//
// sqlSelectCommand3
//
this.sqlSelectCommand3.CommandText = "SELECT 内码, 订单编号, 最短路径 FROM short_pragh";
this.sqlSelectCommand3.Connection = this.sqlConnection1;
//
// sqlUpdateCommand3
//
this.sqlUpdateCommand3.CommandText = @"UPDATE short_pragh SET 订单编号 = @订单编号, 最短路径 = @最短路径 WHERE (内码 = @Original_内码) AND (最短路径 = @Original_最短路径 OR @Original_最短路径 IS NULL AND 最短路径 IS NULL) AND (订单编号 = @Original_订单编号 OR @Original_订单编号 IS NULL AND 订单编号 IS NULL); SELECT 内码, 订单编号, 最短路径 FROM short_pragh WHERE (内码 = @内码)";
this.sqlUpdateCommand3.Connection = this.sqlConnection1;
this.sqlUpdateCommand3.Parameters.Add(new System.Data.SqlClient.SqlParameter("@订单编号", System.Data.SqlDbType.Int, 4, "订单编号"));
this.sqlUpdateCommand3.Parameters.Add(new System.Data.SqlClient.SqlParameter("@最短路径", System.Data.SqlDbType.VarChar, 1000, "最短路径"));
this.sqlUpdateCommand3.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_内码", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "内码", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand3.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_最短路径", System.Data.SqlDbType.VarChar, 1000, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "最短路径", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand3.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_订单编号", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "订单编号", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand3.Parameters.Add(new System.Data.SqlClient.SqlParameter("@内码", System.Data.SqlDbType.Int, 4, "内码"));
//
// shortpraghDataSet1
//
this.shortpraghDataSet1.DataSetName = "shortpraghDataSet";
this.shortpraghDataSet1.Locale = new System.Globalization.CultureInfo("zh-CN");
this.shortpraghDataSet1.Namespace = "http://www.tempuri.org/shortpraghDataSet.xsd";
//
// button3
//
this.button3.Location = new System.Drawing.Point(200, 536);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(168, 40);
this.button3.TabIndex = 11;
this.button3.Text = "保存此次设计结果";
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// waitdeal_orderForm
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(792, 623);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.button3,
this.button2,
this.textBox7,
this.button1,
this.label8,
this.groupBox2,
this.groupBox1,
this.label1});
this.Name = "waitdeal_orderForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "waitdeal_orderForm";
this.Load += new System.EventHandler(this.waitdeal_orderForm_Load);
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
this.groupBox1.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.transDataset1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.transDataset21)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.shortpraghDataSet1)).EndInit();
this.ResumeLayout(false);
}
#endregion
private void DataGridStateControl()
{
DataGridTableStyle ts = new DataGridTableStyle();
ts.AlternatingBackColor = Color.LightGray;
ts.MappingName = this.ds1.Tables[0].TableName;
ts.AllowSorting = false;
this.dataGrid1.TableStyles.Add(ts);
}
private void DataBingingsFunction()
{
this.textBox1.DataBindings.Add("Text",ds1.Tables[0],"订单编号");
this.textBox2.DataBindings.Add("Text",ds1.Tables[0],"客户编号");
this.textBox3.DataBindings.Add("Text",ds1.Tables[0],"始发地");
this.textBox4.DataBindings.Add("Text",ds1.Tables[0],"目的地");
this.textBox5.DataBindings.Add("Text",ds1.Tables[0],"货物名称");
this.textBox6.DataBindings.Add("Text",ds1.Tables[0],"运输时间");
}
private void waitdeal_orderForm_Load(object sender, System.EventArgs e)
{
transDataset1.Clear();
sqlDataAdapter1.Fill(transDataset1);
transDataset21.Clear();
sqlDataAdapter2.Fill(transDataset21);
shortpraghDataSet1.Clear();
sqlDataAdapter3.Fill(shortpraghDataSet1);
}
private void toolBar1_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
{
if (e.Button.ToolTipText == "首记录")
{
this.dataGrid1.UnSelect(cmAmend.Position); //取消选中指定行
cmAmend.Position = 0;
this.dataGrid1.Select(cmAmend.Position); //选中指定行
this.dataGrid1.CurrentRowIndex = cmAmend.Position; //移动表头指示图标
return;
}
if (e.Button.ToolTipText == "上一个记录")
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -