课程设计代码.docx

上传人:b****5 文档编号:6098126 上传时间:2023-01-03 格式:DOCX 页数:31 大小:19.80KB
下载 相关 举报
课程设计代码.docx_第1页
第1页 / 共31页
课程设计代码.docx_第2页
第2页 / 共31页
课程设计代码.docx_第3页
第3页 / 共31页
课程设计代码.docx_第4页
第4页 / 共31页
课程设计代码.docx_第5页
第5页 / 共31页
点击查看更多>>
下载资源
资源描述

课程设计代码.docx

《课程设计代码.docx》由会员分享,可在线阅读,更多相关《课程设计代码.docx(31页珍藏版)》请在冰豆网上搜索。

课程设计代码.docx

课程设计代码

用户登录

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

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 求职职场 > 简历

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1