解决
感谢HAR07帮助我,以及任何已经评论过的人!
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();
_tasks = new List<cAuditTasksEntity>();
Refresh();
}
private void Refresh()
{
var _AuditUserId = _loggedInUser;
cAuditUserEntity user = _AuditUserId as cAuditUserEntity;
int userid = user.AuditUserId;
_tasks = sp.GetTasksByUser(userid).ToList();
var result = (from cAuditTasksEntity tasks in _tasks
select tasks.TaskId).ToList();
cmbToDoList.ItemsSource = result;
}
private void btnAudit_Click(object sender, RoutedEventArgs e)
{
var Audit = cmbToDoList.SelectedItem;
var _TransactionId = Audit;
cAuditTransactionsEntity transaction = _TransactionId as cAuditTransactionsEntity;
string transactionid = transaction.TransactionId;
sp.GetTransactionInfo(transactionid);
}
我想要做的是,从TaskId
我想找到TransactionId
。
从我的刷新方法中的代码中获取LoggedOnUser
并搜索TaskTable
然后找出ID旁边的任何任务,然后在一个中显示`TaskIds'那页上的组合框。
我要做的是当他们点击组合框中的TaskId
并单击“新建审核”时,另一个页面将加载并显示所有不同的信息。
http://i.stack.imgur.com/Bgek2.png
这是TaskTable,TaskID就是那里出现的组合框。
当他们从那里从组合框中选择一个新的ID并点击下一步时,我需要它来找到他们点击的TaskId旁边的transactionId,然后带回来:
http://i.stack.imgur.com/APp6E.png
圈子中的所有信息?
编辑:
cAuditTasksEntity:
namespace DAL
{
[Table(Name = "Audit_Tasks")]
public class cAuditTasksEntity
{
private int _TaskId;
private int _AuditUserId;
private string _TransactionId;
private string _TaskTypeId;
private DateTime _Date;
private string _AuditStatus;
[Column(DbType = "INT", IsPrimaryKey = true, IsDbGenerated = true)]
public int TaskId
{
get { return _TaskId; }
set { _TaskId = value; }
}
[Column(DbType = "INT")]
public int AuditUserId
{
get { return _AuditUserId; }
set { _AuditUserId = value; }
}
[Column(DbType = "CHAR(32)")]
public string TransactionId
{
get { return _TransactionId; }
set { _TransactionId = value; }
}
[Column(DbType = "CHAR(32)")]
public string TaskTypeId
{
get { return _TaskTypeId; }
set { _TaskTypeId = value; }
}
[Column(DbType = "DATETIME")]
public DateTime Date
{
get { return _Date; }
set { _Date = value; }
}
[Column(DbType = "VARCHAR(255)")]
public string AuditStatus
{
get { return _AuditStatus; }
set { _AuditStatus = value; }
}
}
}
我看到的属性也是这4个:
ToString();
GetHashCode();
GetType();
Equals();
EDIT2:
这是Audit.GetType();
显示的内容,但我不明白?
我添加了这段代码:
var result = Audit.GetType();
然后此设置结果等于:
{Name = "Int32" FullName = "System.Int32"
答案 0 :(得分:0)
我认为这就是你要找的,在给定TaskId的情况下得到transactionId:
var _TransactionId = (from task transactionid in _tasks
where task.TaskId == (int)cmbToDoList.SelectedItem
select task.TransactionId).FirstOrDefault();