minor fixes to data and UI customization
This commit is contained in:
parent
632c023a3f
commit
18b91ee5f1
@ -190,7 +190,7 @@
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
string[] requiredHeaders = { "catalogtypename", "catalogbrandname", "description", "name", "price", "pictureuri" };
|
string[] requiredHeaders = { "catalogtypename", "catalogbrandname", "description", "name", "price", "pictureuri" };
|
||||||
string[] optionalheaders = { "availablestock", "restockThreshold", "maxStockThreshold", "onreorder" };
|
string[] optionalheaders = { "availablestock", "restockthreshold", "maxstockthreshold", "onreorder" };
|
||||||
csvheaders = GetHeaders(csvFileCatalogItems, requiredHeaders, optionalheaders );
|
csvheaders = GetHeaders(csvFileCatalogItems, requiredHeaders, optionalheaders );
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -320,18 +320,18 @@
|
|||||||
{
|
{
|
||||||
return new List<CatalogItem>()
|
return new List<CatalogItem>()
|
||||||
{
|
{
|
||||||
new CatalogItem() { CatalogTypeId=2,CatalogBrandId=2, Description = ".NET Bot Black Hoodie", Name = ".NET Bot Black Hoodie", Price = 19.5M, PictureUri = "1.png" },
|
new CatalogItem() { CatalogTypeId=2,CatalogBrandId=2, Description = ".NET Bot Black Hoodie", Name = ".NET Bot Black Hoodie", Price = 19.5M, PictureUri = "1.png", AvailableStock = 100 },
|
||||||
new CatalogItem() { CatalogTypeId=1,CatalogBrandId=2, Description = ".NET Black & White Mug", Name = ".NET Black & White Mug", Price= 8.50M, PictureUri = "2.png" },
|
new CatalogItem() { CatalogTypeId=1,CatalogBrandId=2, Description = ".NET Black & White Mug", Name = ".NET Black & White Mug", Price= 8.50M, PictureUri = "2.png", AvailableStock = 100 },
|
||||||
new CatalogItem() { CatalogTypeId=2,CatalogBrandId=5, Description = "Prism White T-Shirt", Name = "Prism White T-Shirt", Price = 12, PictureUri = "3.png" },
|
new CatalogItem() { CatalogTypeId=2,CatalogBrandId=5, Description = "Prism White T-Shirt", Name = "Prism White T-Shirt", Price = 12, PictureUri = "3.png", AvailableStock = 100 },
|
||||||
new CatalogItem() { CatalogTypeId=2,CatalogBrandId=2, Description = ".NET Foundation T-shirt", Name = ".NET Foundation T-shirt", Price = 12, PictureUri = "4.png" },
|
new CatalogItem() { CatalogTypeId=2,CatalogBrandId=2, Description = ".NET Foundation T-shirt", Name = ".NET Foundation T-shirt", Price = 12, PictureUri = "4.png", AvailableStock = 100 },
|
||||||
new CatalogItem() { CatalogTypeId=3,CatalogBrandId=5, Description = "Roslyn Red Sheet", Name = "Roslyn Red Sheet", Price = 8.5M, PictureUri = "5.png" },
|
new CatalogItem() { CatalogTypeId=3,CatalogBrandId=5, Description = "Roslyn Red Sheet", Name = "Roslyn Red Sheet", Price = 8.5M, PictureUri = "5.png", AvailableStock = 100 },
|
||||||
new CatalogItem() { CatalogTypeId=2,CatalogBrandId=2, Description = ".NET Blue Hoodie", Name = ".NET Blue Hoodie", Price = 12, PictureUri = "6.png" },
|
new CatalogItem() { CatalogTypeId=2,CatalogBrandId=2, Description = ".NET Blue Hoodie", Name = ".NET Blue Hoodie", Price = 12, PictureUri = "6.png", AvailableStock = 100 },
|
||||||
new CatalogItem() { CatalogTypeId=2,CatalogBrandId=5, Description = "Roslyn Red T-Shirt", Name = "Roslyn Red T-Shirt", Price = 12, PictureUri = "7.png" },
|
new CatalogItem() { CatalogTypeId=2,CatalogBrandId=5, Description = "Roslyn Red T-Shirt", Name = "Roslyn Red T-Shirt", Price = 12, PictureUri = "7.png", AvailableStock = 100 },
|
||||||
new CatalogItem() { CatalogTypeId=2,CatalogBrandId=5, Description = "Kudu Purple Hoodie", Name = "Kudu Purple Hoodie", Price = 8.5M, PictureUri = "8.png" },
|
new CatalogItem() { CatalogTypeId=2,CatalogBrandId=5, Description = "Kudu Purple Hoodie", Name = "Kudu Purple Hoodie", Price = 8.5M, PictureUri = "8.png", AvailableStock = 100 },
|
||||||
new CatalogItem() { CatalogTypeId=1,CatalogBrandId=5, Description = "Cup<T> White Mug", Name = "Cup<T> White Mug", Price = 12, PictureUri = "9.png" },
|
new CatalogItem() { CatalogTypeId=1,CatalogBrandId=5, Description = "Cup<T> White Mug", Name = "Cup<T> White Mug", Price = 12, PictureUri = "9.png", AvailableStock = 100 },
|
||||||
new CatalogItem() { CatalogTypeId=3,CatalogBrandId=2, Description = ".NET Foundation Sheet", Name = ".NET Foundation Sheet", Price = 12, PictureUri = "10.png" },
|
new CatalogItem() { CatalogTypeId=3,CatalogBrandId=2, Description = ".NET Foundation Sheet", Name = ".NET Foundation Sheet", Price = 12, PictureUri = "10.png", AvailableStock = 100 },
|
||||||
new CatalogItem() { CatalogTypeId=3,CatalogBrandId=2, Description = "Cup<T> Sheet", Name = "Cup<T> Sheet", Price = 8.5M, PictureUri = "11.png" },
|
new CatalogItem() { CatalogTypeId=3,CatalogBrandId=2, Description = "Cup<T> Sheet", Name = "Cup<T> Sheet", Price = 8.5M, PictureUri = "11.png", AvailableStock = 100 },
|
||||||
new CatalogItem() { CatalogTypeId=2,CatalogBrandId=5, Description = "Prism White TShirt", Name = "Prism White TShirt", Price = 12, PictureUri = "12.png" }
|
new CatalogItem() { CatalogTypeId=2,CatalogBrandId=5, Description = "Prism White TShirt", Name = "Prism White TShirt", Price = 12, PictureUri = "12.png", AvailableStock = 100 }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.IO.Compression;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
@ -45,6 +46,7 @@
|
|||||||
|
|
||||||
var useCustomizationData = settings.UseCustomizationData;
|
var useCustomizationData = settings.UseCustomizationData;
|
||||||
var contentRootPath = env.ContentRootPath;
|
var contentRootPath = env.ContentRootPath;
|
||||||
|
var webroot = env.WebRootPath;
|
||||||
|
|
||||||
if (!context.Users.Any())
|
if (!context.Users.Any())
|
||||||
{
|
{
|
||||||
@ -54,6 +56,11 @@
|
|||||||
|
|
||||||
await context.SaveChangesAsync();
|
await context.SaveChangesAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (useCustomizationData)
|
||||||
|
{
|
||||||
|
GetPreconfiguredImages(contentRootPath, webroot, log);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -111,7 +118,7 @@
|
|||||||
throw new Exception($"column count '{column.Count()}' not the same as headers count'{headers.Count()}'");
|
throw new Exception($"column count '{column.Count()}' not the same as headers count'{headers.Count()}'");
|
||||||
}
|
}
|
||||||
|
|
||||||
string cardtypeString = column[Array.IndexOf(headers, "cardtype")].Trim();
|
string cardtypeString = column[Array.IndexOf(headers, "cardtype")].Trim('"').Trim();
|
||||||
if (!int.TryParse(cardtypeString, out int cardtype))
|
if (!int.TryParse(cardtypeString, out int cardtype))
|
||||||
{
|
{
|
||||||
throw new Exception($"cardtype='{cardtypeString}' is not a number");
|
throw new Exception($"cardtype='{cardtypeString}' is not a number");
|
||||||
@ -119,26 +126,26 @@
|
|||||||
|
|
||||||
var user = new ApplicationUser
|
var user = new ApplicationUser
|
||||||
{
|
{
|
||||||
CardHolderName = column[Array.IndexOf(headers, "cardholdername")].Trim(),
|
CardHolderName = column[Array.IndexOf(headers, "cardholdername")].Trim('"').Trim(),
|
||||||
CardNumber = column[Array.IndexOf(headers, "cardnumber")].Trim(),
|
CardNumber = column[Array.IndexOf(headers, "cardnumber")].Trim('"').Trim(),
|
||||||
CardType = cardtype,
|
CardType = cardtype,
|
||||||
City = column[Array.IndexOf(headers, "city")].Trim(),
|
City = column[Array.IndexOf(headers, "city")].Trim('"').Trim(),
|
||||||
Country = column[Array.IndexOf(headers, "country")].Trim(),
|
Country = column[Array.IndexOf(headers, "country")].Trim('"').Trim(),
|
||||||
Email = column[Array.IndexOf(headers, "email")].Trim(),
|
Email = column[Array.IndexOf(headers, "email")].Trim('"').Trim(),
|
||||||
Expiration = column[Array.IndexOf(headers, "expiration")].Trim(),
|
Expiration = column[Array.IndexOf(headers, "expiration")].Trim('"').Trim(),
|
||||||
Id = Guid.NewGuid().ToString(),
|
Id = Guid.NewGuid().ToString(),
|
||||||
LastName = column[Array.IndexOf(headers, "lastname")].Trim(),
|
LastName = column[Array.IndexOf(headers, "lastname")].Trim('"').Trim(),
|
||||||
Name = column[Array.IndexOf(headers, "name")].Trim(),
|
Name = column[Array.IndexOf(headers, "name")].Trim('"').Trim(),
|
||||||
PhoneNumber = column[Array.IndexOf(headers, "phonenumber")].Trim(),
|
PhoneNumber = column[Array.IndexOf(headers, "phonenumber")].Trim('"').Trim(),
|
||||||
UserName = column[Array.IndexOf(headers, "username")].Trim(),
|
UserName = column[Array.IndexOf(headers, "username")].Trim('"').Trim(),
|
||||||
ZipCode = column[Array.IndexOf(headers, "zipcode")].Trim(),
|
ZipCode = column[Array.IndexOf(headers, "zipcode")].Trim('"').Trim(),
|
||||||
State = column[Array.IndexOf(headers, "state")].Trim(),
|
State = column[Array.IndexOf(headers, "state")].Trim('"').Trim(),
|
||||||
Street = column[Array.IndexOf(headers, "street")].Trim(),
|
Street = column[Array.IndexOf(headers, "street")].Trim('"').Trim(),
|
||||||
SecurityNumber = column[Array.IndexOf(headers, "securitynumber")].Trim(),
|
SecurityNumber = column[Array.IndexOf(headers, "securitynumber")].Trim('"').Trim(),
|
||||||
NormalizedEmail = column[Array.IndexOf(headers, "normalizedemail")].Trim(),
|
NormalizedEmail = column[Array.IndexOf(headers, "normalizedemail")].Trim('"').Trim(),
|
||||||
NormalizedUserName = column[Array.IndexOf(headers, "normalizedusername")].Trim(),
|
NormalizedUserName = column[Array.IndexOf(headers, "normalizedusername")].Trim('"').Trim(),
|
||||||
SecurityStamp = Guid.NewGuid().ToString("D"),
|
SecurityStamp = Guid.NewGuid().ToString("D"),
|
||||||
PasswordHash = column[Array.IndexOf(headers, "password")].Trim(), // Note: This is the password
|
PasswordHash = column[Array.IndexOf(headers, "password")].Trim('"').Trim(), // Note: This is the password
|
||||||
};
|
};
|
||||||
|
|
||||||
user.PasswordHash = _passwordHasher.HashPassword(user, user.PasswordHash);
|
user.PasswordHash = _passwordHasher.HashPassword(user, user.PasswordHash);
|
||||||
@ -199,5 +206,45 @@
|
|||||||
|
|
||||||
return csvheaders;
|
return csvheaders;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void GetPreconfiguredImages(string contentRootPath, string webroot, ILogger log)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string imagesZipFile = Path.Combine(contentRootPath, "Setup", "images.zip");
|
||||||
|
if (!File.Exists(imagesZipFile))
|
||||||
|
{
|
||||||
|
log.LogError($" zip file '{imagesZipFile}' does not exists.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
string imagePath = Path.Combine(webroot, "images");
|
||||||
|
string[] imageFiles = Directory.GetFiles(imagePath).Select(file => Path.GetFileName(file)).ToArray();
|
||||||
|
|
||||||
|
using (ZipArchive zip = ZipFile.Open(imagesZipFile, ZipArchiveMode.Read))
|
||||||
|
{
|
||||||
|
foreach (ZipArchiveEntry entry in zip.Entries)
|
||||||
|
{
|
||||||
|
if (imageFiles.Contains(entry.Name))
|
||||||
|
{
|
||||||
|
string destinationFilename = Path.Combine(imagePath, entry.Name);
|
||||||
|
if (File.Exists(destinationFilename))
|
||||||
|
{
|
||||||
|
File.Delete(destinationFilename);
|
||||||
|
}
|
||||||
|
entry.ExtractToFile(destinationFilename);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
log.LogWarning($"Skip file '{entry.Name}' in zipfile '{imagesZipFile}'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
log.LogError($"Exception in method GetPreconfiguredImages WebMVC. Exception Message={ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
BIN
src/Services/Identity/Identity.API/Setup/images.zip
Normal file
BIN
src/Services/Identity/Identity.API/Setup/images.zip
Normal file
Binary file not shown.
@ -40,10 +40,7 @@
|
|||||||
<br><div class="brand"></div>
|
<br><div class="brand"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<br />
|
<img class="text hidden-xs" src="~/images/main_footer_text.PNG" width="335" height="26" alt="footer text image" />
|
||||||
<br>
|
|
||||||
<br />
|
|
||||||
<div class="text hidden-xs">© e-ShoponContainers. All right reserved</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -476,11 +476,7 @@ footer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
footer .text {
|
footer .text {
|
||||||
text-align: right;
|
margin-top: 55px;
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
color: #83D01B;
|
|
||||||
margin-top: 10px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.text {
|
.text {
|
||||||
|
File diff suppressed because one or more lines are too long
Binary file not shown.
After Width: | Height: | Size: 4.6 KiB |
@ -93,7 +93,7 @@
|
|||||||
throw new Exception("Orderstatus is null or empty");
|
throw new Exception("Orderstatus is null or empty");
|
||||||
}
|
}
|
||||||
|
|
||||||
return new CardType(id++, value.Trim());
|
return new CardType(id++, value.Trim('"').Trim());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -143,7 +143,7 @@
|
|||||||
throw new Exception("Orderstatus is null or empty");
|
throw new Exception("Orderstatus is null or empty");
|
||||||
}
|
}
|
||||||
|
|
||||||
return new OrderStatus(id++, value.Trim().ToLowerInvariant());
|
return new OrderStatus(id++, value.Trim('"').Trim().ToLowerInvariant());
|
||||||
}
|
}
|
||||||
|
|
||||||
static IEnumerable<OrderStatus> GetPredefinedOrderStatus()
|
static IEnumerable<OrderStatus> GetPredefinedOrderStatus()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user