自动包装机数控软件源码.docx
《自动包装机数控软件源码.docx》由会员分享,可在线阅读,更多相关《自动包装机数控软件源码.docx(114页珍藏版)》请在冰豆网上搜索。
自动包装机数控软件源码
usingSystem;
usingSystem.Drawing;
usingSystem.Collections;
usingSystem.ComponentModel;
usingSystem.Windows.Forms;
usingSystem.Data;
usingSystem.Data.SqlClient;
namespaceWindowsApplication4
{
privatevoidsure_button_Click(objectsender,System.EventArgse)
if(textID.Text.Trim()!
=string.Empty)
userID=textID.Text.Trim();
else
MessageBox.Show("");
return;
passWord=textPwdOld.Text.Trim();
else
MessageBox.Show("");
return;
if(textPwdNew1.Text.Trim()!
=string.Empty)
NewPassWord1=textPwdNew1.Text.Trim();
else
MessageBox.Show("");
return;
NewPassWord2=textPwdNew2.Text.Trim();
MessageBox.Show("");
return;
SqlConnectionmyConn=null;
SqlTransactionUserInsertTra=null;
DataSetUserInfoSet=newDataSet();
if(NewPassWord1==NewPassWord2)
ry
{
myConn=newSqlConnection("server=.;
Trusted_Connection=yes;user=sa;pwd=1;database=storage");
myConn.Open();
PwdAdapter.SelectCommand.CommandText
="SELECT*FROMLonInFrmWHEREUserID='"+userID+"'";
PwdAdapter.SelectCommand.Connection=myConn;
PwdAdapter.Fill(UserInfoSet,"UserInfoTab");
if(UserInfoSet.Tables["UserInfoTab"]==null
||UserInfoSet.Tables["UserInfoTab"].Rows.Count==0)
{
MessageBox.Show("Userisnotexist");
this.textID.Focus();
this.textID.Select(0,this.textID.Text.Length);
return;
}
if(UserInfoSet.Tables["UserInfoTab"].Rows[0]
["PassWord"].ToString().Trim()!
=passWord)
{
MessageBox.Show("PassWordError!
");
this.textPwdOld.Focus();
this.textPwdOld.Select(0,this.textPwdOld.Text.Length);
return;
}
UserInfoSet.Tables["UserInfoTab"].Rows[0]
["PassWord"]=NewPassWord1;
UserInsertTra=myConn.BeginTransaction();
PwdAdapter.UpdateCommand.Connection=myConn;
PwdAdapter.UpdateCommand.Transaction=UserInsertTra;
PwdAdapter.Update(UserInfoSet.Tables[0]);
UserInsertTra.Commit();
MessageBox.Show("OK");
}
catch(Exceptionex)
{
UserInsertTra.Rollback();
MessageBox.Show(ex.Message);
}
finally
{
if(myConn.State!
=ConnectionState.Closed)
{
myConn.Close();
privatevoidesc_button_Click(objectsender,System.EventArgse)
{
this.Close();
usingSystem;
usingSystem.Drawing;
usingSystem.Collections;
usingSystem.ComponentModel;
usingSystem.Windows.Forms;
usingSystem.Data;
usingSystem.Data.SqlClient;
namespaceWindowsApplication4
{
publicclassReturnStg:
System.Windows.Forms.Form
{
privateSystem.Windows.Forms.GroupBoxgroupBox1;
privateSystem.Windows.Forms.Labellabel2;
privateSystem.Windows.Forms.Labellabel3;
privateSystem.Windows.Forms.Labellabel4;
privateSystem.Windows.Forms.Labellabel5;
privateSystem.Windows.Forms.Labellabel6;
privateSystem.Windows.Forms.TextBoxtextNum2;
privateSystem.Windows.Forms.TextBoxtextDate;
privateSystem.Windows.Forms.TextBoxtextAmount;
privateSystem.Windows.Forms.TextBoxtextMan;
privateSystem.Windows.Forms.DataGriddataGrid1;
privateDataTableReturnInfo=newDataTable();
privateDataSetReturnset=newDataSet();
privateCurrencyManagerReReport;
privateSqlTransactionReturnTran;
privateSqlConnectionMyConn=newSqlConnection
("server=.;Trusted_Connection=yes;user=sa;pwd=1;database=storage");
privateSystem.Data.SqlClient.SqlCommandsqlSelectCommand1;
privateSystem.Data.SqlClient.SqlCommandsqlInsertCommand1;
privateSystem.Data.SqlClient.SqlCommandsqlUpdateCommand1;
privateSystem.Data.SqlClient.SqlCommandsqlDeleteCommand1;
privateSystem.Data.SqlClient.SqlConnectionsqlConnection1;
privateSystem.Windows.Forms.TextBoxtextDep;
privateSystem.Windows.Forms.Buttoncancel_button;
privateSystem.Windows.Forms.Buttonsend_button;
privateSystem.Windows.Forms.Buttonadd_button;
privateSystem.Data.SqlClient.SqlDataAdapterRetnAdapter;
privatestringoldtxtAmount="";
privateboolchange=false;
privateSystem.ComponentModel.Containercomponents=null;
publicReturnStg()
{
InitializeComponent();
}
protectedoverridevoidDispose(booldisposing)
{
if(disposing)
{
if(components!
=null)
{
components.Dispose();
}
}
base.Dispose(disposing);
}
privatevoidInitializeComponent()
{
this.groupBox1=newSystem.Windows.Forms.GroupBox();
this.textDep=newSystem.Windows.Forms.TextBox();
this.textMan=newSystem.Windows.Forms.TextBox();
this.textAmount=newSystem.Windows.Forms.TextBox();
this.textDate=newSystem.Windows.Forms.TextBox();
this.textNum2=newSystem.Windows.Forms.TextBox();
this.label6=newSystem.Windows.Forms.Label();
this.label5=newSystem.Windows.Forms.Label();
this.label4=newSystem.Windows.Forms.Label();
this.label3=newSystem.Windows.Forms.Label();
this.label2=newSystem.Windows.Forms.Label();
this.add_button=newSystem.Windows.Forms.Button();
this.send_button=newSystem.Windows.Forms.Button();
this.cancel_button=newSystem.Windows.Forms.Button();
this.dataGrid1=newSystem.Windows.Forms.DataGrid();
this.RetnAdapter=newSystem.Data.SqlClient.SqlDataAdapter();
this.sqlDeleteCommand1=newSystem.Data.SqlClient.SqlCommand();
this.sqlConnection1=newSystem.Data.SqlClient.SqlConnection();
this.sqlInsertCommand1=newSystem.Data.SqlClient.SqlCommand();
this.sqlSelectCommand1=newSystem.Data.SqlClient.SqlCommand();
this.sqlUpdateCommand1=newSystem.Data.SqlClient.SqlCommand();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
this.SuspendLayout();
this.groupBox1.Controls.Add(this.textDep);
this.groupBox1.Controls.Add(this.textMan);
this.groupBox1.Controls.Add(this.textAmount);
this.groupBox1.Controls.Add(this.textDate);
this.groupBox1.Controls.Add(this.textNum2);
this.groupBox1.Controls.Add(this.label6);
this.groupBox1.Controls.Add(this.label5);
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.add_button);
this.groupBox1.Controls.Add(this.send_button);
this.groupBox1.Controls.Add(this.cancel_button);
this.groupBox1.Location=newSystem.Drawing.Point(24,192);
this.groupBox1.Name="groupBox1";
this.groupBox1.Size=newSystem.Drawing.Size(456,144);
this.groupBox1.TabIndex=4;
this.groupBox1.TabStop=false;
this.groupBox1.Text="";
this.textDep.Location=newSystem.Drawing.Point(80,96);
this.textDep.Name="textDep";
this.textDep.Size=newSystem.Drawing.Size(248,21);
this.textDep.TabIndex=9;
this.textDep.Text="";
this.textMan.Location=newSystem.Drawing.Point(240,56);
this.textMan.Name="textMan";
this.textMan.Size=newSystem.Drawing.Size(88,21);
this.textMan.TabIndex=8;
this.textMan.Text="";
this.textAmount.Location=newSystem.Drawing.Point(80,56);
this.textAmount.Name="textAmount";
this.textAmount.Size=newSystem.Drawing.Size(88,21);
this.textAmount.TabIndex=7;
this.textAmount.Text="";
this.textDate.Location=newSystem.Drawing.Point(240,16);
this.textDate.Name="textDate";
this.textDate.Size=newSystem.Drawing.Size(88,21);
this.textDate.TabIndex=6;
this.textDate.Text="";
this.textNum2.Location=newSystem.Drawing.Point(80,16);
this.textNum2.Name="textNum2";
this.textNum2.Size=newSystem.Drawing.Size(88,21);
this.textNum2.TabIndex=5;
this.textNum2.Text="";
this.label6.Location=newSystem.Drawing.Point(8,96);
this.label6.Name="label6";
this.label6.Size=newSystem.Drawing.Size(72,16);
this.label6.TabIndex=4;
this.label6.Text="";
this.label5.Location=newSystem.Drawing.Point(184,64);
this.label5.Name="label5";
this.label5.Size=newSystem.Drawing.Size(56,24);
this.label5.TabIndex=3;
this.label5.Text=";
this.label4.Location=newSystem.Drawing.Point(16,56);
this.label4.Name="label4";
this.label4.Size=newSystem.Drawing.Size(48,16);
this.label4.TabIndex=2;
this.label4.Text="";
this.label3.Location=newSystem.Drawing.Point(176,16);
this.label3.Name="label3";
this.label3.Size=newSystem.Drawing.Size(80,16);
this.label3.TabIndex=1;
this.label3.Text="
this.label2.Location=newSystem.Drawing.Point(16,24);
this.label2.Name="label2";
this.label2.Size=newSystem.Drawing.Size(72,16);
this.label2.TabIndex=0;
this.add_button.Font=newSystem.Drawing.Font
("ok",9F,System.Drawing.FontStyle.Regular,
System.Drawing.GraphicsUnit.Point,((System.Byte)(134)));
this.add_button.Location=newSystem.Drawing.Point(376,16);
this.add_button.Name="add_button";
this.add_button.Size=newSystem.Drawing.Size(72,24);
this.add_button.TabIndex=1;
this.add_button.Click+=newSystem.EventHandler(this.add_button_Click);
this.send_button.Font=newSystem.Drawing.Font
("ok",9F,System.Drawing.FontStyle.Regular,
System.Drawing.GraphicsUnit.Point,((System.Byte)(134)));
this.send_button.Location=newSystem.Drawing.Point(376,64);
this.send_button.Name="send_button";
this.send_button.Size=newSystem.Drawing.Size(72,24);
this.send_button.TabIndex=2;
this.send_button.Click+=newSystem.EventHandler(this.send_button_Click);
this.cancel_button.Font=newSystem.Drawing.Font
("ok",9F,System.Drawing.FontStyle.Regular,
System.Drawing.GraphicsUnit.Point,((System.Byte)(134)));
this.cancel_button.Location=newSystem.Drawing.Point(376,112);
this.cancel_button.Name="cancel_button";
this.cancel_button.Size=newSystem.Drawing.Size(72,24);
this.cancel_button.TabIndex=3;
this.cancel_button.Click+=newSystem.EventHandler(this.cancel_button_Click);
this.dataGrid1.DataMember="";
this.dataGrid1.HeaderForeColor=System.Drawing.SystemColors.ControlText;
this.dataGrid1.Location=newSystem.Drawing.Point(24,8);
this.dataGrid1.Name="dataGrid1";
this.dataGrid1.Size=newSystem.Drawing.Size(456,168);
this.dataGrid1.TabIndex=6;
this.dataGrid1.Click+=newSystem.EventHandler(this.dataGrid1_Select);
this.RetnAdapter.DeleteCommand=this.sqlDeleteCommand1;
this.RetnAdapter.InsertCommand=this.sqlInsertCommand1;
this.RetnAdapter.SelectCommand=this.sqlSelectCommand1;
this.RetnAdapter.TableMappings.AddRange
(newSystem.Data.Common.DataTableMapping[]
{
newSystem.Data.Common.DataTableMapping
("Table","storage_retn",newSystem.Data.Common.DataColumnMapping[]
{UserInfoSet.Tables["UserInfoTab"].Rows[0]
["PassWord"]=NewPassWord1;
UserInsertTra=m