// GET: App public ActionResult Index(int pageindex = 1, int appId = 0, string kword = "") { long totalItem; var dto = AppSettingBusiness.GetAppSettings(appId, pageindex, 20, kword, out totalItem); return(View(new PagedList <AppSettingDto>(dto, pageindex, 20, (int)totalItem))); }
public object Get(GetAppSettings getAppSettings) { return(new GetAppSettingsResponse() { AppSettings = AppSettingBusiness.GetAppSettings(getAppSettings.AppId) }); }
public FileResult Export(int appId) { //获取list数据 var checkList = AppSettingBusiness.GetAppSettings(appId); //db.InfoTables.Where(r => r.ProjectName != null).Select(r => new { r.ProjectName, r.InfoTypes, r.field, r.fieldtxt }).ToList(); //创建Excel文件的对象 NPOI.HSSF.UserModel.HSSFWorkbook book = new NPOI.HSSF.UserModel.HSSFWorkbook(); //添加一个sheet NPOI.SS.UserModel.ISheet sheet1 = book.CreateSheet("Sheet1"); //给sheet1添加第一行的头部标题 NPOI.SS.UserModel.IRow row1 = sheet1.CreateRow(0); row1.CreateCell(0).SetCellValue("配置键"); row1.CreateCell(1).SetCellValue("配置值"); //....N行 //将数据逐步写入sheet1各个行 for (int i = 0; i < checkList.Count(); i++) { NPOI.SS.UserModel.IRow rowtemp = sheet1.CreateRow(i + 1); rowtemp.CreateCell(0).SetCellValue(checkList[i].ConfigKey.ToString()); rowtemp.CreateCell(1).SetCellValue(checkList[i].ConfigValue.ToString()); //....N行 } // 写入到客户端 System.IO.MemoryStream ms = new System.IO.MemoryStream(); book.Write(ms); ms.Seek(0, SeekOrigin.Begin); DateTime dt = DateTime.Now; string dateTime = dt.ToString("yyMMddHHmmssfff"); string fileName = "配置" + ".xls"; return(File(ms, "application/vnd.ms-excel", fileName)); }
public dynamic Get([FromRoute] int appId) { return(new GetAppSettingsResponse() { AppSettings = AppSettingBusiness.GetAppSettings(appId) }); }
// GET: App public ActionResult Index(int pageindex = 1, int appId = 0, string kword = "") { long totalItem; var dto = AppSettingBusiness.GetAppSettings(appId, pageindex, 20, kword, out totalItem); var app = AppBusiness.GetAppById(appId); if (app != null) { ViewData["Evn"] = AppBusiness.GetAppById(appId).Environment; ViewData["ProjectName"] = AppBusiness.GetAppById(appId).AppId; } else { ViewData["Evn"] = "无法识别"; ViewData["ProjectName"] = "无法识别"; } return(View(new PagedList <AppSettingDto>(dto, pageindex, 20, (int)totalItem))); }
// GET: App public ActionResult Index(int pageindex = 1, string kword = "", int appId = 0) { long totalItem; int pageSize = 15; var pageList = AppSettingBusiness.GetAppSettings(appId, pageindex, pageSize, kword, out totalItem).ToPagedList(pageindex, pageSize, totalItem); var app = AppBusiness.GetAppById(appId); ViewBag.appid = appId; if (app != null) { ViewData["Evn"] = app.Environment; ViewData["ProjectName"] = app.AppId; } else { ViewData["Evn"] = "无法识别"; ViewData["ProjectName"] = "无法识别"; } return(View(pageList)); }