每个用户都有一个UserID,当用户登录时,我需要它来搜索名为“Audit_Tasks”的表,并且旁边有ID的任何内容都需要显示在列表框中。
目前我刚尝试将登录用户传递给班级:
public partial class xamlAgentDashboard : Window
{
cAuditUserEntity _loggedInUser;
public xamlAgentDashboard(cAuditUserEntity loggedInUser)
{
_loggedInUser = loggedInUser;
InitializeComponent();
}
}
这是我要调用的表,让我们说用户1002刚刚登录我需要调用该数据库并带回来; transactionId,tasktypeid并在该用户列表框中显示:
public partial class xamlAuditorDashboard : Window
{
cEvolve_SP sp = new cEvolve_SP(Properties.Settings.Default.AppConnectionString);
List<cAuditTasksEntity> _tasks;
cAuditUserEntity _loggedInUser;
public xamlAuditorDashboard(cAuditUserEntity loggedInUser)
{
_loggedInUser = loggedInUser;
InitializeComponent();
Refresh();
}
private void Refresh()
{
var _AuditUserId = _loggedInUser;
cAuditUserEntity user = _AuditUserId as cAuditUserEntity;
int userid = user.AuditUserId;
_tasks = new List<cAuditTasksEntity>();
_tasks = sp.GetTasksByUser(userid);
}