考虑到用户分为管理员和普通用户,管理员可以查看所有人的工资记录,而普通用户只能查看自己的工资。
新建ShowPayForm窗体
控件:Label,ComboBox,Button,DataGridView,TextBox
DataGridView绑定StaffInfo表,readonly=true
编辑ComboBox,输入StaffInfo.Office属性
在窗体加载时应该对当前用户的类型进行识别,如果是普通用户,则禁用分类搜索功能且之读取该用户的工资信息
private static int id = Form1.ID;
private string SelectValue=”“;
private void ShowPayForm_Load(object sender, EventArgs e)
{
if (Form1.UserType.Trim() == "Administrator")
{
// TODO: 这行代码将数据加载到表“staffDataSet.Pay”中。您可以根据需要移动或删除它。
this.payTableAdapter.Fill(this.staffDataSet.Pay);
}
else
{
string sql = "select*from Pay where I