我对编程还很陌生,但我的任务是维护一些由以前的员工创建的应用程序。我有一个 ?: 声明,现在需要处理的不仅仅是一个真假声明,但我不知道如何去做。有问题的代码是:
MailDomainContext mail = new MailDomainContext();
mail.Load(mail.GetMailsQuery("Workforce Attendence Issue",
loadEmp.Entities.Where(emp => emp.EmployeeID == _EmployeeID).First().Username,
(loadEmp.Entities.Where(emp => emp.EmployeeID == _EmployeeID).First().EmployeeShiftID >= 2 ? "supervisor1" : "supervisor2"),
loadEmp.Entities.Where(emp => emp.EmployeeID == _EmployeeID).First().FirstName,
attendence.AttendenceDate.ToString("MM/dd/yyyy"),
attendence.TimeLost,
loadAbs.Entities.Where(abs => abs.AbsenceID == attendence.AbsenceID).First().AbsenceDescription,
(from inf in loadAtt.Entities
where inf.EmployeeID == _EmployeeID
where inf.AttendenceDate > DateTime.Now.AddDays(30 * -1)
where inf.Approved == false
select inf).Count() + 1,
attendence.UTOUsed
), null, null);
更具体地说,这一行:
(loadEmp.Entities.Where(emp => emp.EmployeeID == _EmployeeID).First().EmployeeShiftID >= 2 ? "supervisor1" : "supervisor2"),
我需要在列表中再添加 4 名主管,但还没有找到一种不会让其他一切都不愉快的方法。如果这是一个太简单的问题,或者我遗漏了一些您可能需要知道的细节,我深表歉意,因为我说过我对这一切都很陌生。