public static string selectEmployee(string name)
{
OAEntities db = new OAEntities();
var data = from e in db.t_employeeInfo
where (e.name == name)
select new
{ e.pk_employee };
// 语句输入位置
return data.ToString();
}
public static BaseViewModel[] selectReport( string employye)
{
OAEntities db = new OAEntities();
if (employye != null && employye != "")
{ selectEmployee(employye); }
var result = db.t_report.OrderBy(r => r.fk_employee).AsEnumerable().Select(r => new BaseViewModel
{
fk_employee = r.fk_employee,
startTime = r.startTime,
endTime = r.endTime,
address = r.address,
comment = r.comment,
type = r.type
} );
return result.ToArray();
}
现在遇到的问题就是 点击查询的时候后台跳转的方法是第二个方法 根本不走第一个方法, 所以怎么解决让他如果只有根据name查询的话让他跳转第一个方法
BaseViewModel[] bvm= selectReport( pk_employee);
判断一下你前台的用户可输入的查询内容如果只有Name的填写了数据那就走方法一,如果不是则走方法二?
楼主是这个意思吗?
test 方法
if(name)
{第一个}
else{第二个}