Paul Schneider 9 years ago
commit 6a3f644eab
163 changed files with 7350 additions and 3528 deletions

@ -1,99 +0,0 @@
//
// PostJson.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// Copyright (c) 2015 Paul Schneider
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System.Net;
using System.IO;
using System.Threading.Tasks;
using Newtonsoft.Json;
using System;
using System.Json;
namespace Yavsc.Helpers
{
/// <summary>
/// Simple json post method.
/// </summary>
public class SimpleJsonPostMethod : IDisposable
{
private HttpWebRequest request=null;
/// <summary>
/// Initializes a new instance of the Yavsc.Helpers.SimpleJsonPostMethod class.
/// </summary>
/// <param name="pathToMethod">Path to method.</param>
public SimpleJsonPostMethod (string pathToMethod, string authorizationHeader = null)
{
request = (HttpWebRequest) WebRequest.Create (pathToMethod);
request.Method = "POST";
request.Accept = "application/json";
request.ContentType = "application/json";
request.SendChunked = true;
request.TransferEncoding = "UTF-8";
if (authorizationHeader!=null)
request.Headers["Authorization"]=authorizationHeader;
}
public void Dispose()
{
request.Abort();
}
/// <summary>
/// Invoke the specified query.
/// </summary>
/// <param name="query">Query.</param>
public TAnswer Invoke<TAnswer>(object query)
{
using (Stream streamQuery = request.GetRequestStream()) {
using (StreamWriter writer = new StreamWriter(streamQuery)) {
writer.Write (JsonConvert.SerializeObject(query));
}}
TAnswer ans = default (TAnswer);
using (WebResponse response = request.GetResponse ()) {
using (Stream responseStream = response.GetResponseStream ()) {
using (StreamReader rdr = new StreamReader (responseStream)) {
ans = (TAnswer) JsonConvert.DeserializeObject<TAnswer> (rdr.ReadToEnd ());
}
}
response.Close();
}
return ans;
}
public async Task<JsonValue> InvokeJson(object query)
{
JsonValue jsonDoc=null;
using (Stream streamQuery = request.GetRequestStream()) {
using (StreamWriter writer = new StreamWriter(streamQuery)) {
writer.Write (JsonConvert.SerializeObject(query));
}}
using (WebResponse response = request.GetResponse ()) {
using (Stream stream = response.GetResponseStream ()) {
if (stream.Length>0)
jsonDoc = await Task.Run (() => JsonObject.Load (stream));
}
response.Close();
}
return jsonDoc;
}
}
}

@ -1,7 +0,0 @@
{
"name": "Yavsc.Api",
"version": "0.0.0",
"devDependencies": {
"gulp": "^3.9.0"
}
}

@ -1,21 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>5c3248ac-cae0-4324-8a70-08f2dca9fb08</ProjectGuid>
<RootNamespace>Yavsc.Api</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<ProduceOutputsOnBuild>True</ProduceOutputsOnBuild>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ActiveDebugProfile>Démarrer</ActiveDebugProfile>
</PropertyGroup>
</Project>

