Skip to content

Commit

Permalink
修改默认连接字符串的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
LiuLiang authored and LiuLiang committed Jan 10, 2019
1 parent fc82830 commit 318840c
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 11 deletions.
27 changes: 27 additions & 0 deletions demo/WalkingTec.Mvvm.ApiDemo/ApiTestController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,5 +128,32 @@ public IActionResult ExportExcelByIds(Guid[] ids)
return File(data, "application/vnd.ms-excel", $"Export_FrameworkUser_{DateTime.Now.ToString("yyyy-MM-dd")}.xls");
}

[HttpGet("GetExcelTemplate")]
public IActionResult GetExcelTemplate()
{
var importVM = CreateVM<FrameworkUserImportVM>();
var qs = new Dictionary<string, string>();
foreach (var item in Request.Query.Keys)
{
qs.Add(item, Request.Query[item]);
}
importVM.SetParms(qs);
var data = importVM.GenerateTemplate(out string fileName);
return File(data, "application/vnd.ms-excel", fileName);
}

//[HttpPost("Import")]
//[ActionDescription("导入")]
//public ActionResult Import(SchoolImportVM vm, IFormCollection nouse)
//{
// if (vm.ErrorListVM.EntityList.Count > 0 || !vm.BatchSaveData())
// {
// return PartialView(vm);
// }
// else
// {
// return FFResult().RefreshGrid().CloseDialog().Alert("成功导入 " + vm.EntityList.Count.ToString() + " 行数据");
// }
//}
}
}
4 changes: 2 additions & 2 deletions demo/WalkingTec.Mvvm.Demo/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"PageMode": "Single", //页面显示模式,Single或者Tab
"FileUploadOptions": {
"UploadLimit": 20971520,
"SaveFileMode": "local", //上传文件的保存方式,可选Database,local,dfs
"UploadDir": "D://" //当上传文件选择Local时,指定硬盘目录
"SaveFileMode": "Database", //上传文件的保存方式,可选Database,local,dfs
"UploadDir": "D:\\" //当上传文件选择Local时,指定硬盘目录
},
"DFSServer": {
"StorageMaxConnection": 100,
Expand Down
2 changes: 1 addition & 1 deletion src/WalkingTec.Mvvm.Core/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ public static string GetUrlByFileAttachmentId(IDataContext dc, Guid? fileAttachm
var fileAttachment = dc.Set<FileAttachment>().Where(x => x.ID == fileAttachmentId.Value).FirstOrDefault();
if (fileAttachment != null)
{
url = "/_Framework/OutputAttachment/" + fileAttachmentId.ToString();
url = "/_Framework/GetFile/" + fileAttachmentId.ToString();

}
return url;
Expand Down
16 changes: 8 additions & 8 deletions src/WalkingTec.Mvvm.Mvc/_FrameworkController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public IActionResult GetPagingData(string _DONOT_USE_VMNAME,string _DONOT_USE_CS
//var vmType = Type.GetType(_DONOT_USE_VMNAME);
//var vmCreater = vmType.GetConstructor(Type.EmptyTypes);
//var listVM = vmCreater.Invoke(null) as BaseVM;
CurrentCS = _DONOT_USE_CS;
CurrentCS = _DONOT_USE_CS ?? "default";
var listVM = CreateVM(_DONOT_USE_VMNAME, null, null, true) as IBasePagedListVM<TopBasePoco, BaseSearcher>;
listVM.FC = qs;
if (listVM is IBasePagedListVM<TopBasePoco, ISearcher>)
Expand Down Expand Up @@ -200,7 +200,7 @@ public IActionResult GetExportExcel(string _DONOT_USE_VMNAME, string _DONOT_USE_
}
var instanceType = Type.GetType(_DONOT_USE_VMNAME);

CurrentCS = _DONOT_USE_CS;
CurrentCS = _DONOT_USE_CS ?? "default";
var listVM = CreateVM(_DONOT_USE_VMNAME) as IBasePagedListVM<TopBasePoco, ISearcher>;

listVM.FC = qs;
Expand Down Expand Up @@ -229,7 +229,7 @@ public IActionResult GetExportExcel(string _DONOT_USE_VMNAME, string _DONOT_USE_
[ActionDescription("获取模板")]
public IActionResult GetExcelTemplate(string _DONOT_USE_VMNAME, string _DONOT_USE_CS = "default")
{
CurrentCS = _DONOT_USE_CS;
CurrentCS = _DONOT_USE_CS ?? "default";
var importVM = CreateVM(_DONOT_USE_VMNAME) as IBaseImport<BaseTemplateVM>;
var qs = new Dictionary<string, string>();
foreach (var item in Request.Query.Keys)
Expand Down Expand Up @@ -296,7 +296,7 @@ public IActionResult Error()
[ActionDescription("UploadFileRoute")]
public IActionResult Upload(SaveFileModeEnum? sm = null, string groupName = null, bool IsTemprory = true, string _DONOT_USE_CS="default")
{
CurrentCS = _DONOT_USE_CS;
CurrentCS = _DONOT_USE_CS ?? "default";
var FileData = Request.Form.Files[0];
sm = sm == null ? ConfigInfo.FileUploadOptions.SaveFileMode : sm;
var vm = CreateVM<FileAttachmentVM>();
Expand All @@ -318,7 +318,7 @@ public IActionResult Upload(SaveFileModeEnum? sm = null, string groupName = null
[ActionDescription("UploadForLayUIRichTextBox")]
public IActionResult UploadForLayUIRichTextBox(string _DONOT_USE_CS = "default")
{
CurrentCS = _DONOT_USE_CS;
CurrentCS = _DONOT_USE_CS ?? "default";
var FileData = Request.Form.Files[0];
var sm = ConfigInfo.FileUploadOptions.SaveFileMode;
var vm = CreateVM<FileAttachmentVM>();
Expand All @@ -340,15 +340,15 @@ public IActionResult UploadForLayUIRichTextBox(string _DONOT_USE_CS = "default")
[ActionDescription("获取文件名")]
public IActionResult GetFileName(Guid id, string _DONOT_USE_CS = "default")
{
CurrentCS = _DONOT_USE_CS;
CurrentCS = _DONOT_USE_CS ?? "default";
FileAttachmentVM vm = CreateVM<FileAttachmentVM>(id);
return Ok(vm.Entity.FileName);
}

[ActionDescription("获取文件")]
public IActionResult GetFile(Guid id, bool stream = false, string _DONOT_USE_CS = "default")
{
CurrentCS = _DONOT_USE_CS;
CurrentCS = _DONOT_USE_CS ?? "default";
if (id == Guid.Empty)
{
return new StatusCodeResult(StatusCodes.Status404NotFound);
Expand Down Expand Up @@ -383,7 +383,7 @@ public IActionResult GetFile(Guid id, bool stream = false, string _DONOT_USE_CS
[ActionDescription("查看文件")]
public IActionResult ViewFile(Guid id, string _DONOT_USE_CS = "default")
{
CurrentCS = _DONOT_USE_CS;
CurrentCS = _DONOT_USE_CS ?? "default";
string html = string.Empty;
FileAttachmentVM vm = CreateVM<FileAttachmentVM>(id);
if (vm.Entity.FileExt.ToLower() == "pdf")
Expand Down

0 comments on commit 318840c

Please sign in to comment.