教学文库网 - 权威文档分享云平台
您的当前位置:首页 > 精品文档 > 政务民生 >

企业进销存管理系统(C#含源代码) - 图文(6)

来源:网络收集 时间:2025-09-14
导读: 河南科技大学本科毕业设计 this.errAllInfo.SetError(this.txtUid, \用户名不能为空!\); } if (this.txtPwd.Text.Length this.errAllInfo.SetError(this.txtPwd, \密码不能小于6位!\); } //string P_DESDcrypt =

河南科技大学本科毕业设计

this.errAllInfo.SetError(this.txtUid, \用户名不能为空!\); }

if (this.txtPwd.Text.Length < 6) {

this.errAllInfo.SetError(this.txtPwd, \密码不能小于6位!\); }

//string P_DESDcrypt = WinFormClass.DESEncrypt(this.txtPwd.Text);

string cmdtxt = \WHERE SysLoginName='\ + this.txtUid.Text.Trim() + \;

cmdtxt += \ + this.txtPwd.Text.Trim() + \ + this.cbxDegree.SelectedValue.ToString() + \;

SqlDataReader P_dr = SqlExecute.GetReader(cmdtxt); P_dr.Read(); if (P_dr.HasRows) {

AppMain AppForm = new AppMain(); this.Hide();

PropertyClass.SendNameValue = this.txtUid.Text;

PropertyClass.SendPopedomValue = P_dr[\].ToString(); PropertyClass.SendUserIDValue = P_dr[\].ToString(); PropertyClass.SavePassword = P_dr[\].ToString(); AppForm.Show(); } else {

MessageBox.Show(\用户名、密码或身份不正确!\, \登录提示\, MessageBoxButtons.OKCancel, MessageBoxIcon.Information); P_dr.Close(); }

P_dr.Close(); }

3.6.2 系统主窗体设计

1.窗体设计

在窗体中分别添加一个MenuStrip控件、一个Timer控件和一个StatusStrip控件。

21

河南科技大学本科毕业设计

图11 系统主界面

2.代码设计

方法MenuIsVisible()根据用户权限分配显示菜单,方法代码如下:

public void MenuIsVisible()

{

ArrayList arylst = new ArrayList();

ToolStripMenuItem[] menu = new ToolStripMenuItem[] {

this.menuEmployee,this.menuCompany,this.menuCustomer,this.menuGoodsIn,this.menuGoodsOut,this.menuSellGoods,

this.menuGoodsBack,this.menuDepotChange,this.menuDepotAlarm,this.menuSysUser,this.menuPopedomSet,this.menuDatabak,this.menuReBakData };

DataSet P_ds = G_SqlClass.GetDs(\ + PropertyClass.SendNameValue + \);

for (int i = 0; i < 13; i++) {

arylst.Add(P_ds.Tables[0].Rows[0][14 + i].ToString()); }

for (int j = 0; j < arylst.Count; j++) {

if (arylst[j].ToString() == \) {

22

河南科技大学本科毕业设计

menu[j].Visible = false; } else {

menu[j].Visible = true; } } }

在窗体初始化时执行相关操作,窗体初始化代码如下: private void AppMain_Load(object sender, EventArgs e)

{

this.timer1.Start();

this.statusUser.Text = \系统操作员:\ + PropertyClass.SendNameValue; MenuIsVisible(); }

单击菜单项时执行相应操作,菜单项代码如下:

private void Menu_Click(object sender, EventArgs e)

{

//声明对WinForm窗体进行操作的类对象

WinOperationClass P_Menu = new WinOperationClass();

//调用类中的方法,完成对窗体中ToolStripMenuItem控件相应项的操作 P_Menu.ShowForm((ToolStripMenuItem)sender, this); }

退出程序时执行退出确认,确认代码如下:

private void AppMain_FormClosing(object sender, FormClosingEventArgs e)

{

if (MessageBox.Show(\确定要退出吗?\, \提示对话框\, MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) {

this.Dispose(); } else {

AppMain app = new AppMain(); app.Show(); } }

3.6.3 基本档案管理窗体设计

? 员工信息窗体(图12)

23

河南科技大学本科毕业设计

? 供应商信息窗体 ? 客户基本信息窗体

1.窗体设计

在窗体中分别添加一个ToolStrip控件、一个GroupBox控件(包含Label控件、TextBox控件和ComboBox控件)和一个DataGridView控件。

图12 员工信息窗体

2.代码设计

声明公共类SqlBaseClass和WinOperationClass两个全局对象,以及保存工具栏按钮操作状态的标识,代码如下:

SqlBaseClass G_SqlClass = new SqlBaseClass(); //声明数据库操作类的对象

WinOperationClass G_OperationForm = new WinOperationClass(); //声明对窗体操作的类对象 int G_Int_status; //保存工具栏按钮操作状态

方法ControlStatus()控制控件状态,代码如下:

private void ControlStatus()

{

this.toolSave.Enabled = !this.toolSave.Enabled; this.toolAdd.Enabled = !this.toolAdd.Enabled; this.toolCancel.Enabled = !this.toolCancel.Enabled; this.toolAmend.Enabled = !this.toolAmend.Enabled;

this.txtName.ReadOnly = !this.txtName.ReadOnly;

24

河南科技大学本科毕业设计

this.txtPhoneH.ReadOnly = !this.txtPhoneH.ReadOnly; this.txtPhoneM.ReadOnly = !this.txtPhoneM.ReadOnly; this.txtAddress.ReadOnly = !this.txtAddress.ReadOnly;

this.cbxSex.Enabled = !this.cbxSex.Enabled; this.cbxPost.Enabled = !this.cbxPost.Enabled;

this.cbxDepartment.Enabled = !this.cbxDepartment.Enabled;

this.dtBirthday.Enabled = !this.dtBirthday.Enabled; this.dgvUserInfo.Enabled = !this.dgvUserInfo.Enabled; }

方法FillControls()在控件中填充选中的DataGridView控件的数据,代码如下: < …… 此处隐藏:2652字,全部文档内容请下载后查看。喜欢就下载吧 ……

企业进销存管理系统(C#含源代码) - 图文(6).doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.jiaowen.net/wendang/446869.html(转载请注明文章来源)
Copyright © 2020-2025 教文网 版权所有
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:78024566 邮箱:78024566@qq.com
苏ICP备19068818号-2
Top
× 游客快捷下载通道(下载后可以自由复制和排版)
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能出现无法下载或内容有问题,请联系客服协助您处理。
× 常见问题(客服时间:周一到周五 9:30-18:00)