This commit is contained in:
2020-09-11 19:40:19 +00:00
parent f01f4e381c
commit d451d8041d
5 changed files with 40 additions and 3 deletions

View File

@@ -7,6 +7,7 @@ using Microsoft.Extensions.Logging;
using Bogus;
using AyaNova.Api.ControllerHelpers;
using System.Diagnostics;
using Microsoft.EntityFrameworkCore;
namespace AyaNova.Util
@@ -446,6 +447,34 @@ namespace AyaNova.Util
break;
}
//Seed logo files
var LogoFilesPath = System.IO.Path.Combine(ServerBootConfig.AYANOVA_CONTENT_ROOT_PATH, "resource", "rpt", "stock-report-templates");
if (System.IO.Directory.Exists(LogoFilesPath))
{
using (var ct = ServiceProviderProvider.DBContext)
{
var logo = await ct.Logo.FirstOrDefaultAsync();
if (logo == null)
{
logo = new Logo();
ct.Logo.Add(logo);
await ct.SaveChangesAsync();
}
logo.Small = System.IO.File.ReadAllBytes(System.IO.Path.Combine(LogoFilesPath, "300x100.png"));
logo.SmallType = "image/png";
logo.Medium = System.IO.File.ReadAllBytes(System.IO.Path.Combine(LogoFilesPath, "600x200.png"));
logo.MediumType = "image/png";
logo.Large = System.IO.File.ReadAllBytes(System.IO.Path.Combine(LogoFilesPath, "1200x400.png"));
logo.LargeType = "image/png";
await ct.SaveChangesAsync();
}
}
await LogStatusAsync(JobId, LogJob, log, "Seeding completed successfully");
}
catch (Exception ex)
@@ -594,8 +623,8 @@ namespace AyaNova.Util
u.UserType = userType;
u.EmployeeNumber = "A-" + (454 + SeededUserCount + x).ToString() + "-Y";
u.Notes = Fake.Lorem.Sentence(null, 5);//Fake.Lorem.Paragraph(2);
//TODO: After have USER and HEADOFFICE and VENDOR, if usertype is subcontractor or client or headoffice it needs to set a corresponding user's parent org record id to go with it
//use provided tags or generate them
//TODO: After have USER and HEADOFFICE and VENDOR, if usertype is subcontractor or client or headoffice it needs to set a corresponding user's parent org record id to go with it
//use provided tags or generate them
if (tags == null)
u.Tags = RandomTags();
else