un positionnement de paramètre workflow des pros
This commit is contained in:
parent
fbd352e788
commit
96746fcc0b
322 changed files with 25893 additions and 3844 deletions
20
Yavsc/ViewComponents/DirectoryViewComponent.cs
Normal file
20
Yavsc/ViewComponents/DirectoryViewComponent.cs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
using Microsoft.AspNet.Mvc;
|
||||
|
||||
namespace Yavsc.ViewComponents
|
||||
{
|
||||
using System.Threading.Tasks;
|
||||
using Yavsc.ViewModels.UserFiles;
|
||||
|
||||
public class DirectoryViewComponent : ViewComponent
|
||||
{
|
||||
public async Task<IViewComponentResult> InvokeAsync(string dirname)
|
||||
{
|
||||
IViewComponentResult result = null;
|
||||
await Task.Run(() =>
|
||||
{
|
||||
result = View(new UserDirectoryInfo(User.Identity.Name, dirname));
|
||||
});
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -21,8 +21,11 @@ namespace Yavsc.ViewComponents
|
|||
{
|
||||
return await InvokeAsync(id,"Html");
|
||||
}
|
||||
|
||||
public async Task<IViewComponentResult> InvokeAsync(long id, string outputFormat ="Html")
|
||||
public async Task<IViewComponentResult> InvokeAsync(long id, string outputFormat ="Html")
|
||||
{
|
||||
return await InvokeAsync(id,outputFormat,false,false);
|
||||
}
|
||||
public async Task<IViewComponentResult> InvokeAsync(long id, string outputFormat ="Html", bool asBill = false, bool acquitted = false)
|
||||
{
|
||||
return await Task.Run( ()=> {
|
||||
Estimate estimate =
|
||||
|
|
@ -34,7 +37,12 @@ namespace Yavsc.ViewComponents
|
|||
.Include(e => e.Bill).FirstOrDefault(x => x.Id == id);
|
||||
if (estimate == null)
|
||||
throw new Exception("No data");
|
||||
|
||||
var di = new DirectoryInfo(Startup.SiteSetup.UserFiles.Bills);
|
||||
var dia = new DirectoryInfo(Startup.SiteSetup.UserFiles.Avatars);
|
||||
ViewBag.BillsDir = di.FullName;
|
||||
ViewBag.AvatarsDir = dia.FullName;
|
||||
ViewBag.AsBill = asBill;
|
||||
ViewBag.Acquitted = acquitted;
|
||||
if (outputFormat == "LaTeX") {
|
||||
return this.View("Estimate_tex", estimate);
|
||||
}
|
||||
|
|
@ -56,6 +64,7 @@ namespace Yavsc.ViewComponents
|
|||
|
||||
return this.View("Estimate_pdf",
|
||||
new PdfGenerationViewModel{
|
||||
Temp = Startup.Temp,
|
||||
TeXSource = tex,
|
||||
DestDir = Startup.UserBillsDirName,
|
||||
BaseFileName = $"estimate-{id}"
|
||||
|
|
@ -67,4 +76,4 @@ namespace Yavsc.ViewComponents
|
|||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue