public ActionResult OutPutEmp2Roles() { List<AutekInfo.Common.ExcTitvsFeilds> list_excelTitle = new List<AutekInfo.Common.ExcTitvsFeilds>(); list_excelTitle.Add(new AutekInfo.Common.ExcTitvsFeilds() { title = "ID", feild = "m_emp_role_id" }); list_excelTitle.Add(new AutekInfo.Common.ExcTitvsFeilds() { title = "姓名", feild = "emp_cnname" }); list_excelTitle.Add(new AutekInfo.Common.ExcTitvsFeilds() { title = "角色代码", feild = "role_code" }); list_excelTitle.Add(new AutekInfo.Common.ExcTitvsFeilds() { title = "角色名称", feild = "role_name" }); list_excelTitle.Add(new AutekInfo.Common.ExcTitvsFeilds() { title = "角色描述", feild = "role_describe" }); var b = new AutekInfo.BLL.View_Emp_Role(); List<AutekInfo.Model.View_Emp_Role> list_m = b.GetModelList(""); string temp_filepath = AutekInfo.Common.ExcelHelper.OutputList(list_excelTitle, list_m); return File(temp_filepath, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "导出role2emp.xlsx"); }
public string GetEmp2Roles() { string sort = Request["sort"]; bool order = Request["order"] == "desc" ? true : false; var b = new AutekInfo.BLL.View_Emp_Role(); var list = new List<AutekInfo.Model.View_Emp_Role>(); if (order) { list = b.GetModelList("").OrderByDescending(o => o.GetType().GetProperty(sort).GetValue(o, null)).ToList(); } else { list = b.GetModelList("").OrderBy(o => o.GetType().GetProperty(sort).GetValue(o, null)).ToList(); } return JsonConvert.SerializeObject(list); }