已有56人关注
企业人事管理系统的权限管理页面无法保存的问题
发表在C#图书答疑 2010-12-03
是否精华
版块置顶:
老师您好:
企业人事管理系统的权限管理页面无法保存的问题,现在代码复制下来,请老师指教。谢谢。其中tb_Login是登陆表,权限表是tb_UserPope,字段名和企业人事管理系统中的数据表一样


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace JRQMSY.PerForm
{
public partial class F_UserPope : Form
{
public F_UserPope()
{
InitializeComponent();
}

ModuleClass.MyModule MyMC = new JRQMSY.ModuleClass.MyModule();
//定义数据库连接字符串
string strCon = "Data Source=LONGYUAN\\SQLEXPRESS;Database=db_JRGS;Uid=sa;Pwd=112167;";
linqtoqxszDataContext linq;//声明Linq连接对象


private void F_UserPope_Load(object sender, EventArgs e)
{
BindInfo();

}

private void BindInfo()
{
linq = new linqtoqxszDataContext(strCon); //实例化Linq连接对象

//获取所有员工信息
var result = from info in linq.tb_Login
select new
{
员工编号 = info.员工编号,
员工姓名 = info.员工姓名

};
dataGridView1.DataSource = result; //对DataGridView控件进行数据绑定
}


private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{

linq = new linqtoqxszDataContext(strCon); //实例化Linq连接对象
textBox1.Text = Convert.ToString(dataGridView1[0, e.RowIndex].Value).Trim();
var result = from info in linq.tb_Login
where info.员工编号 == textBox1.Text
select new
{
员工编号 = info.员工编号,
员工姓名 = info.员工姓名
};

foreach (var item in result)
{
textBox1.Text = item.员工编号;
textBox2.Text = item.员工姓名;
}
ModuleClass.MyModule.User_ID = textBox1.Text;
ModuleClass.MyModule.User_Name = textBox2.Text;

if (ModuleClass.MyModule.User_ID.Trim() == "001")
{
button1.Enabled = false;
}
else
{
button1.Enabled = true;
MyMC.Show_Pope(groupBox2.Controls, ModuleClass.MyModule.User_ID);


}

private void button2_Click(object sender, EventArgs e)
{
this.Close();
}
private void button1_Click(object sender, EventArgs e)
{
MyMC.Amend_Pope(groupBox2.Controls, ModuleClass.MyModule.User_ID);
MessageBox.Show("用户权限修改成功");
if (DataClass.MyMeans.Login_ID == ModuleClass.MyModule.User_ID)
DataClass.MyMeans.Login_n = 2;
}

}
}
分享到:
精彩评论 1
小科_mrkj
学分:43 LV2
2010-12-04
沙发
读者朋友:
    您好,请你参考一下光盘中的源代码,源程序是好使的。
首页上一页 1 下一页尾页 1 条记录 1/1页
手机同步功能介绍
友情提示:以下图书配套资源能够实现手机同步功能
明日微信公众号
明日之星 明日之星编程特训营
客服热线(每日9:00-17:00)
400 675 1066
mingrisoft@mingrisoft.com
吉林省明日科技有限公司Copyright ©2007-2022,mingrisoft.com, All Rights Reserved长春市北湖科技开发区盛北大街3333号长春北湖科技园项目一期A10号楼四、五层
吉ICP备10002740号-2吉公网安备22010202000132经营性网站备案信息 营业执照