课程设计代码.docx
《课程设计代码.docx》由会员分享,可在线阅读,更多相关《课程设计代码.docx(31页珍藏版)》请在冰豆网上搜索。
课程设计代码
用户登录
usingSystem;
usingSystem.Collections.Generic;
usingSystem.ComponentModel;
usingSystem.Data;
usingSystem.Drawing;
usingSystem.Linq;
usingSystem.Text;
usingSystem.Threading.Tasks;
usingSystem.Windows.Forms;
usingSystem.Data.SqlClient;
usingSystem.Configuration;
namespacejinxiaocunSystem
{
publicpartialclass用户登录:
Form
privatestringstrcon=ConfigurationManager.ConnectionStrings["DbLink"].ToString();
public用户登录()
InitializeComponent();
}
privatevoidbutton1_Click(objectsender,EventArgse)//登录
Common.Name=this.textBox1.Text;
stringusernumber=textBox1.Text.Trim();
stringpassward=textBox2.Text.Trim();
intp=0;intq=0;
SqlConnectionconnection=newSqlConnection(strcon);
connection.Open();
if(connection.State.ToString()=="Open")
stringsqls="Select*fromEnter";
SqlDataAdapterda=newSqlDataAdapter(sqls,connection);
DataSetds=newDataSet();
da.Fill(ds,"Enter");
for(inti=0;i{if(Convert.ToInt32(ds.Tables[0].Rows[i]["productShu"])<100)p=p+1;if(Convert.ToInt32(ds.Tables[0].Rows[i]["productShu"].ToString())>1000)q=q+1;}}connection.Close(); if(radioButton1.Checked)//系统管理员登陆{stringstrsql="selectcount(*)fromEnterlablewhereusenumber='"+textBox1.Text.Trim()+"'andpassword='"+textBox2.Text.Trim()+"'androle='"+radioButton1.Text+"'";SqlCommandcmd=newSqlCommand(strsql,connection);connection.Open();inti=(int)cmd.ExecuteScalar();if(i>0){Form1aa=newForm1();aa.Show();this.Hide();}else{MessageBox.Show("请输入登录信息","错误提示",MessageBoxButtons.OKCancel,MessageBoxIcon.Stop);}}elseif(radioButton2.Checked)//部门经理登录{stringstrsql="selectcount(*)fromEnterlablewhereusenumber='"+textBox1.Text.Trim()+"'andpassword='"+textBox2.Text.Trim()+"'androle='"+radioButton2.Text+"'";SqlCommandcmd=newSqlCommand(strsql,connection);connection.Open();inti=(int)cmd.ExecuteScalar();if(i>0){Form4aa=newForm4();aa.Show();this.Hide();}else{MessageBox.Show("请输入登录信息","错误提示",MessageBoxButtons.OKCancel,MessageBoxIcon.Stop);}}elseif(radioButton3.Checked)//仓库管理员登陆{stringstrsql="selectcount(*)fromEnterlablewhereusenumber='"+textBox1.Text.Trim()+"'andpassword='"+textBox2.Text.Trim()+"'androle='"+radioButton3.Text+"'";SqlCommandcmd=newSqlCommand(strsql,connection);connection.Open();inti=(int)cmd.ExecuteScalar();if(i>0){if(p>0||q>0){MessageBox.Show("有'"+p+"'种产品不足需采购,有'"+q+"'种产品过多停止采购");}Form2aa=newForm2();aa.Show();this.Hide();}else{MessageBox.Show("请输入登录信息","错误提示",MessageBoxButtons.OKCancel,MessageBoxIcon.Stop);}}else{MessageBox.Show("请选择登录权限","错误提示",MessageBoxButtons.OKCancel,MessageBoxIcon.Stop);}connection.Close();}privatevoid用户登录_Load(objectsender,EventArgse){}}} 仓库管理员模块usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Threading.Tasks;usingSystem.Windows.Forms;usingSystem.Data.SqlClient;usingSystem.Configuration;namespacejinxiaocunSystem{publicpartialclassForm2:Form{privatestringstrcon=ConfigurationManager.ConnectionStrings["DbLink"].ToString();publicForm2(){InitializeComponent();}privatevoid修改密码_Click(objectsender,EventArgse){修改密码aa=new修改密码();aa.Show();}privatevoid出货管理_Click(objectsender,EventArgse){删除采购aa=new删除采购();aa.Show();}privatevoid进货管理_Click(objectsender,EventArgse){添加aa=new添加();aa.Show();}privatevoidbutton1_Click(objectsender,EventArgse){修改采购aa=new修改采购();aa.Show();}privatevoidbutton2_Click(objectsender,EventArgse){查询采购aa=new查询采购();aa.Show();}privatevoidbutton3_Click(objectsender,EventArgse){入库aa=new入库();aa.Show();}privatevoidbutton4_Click(objectsender,EventArgse){出库aa=new出库);aa.Show();}privatevoidbutton5_Click(objectsender,EventArgse){库存信息查询aa=new库存信息查询();aa.Show();}privatevoidbutton6_Click(objectsender,EventArgse){用户登录aa=new用户登录();aa.Show();this.Hide();}}} 经理管理模块 usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Windows.Forms;namespacejinxiaocunSystem{publicpartialclassForm4:Form{publicForm4(){InitializeComponent();}privatevoid信息查询_Click(objectsender,EventArgse){查询采购aa=new查询采购();aa.Show();}privatevoid修改密ü_Click(objectsender,EventArgse){修改密码aa=new修改密码();aa.Show();}privatevoidbutton3_Click(objectsender,EventArgse){用户登录aa=new用户登录();aa.Show();this.Hide();}privatevoidbutton1_Click(objectsender,EventArgse){库存查询aa=new库存查询();aa.Show();}}} 系统管理模块 usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Windows.Forms;namespacejinxiaocunSystem{publicpartialclassForm1:Form{publicForm1(){InitializeComponent();}privatevoid退出系统_Click(objectsender,EventArgse){用户登录aa=new用户登录();aa.Show();this.Hide();}privatevoidbutton1_Click(objectsender,EventArgse){系统管理aa=new系统管理();aa.Show();}privatevoidbutton3_Click(objectsender,EventArgse){查询采购aa=new查询采购();aa.Show();}privatevoidbutton4_Click(objectsender,EventArgse){库存查询aa=new库存查询();aa.Show();}privatevoidbutton2_Click(objectsender,EventArgse){修改密码系统_管理员_aa=new修改密码_系统管理员_();aa.Show();}} 修改密码usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Threading.Tasks;usingSystem.Windows.Forms;usingSystem.Configuration;usingSystem.Data.SqlClient;namespacejinxiaocunSystem{publicpartialclass修改密码:Form{privatestringstrcon=ConfigurationManager.ConnectionStrings["DbLink"].ToString();public修改密码(){InitializeComponent();}privatevoid确认_Click(objectsender,EventArgse){if(textBox1.Text.Trim()==textBox2.Text.Trim()){SqlConnectionconnection=newSqlConnection(strcon);connection.Open();Stringstrsql1="selectcount(*)fromEnterlablewhereusenumber='"+textBox3.Text.Trim()+"'andpassword='"+textBox4.Text.Trim()+"'";SqlCommandcmd1=newSqlCommand(strsql1,connection);inti=(int)cmd1.ExecuteScalar();if(i>0){stringstrsql="updateEnterLablesetpassword='"+textBox1.Text.Trim()+"'whereusenumber='"+textBox3.Text.Trim()+"'";SqlCommandcmd=newSqlCommand(strsql,connection);intiresult=cmd.ExecuteNonQuery();if(iresult>0){MessageBox.Show("信息更改成功");connection.Close();}else{MessageBox.Show("信息更改失败);connection.Close();}else{MessageBox.Show("旧é密ü码?输?入?错洙?误ó");connection.Close();}}else{MessageBox.Show("两次密码不一样,请重新输入","错误提示",MessageBoxButtons.OKCancel,MessageBoxIcon.Stop);return;}}privatevoid取消_Click(objectsender,EventArgse){Form4aa=newForm4();aa.Show();This.Hide();}}} 修改采购usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Windows.Forms;usingSystem.Data.SqlClient;usingSystem.Configuration;namespacejinxiaocunSystem{publicpartialclass修改采购:Form{privatestringstrcon=ConfigurationManager.ConnectionStrings["DbLink"].ToString();public修改采购(){InitializeComponent();}privatevoid修改采购_Load(objectsender,EventArgse){this.gRNTableAdapter.Fill(this.jinxiaocunSystemDataSet2.GRN);}privatevoidbutton1_Click(objectsender,EventArgse){SqlConnectionconnection=newSqlConnection(strcon);connection.Open();if(connection.State.ToString()=="Open"){if(textBox1.Text!=""&&textBox2.Text!=""&&textBox3.Text!=""&&textBox4.Text!=""&&textBox5.Text!=""&&textBox6.Text!=""&&textBox7.Text!=""&&textBox8.Text!=""){stringstrsql="updateGRNsetCredentialsnumber='"+textBox1.Text.Trim()+"',CKnumber='"+textBox2.Text.Trim()+"',Goodsnumber='"+textBox3.Text.Trim()+"',Goodnumber='"+textBox4.Text.Trim()+"',Inunit='"+textBox5.Text.Trim()+"',Incktime='"+textBox6.Text.Trim()+"',Makingpeople='"+textBox7.Text.Trim()+"',Purchasingpeople='"+textBox8.Text.Trim()+"'whereCredentialsnumber='"+textBox1.Text.Trim()+"'";SqlCommandcmda=newSqlCommand(strsql,connection);intiresult=cmda.ExecuteNonQuery();if(iresult>0)MessageBox.Show("修改信息成功");this.gRNTableAdapter.Fill(this.jinxiaocunSystemDataSet2.GRN);}else{MessageBox.Show("修改信息失骸败,"错误提示",MessageBoxButtons.OKCancel,MessageBoxIcon.Stop);return;}}else{MessageBox.Show("修改信息不能为空?","错误提示",MessageBoxButtons.OKCancel,MessageBoxIcon.Stop);return;}}connection.Close();}privatevoidbutton2_Click(objectsender,EventArgse){textBox1.Text=null;textBox2.Text=null;textBox3.Text=null;textBox4.Text=null;textBox5.Text=null;textBox6.Text=null;textBox7.Text=null;textBox8.Text=null;}}}添加采购usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSy
if(Convert.ToInt32(ds.Tables[0].Rows[i]["productShu"])<100)
p=p+1;
if(Convert.ToInt32(ds.Tables[0].Rows[i]["productShu"].ToString())>1000)
q=q+1;
}connection.Close();
if(radioButton1.Checked)//系统管理员登陆
stringstrsql="selectcount(*)fromEnterlablewhereusenumber='"+textBox1.Text.Trim()+"'andpassword='"+textBox2.Text.Trim()+"'androle='"+radioButton1.Text+"'";
SqlCommandcmd=newSqlCommand(strsql,connection);
inti=(int)cmd.ExecuteScalar();
if(i>0)
Form1aa=newForm1();
aa.Show();
this.Hide();
else{MessageBox.Show("请输入登录信息","错误提示",MessageBoxButtons.OKCancel,MessageBoxIcon.Stop);}
elseif(radioButton2.Checked)//部门经理登录
stringstrsql="selectcount(*)fromEnterlablewhereusenumber='"+textBox1.Text.Trim()+"'andpassword='"+textBox2.Text.Trim()+"'androle='"+radioButton2.Text+"'";
Form4aa=newForm4();
elseif(radioButton3.Checked)//仓库管理员登陆
stringstrsql="selectcount(*)fromEnterlablewhereusenumber='"+textBox1.Text.Trim()+"'andpassword='"+textBox2.Text.Trim()+"'androle='"+radioButton3.Text+"'";
if(p>0||q>0)
MessageBox.Show("有'"+p+"'种产品不足需采购,有'"+q+"'种产品过多停止采购");
Form2aa=newForm2();
else{MessageBox.Show("请选择登录权限","错误提示",MessageBoxButtons.OKCancel,MessageBoxIcon.Stop);}
connection.Close();
privatevoid用户登录_Load(objectsender,EventArgse)
仓库管理员模块
publicpartialclassForm2:
{privatestringstrcon=ConfigurationManager.ConnectionStrings["DbLink"].ToString();
publicForm2()
privatevoid修改密码_Click(objectsender,EventArgse)
修改密码aa=new修改密码();
privatevoid出货管理_Click(objectsender,EventArgse)
删除采购aa=new删除采购();
privatevoid进货管理_Click(objectsender,EventArgse)
添加aa=new添加();
privatevoidbutton1_Click(objectsender,EventArgse)
修改采购aa=new修改采购();
privatevoidbutton2_Click(objectsender,EventArgse)
查询采购aa=new查询采购();
privatevoidbutton3_Click(objectsender,EventArgse)
入库aa=new入库();
privatevoidbutton4_Click(objectsender,EventArgse)
出库aa=new出库);
privatevoidbutton5_Click(objectsender,EventArgse)
库存信息查询aa=new库存信息查询();
privatevoidbutton6_Click(objectsender,EventArgse)
用户登录aa=new用户登录();
经理管理模块
publicpartialclassForm4:
publicForm4()
privatevoid信息查询_Click(objectsender,EventArgse)
privatevoid修改密ü_Click(objectsender,EventArgse)
库存查询aa=new库存查询();
系统管理模块
publicpartialclassForm1:
publicForm1()
privatevoid退出系统_Click(objectsender,EventArgse)
系统管理aa=new系统管理();
修改密码系统_管理员_aa=new修改密码_系统管理员_();
修改密码
publicpartialclass修改密码:
public修改密码()
privatevoid确认_Click(objectsender,EventArgse)
if(textBox1.Text.Trim()==textBox2.Text.Trim())
Stringstrsql1="selectcount(*)fromEnterlablewhereusenumber='"+textBox3.Text.Trim()+"'andpassword='"+textBox4.Text.Trim()+"'";
SqlCommandcmd1=newSqlCommand(strsql1,connection);
inti=(int)cmd1.ExecuteScalar();
stringstrsql="updateEnterLablesetpassword='"+textBox1.Text.Trim()+"'whereusenumber='"+textBox3.Text.Trim()+"'";
intiresult=cmd.ExecuteNonQuery();
if(iresult>0)
MessageBox.Show("信息更改成功");
else
MessageBox.Show("信息更改失败);
MessageBox.Show("旧é密ü码?
输?
入?
错洙?
误ó");
MessageBox.Show("两次密码不一样,请重新输入","错误提示",MessageBoxButtons.OKCancel,MessageBoxIcon.Stop);
return;
privatevoid取消_Click(objectsender,EventArgse)
This.Hide();
修改采购
publicpartialclass修改采购:
public修改采购()
privatevoid修改采购_Load(objectsender,EventArgse)
this.gRNTableAdapter.Fill(this.jinxiaocunSystemDataSet2.GRN);
if(textBox1.Text!
=""&&textBox2.Text!
=""&&textBox3.Text!
=""&&textBox4.Text!
=""&&textBox5.Text!
=""&&textBox6.Text!
=""&&textBox7.Text!
=""&&textBox8.Text!
="")
stringstrsql="updateGRNsetCredentialsnumber='"+textBox1.Text.Trim()+"',CKnumber='"+textBox2.Text.Trim()+"',Goodsnumber='"+textBox3.Text.Trim()+"',Goodnumber='"+textBox4.Text.Trim()+"',Inunit='"+textBox5.Text.Trim()+"',Incktime='"+textBox6.Text.Trim()+"',Makingpeople='"+textBox7.Text.Trim()+"',Purchasingpeople='"+textBox8.Text.Trim()+"'whereCredentialsnumber='"+textBox1.Text.Trim()+"'";
SqlCommandcmda=newSqlCommand(strsql,connection);
intiresult=cmda.ExecuteNonQuery();
MessageBox.Show("修改信息成功");
MessageBox.Show("修改信息失骸败,"错误提示",MessageBoxButtons.OKCancel,MessageBoxIcon.Stop);
MessageBox.Show("修改信息不能为空?
","错误提示",MessageBoxButtons.OKCancel,MessageBoxIcon.Stop);
textBox1.Text=null;
textBox2.Text=null;
textBox3.Text=null;
textBox4.Text=null;
textBox5.Text=null;
textBox6.Text=null;
textBox7.Text=null;
textBox8.Text=null;
添加采购
usingSy
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1