@ -1,8 +0,0 @@
#!/bin/bash
dnu pack
cp -a bin/Debug/*.nupkg ~/Nupkgs
(cd ../Yavsc && dnu install Yavsc.Api)
(cd ../testOauthClient && dnu install Yavsc.Api)

@ -1,30 +0,0 @@
{
"version": "1.0.0-*",
"description": "Api Class Library",
"authors": [
"Class Library template"
],
"tags": [
""
],
"projectUrl": "",
"licenseUrl": "",
"tooling": {
"defaultNamespace": "Yavsc"
},
"dependencies": {
"EntityFramework.Commands": "7.0.0-rc1-*",
"EntityFramework.Core": "7.0.0-rc1-*",
"EntityFramework.MicrosoftSqlServer": "7.0.0-rc1-*",
"EntityFramework.Relational": "7.0.0-rc1-*",
"Microsoft.AspNet.Identity.EntityFramework": "3.0.0-rc1-*",
"Newtonsoft.Json": "9.0.1",
"System.Json": "4.0.20126.16343"
},
"frameworks": {
"net451": {
"dependencies": {
}
}
}
}

File diff suppressed because it is too large Load Diff

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="EmitMSBuildWarning" BeforeTargets="Build">
<Warning Text="Les packages contenant des cibles et des fichiers de propriétés MSBuild ne peuvent pas être installés complètement dans des projets ciblant plusieurs infrastructures. Les cibles et les fichiers de propriétés MSBuild ont été ignorés." />
</Target>
</Project>

@ -1,16 +0,0 @@
{
"locked": false,
"version": 2,
"targets": {
".NETFramework,Version=v4.5.1": {},
".NETPortable,Version=v4.5,Profile=Profile111": {}
},
"libraries": {},
"projectFileDependencyGroups": {
"": [],
".NETFramework,Version=v4.5.1": [],
".NETPortable,Version=v4.5,Profile=Profile111": []
},
"tools": {},
"projectFileToolGroups": {}
}

@ -11,6 +11,7 @@ namespace Yavsc.WebApi.Controllers
using Models.Account;
using ViewModels.Account;
using Models.Auth;
using Yavsc.Helpers;
[Authorize,Route("~/api/account")]
public class ApiAccountController : Controller
@ -136,31 +137,37 @@ namespace Yavsc.WebApi.Controllers
);
return Ok(user);
}
/// <summary>
/// Actually only updates the user's name.
/// </summary>
/// <param name="me">MyUpdate containing the new user name </param>
/// <returns>Ok when all is ok.</returns>
[HttpPut("~/api/me")]
public async Task<IActionResult> UpdateMe(MyUpdate me)
{
var ko = new BadRequestObjectResult(
new { error = "Specify some valid update request." });
if (me==null) return ko;
if (me.Avatar==null && me.UserName == null) return ko;
if (!ModelState.IsValid) return new BadRequestObjectResult(
new { error = "Specify some valid user update request." });
var user = await _userManager.FindByIdAsync(User.GetUserId());
if (me.UserName !=null) {
var result = await _userManager.SetUserNameAsync(user, me.UserName);
if (result.Succeeded)
return Ok();
else return new BadRequestObjectResult(result);
}
if (me.Avatar!=null) {
user.Avatar = me.Avatar;
var result = await _userManager.UpdateAsync(user);
if (!result.Succeeded)
/// <summary>
/// Updates the avatar
/// </summary>
/// <returns></returns>
[HttpPost("~/api/setavatar")]
public async Task<IActionResult> SetAvatar()
{
AddErrors("Avatar", result);
return new BadRequestObjectResult(ModelState);
}
}
return Ok();
var root = User.InitPostToFileSystem(null);
var user = await _userManager.FindByIdAsync(User.GetUserId());
if (Request.Form.Files.Count!=1)
return new BadRequestResult();
var info = user.ReceiveAvatar(Request.Form.Files[0]);
await _userManager.UpdateAsync(user);
return Ok(info);
}
}
}

@ -1,21 +1,31 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Claims;
using Microsoft.AspNet.Authorization;
using Microsoft.AspNet.Mvc;
using Yavsc.Helpers;
using Yavsc.Models;
using Yavsc.Models.FileSystem;
namespace Yavsc.ApiControllers
{
public class FSQuotaException : Exception {
}
[Authorize,Route("api/fs")]
public class FileSystemApiController : Controller
{
ApplicationDbContext dbContext;
private IAuthorizationService AuthorizationService;
public FileSystemApiController(ApplicationDbContext context,
IAuthorizationService authorizationService)
{
AuthorizationService = authorizationService;
dbContext = context;
}
[HttpGet()]
@ -34,43 +44,20 @@ namespace Yavsc.ApiControllers
return Ok(files);
}
public class FileRecievedInfo
{
public string DestDir { get; set; }
public string ContentDisposition { get; set; }
public bool Overriden { get; set; }
}
[HttpPost]
public IEnumerable<FileRecievedInfo> Post(string subdir="")
{
var root = Path.Combine(Startup.UserFilesDirName, User.Identity.Name);
// TOSO secure this path
// if (subdir!=null) root = Path.Combine(root, subdir);
var diRoot = new DirectoryInfo(root);
if (!diRoot.Exists) diRoot.Create();
var root = User.InitPostToFileSystem(subdir);
foreach (var f in Request.Form.Files.GetFiles("Files"))
{
var item = new FileRecievedInfo();
item.ContentDisposition = f.ContentDisposition;
var fi = new FileInfo(Path.Combine(root, f.ContentDisposition));
if (fi.Exists) item.Overriden = true;
using (var dest = fi.OpenWrite())
{
using (var org = f.OpenReadStream())
{
byte[] buffer = new byte[1024];
int o = 0, c;
while ((c = org.Read(buffer, o, 1024)) > 0)
var user = dbContext.Users.Single(
u => u.Id == User.GetUserId()
);
foreach (var f in Request.Form.Files)
{
dest.Write(buffer, o, c);
o += 1024;
// TODO quota
}
dest.Close();
org.Close();
}
}
var item = user.ReceiveUserFile(root, f);
dbContext.SaveChanges();
yield return item;
};
}

@ -8,6 +8,7 @@ using Microsoft.AspNet.Razor;
namespace Yavsc.ApiControllers
{
using Models;
using Helpers;
[Route("api/pdfestimate"), Authorize]
public class PdfEstimateController : Controller
@ -79,13 +80,21 @@ namespace Yavsc.ApiControllers
public IActionResult GetTex(long id)
{
Response.ContentType = "text/x-tex";
return ViewComponent("Estimate",new object[] { id, false });
return ViewComponent("Estimate",new object[] { id, "LaTeX" });
}
[HttpPost("gen/{id}")]
public IActionResult GeneratePdf(long id)
{
return ViewComponent("Estimate",new object[] { id, true } );
return ViewComponent("Estimate",new object[] { id, "Pdf" } );
}
[HttpPost("prosign/{id}")]
public IActionResult ProSign(long id)
{
if (Request.Form.Files.Count!=1)
return new BadRequestResult();
return Ok (User.ReceiveProSignature(id,Request.Form.Files[0]));
}
}
}

@ -23,10 +23,10 @@ namespace Yavsc
StarHunterGroupName = "StarHunter",
BlogModeratorGroupName = "Moderator",
FrontOfficeGroupName = "FrontOffice",
UserBillsFilesDir= "Bills",
UserFilesDir = "UserFiles",
GCMNotificationUrl = "https://gcm-http.googleapis.com/gcm/send",
KeyProtectorPurpose = "OAuth.AspNet.AuthServer";
KeyProtectorPurpose = "OAuth.AspNet.AuthServer",
UserFilesPath = "/UserFiles",
AvatarsPath = "/Avatars" ;
public static readonly Scope[] SiteScopes = { 
new Scope { Id = "profile", Description = "Your profile informations" },  
new Scope { Id = "book" , Description ="Your booking interface"},  

@ -183,6 +183,7 @@ namespace Yavsc.Controllers
var result = await _userManager.CreateAsync(user, model.Password);
if (result.Succeeded)
{
user.DiskQuota = Startup.SiteSetup.UserFiles.Quota;
// For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=532713
// Send an email with this link
var code = await _userManager.GenerateEmailConfirmationTokenAsync(user);

@ -1,9 +1,9 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Mime;
using System.Security.Claims;
using Microsoft.AspNet.Authorization;
using Microsoft.AspNet.FileProviders;
using Microsoft.AspNet.Http;
using Microsoft.AspNet.Mvc;
using Microsoft.Data.Entity;
@ -62,9 +62,6 @@ namespace Yavsc.Controllers
{
return HttpNotFound();
}
DirectoryInfo di = new DirectoryInfo(_site.UserFiles.DirName);
return View(estimate);
}
@ -106,21 +103,26 @@ namespace Yavsc.Controllers
cmd => cmd.Id == estimate.CommandId
);
var userdir = Path.Combine(
_site.UserFiles.DirName,
var billsdir = Path.Combine(
_site.UserFiles.Bills,
perfomerProfile.Performer.UserName
);
var fsp = new PhysicalFileProvider(userdir);
var billsdir = Path.Combine(userdir,
Constants.UserBillsFilesDir);
foreach (var gr in newGraphics)
{
ContentDisposition contentDisposition = new ContentDisposition(gr.ContentDisposition);
gr.SaveAs(
Path.Combine(
Path.Combine(billsdir, estimate.Id.ToString()),
gr.ContentDisposition));
contentDisposition.FileName));
}
foreach (var formFile in newFiles)
{
ContentDisposition contentDisposition = new ContentDisposition(formFile.ContentDisposition);
formFile.SaveAs(
Path.Combine(
Path.Combine(billsdir, estimate.Id.ToString()),
contentDisposition.FileName));
}
return RedirectToAction("Index");
}

@ -106,7 +106,9 @@ namespace Yavsc.Controllers
PostalAddress = user.PostalAddress?.Address,
FullName = user.FullName,
Avatar = user.Avatar,
BankInfo = user.BankInfo
BankInfo = user.BankInfo,
DiskUsage = user.DiskUsage,
DiskQuota = user.DiskQuota
};
if (_dbContext.Performers.Any(x => x.PerformerId == user.Id))
{
@ -481,7 +483,7 @@ namespace Yavsc.Controllers
[HttpGet, Authorize]
public IActionResult SetAvatar()
{
throw new NotImplementedException();
return View();
}
[HttpGet, Authorize]

@ -1,36 +1,187 @@
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Net.Mime;
using System.Security.Claims;
using Microsoft.AspNet.Http;
using Yavsc.ApiControllers;
using Yavsc.Models;
using Yavsc.Models.FileSystem;
using Yavsc.ViewModels.UserFiles;
namespace Yavsc.Helpers
{
public static class FileSystemHelpers {
public static class FileSystemHelpers
{
public static UserDirectoryInfo GetUserFiles(this ClaimsPrincipal user,string subdir) {
public static UserDirectoryInfo GetUserFiles(this ClaimsPrincipal user, string subdir)
{
UserDirectoryInfo di = new UserDirectoryInfo(user.Identity.Name,subdir);
UserDirectoryInfo di = new UserDirectoryInfo(user.Identity.Name, subdir);
return di;
}
static char [] ValidChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_~.".ToCharArray();
static char[] ValidChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_~.".ToCharArray();
public static bool IsValidDirectoryName(this string name)
{ 
return !name.Any(c=> !ValidChars.Contains(c));
{
return !name.Any(c => !ValidChars.Contains(c));
}
public static bool IsValidPath(this string path)
{ 
if (path==null) return true;
{
if (path == null) return true;
foreach (var name in path.Split(Path.DirectorySeparatorChar))
{
if (name!=null)
if (name != null)
if (!IsValidDirectoryName(name)
|| name.Equals("..")) return false;
|| name.Equals(".."))
return false;
}
return true;
}
public static string InitPostToFileSystem(
this ClaimsPrincipal user,
string subpath)
{
var root = Path.Combine(Startup.UserFilesDirName, user.Identity.Name);
// TOSO secure this path
// if (subdir!=null) root = Path.Combine(root, subdir);
var diRoot = new DirectoryInfo(root);
if (!diRoot.Exists) diRoot.Create();
if (subpath != null)
if (subpath.IsValidPath())
{
root = Path.Combine(root, subpath);
diRoot = new DirectoryInfo(root);
if (!diRoot.Exists) diRoot.Create();
}
return root;
}
public static FileRecievedInfo ReceiveUserFile(this ApplicationUser user, string root, IFormFile f)
{
long usage = user.DiskUsage;
var item = new FileRecievedInfo();
// form-data; name="file"; filename="capt0008.jpg"
ContentDisposition contentDisposition = new ContentDisposition(f.ContentDisposition);
item.FileName = contentDisposition.FileName;
var fi = new FileInfo(Path.Combine(root, item.FileName));
if (fi.Exists) item.Overriden = true;
using (var dest = fi.OpenWrite())
{
using (var org = f.OpenReadStream())
{
byte[] buffer = new byte[1024];
long len = org.Length;
if (len > (user.DiskQuota - usage)) throw new FSQuotaException();
usage += len;
while (len > 0)
{
int blen = len > 1024 ? 1024 : (int)len;
org.Read(buffer, 0, blen);
dest.Write(buffer, 0, blen);
len -= blen;
}
dest.Close();
org.Close();
}
}
user.DiskUsage = usage;
return item;
}
public static FileRecievedInfo ReceiveAvatar(this ApplicationUser user, IFormFile formFile)
{
var item = new FileRecievedInfo();
item.FileName = user.UserName + ".png";
var destFileName = Path.Combine(Startup.SiteSetup.UserFiles.Avatars, item.FileName);
var fi = new FileInfo(destFileName);
if (fi.Exists) item.Overriden = true;
Rectangle cropRect = new Rectangle();
using (var org = formFile.OpenReadStream())
{
Image i = Image.FromStream(org);
using (Bitmap source = new Bitmap(i))
{
if (i.Width != i.Height)
{
if (i.Width > i.Height)
{
cropRect.X = (i.Width - i.Height) / 2;
cropRect.Y = 0;
cropRect.Width = i.Height;
cropRect.Height = i.Height;
}
else
{
cropRect.X = 0;
cropRect.Y = (i.Height - i.Width) / 2;
cropRect.Width = i.Width;
cropRect.Height = i.Width;
}
using (var cropped = source.Clone(cropRect, source.PixelFormat))
{
CreateAvatars(user,cropped);
}
}
}
}
item.DestDir = "/Avatars";
user.Avatar = item.FileName;
return item;
}
private static void CreateAvatars(this ApplicationUser user, Bitmap source)
{
var dir = Startup.SiteSetup.UserFiles.Avatars;
var name = user.UserName + ".png";
var smallname = user.UserName + ".s.png";
var xsmallname = user.UserName + ".xs.png";
using (Bitmap newBMP = new Bitmap(source, 128, 128))
{
newBMP.Save(Path.Combine(
dir, name), ImageFormat.Png);
}
using (Bitmap newBMP = new Bitmap(source, 64, 64))
{
newBMP.Save(Path.Combine(
dir, smallname), ImageFormat.Png);
}
using (Bitmap newBMP = new Bitmap(source, 32, 32))
{
newBMP.Save(Path.Combine(
dir, xsmallname), ImageFormat.Png);
}
}
public static FileRecievedInfo ReceiveProSignature(this ClaimsPrincipal user, long estimateId, IFormFile formFile)
{
var item = new FileRecievedInfo();
item.FileName = $"estimate-prosign-{estimateId}.png";
var destFileName = Path.Combine(Startup.SiteSetup.UserFiles.Blog, item.FileName);
var fi = new FileInfo(destFileName);
if (fi.Exists) item.Overriden = true;
using (var org = formFile.OpenReadStream())
{
Image i = Image.FromStream(org);
using (Bitmap source = new Bitmap(i))
{
source.Save(destFileName, ImageFormat.Png);
}
}
throw new NotImplementedException();
}
}
}

@ -23,12 +23,13 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNet.Identity;
using Yavsc.Models;
using Yavsc.Models.Auth;
using Yavsc.Models.Google.Messaging;
using Yavsc.Models.Messaging;
namespace Yavsc.Helpers
{
using Models.Auth;
using Models.Google.Messaging;
using Models.Messaging;
using Models;
/// <summary>
/// Google helpers.
/// </summary>

@ -1,25 +1,30 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using Microsoft.AspNet.Http;
using Microsoft.AspNet.Mvc;
using Microsoft.AspNet.Mvc.Rendering;
using Microsoft.AspNet.Mvc.ViewEngines;
using Yavsc.ViewModels.Gen;
namespace Yavsc.Helpers
{
public class TeXString {
public class TeXString
{
public class Replacement {
public class Replacement
{
string target;
string replacement;
public Replacement(string target, string replacement){
this.target=target;
this.replacement=replacement;
public Replacement(string target, string replacement)
{
this.target = target;
this.replacement = replacement;
}
public string Execute(string source)
{
return source.Replace(target,replacement);
return source.Replace(target, replacement);
}
}
@ -49,9 +54,11 @@ namespace Yavsc.Helpers
new Replacement("","\\textendash")
};
string data;
public TeXString(string str) {
public TeXString(string str)
{
data = str;
foreach (var r in SpecialCharsRendering) {
foreach (var r in SpecialCharsRendering)
{
data = r.Execute(data);
}
}
@ -65,23 +72,66 @@ namespace Yavsc.Helpers
{
public static string NewLinesWith(this string target, string separator)
{
var items = target.Split(new char[] {'\n'}).Where(
s=> !string.IsNullOrWhiteSpace(s) ) ;
var items = target.Split(new char[] { '\n' }).Where(
s => !string.IsNullOrWhiteSpace(s));
return string.Join(separator, items);
}
public static TeXString ToTeX(string target, string lineSeparator="\n\\\\")
public static TeXString ToTeX(string target, string lineSeparator = "\n\\\\")
{
if (target==null) return null;
if (target == null) return null;
return new TeXString(target.NewLinesWith(lineSeparator));
}
public static bool GenerateEstimatePdf(this PdfGenerationViewModel Model)
{
string errorMsg = null;
var billdir = Model.DestDir;
var tempdir = Startup.SiteSetup.TempDir;
string name = Model.BaseFileName;
string fullname = new FileInfo(
System.IO.Path.Combine(tempdir, name)).FullName;
string ofullname = new FileInfo(
System.IO.Path.Combine(billdir, name)).FullName;
FileInfo fi = new FileInfo(fullname + ".tex");
FileInfo fo = new FileInfo(ofullname + ".pdf");
using (StreamWriter sw = new StreamWriter(fi.FullName))
{
sw.Write(Model.TeXSource);
}
if (!fi.Exists)
{
errorMsg = "Source write failed";
}
else
{
using (Process p = new Process())
{
p.StartInfo.WorkingDirectory = tempdir;
p.StartInfo = new ProcessStartInfo();
p.StartInfo.UseShellExecute = false;
p.StartInfo.FileName = "/usr/bin/texi2pdf";
p.StartInfo.Arguments = $"--batch --build-dir=. -o {fo.FullName} {fi.FullName}";
p.Start();
p.WaitForExit();
if (p.ExitCode != 0)
{
errorMsg = $"Pdf generation failed with exit code: {p.ExitCode}";
}
}
fi.Delete();
}
Model.Generated = fo.Exists;
Model.GenerationErrorMessage = new HtmlString(errorMsg);
return fo.Exists;
}
public static string RenderViewToString(
this Controller controller, IViewEngine engine,
IHttpContextAccessor httpContextAccessor,
string viewName, object model)
{
{
using (var sw = new StringWriter())
{
if (engine == null)
@ -103,6 +153,6 @@ namespace Yavsc.Helpers
viewResult.EnsureSuccessful();
return sw.GetStringBuilder().ToString();
}
}
}
}
}

@ -0,0 +1,836 @@
using System;
using Microsoft.Data.Entity;
using Microsoft.Data.Entity.Infrastructure;
using Microsoft.Data.Entity.Migrations;
using Yavsc.Models;
namespace Yavsc.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20161130084909_diskQuota")]
partial class diskQuota
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
modelBuilder
.HasAnnotation("ProductVersion", "7.0.0-rc1-16348");
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRole", b =>
{
b.Property<string>("Id");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Name")
.HasAnnotation("MaxLength", 256);
b.Property<string>("NormalizedName")
.HasAnnotation("MaxLength", 256);
b.HasKey("Id");
b.HasIndex("NormalizedName")
.HasAnnotation("Relational:Name", "RoleNameIndex");
b.HasAnnotation("Relational:TableName", "AspNetRoles");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("RoleId")
.IsRequired();
b.HasKey("Id");
b.HasAnnotation("Relational:TableName", "AspNetRoleClaims");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("Id");
b.HasAnnotation("Relational:TableName", "AspNetUserClaims");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider");
b.Property<string>("ProviderKey");
b.Property<string>("ProviderDisplayName");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("LoginProvider", "ProviderKey");
b.HasAnnotation("Relational:TableName", "AspNetUserLogins");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId");
b.Property<string>("RoleId");
b.HasKey("UserId", "RoleId");
b.HasAnnotation("Relational:TableName", "AspNetUserRoles");
});
modelBuilder.Entity("Yavsc.Location", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Address")
.IsRequired()
.HasAnnotation("MaxLength", 512);
b.Property<double>("Latitude");
b.Property<double>("Longitude");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Model.Bank.BankIdentity", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("AccountNumber")
.HasAnnotation("MaxLength", 15);
b.Property<string>("BIC")
.HasAnnotation("MaxLength", 15);
b.Property<string>("BankCode")
.HasAnnotation("MaxLength", 5);
b.Property<int>("BankedKey");
b.Property<string>("IBAN")
.HasAnnotation("MaxLength", 33);
b.Property<string>("WicketCode")
.HasAnnotation("MaxLength", 5);
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Model.Chat.Connection", b =>
{
b.Property<string>("ConnectionId");
b.Property<string>("ApplicationUserId");
b.Property<bool>("Connected");
b.Property<string>("UserAgent");
b.HasKey("ConnectionId");
});
modelBuilder.Entity("Yavsc.Model.ClientProviderInfo", b =>
{
b.Property<string>("UserId");
b.Property<string>("Avatar");
b.Property<long?>("BillingAddressId");
b.Property<string>("ChatHubConnectionId");
b.Property<string>("EMail");
b.Property<string>("Phone");
b.Property<int>("Rate");
b.Property<string>("UserName");
b.HasKey("UserId");
});
modelBuilder.Entity("Yavsc.Models.AccountBalance", b =>
{
b.Property<string>("UserId");
b.Property<long>("ContactCredits");
b.Property<decimal>("Credits");
b.HasKey("UserId");
});
modelBuilder.Entity("Yavsc.Models.Activity", b =>
{
b.Property<string>("Code")
.HasAnnotation("MaxLength", 512);
b.Property<string>("ActorDenomination");
b.Property<string>("Description");
b.Property<string>("ModeratorGroupName");
b.Property<string>("Name")
.IsRequired()
.HasAnnotation("MaxLength", 512);
b.Property<string>("Photo");
b.HasKey("Code");
});
modelBuilder.Entity("Yavsc.Models.ApplicationUser", b =>
{
b.Property<string>("Id");
b.Property<int>("AccessFailedCount");
b.Property<string>("Avatar")
.HasAnnotation("MaxLength", 512);
b.Property<long?>("BankInfoId");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("DedicatedGoogleCalendar");
b.Property<long>("DiskQuota");
b.Property<long>("DiskUsage");
b.Property<string>("Email")
.HasAnnotation("MaxLength", 256);
b.Property<bool>("EmailConfirmed");
b.Property<string>("FullName")
.HasAnnotation("MaxLength", 512);
b.Property<bool>("LockoutEnabled");
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<string>("NormalizedEmail")
.HasAnnotation("MaxLength", 256);
b.Property<string>("NormalizedUserName")
.HasAnnotation("MaxLength", 256);
b.Property<string>("PasswordHash");
b.Property<string>("PhoneNumber");
b.Property<bool>("PhoneNumberConfirmed");
b.Property<long?>("PostalAddressId");
b.Property<string>("SecurityStamp");
b.Property<bool>("TwoFactorEnabled");
b.Property<string>("UserName")
.HasAnnotation("MaxLength", 256);
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasAnnotation("Relational:Name", "EmailIndex");
b.HasIndex("NormalizedUserName")
.HasAnnotation("Relational:Name", "UserNameIndex");
b.HasAnnotation("Relational:TableName", "AspNetUsers");
});
modelBuilder.Entity("Yavsc.Models.Auth.Client", b =>
{
b.Property<string>("Id");
b.Property<bool>("Active");
b.Property<string>("DisplayName");
b.Property<string>("LogoutRedirectUri")
.HasAnnotation("MaxLength", 100);
b.Property<string>("RedirectUri");
b.Property<int>("RefreshTokenLifeTime");
b.Property<string>("Secret");
b.Property<int>("Type");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Auth.RefreshToken", b =>
{
b.Property<string>("Id");
b.Property<string>("ClientId")
.IsRequired()
.HasAnnotation("MaxLength", 50);
b.Property<DateTime>("ExpiresUtc");
b.Property<DateTime>("IssuedUtc");
b.Property<string>("ProtectedTicket")
.IsRequired();
b.Property<string>("Subject")
.IsRequired()
.HasAnnotation("MaxLength", 50);
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.BalanceImpact", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("BalanceId")
.IsRequired();
b.Property<DateTime>("ExecDate");
b.Property<decimal>("Impact");
b.Property<string>("Reason")
.IsRequired();
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Billing.CommandLine", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long?>("ArticleId");
b.Property<int>("Count");
b.Property<string>("Description")
.IsRequired()
.HasAnnotation("MaxLength", 512);
b.Property<long>("EstimateId");
b.Property<long?>("EstimateTemplateId");
b.Property<decimal>("UnitaryCost");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Billing.Estimate", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("AttachedFilesString");
b.Property<string>("AttachedGraphicsString");
b.Property<string>("ClientId")
.IsRequired();
b.Property<DateTime>("ClientValidationDate");
b.Property<long?>("CommandId");
b.Property<string>("CommandType");
b.Property<string>("Description");
b.Property<string>("OwnerId")
.IsRequired();
b.Property<DateTime>("ProviderValidationDate");
b.Property<string>("Title");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Billing.EstimateTemplate", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Description");
b.Property<string>("OwnerId")
.IsRequired();
b.Property<string>("Title");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Billing.ExceptionSIREN", b =>
{
b.Property<string>("SIREN");
b.HasKey("SIREN");
});
modelBuilder.Entity("Yavsc.Models.Blog", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("AuthorId");
b.Property<string>("Content");
b.Property<DateTime>("Modified");
b.Property<string>("Photo");
b.Property<DateTime>("Posted")
.ValueGeneratedOnAdd()
.HasAnnotation("Relational:GeneratedValueSql", "LOCALTIMESTAMP");
b.Property<int>("Rate");
b.Property<string>("Title");
b.Property<bool>("Visible");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Booking.BookQuery", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClientId")
.IsRequired();
b.Property<DateTime>("CreationDate")
.ValueGeneratedOnAdd()
.HasAnnotation("Relational:GeneratedValueSql", "LOCALTIMESTAMP");
b.Property<DateTime>("EventDate");
b.Property<long?>("LocationId");
b.Property<string>("PerformerId")
.IsRequired();
b.Property<decimal?>("Previsional");
b.Property<DateTime?>("ValidationDate");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Circle", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ApplicationUserId");
b.Property<string>("Name");
b.Property<string>("OwnerId");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.CircleMember", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long>("CircleId");
b.Property<string>("MemberId")
.IsRequired();
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Contact", b =>
{
b.Property<string>("OwnerId");
b.Property<string>("UserId");
b.Property<string>("ApplicationUserId");
b.HasKey("OwnerId", "UserId");
});
modelBuilder.Entity("Yavsc.Models.Identity.GoogleCloudMobileDeclaration", b =>
{
b.Property<string>("DeviceId");
b.Property<DateTime>("DeclarationDate")
.ValueGeneratedOnAdd()
.HasAnnotation("Relational:GeneratedValueSql", "LOCALTIMESTAMP");
b.Property<string>("DeviceOwnerId");
b.Property<string>("GCMRegistrationId")
.IsRequired();
b.Property<string>("Model");
b.Property<string>("Platform");
b.Property<string>("Version");
b.HasKey("DeviceId");
});
modelBuilder.Entity("Yavsc.Models.Market.BaseProduct", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Description");
b.Property<string>("Discriminator")
.IsRequired();
b.Property<string>("Name");
b.Property<bool>("Public");
b.HasKey("Id");
b.HasAnnotation("Relational:DiscriminatorProperty", "Discriminator");
b.HasAnnotation("Relational:DiscriminatorValue", "BaseProduct");
});
modelBuilder.Entity("Yavsc.Models.Market.Service", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ContextId");
b.Property<string>("Description");
b.Property<string>("Name");
b.Property<bool>("Public");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.OAuth.OAuth2Tokens", b =>
{
b.Property<string>("UserId");
b.Property<string>("AccessToken");
b.Property<DateTime>("Expiration");
b.Property<string>("ExpiresIn");
b.Property<string>("RefreshToken");
b.Property<string>("TokenType");
b.HasKey("UserId");
});
modelBuilder.Entity("Yavsc.Models.PostTag", b =>
{
b.Property<long>("PostId");
b.Property<long>("TagId");
b.HasKey("PostId", "TagId");
});
modelBuilder.Entity("Yavsc.Models.Skill", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name");
b.Property<int>("Rate");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Tag", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name")
.IsRequired();
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Workflow.PerformerProfile", b =>
{
b.Property<string>("PerformerId");
b.Property<bool>("AcceptGeoLocalization");
b.Property<bool>("AcceptNotifications");
b.Property<bool>("AcceptPublicContact");
b.Property<bool>("Active");
b.Property<string>("ActivityCode")
.IsRequired();
b.Property<int?>("MaxDailyCost");
b.Property<int?>("MinDailyCost");
b.Property<long?>("OfferId");
b.Property<long>("OrganizationAddressId");
b.Property<int>("Rate");
b.Property<string>("SIREN")
.IsRequired()
.HasAnnotation("MaxLength", 14);
b.Property<string>("WebSite");
b.HasKey("PerformerId");
});
modelBuilder.Entity("Yavsc.Models.Market.Product", b =>
{
b.HasBaseType("Yavsc.Models.Market.BaseProduct");
b.Property<decimal>("Depth");
b.Property<decimal>("Height");
b.Property<decimal?>("Price");
b.Property<decimal>("Weight");
b.Property<decimal>("Width");
b.HasAnnotation("Relational:DiscriminatorValue", "Product");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNet.Identity.EntityFramework.IdentityRole")
.WithMany()
.HasForeignKey("RoleId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim<string>", b =>
{
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin<string>", b =>
{
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNet.Identity.EntityFramework.IdentityRole")
.WithMany()
.HasForeignKey("RoleId");
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("Yavsc.Model.Chat.Connection", b =>
{
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("ApplicationUserId");
});
modelBuilder.Entity("Yavsc.Model.ClientProviderInfo", b =>
{
b.HasOne("Yavsc.Location")
.WithMany()
.HasForeignKey("BillingAddressId");
});
modelBuilder.Entity("Yavsc.Models.AccountBalance", b =>
{
b.HasOne("Yavsc.Models.ApplicationUser")
.WithOne()
.HasForeignKey("Yavsc.Models.AccountBalance", "UserId");
});
modelBuilder.Entity("Yavsc.Models.ApplicationUser", b =>
{
b.HasOne("Yavsc.Model.Bank.BankIdentity")
.WithMany()
.HasForeignKey("BankInfoId");
b.HasOne("Yavsc.Location")
.WithMany()
.HasForeignKey("PostalAddressId");
});
modelBuilder.Entity("Yavsc.Models.BalanceImpact", b =>
{
b.HasOne("Yavsc.Models.AccountBalance")
.WithMany()
.HasForeignKey("BalanceId");
});
modelBuilder.Entity("Yavsc.Models.Billing.CommandLine", b =>
{
b.HasOne("Yavsc.Models.Market.BaseProduct")
.WithMany()
.HasForeignKey("ArticleId");
b.HasOne("Yavsc.Models.Billing.Estimate")
.WithMany()
.HasForeignKey("EstimateId");
b.HasOne("Yavsc.Models.Billing.EstimateTemplate")
.WithMany()
.HasForeignKey("EstimateTemplateId");
});
modelBuilder.Entity("Yavsc.Models.Billing.Estimate", b =>
{
b.HasOne("Yavsc.Models.Booking.BookQuery")
.WithMany()
.HasForeignKey("CommandId");
});
modelBuilder.Entity("Yavsc.Models.Blog", b =>
{
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("AuthorId");
});
modelBuilder.Entity("Yavsc.Models.Booking.BookQuery", b =>
{
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("ClientId");
b.HasOne("Yavsc.Location")
.WithMany()
.HasForeignKey("LocationId");
b.HasOne("Yavsc.Models.Workflow.PerformerProfile")
.WithMany()
.HasForeignKey("PerformerId");
});
modelBuilder.Entity("Yavsc.Models.Circle", b =>
{
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("ApplicationUserId");
});
modelBuilder.Entity("Yavsc.Models.CircleMember", b =>
{
b.HasOne("Yavsc.Models.Circle")
.WithMany()
.HasForeignKey("CircleId");
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("MemberId");
});
modelBuilder.Entity("Yavsc.Models.Contact", b =>
{
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("ApplicationUserId");
});
modelBuilder.Entity("Yavsc.Models.Identity.GoogleCloudMobileDeclaration", b =>
{
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("DeviceOwnerId");
});
modelBuilder.Entity("Yavsc.Models.Market.Service", b =>
{
b.HasOne("Yavsc.Models.Activity")
.WithMany()
.HasForeignKey("ContextId");
});
modelBuilder.Entity("Yavsc.Models.PostTag", b =>
{
b.HasOne("Yavsc.Models.Blog")
.WithMany()
.HasForeignKey("PostId");
});
modelBuilder.Entity("Yavsc.Models.Workflow.PerformerProfile", b =>
{
b.HasOne("Yavsc.Models.Activity")
.WithMany()
.HasForeignKey("ActivityCode");
b.HasOne("Yavsc.Models.Market.Service")
.WithMany()
.HasForeignKey("OfferId");
b.HasOne("Yavsc.Location")
.WithMany()
.HasForeignKey("OrganizationAddressId");
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("PerformerId");
});
}
}
}

@ -0,0 +1,293 @@
using Microsoft.Data.Entity.Migrations;
namespace Yavsc.Migrations
{
public partial class diskQuota : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_AccountBalance_ApplicationUser_UserId", table: "AccountBalance");
migrationBuilder.DropForeignKey(name: "FK_BalanceImpact_AccountBalance_BalanceId", table: "BalanceImpact");
migrationBuilder.DropForeignKey(name: "FK_CommandLine_Estimate_EstimateId", table: "CommandLine");
migrationBuilder.DropForeignKey(name: "FK_BookQuery_ApplicationUser_ClientId", table: "BookQuery");
migrationBuilder.DropForeignKey(name: "FK_BookQuery_PerformerProfile_PerformerId", table: "BookQuery");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_Circle_CircleId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_ApplicationUser_MemberId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_PostTag_Blog_PostId", table: "PostTag");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Activity_ActivityCode", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Location_OrganizationAddressId", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_ApplicationUser_PerformerId", table: "PerformerProfile");
migrationBuilder.DropColumn(name: "ClientSignature", table: "Estimate");
migrationBuilder.DropColumn(name: "ProviderSignature", table: "Estimate");
migrationBuilder.AddColumn<long>(
name: "DiskQuota",
table: "AspNetUsers",
nullable: false,
defaultValue: 0L);
migrationBuilder.AddColumn<long>(
name: "DiskUsage",
table: "AspNetUsers",
nullable: false,
defaultValue: 0L);
migrationBuilder.AddForeignKey(
name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
table: "AspNetRoleClaims",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
table: "AspNetUserClaims",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
table: "AspNetUserLogins",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
table: "AspNetUserRoles",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
table: "AspNetUserRoles",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_AccountBalance_ApplicationUser_UserId",
table: "AccountBalance",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_BalanceImpact_AccountBalance_BalanceId",
table: "BalanceImpact",
column: "BalanceId",
principalTable: "AccountBalance",
principalColumn: "UserId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CommandLine_Estimate_EstimateId",
table: "CommandLine",
column: "EstimateId",
principalTable: "Estimate",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_BookQuery_ApplicationUser_ClientId",
table: "BookQuery",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_BookQuery_PerformerProfile_PerformerId",
table: "BookQuery",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerformerId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_Circle_CircleId",
table: "CircleMember",
column: "CircleId",
principalTable: "Circle",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_ApplicationUser_MemberId",
table: "CircleMember",
column: "MemberId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PostTag_Blog_PostId",
table: "PostTag",
column: "PostId",
principalTable: "Blog",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Activity_ActivityCode",
table: "PerformerProfile",
column: "ActivityCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Location_OrganizationAddressId",
table: "PerformerProfile",
column: "OrganizationAddressId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_ApplicationUser_PerformerId",
table: "PerformerProfile",
column: "PerformerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_AccountBalance_ApplicationUser_UserId", table: "AccountBalance");
migrationBuilder.DropForeignKey(name: "FK_BalanceImpact_AccountBalance_BalanceId", table: "BalanceImpact");
migrationBuilder.DropForeignKey(name: "FK_CommandLine_Estimate_EstimateId", table: "CommandLine");
migrationBuilder.DropForeignKey(name: "FK_BookQuery_ApplicationUser_ClientId", table: "BookQuery");
migrationBuilder.DropForeignKey(name: "FK_BookQuery_PerformerProfile_PerformerId", table: "BookQuery");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_Circle_CircleId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_ApplicationUser_MemberId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_PostTag_Blog_PostId", table: "PostTag");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Activity_ActivityCode", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Location_OrganizationAddressId", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_ApplicationUser_PerformerId", table: "PerformerProfile");
migrationBuilder.DropColumn(name: "DiskQuota", table: "AspNetUsers");
migrationBuilder.DropColumn(name: "DiskUsage", table: "AspNetUsers");
migrationBuilder.AddColumn<byte[]>(
name: "ClientSignature",
table: "Estimate",
nullable: true);
migrationBuilder.AddColumn<byte[]>(
name: "ProviderSignature",
table: "Estimate",
nullable: true);
migrationBuilder.AddForeignKey(
name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
table: "AspNetRoleClaims",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
table: "AspNetUserClaims",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
table: "AspNetUserLogins",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
table: "AspNetUserRoles",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
table: "AspNetUserRoles",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_AccountBalance_ApplicationUser_UserId",
table: "AccountBalance",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_BalanceImpact_AccountBalance_BalanceId",
table: "BalanceImpact",
column: "BalanceId",
principalTable: "AccountBalance",
principalColumn: "UserId",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_CommandLine_Estimate_EstimateId",
table: "CommandLine",
column: "EstimateId",
principalTable: "Estimate",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_BookQuery_ApplicationUser_ClientId",
table: "BookQuery",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_BookQuery_PerformerProfile_PerformerId",
table: "BookQuery",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerformerId",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_Circle_CircleId",
table: "CircleMember",
column: "CircleId",
principalTable: "Circle",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_ApplicationUser_MemberId",
table: "CircleMember",
column: "MemberId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PostTag_Blog_PostId",
table: "PostTag",
column: "PostId",
principalTable: "Blog",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Activity_ActivityCode",
table: "PerformerProfile",
column: "ActivityCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Location_OrganizationAddressId",
table: "PerformerProfile",
column: "OrganizationAddressId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_ApplicationUser_PerformerId",
table: "PerformerProfile",
column: "PerformerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
}
}

@ -217,6 +217,10 @@ namespace Yavsc.Migrations
b.Property<string>("DedicatedGoogleCalendar");
b.Property<long>("DiskQuota");
b.Property<long>("DiskUsage");
b.Property<string>("Email")
.HasAnnotation("MaxLength", 256);
@ -357,8 +361,6 @@ namespace Yavsc.Migrations
b.Property<string>("ClientId")
.IsRequired();
b.Property<byte[]>("ClientSignature");
b.Property<DateTime>("ClientValidationDate");
b.Property<long?>("CommandId");
@ -370,8 +372,6 @@ namespace Yavsc.Migrations
b.Property<string>("OwnerId")
.IsRequired();
b.Property<byte[]>("ProviderSignature");
b.Property<DateTime>("ProviderValidationDate");
b.Property<string>("Title");

@ -1,10 +1,9 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Yavsc.Interfaces;
namespace Yavsc.Models
{
using Interfaces;
public partial class AccountBalance: IAccountBalance {
[Key]

@ -68,9 +68,6 @@ namespace Yavsc.Models.Billing
{
get; set;
}
public Byte [] ProviderSignature { get; set; }
public Byte [] ClientSignature { get; set; }
public DateTime ProviderValidationDate { get; set; }
public DateTime ClientValidationDate { get; set; }

@ -0,0 +1,9 @@
namespace Yavsc.Models.FileSystem
{
public class FileRecievedInfo
{
public string DestDir { get; set; }
public string FileName { get; set; }
public bool Overriden { get; set; }
}
}

@ -85,5 +85,7 @@ namespace Yavsc.Models
public BankIdentity BankInfo { get; set; }
public long DiskQuota { get; set; } = 512*1024*1024;
public long DiskUsage { get; set; } = 0;
}
}

@ -20,10 +20,10 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System.ComponentModel.DataAnnotations;
using Yavsc.Interfaces;
namespace Yavsc.Models.Messaging
{
using Interfaces;
/// <summary>
/// Base event.
/// </summary>

Some files were not shown because too many files have changed in this diff Show More

Loading…