根据个人ID过滤数据

时间:2017-04-26 08:41:15

标签: c# database linq

我想根据自己的个人数据显示数据。

  • 以上是正确的。
  • 我希望“else”语句显示他/她自己的数据。
  • 我在其他地方加了一个“WHERE”。
希望你能帮上忙。 感谢。

else
{
    using (DB.SASupportITEntities db = new DB.SASupportITEntities())
    {
        IQueryable<DB.ITCase1> dbIT = db.ITCase1;

        // Put any filter here before the next comment.
        // Example filter dbIT = dbIT.where(m => m.Department == ddlFilterDepartment.selectedValue);


        // Now start extract data from database.
        var result = (from tbCase in dbIT
                      join tbRequestor in db.View_SA_Employee on tbCase.Requestor equals tbRequestor.User_ID
                      join tbCloseBy in db.View_SA_Employee on tbCase.CloseBy equals tbCloseBy.User_ID into outerCloseBy
                      from tbCloseBy in outerCloseBy.DefaultIfEmpty()
                      join tbDept in db.View_SA_Department on tbCase.Department equals tbDept.Department_Code
                      //// where  aa => aa.User_ID == aa.selectedValue 
                      select new
                      {
                          tbCase.Area,
                          tbCase.Case_ID,
                          tbCase.CloseBy,
                          tbCase.CloseDate,
                          tbCase.CloseRemark,
                          tbCase.CreationDate,
                          tbCase.Department,
                          tbCase.DepartmentCharge,
                          tbCase.DocNo,
                          tbCase.NormalService,
                          tbCase.OtherService,
                          tbCase.Purpose,
                          RequestorName = tbRequestor.User_Name,
                          CloseByName = tbCloseBy.User_Name,
                          tbDept.Department_Name
                      }
                     ).ToList();

        gridHistory.DataSource = result;
        gridHistory.DataBind();
    }
}

0 个答案:

没有答案