v1.0.7.0
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
# Saxonite
|
||||
|
||||
## Sarand - Wawam collaboration
|
||||
|
||||
### Graphics
|
||||
|
||||
#### Animated gifs
|
||||
|
||||
* https://icons8.com/preloaders/
|
||||
+4
-1
@@ -26,8 +26,11 @@ EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SaxoniteCoreUnitTests", "SaxoniteCoreUnitTests\SaxoniteCoreUnitTests.csproj", "{CA680625-E334-4F76-881B-1327A2F9FE86}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution files", "Solution files", "{BD66A338-2D41-4B64-86B0-670F4F42A489}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
ReadMe.md = ReadMe.md
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SaxoniteCoreUnitTestsOnline", "SaxoniteCoreUnitTestsOnline\SaxoniteCoreUnitTestsOnline.csproj", "{303BA8E9-1B95-41AD-9F51-32037A22C908}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SaxoniteCoreUnitTestsOnline", "SaxoniteCoreUnitTestsOnline\SaxoniteCoreUnitTestsOnline.csproj", "{303BA8E9-1B95-41AD-9F51-32037A22C908}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
|
||||
@@ -59,6 +59,15 @@ namespace Saxonite.Net.Core.Web.Base.App
|
||||
}
|
||||
protected void ConfigureServices(ConfigureServicesConfig config)
|
||||
{
|
||||
// Authentication service.
|
||||
// Required to handle 'Forbidden' responses etc.
|
||||
config.services
|
||||
.AddAuthentication(options => {
|
||||
options.DefaultAuthenticateScheme = "forbidScheme";
|
||||
options.DefaultForbidScheme = "forbidScheme";
|
||||
options.AddScheme<SaxAuthenticationHandler>("forbidScheme", "Handle Forbidden");
|
||||
});
|
||||
|
||||
// Added to support memory caching of sessions.
|
||||
config.services.AddMemoryCache();
|
||||
//config.services.AddDistributedMemoryCache(); - for multiple web servers.
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace Saxonite.Net.Core.Web.Base.App
|
||||
{
|
||||
internal class SaxyAuthenticationHandler
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Text.Encodings.Web;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Saxonite.Net.Core.Web.Base.Middleware
|
||||
{
|
||||
//=======================================================================
|
||||
// Authentication handler required to allow actions to issue Forbid() responses.
|
||||
// Ref. https://stackoverflow.com/questions/54578426/why-do-i-need-to-set-a-defaultforbidscheme/54587054#54587054
|
||||
//=======================================================================
|
||||
public class SaxAuthenticationHandler : AuthenticationHandler<AuthenticationSchemeOptions>
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
public SaxAuthenticationHandler(IOptionsMonitor<AuthenticationSchemeOptions> options, ILoggerFactory logger, UrlEncoder encoder, ISystemClock clock) :
|
||||
base(options, logger, encoder, clock)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
protected override Task HandleForbiddenAsync(AuthenticationProperties properties)
|
||||
{
|
||||
Context.Response.StatusCode = (int)HttpStatusCode.Forbidden;
|
||||
return base.HandleForbiddenAsync(properties);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
protected override async Task<AuthenticateResult> HandleAuthenticateAsync()
|
||||
{
|
||||
Context.Response.StatusCode = (int)HttpStatusCode.Unauthorized;
|
||||
return AuthenticateResult.NoResult();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -44,7 +44,7 @@ namespace Saxonite.Net.Core.Web.Admin.Models
|
||||
public String UserFirstName { get; set; }
|
||||
public String UserLastName { get; set; }
|
||||
public String UserRoleCodeDelim = ",";
|
||||
public List<String> UserRoleCodes { get; set; }
|
||||
public new List<String> UserRoleCodes { get; set; }
|
||||
public List<String> GetUserRoleCodes()
|
||||
{
|
||||
List<String> codes = new List<string>();
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
|
||||
@* Scripts *@
|
||||
<script>
|
||||
var sax = sax || { page: {}, url: {}, links: {}, form: {}, data: {}, msg: {}, lbl: {}, dlg: { title: {}, btn: {} }, $frm: {}, $dlg: {} };
|
||||
var sax = sax || { page: {}, url: {}, links: {}, form: {}, data: {}, ajax: {}, msg: {}, lbl: {}, dlg: { title: {}, btn: {} }, $frm: {}, $dlg: {}, $pnl: {} };
|
||||
sax.url.base = '@Model.RedirectLocation.Base';
|
||||
sax.url.home = '@Model.RedirectLocation.Home';
|
||||
sax.url.sessionExpired = '@Model.RedirectLocation.Home_SessionExpired';
|
||||
@@ -90,7 +90,7 @@
|
||||
<body>
|
||||
|
||||
@* Header *@
|
||||
<header>
|
||||
<header id="sax-page-header">
|
||||
|
||||
@* Navigation bar *@
|
||||
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
|
||||
@@ -172,14 +172,14 @@
|
||||
</header>
|
||||
|
||||
@* Page body *@
|
||||
<div class="container">
|
||||
<div id="sax-page-body" class="container">
|
||||
<main role="main" class="pb-3">
|
||||
@RenderBody()
|
||||
</main>
|
||||
</div>
|
||||
|
||||
@* Footer *@
|
||||
<footer class="border-top footer text-muted">
|
||||
<footer id="sax-page-footer" class="border-top footer text-muted">
|
||||
<div class="container">
|
||||
@(Model.CopyrightNotice) - @Localiser["company.name"] @(Model.InstanceVersion) - <a asp-area="" asp-controller="Home" asp-action="">Home</a>
|
||||
</div>
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
min-height: 24px;
|
||||
color: #f0f0f0;
|
||||
background-color: #979797;
|
||||
border-bottom: solid 2px #979797;
|
||||
border-bottom: solid 1px #979797;
|
||||
}
|
||||
|
||||
.sax-panel-filter .sax-header .sax-caption
|
||||
@@ -113,7 +113,7 @@
|
||||
padding: 2px 8px;
|
||||
min-height: 24px;
|
||||
background-color: #e0e0e0;
|
||||
border-bottom: solid 2px #979797;
|
||||
border-bottom: solid 1px #979797;
|
||||
}
|
||||
|
||||
.sax-panel-item > .sax-header .sax-caption
|
||||
|
||||
@@ -65,6 +65,11 @@
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.sax-panel-info > .sax-content
|
||||
{
|
||||
padding: 8px 12px;
|
||||
}
|
||||
|
||||
.sax-panel-section.sax-edit .sax-panel-info,
|
||||
.sax-panel-section.sax-populating .sax-button-action.edit,
|
||||
.sax-panel-section .sax-panel-form
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
:root
|
||||
{
|
||||
/* Colour analysis: https://www.colorhexa.com/ */
|
||||
/* #4b0082 - Indigo. Ref. https://www.crispedge.com/color/4b0082 */
|
||||
--color-primary: #4b0082;
|
||||
--color-light: #9b71b9;
|
||||
|
||||
@@ -117,6 +117,9 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="account.caption.image.upload" xml:space="preserve">
|
||||
<value>Image Upload</value>
|
||||
</data>
|
||||
<data name="account.caption.profile" xml:space="preserve">
|
||||
<value>My Profile</value>
|
||||
</data>
|
||||
@@ -222,6 +225,9 @@
|
||||
<data name="label.effective" xml:space="preserve">
|
||||
<value>Effective</value>
|
||||
</data>
|
||||
<data name="label.email" xml:space="preserve">
|
||||
<value>Email</value>
|
||||
</data>
|
||||
<data name="label.email.address" xml:space="preserve">
|
||||
<value>Email address</value>
|
||||
</data>
|
||||
@@ -234,6 +240,9 @@
|
||||
<data name="label.headline" xml:space="preserve">
|
||||
<value>Headline</value>
|
||||
</data>
|
||||
<data name="label.image" xml:space="preserve">
|
||||
<value>Image</value>
|
||||
</data>
|
||||
<data name="label.keep.signed.in" xml:space="preserve">
|
||||
<value>Remember Me</value>
|
||||
</data>
|
||||
@@ -381,6 +390,21 @@
|
||||
<data name="msg.something.gone.wrong" xml:space="preserve">
|
||||
<value>Unfortunately, something has gone wrong.\n\nYou will be returned to the home page.</value>
|
||||
</data>
|
||||
<data name="msg.upload.file.select" xml:space="preserve">
|
||||
<value>Please select a file to upload.</value>
|
||||
</data>
|
||||
<data name="msg.upload.file.size.max" xml:space="preserve">
|
||||
<value>Maximum image file size is {0}.</value>
|
||||
</data>
|
||||
<data name="msg.upload.file.type.invalid" xml:space="preserve">
|
||||
<value>Unsupported file type: {0}.</value>
|
||||
</data>
|
||||
<data name="msg.upload.file.uploading" xml:space="preserve">
|
||||
<value>Uploading {0}.</value>
|
||||
</data>
|
||||
<data name="msg.upload.image.single" xml:space="preserve">
|
||||
<value>Only one image can be uploaded.</value>
|
||||
</data>
|
||||
<data name="msg.validation.duplicate.value" xml:space="preserve">
|
||||
<value>Value is already in use</value>
|
||||
</data>
|
||||
|
||||
@@ -12,6 +12,12 @@ using Saxonite.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Saxonite.Net.Standard.Base.App;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Sarand.Net.Standard.Base.Helpers;
|
||||
using System.IO;
|
||||
using System.Drawing;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
|
||||
namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
{
|
||||
@@ -21,6 +27,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
partial class AccountController
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Common response data.
|
||||
public class ContactResponseData
|
||||
{
|
||||
public String EmailAddress { get; set; }
|
||||
@@ -54,6 +61,13 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Utilites.
|
||||
private ItemId GetUserItemId(SysId userAccountId)
|
||||
{
|
||||
return new ItemId((short)Sax.DataItemType.UserAccount, SessionData.User.UserAccountId);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Account - Get Contact Details.
|
||||
//-------------------------------------------------------------------
|
||||
@@ -84,6 +98,17 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
return Json(responseData.SetGoHome(messageTitle, @Localiser.GetJavascriptText("msg.something.gone.wrong")));
|
||||
}
|
||||
|
||||
// Logically delete any previous 'Uploaded' Avatar image.
|
||||
ItemId userItemId = GetUserItemId(SessionData.User.UserAccountId);
|
||||
SaxItemImage itemImageAvatarUploaded = ItemDataMgr.GetItemImage(userItemId, Sax.ImageType.AvatarUpload, SaxItemImage.StatusCat.ActiveOnly);
|
||||
if (itemImageAvatarUploaded != null)
|
||||
{
|
||||
itemImageAvatarUploaded.Status = SaStatus.Deleted;
|
||||
if (!ItemDataMgr.UpdateItemImage(itemImageAvatarUploaded, DbUpdateInfo))
|
||||
SaLogger.Warn(fn + " Failed to logically delete uploaded avatar image - " + ItemDataMgr.ErrorStateMessage);
|
||||
}
|
||||
|
||||
|
||||
// Populate data to response.
|
||||
responseData.Contact = new ContactResponseData();
|
||||
PopulateContactResponseData(responseData.Contact, userAccount);
|
||||
@@ -91,6 +116,93 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
return Json(responseData);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Account - Upload Contact Image.
|
||||
// Ref. http://www.binaryintellect.net/articles/474dc031-087f-4b81-b994-9ca2adb949d6.aspx
|
||||
//-------------------------------------------------------------------
|
||||
public class AjaxResponse_UploadContactImage : AjaxResponse_Data
|
||||
{
|
||||
public String UploadMsg { get; set; }
|
||||
}
|
||||
// Ajax request.
|
||||
[HttpPost]
|
||||
[Route("Account/Ajax/UploadContactImage")]
|
||||
public IActionResult UploadContactImage(Model_Account model)
|
||||
{
|
||||
String fn = GetType().Name + ".UploadContactImage";
|
||||
AjaxResponse_UploadContactImage responseData = new AjaxResponse_UploadContactImage();
|
||||
String messageTitle = Localiser["account.caption.profile.contact"];
|
||||
|
||||
// Validate session and referrer.
|
||||
if (!ValidReferer)
|
||||
return Forbid();
|
||||
if (!ValidUserSession)
|
||||
return GetAjaxResult_InvalidSession(responseData);
|
||||
|
||||
// Validate number of images.
|
||||
if (model.AccountContactImage.IsEmpty())
|
||||
{
|
||||
SaLogger.Warn(fn + " No image file supplied for upload");
|
||||
return Json(responseData);
|
||||
}
|
||||
if (model.AccountContactImage.Count != 1)
|
||||
{
|
||||
SaLogger.Warn(fn + " Invalid number of image files uploaded: " + model.AccountContactImage.Count);
|
||||
return Json(responseData.SetControlError("AccountContactImage", "Only one image can be uploaded."));
|
||||
}
|
||||
IFormFile file = model.AccountContactImage[0];
|
||||
|
||||
// Image properties.
|
||||
byte[] imageData = null;
|
||||
using (MemoryStream fileStream = new MemoryStream())
|
||||
{
|
||||
file.CopyTo(fileStream);
|
||||
imageData = fileStream.ToArray();
|
||||
}
|
||||
|
||||
// Validate the image.
|
||||
ImageUtils.ImageConfig imageConfig = ImageUtils.VerifyImageData(imageData);
|
||||
if (!imageConfig.ValidImage)
|
||||
return Json(responseData.SetControlError("AccountContactImage", "Invalid image file uploaded."));
|
||||
|
||||
// Image belongs to the user's account.
|
||||
ItemId userItemId = GetUserItemId(SessionData.User.UserAccountId);
|
||||
|
||||
// Store uploaded image as 'Upload' Avatar - awaiting confirmation that the contact details are to be saved.
|
||||
SaxItemImage itemImage = ItemDataMgr.GetItemImage(userItemId, Sax.ImageType.AvatarUpload, SaxItemImage.StatusCat.Any);
|
||||
if (itemImage == null)
|
||||
itemImage = ItemDataMgr.CreateItemImage(userItemId, Sax.ImageType.AvatarUpload);
|
||||
itemImage.Filename = file.FileName;
|
||||
itemImage.Mime = SacsContentTypeHelper.GetMimeTypeFromContentType(file.ContentType).ToString().ToLower();
|
||||
itemImage.ContentType = file.ContentType;
|
||||
itemImage.Width = imageConfig.Width;
|
||||
itemImage.Height = imageConfig.Height;
|
||||
itemImage.ImageData = imageData;
|
||||
itemImage.Status = SaxItemImage.DefaultStatus;
|
||||
|
||||
if (!SysId.IsValid(itemImage.Id))
|
||||
{
|
||||
if (!ItemDataMgr.InsertItemImage(itemImage, DbUpdateInfo))
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to insert uploaded image - " + ItemDataMgr.ErrorStateMessage);
|
||||
return Json(responseData.SetControlError("AccountContactImage", Localiser["msg.error.item.insert.failed"]));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!ItemDataMgr.UpdateItemImage(itemImage, DbUpdateInfo))
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to update uploaded image - " + ItemDataMgr.ErrorStateMessage);
|
||||
return Json(responseData.SetControlError("AccountContactImage", Localiser["msg.error.item.insert.failed"]));
|
||||
}
|
||||
}
|
||||
|
||||
// Complete response.
|
||||
//responseData.SetNotification(messageTitle, "Image uploaded.");
|
||||
responseData.Success = true;
|
||||
return Json(responseData);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Account - Store Contact Details.
|
||||
//-------------------------------------------------------------------
|
||||
@@ -160,6 +272,45 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
// Refresh profile contact details to session.
|
||||
RefreshSessionProfileContact(userAccount);
|
||||
|
||||
// Check for uploaded profile image.
|
||||
ItemId userItemId = GetUserItemId(SessionData.User.UserAccountId);
|
||||
SaxItemImage itemImageAvatarUploaded = ItemDataMgr.GetItemImage(userItemId, Sax.ImageType.AvatarUpload, SaxItemImage.StatusCat.ActiveOnly);
|
||||
if (itemImageAvatarUploaded != null)
|
||||
{
|
||||
// Retrieve current Avatar image.
|
||||
SaxItemImage itemImageAvatar = ItemDataMgr.GetItemImage(userItemId, Sax.ImageType.Avatar, SaxItemImage.StatusCat.Any);
|
||||
if (itemImageAvatar == null)
|
||||
itemImageAvatar = ItemDataMgr.CreateItemImage(userItemId, Sax.ImageType.Avatar);
|
||||
// Copy properties from uploaded image.
|
||||
itemImageAvatar.Filename = itemImageAvatarUploaded.Filename;
|
||||
itemImageAvatar.Mime = itemImageAvatarUploaded.Mime;
|
||||
itemImageAvatar.ContentType = itemImageAvatarUploaded.ContentType;
|
||||
itemImageAvatar.Width = itemImageAvatarUploaded.Width;
|
||||
itemImageAvatar.Height = itemImageAvatarUploaded.Height;
|
||||
itemImageAvatar.ImageData = itemImageAvatarUploaded.ImageData;
|
||||
itemImageAvatar.Status = SaxItemImage.DefaultStatus;
|
||||
if (!SysId.IsValid(itemImageAvatar.Id))
|
||||
{
|
||||
if (!ItemDataMgr.InsertItemImage(itemImageAvatar, DbUpdateInfo))
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to insert avatar image - " + ItemDataMgr.ErrorStateMessage);
|
||||
return Json(responseData.SetControlError("AccountContactImage", Localiser["msg.error.item.insert.failed"]));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!ItemDataMgr.UpdateItemImage(itemImageAvatar, DbUpdateInfo))
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to update avatar image - " + ItemDataMgr.ErrorStateMessage);
|
||||
return Json(responseData.SetControlError("AccountContactImage", Localiser["msg.error.item.update.failed"]));
|
||||
}
|
||||
}
|
||||
// Logically delete the uplaoded image.
|
||||
itemImageAvatarUploaded.Status = SaStatus.Deleted;
|
||||
if (!ItemDataMgr.UpdateItemImage(itemImageAvatarUploaded, DbUpdateInfo))
|
||||
SaLogger.Warn(fn + " Failed to logically delete uploaded avatar image - " + ItemDataMgr.ErrorStateMessage);
|
||||
}
|
||||
|
||||
// Construct response.
|
||||
responseData.Contact = new ContactResponseData();
|
||||
PopulateContactResponseData(responseData.Contact, userAccount);
|
||||
|
||||
@@ -0,0 +1,124 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Saxonite.Net.Core.Web.Online.Models;
|
||||
using Saxonite.Net.Core.Web.Base.App;
|
||||
using Saxonite.Net.Core.Web.Base.Controllers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Saxonite.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Saxonite.Net.Standard.Base.App;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Sarand.Net.Standard.Base.Helpers;
|
||||
using System.IO;
|
||||
using System.Drawing;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Microsoft.Net.Http.Headers;
|
||||
|
||||
namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
{
|
||||
//=======================================================================
|
||||
// Online Image Controller - delivers dynamic images.
|
||||
//=======================================================================
|
||||
public partial class ImageController : SaxController_Online
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public ImageController(SaxLocaliser localiser, ILogger<HomeController> logger) :
|
||||
base(localiser, logger)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Account Contact image - General
|
||||
//-------------------------------------------------------------------
|
||||
// Account Contact Image request.
|
||||
/// <summary>
|
||||
/// Get the Account Contact Image for the specified account.
|
||||
/// <para>Current User Account is used if no other specified in the encrypted parameter.</para>
|
||||
/// <para>Encrypted parameter:</para>
|
||||
/// <para>- uaie: User Account Id encrypted.</para>
|
||||
/// </summary>
|
||||
[HttpGet]
|
||||
[Route("Image/Account/Contact")]
|
||||
public IActionResult GetAccountContactImage(String uaie)
|
||||
{
|
||||
String userAccountIdParam = "";// ToDo Decrypt from uaie value.
|
||||
SysId userAccountId = userAccountIdParam.ToSysId();
|
||||
if (!SysId.IsValid(userAccountId))
|
||||
userAccountId = SessionData.User.UserAccountId;
|
||||
return GetAccountContactImage(userAccountId, Sax.ImageType.Avatar);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Account Contact image - Profile
|
||||
//-------------------------------------------------------------------
|
||||
// Account Profile Contact Image request.
|
||||
/// <summary>
|
||||
/// Get the current Account Profile Contact Image for the specified account.
|
||||
/// <para>Account is always current User Account - this request is only fir use from the user's own profile page.</para>
|
||||
/// <para>'Uploaded' avatar image will take precedence as this will be the latest if present.</para>
|
||||
/// <para>NB Avoid caching this image as it will change whenever a new one is uploaded.</para>
|
||||
/// </summary>
|
||||
[HttpGet]
|
||||
[Route("Image/Account/Contact/Profile")]
|
||||
[ResponseCache(NoStore = true, Location = ResponseCacheLocation.None)]
|
||||
public IActionResult GetAccountContactImage()
|
||||
{
|
||||
// Response should not be cached.
|
||||
Response.Headers[HeaderNames.CacheControl] = "no-cache, no-store, must-revalidate, max-age=0";
|
||||
Response.Headers[HeaderNames.Expires] = "-1";
|
||||
SysId userAccountId = SessionData.User.UserAccountId;
|
||||
return GetAccountContactImage(userAccountId, Sax.ImageType.AvatarUpload);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// Get the
|
||||
/// </summary>
|
||||
/// <param name="imageTypePriority"></param>
|
||||
/// <returns></returns>
|
||||
private IActionResult GetAccountContactImage(SysId userAccountId, Sax.ImageType imageTypePriority)
|
||||
{
|
||||
String fn = GetType().Name + ".GetAccountContactImage";
|
||||
|
||||
// Validate session and referrer.
|
||||
if (!ValidReferer)
|
||||
return Forbid();
|
||||
if (!ValidUserSession)
|
||||
return Forbid();
|
||||
ItemId userItemId = new ItemId((short)Sax.DataItemType.UserAccount, userAccountId);
|
||||
|
||||
// Retrieve account contact images.
|
||||
SaxItemImage.Params prmItemImage = new SaxItemImage.Params();
|
||||
prmItemImage.ItemIdsIncluded.Add(userItemId);
|
||||
prmItemImage.ImageTypesIncluded.Add(Sax.ImageType.Avatar);
|
||||
prmItemImage.ImageTypesIncluded.Add(Sax.ImageType.AvatarUpload);
|
||||
prmItemImage.StatusCat = SaxItemImage.StatusCat.ActiveOnly;
|
||||
SaxItemImage itemImage = null;
|
||||
foreach (SaxItemImage itemImageCandidate in ItemDataMgr.GetItemImageList(prmItemImage))
|
||||
{
|
||||
// One of the 'Avatar' image types will take precedence.
|
||||
if (itemImage == null || itemImageCandidate.ImageType == imageTypePriority)
|
||||
itemImage = itemImageCandidate;
|
||||
}
|
||||
|
||||
if (itemImage == null)
|
||||
return NotFound();
|
||||
|
||||
// Construct response.
|
||||
return File(itemImage.ImageData, itemImage.ContentType);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -33,6 +33,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
public class ActivityResponseData
|
||||
{
|
||||
public short ItemType { get; set; }
|
||||
public String ItemTypeClass { get; set; }
|
||||
public long ItemIdx { get; set; }
|
||||
public String Caption { get; set; }
|
||||
public String Blurb { get; set; }
|
||||
@@ -84,6 +85,10 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
{
|
||||
ActivityResponseData activityData = new ActivityResponseData();
|
||||
activityData.ItemType = itemData.ItemId.Type;
|
||||
if (itemData.ItemId.Type == (int)Sax.DataItemType.JournalistArticle)
|
||||
activityData.ItemTypeClass = "Article";
|
||||
else if (itemData.ItemId.Type == (int)Sax.DataItemType.OrganisationOpportunity)
|
||||
activityData.ItemTypeClass = "Opportunity";
|
||||
// ToDo Mask activity index Id with cross-reference stored in session data.
|
||||
activityData.ItemIdx = SysId.ToLong(itemData.ItemId.Id);
|
||||
activityData.Caption = itemData.Caption;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Saxonite.Base.App;
|
||||
@@ -37,6 +38,8 @@ namespace Saxonite.Net.Core.Web.Online.Models
|
||||
public String AccountRegionCaptionCountry { get; }
|
||||
public String AccountRegionIdProvince { get; set; }
|
||||
public String AccountRegionCaptionProvince { get; }
|
||||
// Image.
|
||||
public List<IFormFile> AccountContactImage { get; set; }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Sport properties.
|
||||
|
||||
@@ -16,25 +16,38 @@
|
||||
|
||||
<div class="sax-content">
|
||||
|
||||
<div class="sax-property AccountEmailAddress hidden">
|
||||
<div class="row">
|
||||
<div class="col-sm-4 sax-label text-sm-right">@Localiser["label.email.address"]</div>
|
||||
<div class="col-sm-8 sax-value"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
||||
<div class="sax-property AccountName hidden">
|
||||
<div class="row">
|
||||
<div class="col-sm-4 sax-label text-sm-right">@Localiser["label.name"]</div>
|
||||
<div class="col-sm-8 sax-value"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
|
||||
<div class="sax-property AccountEmailAddress hidden">
|
||||
<div class="row">
|
||||
<div class="col-sm-4 sax-label text-sm-right">@Localiser["label.email.address"]</div>
|
||||
<div class="col-sm-8 sax-value"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="sax-property AccountName hidden">
|
||||
<div class="row">
|
||||
<div class="col-sm-4 sax-label text-sm-right">@Localiser["label.name"]</div>
|
||||
<div class="col-sm-8 sax-value"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="sax-property AccountLocation hidden">
|
||||
<div class="row">
|
||||
<div class="col-sm-4 sax-label text-sm-right">@Localiser["label.location"]</div>
|
||||
<div class="col-sm-8 sax-value"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="sax-property AccountLocation hidden">
|
||||
<div class="row">
|
||||
<div class="col-sm-4 sax-label text-sm-right">@Localiser["label.location"]</div>
|
||||
<div class="col-sm-8 sax-value"></div>
|
||||
</div>
|
||||
|
||||
<div class="fixed">
|
||||
@* Account Contact image *@
|
||||
<div class=""><img src="" class="sax-contact-image AccountContact" alt="" title="" /></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -58,7 +71,7 @@
|
||||
@* User email *@
|
||||
<div class="sax-form-control AccountEmailAddress">
|
||||
<div class="sax-label">
|
||||
<label for="ifAccountEmailAddress"><span><span class="required">*</span> @Localiser["label.email.address"]</span></label>
|
||||
<label for="ifAccountEmailAddress"><span><span class="required">*</span> @Localiser["label.email"]</span></label>
|
||||
</div>
|
||||
<div class="sax-control">
|
||||
@Html.TextBoxFor(model => model.AccountEmailAddress, new { @id = "ifAccountEmailAddress", @class = "AccountEmailAddress sax-input", @readonly = "readonly", @maxlength = @Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.UserAccount_EmailAddress) })
|
||||
@@ -66,36 +79,47 @@
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
|
||||
<div class="sax-form-control AccountTitle">
|
||||
<div class="sax-label">
|
||||
<label for="cbAccountTitle"><span><span class="required"></span> @Localiser["label.title"]</span></label>
|
||||
</div>
|
||||
<div class="sax-control">
|
||||
@Html.DropDownListFor(model => model.AccountTitle, Model.TitlesForSelect, Localiser["label.select"], new { @id = "cbAccountTitle", @class = "AccountTitle sax-select" })
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
||||
@* User first name *@
|
||||
<div class="sax-form-control AccountFirstName">
|
||||
<div class="sax-label">
|
||||
<label for="ifAccountFirstName"><span><span class="required">*</span> @Localiser["label.first.name"]</span></label>
|
||||
<div class="col-sm-4">
|
||||
@* User first Title *@
|
||||
<div class="sax-form-control AccountTitle pr8">
|
||||
<div class="sax-label">
|
||||
<label for="cbAccountTitle"><span><span class="required"></span> @Localiser["label.title"]</span></label>
|
||||
</div>
|
||||
<div class="sax-control">
|
||||
@Html.DropDownListFor(model => model.AccountTitle, Model.TitlesForSelect, Localiser["label.select"], new { @id = "cbAccountTitle", @class = "AccountTitle sax-select" })
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sax-control">
|
||||
@Html.TextBoxFor(model => model.AccountFirstName, new { @id = "ifAccountFirstName", @class = "AccountFirstName sax-input", @maxlength = @Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.UserAccount_FirstName) })
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
|
||||
@* User last name *@
|
||||
<div class="sax-form-control AccountLastName">
|
||||
<div class="sax-label">
|
||||
<label for="ifAccountLastName"><span><span class="required">*</span> @Localiser["label.last.name"]</span></label>
|
||||
<div class="col-sm-4">
|
||||
@* User first name *@
|
||||
<div class="sax-form-control AccountFirstName pr8">
|
||||
<div class="sax-label">
|
||||
<label for="ifAccountFirstName"><span><span class="required">*</span> @Localiser["label.first.name"]</span></label>
|
||||
</div>
|
||||
<div class="sax-control">
|
||||
@Html.TextBoxFor(model => model.AccountFirstName, new { @id = "ifAccountFirstName", @class = "AccountFirstName sax-input", @maxlength = @Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.UserAccount_FirstName) })
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sax-control">
|
||||
@Html.TextBoxFor(model => model.AccountLastName, new { @id = "ifAccountLastName", @class = "AccountLastName sax-input", @maxlength = @Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.UserAccount_LastName) })
|
||||
|
||||
<div class="col-sm-4">
|
||||
@* User last name *@
|
||||
<div class="sax-form-control AccountLastName">
|
||||
<div class="sax-label">
|
||||
<label for="ifAccountLastName"><span><span class="required">*</span> @Localiser["label.last.name"]</span></label>
|
||||
</div>
|
||||
<div class="sax-control">
|
||||
@Html.TextBoxFor(model => model.AccountLastName, new { @id = "ifAccountLastName", @class = "AccountLastName sax-input", @maxlength = @Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.UserAccount_LastName) })
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
|
||||
</div>
|
||||
|
||||
@* Country Region *@
|
||||
@@ -111,6 +135,32 @@
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
|
||||
@* Account image *@
|
||||
<div class="sax-form-control AccountContactImage">
|
||||
<div class="sax-label">
|
||||
<label for="ifAccountImage"><span>@Localiser["label.image"]</span></label>
|
||||
</div>
|
||||
<div class="sax-control">
|
||||
<div id="pnlContactImageDrop" class="sax-panel-drop row">
|
||||
<div class="fixed">
|
||||
<div class=""><img src="" class="sax-contact-image AccountContact" alt="" title="" /></div>
|
||||
</div>
|
||||
<div class="col">
|
||||
Drag your image here.
|
||||
<div class="DropMessage"></div>
|
||||
<div class="UploadMessage"></div>
|
||||
<div class="spacer4"></div>
|
||||
<button id="pbSelectContactImage" class="sax-button" style="min-width:auto;margin-left:4px;padding:4px 6px" onclick="sax.selectContactImage()">@Localiser["label.select"]</button>
|
||||
</div>
|
||||
<div class="fixed">
|
||||
<img id="" class="ContactImageUploadProgress" src="~/img/animated/progress-basketball-32.gif" style="display:none;margin:8px 4px;" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
|
||||
@* Action buttons *@
|
||||
<div class="spacer2"></div>
|
||||
<div class="row">
|
||||
<div class="col-6 text-left"><button type="button" class="sax-button" value="" onclick="sax.refreshProfileContactInfo();">@Localiser["label.cancel"]</button></div>
|
||||
@@ -121,6 +171,26 @@
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div id="dlgSelectContactImage" class="sax-dialog">
|
||||
@using (@Html.BeginForm(FormMethod.Post, new { @id = "frmSelectContactImage", @class = "sax-form", @onSubmit = "return false;" }))
|
||||
{
|
||||
<div class="spacer4"></div>
|
||||
<div class="sax-form-control AccountContactImage">
|
||||
<div class="row">
|
||||
<div class="fixed"><div style="padding:0 12px;">@Localiser["label.image"]</div></div>
|
||||
<div class="col"><input type="file" id="ifContactImage" name="" class="fullwidth" style="" /></div>
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
<div class="spacer2"></div>
|
||||
<div class="row">
|
||||
<div class="col"><div class="UploadMessage"></div></div>
|
||||
<div class="fixed"><img id="" class="ContactImageUploadProgress" src="~/img/animated/progress-basketball-32.gif" style="display:none;margin:8px 4px;" /></div>
|
||||
</div>
|
||||
<div class="spacer2"></div>
|
||||
}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -22,7 +22,13 @@
|
||||
|
||||
<script type="text/javascript">
|
||||
sax.dlg.title.selectRegionCountry = '@Localiser.GetJavascriptText("reference.caption.country.select")';
|
||||
sax.dlg.title.selectRegionProvince= '@Localiser.GetJavascriptText("reference.caption.province.select")';
|
||||
sax.dlg.title.selectRegionProvince = '@Localiser.GetJavascriptText("reference.caption.province.select")';
|
||||
sax.dlg.title.imageUpload = '@Localiser.GetJavascriptText("account.caption.image.upload")';
|
||||
sax.msg.uploadFileSelect = '@Localiser.GetJavascriptText("msg.upload.file.select")';
|
||||
sax.msg.uploadImageSingle = '@Localiser.GetJavascriptText("msg.upload.image.single")';
|
||||
sax.msg.uploadFileSizeMax = '@Localiser.GetJavascriptText("msg.upload.file.size.max","{0}")';
|
||||
sax.msg.uploadFileTypeInvalid = '@Localiser.GetJavascriptText("msg.upload.file.type.invalid","{0}")';
|
||||
sax.msg.uploadingFile = '@Localiser.GetJavascriptText("msg.upload.file.uploading","{0}")';
|
||||
sax.dlg.title.addUserSport = '@Localiser.GetJavascriptText("account.caption.profile.sport.add")';
|
||||
sax.dlg.title.updateUserSport = '@Localiser.GetJavascriptText("account.caption.profile.sport.update")';
|
||||
sax.dlg.title.selectRegion = '@Localiser.GetJavascriptText("reference.caption.region.select")';
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
<input type="hidden" class="FilterPageNo" name="DataPageNo" value="0" />
|
||||
<div class="row">
|
||||
<div class="col-sm-5 sax-label text-left text-sm-right">@Localiser["label.search"]</div>
|
||||
<div class="col-sm-7"><input type="search" id="" class="sax-input FilterOrganisation" name="Filter.Organisation" maxlength="32" /></div>
|
||||
<div class="col-sm-7"><input type="search" id="" class="sax-input FilterOrganisation" name="Filter.Organisation" maxlength="32" autocomplete="off" /></div>
|
||||
</div>
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<div class="RegionFilter sax-form">
|
||||
<div class="row">
|
||||
<div class="col right"><div class="sax-label">@Localiser["label.search"]</div></div>
|
||||
<div class="fixed"><input id="ifRegionFilter" class="sax-input" type="search" onkeyup="sax.data.selectRegion.fn.displayRegions();" /></div>
|
||||
<div class="fixed"><input type="search" id="ifRegionFilter" class="sax-input" maxlength="16" autocomplete="off" onkeyup="sax.data.selectRegion.fn.displayRegions();" /></div>
|
||||
</div>
|
||||
<div class="spacer2"></div>
|
||||
</div>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<div class="SportFilter sax-form">
|
||||
<div class="row">
|
||||
<div class="col right"><div class="sax-label">@Localiser["label.search"]</div></div>
|
||||
<div class="fixed"><input id="ifSportFilter" class="sax-input" type="search" onkeyup="sax.data.selectSport.fn.displaySports();" /></div>
|
||||
<div class="fixed"><input type="search" id="ifSportFilter" class="sax-input" maxlength="16" autocomplete="off" onkeyup="sax.data.selectSport.fn.displaySports();" /></div>
|
||||
</div>
|
||||
<div class="spacer2"></div>
|
||||
</div>
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
</div>
|
||||
<div class="sax-control row">
|
||||
<div class="col-sm-4"><div class="sax-label text-left text-sm-right">@Localiser["label.search"]</div></div>
|
||||
<div class="col-sm-8"><input type="search" name="Filter.Opportunity" id="ifOpportunityFilter" class="OpportunityFilter sax-input" maxlength="64" /></div>
|
||||
<div class="col-sm-8"><input type="search" id="ifOpportunityFilter" name="Filter.Opportunity" class="OpportunityFilter sax-input" maxlength="64" autocomplete="off" /></div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
@@ -34,9 +34,6 @@
|
||||
<label for="ifPassword"><span><span class="required">*</span> @Localiser["label.password"]</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 right">
|
||||
<div class="sax-action-link" style="font-size:12px;" onclick="sax.goToPage('Security/RequestPassword');">@Localiser["label.forgotten.password"]</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sax-control">
|
||||
@Html.PasswordFor(model => model.Password, new { @id = "ifPassword", @class = "sax-input", @maxlength = @Model.PasswordMaxLength })
|
||||
@@ -46,10 +43,15 @@
|
||||
|
||||
<div class="spacer4"></div>
|
||||
<div class="sax-form-control">
|
||||
<div class="">
|
||||
@Html.CheckBoxFor(model => model.KeepMeSignedIn, new { @id = "chkKeepMeSignedIn" })
|
||||
|
||||
<span class="sax-label pointer" onclick="$('#chkKeepMeSignedIn').click()">@Localiser["label.keep.signed.in"]</span>
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
@Html.CheckBoxFor(model => model.KeepMeSignedIn, new { @id = "chkKeepMeSignedIn" })
|
||||
|
||||
<span class="sax-label pointer" onclick="$('#chkKeepMeSignedIn').click()">@Localiser["label.keep.signed.in"]</span>
|
||||
</div>
|
||||
<div class="col-6 right">
|
||||
<div class="sax-action-link" style="font-size:0.9rem;" onclick="sax.goToPage('Security/RequestPassword');">@Localiser["label.forgotten.password"]</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
|
||||
@* Scripts *@
|
||||
<script>
|
||||
var sax = sax || { page: {}, url: {}, links: {}, data: {}, form: {}, msg: {}, lbl: {}, dlg: { title: {}, btn: {} }, $frm: {}, $dlg: {} };
|
||||
var sax = sax || { page: {}, url: {}, links: {}, data: {}, form: {}, ajax: {}, msg: {}, lbl: {}, dlg: { title: {}, btn: {} }, $frm: {}, $dlg: {}, $pnl: {} };
|
||||
sax.url.base = '@Model.RedirectLocation.Base';
|
||||
sax.url.home = '@Model.RedirectLocation.Home';
|
||||
sax.url.sessionExpired = '@Model.RedirectLocation.Home_SessionExpired';
|
||||
@@ -79,6 +79,7 @@
|
||||
sax.msg.dataRefreshing = '@Localiser.GetJavascriptText("msg.data.refreshing")';
|
||||
sax.msg.dataQuerying = '@Localiser.GetJavascriptText("msg.data.querying")';
|
||||
sax.msg.dataNoneFound = '@Localiser.GetJavascriptText("msg.data.noneFound")';
|
||||
sax.maxProfileImageSize = 2*10**6;
|
||||
sax.sessionCookieName = '@Model.SessionCookieName';
|
||||
sax.awaitingLogin = @awaitingLogin;
|
||||
sax.keepLoggedIn = @keepLoggedIn;
|
||||
@@ -90,7 +91,7 @@
|
||||
<body>
|
||||
|
||||
@* Header *@
|
||||
<header>
|
||||
<header id="sax-page-header">
|
||||
|
||||
@* Navigation bar *@
|
||||
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
|
||||
@@ -150,13 +151,17 @@
|
||||
</header>
|
||||
|
||||
@* Page body *@
|
||||
<div class="container">
|
||||
<div id="sax-page-body" class="container">
|
||||
<partial name="_CookieConsentPartial" />
|
||||
<main role="main" class="pb-3">
|
||||
@RenderBody()
|
||||
</main>
|
||||
</div>
|
||||
|
||||
@* Footer *@
|
||||
<footer id="sax-page-footer" class="">
|
||||
</footer>
|
||||
|
||||
@* Form to allow page navigation. *@
|
||||
@using (@Html.BeginForm(FormMethod.Post, new { @id = "frmNavigate" })) { }
|
||||
<div id='sax-please-wait'></div>
|
||||
|
||||
@@ -26,16 +26,17 @@
|
||||
border-color: var(--color-profile);
|
||||
}
|
||||
|
||||
.sax-profile .sax-header .sax-caption
|
||||
.sax-profile > .sax-header .sax-caption
|
||||
{
|
||||
font-size: 1.1rem;
|
||||
font-size: 1.25rem;
|
||||
font-weight: bold;
|
||||
color: var(--color-primary-dark);
|
||||
}
|
||||
|
||||
.sax-profile > .sax-content
|
||||
{
|
||||
padding: 6px 6px;
|
||||
background-color:#fff;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.sax-profile .sax-panel-info,
|
||||
@@ -49,19 +50,48 @@
|
||||
.sax-profile .sax-panel-form > .sax-header
|
||||
{
|
||||
padding: 4px 8px;
|
||||
background-color: #e8e8e8;
|
||||
background-color: var(--color-primary-pale);
|
||||
border-bottom: solid 1px #b0b0b0;
|
||||
border-color: var(--color-profile);
|
||||
}
|
||||
|
||||
.sax-profile .sax-panel-info > .sax-header .sax-caption,
|
||||
.sax-profile .sax-panel-form > .sax-header .sax-caption
|
||||
{
|
||||
font-size: 1.1rem;
|
||||
font-weight: bold;
|
||||
color: var(--color-primary-dark);
|
||||
}
|
||||
|
||||
.sax-profile .sax-panel-results .sax-panel-info > .sax-header
|
||||
{
|
||||
text-align:left;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.sax-profile .sax-panel-item
|
||||
{
|
||||
border-width:1px;
|
||||
border-width: 1px;
|
||||
}
|
||||
|
||||
/* Contact image */
|
||||
.sax-profile .sax-contact-image.AccountContact
|
||||
{
|
||||
max-width: 160px;
|
||||
max-height: 160px;
|
||||
margin: 0 8px;
|
||||
border: 1px solid #808080;
|
||||
}
|
||||
|
||||
.sax-profile #pnlContactImageDrop.sax-panel-drop
|
||||
{
|
||||
padding: 4px 8px;
|
||||
border: 1px solid #b0b0b080;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.sax-profile #pnlContactImageDrop.sax-panel-drop.sax-dragging
|
||||
{
|
||||
border-color: var(--color-profile);
|
||||
}
|
||||
|
||||
/* The End */
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
{
|
||||
margin: 8px auto;
|
||||
background-color: #f8f8f8;
|
||||
border: solid 2px #979797;
|
||||
border: solid 2px var(--color-primary);
|
||||
border-radius: 6px;
|
||||
-webkit-border-radius: 6px;
|
||||
-moz-border-radius: 6px;
|
||||
@@ -26,8 +26,8 @@
|
||||
padding: 2px 8px;
|
||||
min-height: 24px;
|
||||
color: #f0f0f0;
|
||||
background-color: #979797;
|
||||
border-bottom: solid 2px #979797;
|
||||
background-color: var(--color-primary);
|
||||
border-bottom: solid 1px var(--color-primary);
|
||||
}
|
||||
|
||||
.sax-panel-filter > .sax-header .sax-caption
|
||||
@@ -182,7 +182,25 @@
|
||||
.sax-panel-item.Article,
|
||||
.sax-panel-item.Article > .sax-header
|
||||
{
|
||||
border-color: #23397a;
|
||||
border-color: var(--color-article);
|
||||
}
|
||||
|
||||
.sax-panel-item.Article > .sax-header
|
||||
{
|
||||
background-color: var(--color-article-pale);
|
||||
}
|
||||
|
||||
/* Opportunitys */
|
||||
|
||||
.sax-panel-item.Opportunity,
|
||||
.sax-panel-item.Opportunity > .sax-header
|
||||
{
|
||||
border-color: var(--color-opportunity);
|
||||
}
|
||||
|
||||
.sax-panel-item.Opportunity > .sax-header
|
||||
{
|
||||
background-color: var(--color-opportunity-pale);
|
||||
}
|
||||
|
||||
/* The End */
|
||||
|
||||
@@ -40,14 +40,24 @@
|
||||
border-color: var(--color-primary);
|
||||
}
|
||||
|
||||
.sax-panel-form > .sax-header
|
||||
{
|
||||
background-color: var(--color-primary);
|
||||
}
|
||||
|
||||
.sax-panel-info > .sax-header .sax-caption,
|
||||
.sax-panel-form > .sax-header .sax-caption
|
||||
{
|
||||
font-size: 1.5rem;
|
||||
font-size: 1.25rem;
|
||||
font-weight: bold;
|
||||
color: var(--color-primary-dark);
|
||||
}
|
||||
|
||||
.sax-panel-form > .sax-header .sax-caption
|
||||
{
|
||||
color:#f0f0f0;
|
||||
}
|
||||
|
||||
.sax-panel-info > .sax-header .sax-action img:hover,
|
||||
.sax-panel-form > .sax-header .sax-action img:hover
|
||||
{
|
||||
@@ -102,7 +112,7 @@
|
||||
|
||||
.sax-form .sax-form-control .sax-label
|
||||
{
|
||||
margin: 0 0 8px 0;
|
||||
margin: 0 0 4px 0;
|
||||
font-size: 1rem;
|
||||
line-height: 1.25;
|
||||
}
|
||||
@@ -128,10 +138,11 @@
|
||||
|
||||
.sax-form .sax-input, .sax-form .sax-textarea, .sax-form .sax-select
|
||||
{
|
||||
padding: 3px 8px 4px 8px;
|
||||
padding: 3px 8px 0 8px;
|
||||
width: 100%;
|
||||
min-height: 30px;
|
||||
font-size: 1rem;
|
||||
line-height: 1.25;
|
||||
line-height: 1.3;
|
||||
background-color: #fff;
|
||||
border: 1px solid #595959;
|
||||
border-radius: 2px;
|
||||
@@ -195,9 +206,9 @@
|
||||
color: #606060;
|
||||
color: var(--color-primary);
|
||||
background-color: #DFD2E1;
|
||||
border: solid 2px #606060;
|
||||
border: solid 1px #606060;
|
||||
border-color: var(--color-primary);
|
||||
border-radius: 8px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.sax-form button.sax-button:hover,
|
||||
|
||||
@@ -19,6 +19,15 @@
|
||||
--color-alt1: #2f6b63;
|
||||
--color-alt2: #452f6b;
|
||||
--color-alt3: #6b2f37;
|
||||
/* Activity colours */
|
||||
--color-article-dark: #7339ac;
|
||||
--color-article: #9966CC;
|
||||
--color-article-light: #b38cd9;
|
||||
--color-article-pale: #decdee;
|
||||
--color-opportunity-dark: #8f6b24;
|
||||
--color-opportunity: #CC9933;
|
||||
--color-opportunity-light: #dbb870;
|
||||
--color-opportunity-pale: #f3e7d0;
|
||||
/* Specific colours */
|
||||
--color-dialog: var(--color-alt3);
|
||||
}
|
||||
@@ -260,7 +269,7 @@ a:focus
|
||||
.ui-dialog
|
||||
{
|
||||
position: fixed;
|
||||
padding: 4px 4px 0 4px;
|
||||
padding: 0;
|
||||
background-color: #e9edf6;
|
||||
}
|
||||
|
||||
@@ -281,13 +290,18 @@ a:focus
|
||||
.ui-dialog.ui-widget .ui-widget-header
|
||||
{
|
||||
font-size: 1.1rem;
|
||||
color: #fff;
|
||||
color: #f0f0f0;
|
||||
background-color: #606060;
|
||||
border-color: var(--color-dialog);
|
||||
background-color: #606060;
|
||||
background-color: var(--color-dialog);
|
||||
}
|
||||
|
||||
.ui-dialog.ui-widget .ui-widget-header.ui-corner-all
|
||||
{
|
||||
border-radius:0;
|
||||
}
|
||||
|
||||
.ui-dialog.ui-widget .ui-widget-content
|
||||
{
|
||||
font-size: 1rem;
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 21 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 40 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 39 KiB |
@@ -32,20 +32,22 @@
|
||||
sax.refreshProfileContact = function (callbackFn)
|
||||
{
|
||||
delete sax.page.profileContactChanged;
|
||||
sax.ajaxProfileContact = sax.ajaxProfileContact || { url: sax.url.base + 'Account/Ajax/GetProfileContact', formId: 'frmNavigate', noWaitIcon: true };
|
||||
sax.ajaxProfileContact.callbackFn = callbackFn;
|
||||
sax.doAjaxRequest(sax.ajaxProfileContact, 50);
|
||||
sax.ajax.profileContact = sax.ajax.profileContact || { url: sax.url.base + 'Account/Ajax/GetProfileContact', formId: 'frmNavigate', noWaitIcon: true };
|
||||
sax.ajax.profileContact.callbackFn = callbackFn;
|
||||
sax.doAjaxRequest(sax.ajax.profileContact, 50);
|
||||
}
|
||||
sax.onRefreshProfileContactInfo = function (response)
|
||||
{
|
||||
//sax.debug('onRefreshProfileContactInfo', response);
|
||||
if (!response || !response.success || !response.contact) return;
|
||||
$('.sax-panel-section').show();
|
||||
var $section = $('.sax-panel-section.ProfileContact');
|
||||
$('.sax-message', $section).stop(true, false).fadeOut(200).empty();
|
||||
$('.sax-value', $section).empty();
|
||||
sax.refreshInfo($section, 'AccountEmailAddress', response.contact.emailAddress);
|
||||
sax.refreshInfo($section, 'AccountName', response.contact.displayName);
|
||||
sax.refreshInfo($section, 'AccountLocation', response.contact.locationCaption);
|
||||
$('img.AccountContact', $section).prop('src', 'Image/Account/Contact/Profile?' + (new Date()).getTime());
|
||||
sax.showNoInfoMsg($section);
|
||||
$section.removeClass('sax-populating');
|
||||
}
|
||||
@@ -53,7 +55,8 @@
|
||||
{
|
||||
//sax.debug('onRefreshProfileContactForm', response);
|
||||
if (!response || !response.success) return;
|
||||
var $section = $('.sax-panel-section.ProfileContact');
|
||||
$('.sax-panel-section').hide();
|
||||
var $section = $('.sax-panel-section.ProfileContact').show();
|
||||
$('.sax-message', $section).stop(true, false).fadeOut(200).empty();
|
||||
sax.refreshInput($section, 'AccountEmailAddress', response.contact.emailAddress);
|
||||
sax.refreshSelect($section, 'AccountTitle', response.contact.title);
|
||||
@@ -63,13 +66,14 @@
|
||||
sax.refreshInput($section, 'AccountRegionCaptionCountry', response.contact.regionCaptionCountry);
|
||||
sax.refreshInput($section, 'AccountRegionIdProvince', response.contact.regionIdProvince);
|
||||
sax.refreshInput($section, 'AccountRegionCaptionProvince', response.contact.regionCaptionProvince);
|
||||
$('img.AccountContact', $section).prop('src', 'Image/Account/Contact/Profile?' + (new Date()).getTime());
|
||||
$section.addClass('sax-edit');
|
||||
}
|
||||
sax.doStoreProfileContact = function ()
|
||||
{
|
||||
sax.clearControlErrors();
|
||||
sax.ajaxStoreProfileContact = sax.ajaxStoreProfileContact || { url: sax.url.base + 'Account/Ajax/StoreProfileContact', formId: 'frmProfileContact', callbackFn: sax.onStoreProfileContact };
|
||||
sax.doAjaxRequest(sax.ajaxStoreProfileContact, 50);
|
||||
sax.ajax.storeProfileContact = sax.ajax.storeProfileContact || { url: sax.url.base + 'Account/Ajax/StoreProfileContact', formId: 'frmProfileContact', callbackFn: sax.onStoreProfileContact };
|
||||
sax.doAjaxRequest(sax.ajax.storeProfileContact, 50);
|
||||
}
|
||||
sax.onStoreProfileContact = function (response)
|
||||
{
|
||||
@@ -91,6 +95,62 @@
|
||||
$('#ifAccountRegionCaptionCountry').val(region ? region.name : '');
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
sax.onDropContactImage = function (evt)
|
||||
{
|
||||
//sax.debug('onDropContactImage', evt);
|
||||
let files = evt.originalEvent.dataTransfer.files;
|
||||
if (files.length < 1) return;
|
||||
if (files.length > 1) return sax.doAlert(sax.dlg.title.imageUpload, sax.msg.uploadImageSingle);
|
||||
sax.onDropContactImageFile(files[0], $('#frmProfileContact'));
|
||||
}
|
||||
sax.onDropContactImageFile = function (file, context)
|
||||
{
|
||||
//sax.debug('onDropContactImageFile', file);
|
||||
if (file.size > sax.maxProfileImageSize) return sax.doAlert(sax.dlg.title.imageUpload, sax.msg.uploadFileSizeMax.format(sax.formatFileSize(sax.maxProfileImageSize)));
|
||||
if (file.type != 'image/jpg' && file.type != 'image/jpeg' && file.type != 'image/png') return sax.doAlert(sax.dlg.title.imageUpload, sax.msg.uploadFileTypeInvalid.format(sax.getFileType(file)));
|
||||
$(".UploadMessage", context).text(sax.msg.uploadingFile.format(file.name));
|
||||
$('img.ContactImageUploadProgress', context).fadeIn(200);
|
||||
sax.clearControlError(sax.$pnl.contactImageDrag);
|
||||
sax.data.contactImageUploadContext = context;
|
||||
|
||||
sax.ajax.uploadContactImage = sax.ajax.uploadContactImage || { url: sax.url.base + 'Account/Ajax/UploadContactImage', callbackFn: sax.handleContactImageUploadResponse, noWaitIcon: true };
|
||||
sax.ajax.uploadContactImage.formData = new FormData();
|
||||
sax.ajax.uploadContactImage.formData.append("__RequestVerificationToken", $('#frmNavigate input[name="__RequestVerificationToken"]').val());
|
||||
sax.ajax.uploadContactImage.formData.append("AccountContactImage", file);
|
||||
sax.doAjaxRequest(sax.ajax.uploadContactImage, 50);
|
||||
}
|
||||
sax.handleContactImageUploadResponse = function (response)
|
||||
{
|
||||
let context = sax.data.contactImageUploadContext;
|
||||
sax.debug('handleContactImageUploadResponse', response, context);
|
||||
if (!response) return;
|
||||
var $section = $('.sax-panel-section.ProfileContact');
|
||||
sax.refreshControlValues(response.controlValues, context);
|
||||
$(".UploadMessage", context).empty();
|
||||
$('img.ContactImageUploadProgress', context).hide();
|
||||
if (response.success)
|
||||
{
|
||||
sax.$dlg.selectContactImage.dialog('close');
|
||||
$('img.AccountContact', $section).prop('src', 'Image/Account/Contact/Profile?' + (new Date()).getTime());
|
||||
}
|
||||
}
|
||||
sax.selectContactImage = function ()
|
||||
{
|
||||
let $dlg = sax.$dlg.selectContactImage.dialog('option', { title: sax.dlg.title.imageUpload });
|
||||
$('#ifContactImage', $dlg).val('');
|
||||
sax.openDialog($dlg, 560, 240);
|
||||
}
|
||||
sax.uploadContactImage = function ()
|
||||
{
|
||||
let $dlg = sax.$dlg.selectContactImage;
|
||||
let $fileCtrl = $('#ifContactImage', $dlg);
|
||||
if (!$fileCtrl.length || !$fileCtrl[0].files.length)
|
||||
return sax.doAlert(sax.dlg.title.imageUpload, sax.msg.uploadFileSelect);
|
||||
let file = $fileCtrl[0].files[0];
|
||||
sax.onDropContactImageFile(file, $dlg);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
sax.refreshProfileSportsInfo = function (delay)
|
||||
{
|
||||
@@ -102,11 +162,11 @@
|
||||
}
|
||||
sax.refreshProfileSports = function (callbackFn)
|
||||
{
|
||||
sax.debug('refreshProfileSports');
|
||||
//sax.debug('refreshProfileSports');
|
||||
delete sax.page.profileSportsChanged;
|
||||
sax.ajaxProfileSports = sax.ajaxProfileSports || { url: sax.url.base + 'Account/Ajax/GetProfileSports', formId: 'frmNavigate', noWaitIcon: true };
|
||||
sax.ajaxProfileSports.callbackFn = callbackFn;
|
||||
sax.doAjaxRequest(sax.ajaxProfileSports, 50);
|
||||
sax.ajax.profileSports = sax.ajax.profileSports || { url: sax.url.base + 'Account/Ajax/GetProfileSports', formId: 'frmNavigate', noWaitIcon: true };
|
||||
sax.ajax.profileSports.callbackFn = callbackFn;
|
||||
sax.doAjaxRequest(sax.ajax.profileSports, 50);
|
||||
}
|
||||
sax.onRefreshProfileSportsInfo = function (response)
|
||||
{
|
||||
@@ -149,12 +209,12 @@
|
||||
{
|
||||
//sax.debug('updateProfileSport', id);
|
||||
$('#frmProfileSportId .UserSportId').val(id);
|
||||
sax.ajaxProfileSport = sax.ajaxProfileSport || { url: sax.url.base + 'Account/Ajax/GetProfileSport', formId: 'frmProfileSportId', callbackFn: sax.doUpdateProfileSport };
|
||||
sax.doAjaxRequest(sax.ajaxProfileSport, 50);
|
||||
sax.ajax.profileSport = sax.ajax.profileSport || { url: sax.url.base + 'Account/Ajax/GetProfileSport', formId: 'frmProfileSportId', callbackFn: sax.doUpdateProfileSport };
|
||||
sax.doAjaxRequest(sax.ajax.profileSport, 50);
|
||||
}
|
||||
sax.doUpdateProfileSport = function (response)
|
||||
{
|
||||
sax.debug('doUpdateProfileSport', response);
|
||||
//sax.debug('doUpdateProfileSport', response);
|
||||
let $dlg = sax.$dlg.profileSport;
|
||||
let item = response.sport;
|
||||
$('.UserSportId', $dlg).val(item.id);
|
||||
@@ -182,8 +242,8 @@
|
||||
{
|
||||
//sax.debug('storeProfileSport');
|
||||
sax.clearControlErrors();
|
||||
sax.ajaxStoreProfileSport = sax.ajaxStoreProfileSport || { url: sax.url.base + 'Account/Ajax/StoreProfileSport', formId: 'frmProfileSport', callbackFn: sax.onStoreProfileSport };
|
||||
sax.doAjaxRequest(sax.ajaxStoreProfileSport, 50);
|
||||
sax.ajax.storeProfileSport = sax.ajax.storeProfileSport || { url: sax.url.base + 'Account/Ajax/StoreProfileSport', formId: 'frmProfileSport', callbackFn: sax.onStoreProfileSport };
|
||||
sax.doAjaxRequest(sax.ajax.storeProfileSport, 50);
|
||||
}
|
||||
sax.onStoreProfileSport = function (response)
|
||||
{
|
||||
@@ -206,9 +266,9 @@
|
||||
{
|
||||
//sax.debug('refreshProfileOrganisations');
|
||||
delete sax.page.profileOrganisationsChanged;
|
||||
sax.ajaxProfileOrganisations = sax.ajaxProfileOrganisations || { url: sax.url.base + 'Account/Ajax/GetProfileOrganisations', formId: 'frmNavigate', noWaitIcon: true };
|
||||
sax.ajaxProfileOrganisations.callbackFn = callbackFn;
|
||||
sax.doAjaxRequest(sax.ajaxProfileOrganisations, 50);
|
||||
sax.ajax.profileOrganisations = sax.ajax.profileOrganisations || { url: sax.url.base + 'Account/Ajax/GetProfileOrganisations', formId: 'frmNavigate', noWaitIcon: true };
|
||||
sax.ajax.profileOrganisations.callbackFn = callbackFn;
|
||||
sax.doAjaxRequest(sax.ajax.profileOrganisations, 50);
|
||||
}
|
||||
sax.onRefreshProfileOrganisationsInfo = function (response)
|
||||
{
|
||||
@@ -278,11 +338,21 @@
|
||||
$('.sax-panel-section.ProfileContact .sax-action.sax-edit').on('click', function (evt) { sax.refreshProfileContactForm(); });
|
||||
$('input,textarea,select', '.sax-panel-section.ProfileContact').on('change', function () { sax.clearControlErrors(); sax.page.profileContactChanged = true; });
|
||||
|
||||
sax.$pnl.contactImageDrag = $('#pnlContactImageDrop')
|
||||
.on("dragenter", function (evt) { sax.haltEvent(evt); })
|
||||
.on("dragover", function (evt) { sax.haltEvent(evt); if (!sax.$pnl.contactImageDrag.hasClass('sax-dragging')) sax.$pnl.contactImageDrag.addClass('sax-dragging'); })
|
||||
.on("dragleave", function (evt) { sax.haltEvent(evt); sax.$pnl.contactImageDrag.removeClass('sax-dragging'); })
|
||||
.on("drop", function (evt) { sax.haltEvent(evt); sax.$pnl.contactImageDrag.removeClass('sax-dragging'); sax.onDropContactImage(evt); });
|
||||
|
||||
$('.sax-panel-section.ProfileSports .sax-action.sax-add').on('click', function (evt) { sax.addProfileSport(); });
|
||||
var opt = sax.dlgOpts();
|
||||
opt.buttons[sax.dlg.btn.ok] = function () { sax.storeProfileSport(); };
|
||||
opt.buttons[sax.dlg.btn.cancel] = function () { $(this).dialog('close'); };
|
||||
sax.$dlg.profileSport = $('#dlgProfileSport').dialog(opt);
|
||||
var opt = sax.dlgOpts();
|
||||
opt.buttons[sax.dlg.btn.ok] = function () { sax.uploadContactImage(); };
|
||||
opt.buttons[sax.dlg.btn.cancel] = function () { $(this).dialog('close'); };
|
||||
sax.$dlg.selectContactImage = $('#dlgSelectContactImage').dialog(opt);
|
||||
|
||||
setTimeout(sax.refreshProfile, 200);
|
||||
});
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
sax.populateItem = function ($item, item)
|
||||
{
|
||||
if (!item) return;
|
||||
$item.prop('id', sax.itemIdPrefix + item.id);
|
||||
$item.prop('id', sax.itemIdPrefix + item.id).addClass(item.itemTypeClass);
|
||||
$('.ActivityCaption', $item).text(item.caption);
|
||||
$('.ActivityBlurb', $item).text(item.blurb);
|
||||
$('.ActivitySport', $item).text(item.sport);
|
||||
|
||||
@@ -31,10 +31,43 @@
|
||||
{
|
||||
return sax.isNumeric(value) ? parseInt(value, 10) : defaultValue || 0;
|
||||
}
|
||||
if ("function" != typeof "".format)
|
||||
String.prototype.format = (function ()
|
||||
{
|
||||
var rx1 = /\{(\d|\d\d)\}/g, rx2 = /\d+/;
|
||||
return function ()
|
||||
{
|
||||
var args = arguments;
|
||||
return this.replace(rx1, function ($0)
|
||||
{
|
||||
var idx = 1 * $0.match(rx2)[0];
|
||||
return args[idx] !== undefined ? args[idx] : (args[idx] === "" ? "" : $0);
|
||||
});
|
||||
}
|
||||
}());
|
||||
sax.getFileType = function (file)
|
||||
{
|
||||
if (!file) return "";
|
||||
if (file.type) return file.type;
|
||||
if (file.filename) return filename.split('.').pop();
|
||||
return "";
|
||||
}
|
||||
sax.formatFileSize = function (size)
|
||||
{
|
||||
if (size / 10 ** 9 > 1) return Math.floor(size / 10 ** 9) + 'Gb';
|
||||
if (size / 10 ** 6 > 1) return Math.floor(size / 10 ** 6) + 'Mb';
|
||||
if (size / 10 ** 3 > 1) return Math.floor(size / 10 ** 3) + 'Kb';
|
||||
return size + 'bytes';
|
||||
}
|
||||
sax.escapeRegExp = function (val)
|
||||
{
|
||||
return (val || '').replace(/[[{}()*+?^$|\]\.\\]/g, "\\$&");
|
||||
}
|
||||
sax.haltEvent = function (evt)
|
||||
{
|
||||
evt.preventDefault();
|
||||
evt.stopPropagation();
|
||||
}
|
||||
sax.debug = sax.debugMode ? window.console.log.bind(window.console) : function () { };
|
||||
|
||||
//--------------------------------------------------------------
|
||||
@@ -213,7 +246,7 @@
|
||||
var $hdr = $('.heading', $not).css({ 'background-color': 'rgba(247,217,0,0.7)' });
|
||||
$('.title', $not).html(title);
|
||||
$('.message', $not).html(msg);
|
||||
var $bdy = $('.sax-page-body');
|
||||
var $bdy = $('#sax-page-body');
|
||||
//sax.debug(sax.topMargin($bdy));
|
||||
var fbr = $bdy[0].getBoundingClientRect();
|
||||
var fn = function () { $hdr.delay(2000).animate({ backgroundColor: '#f0f0f0' }, 1000); };
|
||||
@@ -350,24 +383,24 @@
|
||||
}
|
||||
sax.setControlError = function (sel, error)
|
||||
{
|
||||
var $ctrl = $(sel).closest('.sax-form-control').addClass('sax-error');
|
||||
var $ctrl = $(sel).closest('.sax-form-control').toggleClass('sax-error',!!error.length);
|
||||
$('.sax-message', $ctrl).text(error);
|
||||
}
|
||||
sax.refreshControlValues = function (controlValues)
|
||||
sax.refreshControlValues = function (controlValues, context)
|
||||
{
|
||||
var $frmCtrls = $('.sax-form-control').removeClass('sax-error');
|
||||
var $frmCtrls = $('.sax-form-control',context).removeClass('sax-error');
|
||||
sax.clearControlErrors();
|
||||
var values = (controlValues || []);
|
||||
var valuesLen = values.length;
|
||||
for (var valIdx = 0; valIdx < (controlValues || []).length; valIdx++)
|
||||
for (var valIdx = 0; valIdx < valuesLen; valIdx++)
|
||||
{
|
||||
let ctrlValue = controlValues[valIdx];
|
||||
let ctrlValue = values[valIdx];
|
||||
$frmCtrls.each(function (idx, frmCtrl)
|
||||
{
|
||||
var $frmCtrl = $(frmCtrl);
|
||||
if (!$frmCtrl.hasClass(ctrlValue.controlName)) return;
|
||||
var $ctrl = $('input,textarea,select', $frmCtrl);
|
||||
if ($ctrl.prop('name') != ctrlValue.controlName) return;
|
||||
if (ctrlValue.value)
|
||||
if ($ctrl.length && $ctrl.prop('name') == ctrlValue.controlName && ctrlValue.value)
|
||||
$ctrl.val(ctrlValue.value);
|
||||
if (ctrlValue.error)
|
||||
$frmCtrl.addClass('sax-error').find('.sax-message').text(ctrlValue.error);
|
||||
@@ -433,9 +466,9 @@
|
||||
sax.onWinResize = function ()
|
||||
{
|
||||
var winH = $(window).height();
|
||||
var $pageBody = $('#sax-body');
|
||||
var $hdr = $('#sax-header');
|
||||
var $ftr = $('#sax-footer');
|
||||
var $pageBody = $('#sax-page-body');
|
||||
var $hdr = $('#sax-page-header');
|
||||
var $ftr = $('#sax-page-footer');
|
||||
if (sax.isAutoHeight())
|
||||
$pageBody.height('auto');
|
||||
else
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
//-------------------------------------------------------------------
|
||||
public static class Version
|
||||
{
|
||||
private static String version { get; } = "1.0.6.2";
|
||||
private static String version { get; } = "1.0.7.0";
|
||||
// Retrieve version.
|
||||
public static String GetFullVersion () { return version; }
|
||||
public static String GetAppVersion ()
|
||||
@@ -40,6 +40,9 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
//-------------------------------------------------------------------
|
||||
// Version history.
|
||||
//-------------------------------------------------------------------
|
||||
// 1.0.7 8-Jun-2021 Online Activities & Profile
|
||||
// - Style Online Activities by type.
|
||||
// - Profile Contact Image upload.
|
||||
// 1.0.6 2-Jun-2021 Online Profile
|
||||
// - Refresh Online Session with profile region and sport changes.
|
||||
// - Profile Sport - participation and officiating dropdowns.
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
public static class RefreshIntervalSecs
|
||||
{
|
||||
public static int Initial { get; } = SacsSystem.DebugMode ? 2 : 5;
|
||||
public static int Periodic{ get; } = SacsSystem.DebugMode ? 60 : 1800;
|
||||
public static int Periodic { get; } = SacsSystem.DebugMode ? 60 : 1800;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -93,6 +93,7 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
RegionType,
|
||||
UserRole,
|
||||
Title,
|
||||
ImageType,
|
||||
OrganisationType,
|
||||
OrganisationCategory,
|
||||
OrganisationRole,
|
||||
@@ -136,7 +137,8 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
OrganisationOpportunity = 220,
|
||||
OrganisationEvent = 225,
|
||||
// Item link components.
|
||||
ItemSport = 400,
|
||||
ItemImage = 400,
|
||||
ItemSport = 420,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -216,6 +218,17 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
Lady
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Image Types.</summary>
|
||||
public enum ImageType
|
||||
{
|
||||
Unknown,
|
||||
/// <summary>User's profile image.</summary>
|
||||
Avatar = 100,
|
||||
/// <summary>User's new profile image awaiting confirmation.</summary>
|
||||
AvatarUpload = 101,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Organisation Types.</summary>
|
||||
public enum OrganisationType
|
||||
|
||||
@@ -6,7 +6,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Wed 2-Jun-2021 17:55:46
|
||||
// Code generated by Sarand Database Utilities Fri 4-Jun-2021 17:09:14
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Base.App
|
||||
{
|
||||
@@ -18,6 +18,7 @@ namespace Saxonite.Base.App
|
||||
{
|
||||
Unknown = 0,
|
||||
ActivityIndex,
|
||||
ItemImage,
|
||||
ItemSport,
|
||||
JournalistArticle,
|
||||
Organisation,
|
||||
@@ -50,6 +51,26 @@ namespace Saxonite.Base.App
|
||||
ActivityIndex_UpdateOn,
|
||||
ActivityIndex_UpdateBy,
|
||||
ActivityIndex_UpdateHost,
|
||||
ItemImage_Id,
|
||||
ItemImage_ItemType,
|
||||
ItemImage_ItemId,
|
||||
ItemImage_ImageType,
|
||||
ItemImage_ImageSeq,
|
||||
ItemImage_Filename,
|
||||
ItemImage_Mime,
|
||||
ItemImage_ContentType,
|
||||
ItemImage_Width,
|
||||
ItemImage_Height,
|
||||
ItemImage_ImageData,
|
||||
ItemImage_Notes,
|
||||
ItemImage_Flags,
|
||||
ItemImage_Status,
|
||||
ItemImage_CreateOn,
|
||||
ItemImage_CreateBy,
|
||||
ItemImage_CreateHost,
|
||||
ItemImage_UpdateOn,
|
||||
ItemImage_UpdateBy,
|
||||
ItemImage_UpdateHost,
|
||||
ItemSport_Id,
|
||||
ItemSport_ItemType,
|
||||
ItemSport_ItemId,
|
||||
@@ -224,8 +245,8 @@ namespace Saxonite.Base.App
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private static readonly int tableCount = 12;
|
||||
private static readonly int columnCount = 184;
|
||||
private static readonly int tableCount = 13;
|
||||
private static readonly int columnCount = 204;
|
||||
private static ulong maxTextLen = 0;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -372,6 +393,7 @@ namespace Saxonite.Base.App
|
||||
private static readonly String[] tables =
|
||||
{
|
||||
"ActivityIndex",
|
||||
"ItemImage",
|
||||
"ItemSport",
|
||||
"JournalistArticle",
|
||||
"Organisation",
|
||||
@@ -423,11 +445,17 @@ namespace Saxonite.Base.App
|
||||
new ColumnDfn(1,"UpdateOn",9,93,false,23),
|
||||
new ColumnDfn(1,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(1,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(2,"Id",4,4,true,10),
|
||||
new ColumnDfn(2,"Id",5,-5,true,19),
|
||||
new ColumnDfn(2,"ItemType",3,5,false,5),
|
||||
new ColumnDfn(2,"ItemId",4,4,false,10),
|
||||
new ColumnDfn(2,"SportId",4,4,false,10),
|
||||
new ColumnDfn(2,"ItemSportData",0,-9,false,0),
|
||||
new ColumnDfn(2,"ImageType",3,5,false,5),
|
||||
new ColumnDfn(2,"ImageSeq",2,-6,false,3),
|
||||
new ColumnDfn(2,"Filename",0,-9,false,1024),
|
||||
new ColumnDfn(2,"Mime",0,12,false,64),
|
||||
new ColumnDfn(2,"ContentType",0,12,false,128),
|
||||
new ColumnDfn(2,"Width",4,4,false,10),
|
||||
new ColumnDfn(2,"Height",4,4,false,10),
|
||||
new ColumnDfn(2,"ImageData",10,-3,false,0),
|
||||
new ColumnDfn(2,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(2,"Flags",3,5,false,5),
|
||||
new ColumnDfn(2,"Status",0,12,false,3),
|
||||
@@ -438,13 +466,10 @@ namespace Saxonite.Base.App
|
||||
new ColumnDfn(2,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(2,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(3,"Id",4,4,true,10),
|
||||
new ColumnDfn(3,"UserAccountIdJournalist",4,4,false,10),
|
||||
new ColumnDfn(3,"SportIdPrimary",4,4,false,10),
|
||||
new ColumnDfn(3,"RegionIdPrimary",4,4,false,10),
|
||||
new ColumnDfn(3,"Headline",0,-9,false,200),
|
||||
new ColumnDfn(3,"Summary",0,-9,false,2000),
|
||||
new ColumnDfn(3,"BodyData",0,-9,false,0),
|
||||
new ColumnDfn(3,"PublishedAt",9,93,false,16),
|
||||
new ColumnDfn(3,"ItemType",3,5,false,5),
|
||||
new ColumnDfn(3,"ItemId",4,4,false,10),
|
||||
new ColumnDfn(3,"SportId",4,4,false,10),
|
||||
new ColumnDfn(3,"ItemSportData",0,-9,false,0),
|
||||
new ColumnDfn(3,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(3,"Flags",3,5,false,5),
|
||||
new ColumnDfn(3,"Status",0,12,false,3),
|
||||
@@ -455,14 +480,13 @@ namespace Saxonite.Base.App
|
||||
new ColumnDfn(3,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(3,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(4,"Id",4,4,true,10),
|
||||
new ColumnDfn(4,"Name",0,-9,false,100),
|
||||
new ColumnDfn(4,"OrganisationType",0,12,false,3),
|
||||
new ColumnDfn(4,"OrganisationCategory",0,12,false,3),
|
||||
new ColumnDfn(4,"UserAccountIdJournalist",4,4,false,10),
|
||||
new ColumnDfn(4,"SportIdPrimary",4,4,false,10),
|
||||
new ColumnDfn(4,"RegionIdPrimary",4,4,false,10),
|
||||
new ColumnDfn(4,"CountryIso2Code",0,12,false,2),
|
||||
new ColumnDfn(4,"PhoneMain",0,-9,false,50),
|
||||
new ColumnDfn(4,"PhoneAlt",0,-9,false,50),
|
||||
new ColumnDfn(4,"Headline",0,-9,false,200),
|
||||
new ColumnDfn(4,"Summary",0,-9,false,2000),
|
||||
new ColumnDfn(4,"BodyData",0,-9,false,0),
|
||||
new ColumnDfn(4,"PublishedAt",9,93,false,16),
|
||||
new ColumnDfn(4,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(4,"Flags",3,5,false,5),
|
||||
new ColumnDfn(4,"Status",0,12,false,3),
|
||||
@@ -473,15 +497,14 @@ namespace Saxonite.Base.App
|
||||
new ColumnDfn(4,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(4,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(5,"Id",4,4,true,10),
|
||||
new ColumnDfn(5,"OrganisationId",4,4,false,10),
|
||||
new ColumnDfn(5,"Name",0,-9,false,100),
|
||||
new ColumnDfn(5,"OrganisationType",0,12,false,3),
|
||||
new ColumnDfn(5,"OrganisationCategory",0,12,false,3),
|
||||
new ColumnDfn(5,"SportIdPrimary",4,4,false,10),
|
||||
new ColumnDfn(5,"RegionIdPrimary",4,4,false,10),
|
||||
new ColumnDfn(5,"OpportunityTypeCode",0,12,false,3),
|
||||
new ColumnDfn(5,"Position",0,-9,false,200),
|
||||
new ColumnDfn(5,"Outline",0,-9,false,2000),
|
||||
new ColumnDfn(5,"OpportunityData",0,-9,false,0),
|
||||
new ColumnDfn(5,"PublishedAt",9,93,false,16),
|
||||
new ColumnDfn(5,"ExpiresAt",9,93,false,16),
|
||||
new ColumnDfn(5,"CountryIso2Code",0,12,false,2),
|
||||
new ColumnDfn(5,"PhoneMain",0,-9,false,50),
|
||||
new ColumnDfn(5,"PhoneAlt",0,-9,false,50),
|
||||
new ColumnDfn(5,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(5,"Flags",3,5,false,5),
|
||||
new ColumnDfn(5,"Status",0,12,false,3),
|
||||
@@ -492,12 +515,15 @@ namespace Saxonite.Base.App
|
||||
new ColumnDfn(5,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(5,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(6,"Id",4,4,true,10),
|
||||
new ColumnDfn(6,"RegionType",3,5,false,5),
|
||||
new ColumnDfn(6,"CountryIso2Code",0,12,false,2),
|
||||
new ColumnDfn(6,"Name",0,-9,false,100),
|
||||
new ColumnDfn(6,"Latitude",8,3,false,9),
|
||||
new ColumnDfn(6,"Longitude",8,3,false,9),
|
||||
new ColumnDfn(6,"RegionIdParent",4,4,false,10),
|
||||
new ColumnDfn(6,"OrganisationId",4,4,false,10),
|
||||
new ColumnDfn(6,"SportIdPrimary",4,4,false,10),
|
||||
new ColumnDfn(6,"RegionIdPrimary",4,4,false,10),
|
||||
new ColumnDfn(6,"OpportunityTypeCode",0,12,false,3),
|
||||
new ColumnDfn(6,"Position",0,-9,false,200),
|
||||
new ColumnDfn(6,"Outline",0,-9,false,2000),
|
||||
new ColumnDfn(6,"OpportunityData",0,-9,false,0),
|
||||
new ColumnDfn(6,"PublishedAt",9,93,false,16),
|
||||
new ColumnDfn(6,"ExpiresAt",9,93,false,16),
|
||||
new ColumnDfn(6,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(6,"Flags",3,5,false,5),
|
||||
new ColumnDfn(6,"Status",0,12,false,3),
|
||||
@@ -508,7 +534,12 @@ namespace Saxonite.Base.App
|
||||
new ColumnDfn(6,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(6,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(7,"Id",4,4,true,10),
|
||||
new ColumnDfn(7,"RegionType",3,5,false,5),
|
||||
new ColumnDfn(7,"CountryIso2Code",0,12,false,2),
|
||||
new ColumnDfn(7,"Name",0,-9,false,100),
|
||||
new ColumnDfn(7,"Latitude",8,3,false,9),
|
||||
new ColumnDfn(7,"Longitude",8,3,false,9),
|
||||
new ColumnDfn(7,"RegionIdParent",4,4,false,10),
|
||||
new ColumnDfn(7,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(7,"Flags",3,5,false,5),
|
||||
new ColumnDfn(7,"Status",0,12,false,3),
|
||||
@@ -519,24 +550,7 @@ namespace Saxonite.Base.App
|
||||
new ColumnDfn(7,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(7,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(8,"Id",4,4,true,10),
|
||||
new ColumnDfn(8,"EmailAddress",0,-9,false,200),
|
||||
new ColumnDfn(8,"Title",0,-9,false,20),
|
||||
new ColumnDfn(8,"FirstName",0,-9,false,100),
|
||||
new ColumnDfn(8,"Initials",0,-9,false,10),
|
||||
new ColumnDfn(8,"LastName",0,-9,false,100),
|
||||
new ColumnDfn(8,"PhoneMain",0,-9,false,50),
|
||||
new ColumnDfn(8,"PhoneMobile",0,-9,false,50),
|
||||
new ColumnDfn(8,"PhoneAlt",0,-9,false,50),
|
||||
new ColumnDfn(8,"DateOfBirth",9,93,false,16),
|
||||
new ColumnDfn(8,"RegionIdCountry",4,4,false,10),
|
||||
new ColumnDfn(8,"RegionIdProvince",4,4,false,10),
|
||||
new ColumnDfn(8,"PasswordToken",0,12,false,32),
|
||||
new ColumnDfn(8,"PasswordHashed",0,-9,false,100),
|
||||
new ColumnDfn(8,"PasswordHistory",0,-9,false,0),
|
||||
new ColumnDfn(8,"PasswordChangedAt",9,93,false,16),
|
||||
new ColumnDfn(8,"LastLoginAt",9,93,false,16),
|
||||
new ColumnDfn(8,"LastInvalidLoginAt",9,93,false,16),
|
||||
new ColumnDfn(8,"InvalidLoginCount",3,5,false,5),
|
||||
new ColumnDfn(8,"Name",0,-9,false,100),
|
||||
new ColumnDfn(8,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(8,"Flags",3,5,false,5),
|
||||
new ColumnDfn(8,"Status",0,12,false,3),
|
||||
@@ -546,11 +560,25 @@ namespace Saxonite.Base.App
|
||||
new ColumnDfn(8,"UpdateOn",9,93,false,23),
|
||||
new ColumnDfn(8,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(8,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(9,"Id",5,-5,true,19),
|
||||
new ColumnDfn(9,"UserAccountId",4,4,false,10),
|
||||
new ColumnDfn(9,"OrganisationId",4,4,false,10),
|
||||
new ColumnDfn(9,"OrganisationRoleCodes",0,12,false,256),
|
||||
new ColumnDfn(9,"OrganisationRoleCount",2,-6,false,3),
|
||||
new ColumnDfn(9,"Id",4,4,true,10),
|
||||
new ColumnDfn(9,"EmailAddress",0,-9,false,200),
|
||||
new ColumnDfn(9,"Title",0,-9,false,20),
|
||||
new ColumnDfn(9,"FirstName",0,-9,false,100),
|
||||
new ColumnDfn(9,"Initials",0,-9,false,10),
|
||||
new ColumnDfn(9,"LastName",0,-9,false,100),
|
||||
new ColumnDfn(9,"PhoneMain",0,-9,false,50),
|
||||
new ColumnDfn(9,"PhoneMobile",0,-9,false,50),
|
||||
new ColumnDfn(9,"PhoneAlt",0,-9,false,50),
|
||||
new ColumnDfn(9,"DateOfBirth",9,93,false,16),
|
||||
new ColumnDfn(9,"RegionIdCountry",4,4,false,10),
|
||||
new ColumnDfn(9,"RegionIdProvince",4,4,false,10),
|
||||
new ColumnDfn(9,"PasswordToken",0,12,false,32),
|
||||
new ColumnDfn(9,"PasswordHashed",0,-9,false,100),
|
||||
new ColumnDfn(9,"PasswordHistory",0,-9,false,0),
|
||||
new ColumnDfn(9,"PasswordChangedAt",9,93,false,16),
|
||||
new ColumnDfn(9,"LastLoginAt",9,93,false,16),
|
||||
new ColumnDfn(9,"LastInvalidLoginAt",9,93,false,16),
|
||||
new ColumnDfn(9,"InvalidLoginCount",3,5,false,5),
|
||||
new ColumnDfn(9,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(9,"Flags",3,5,false,5),
|
||||
new ColumnDfn(9,"Status",0,12,false,3),
|
||||
@@ -562,7 +590,9 @@ namespace Saxonite.Base.App
|
||||
new ColumnDfn(9,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(10,"Id",5,-5,true,19),
|
||||
new ColumnDfn(10,"UserAccountId",4,4,false,10),
|
||||
new ColumnDfn(10,"UserRoleCode",0,12,false,16),
|
||||
new ColumnDfn(10,"OrganisationId",4,4,false,10),
|
||||
new ColumnDfn(10,"OrganisationRoleCodes",0,12,false,256),
|
||||
new ColumnDfn(10,"OrganisationRoleCount",2,-6,false,3),
|
||||
new ColumnDfn(10,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(10,"Flags",3,5,false,5),
|
||||
new ColumnDfn(10,"Status",0,12,false,3),
|
||||
@@ -572,27 +602,39 @@ namespace Saxonite.Base.App
|
||||
new ColumnDfn(10,"UpdateOn",9,93,false,23),
|
||||
new ColumnDfn(10,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(10,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(11,"Id",5,-5,true,19),
|
||||
new ColumnDfn(11,"UserAccountId",4,4,false,10),
|
||||
new ColumnDfn(11,"ActivityIndexIds",0,-9,false,0),
|
||||
new ColumnDfn(11,"UserSessionData",0,-9,false,0),
|
||||
new ColumnDfn(11,"UserRoleCode",0,12,false,16),
|
||||
new ColumnDfn(11,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(11,"Flags",3,5,false,5),
|
||||
new ColumnDfn(11,"Status",0,12,false,3),
|
||||
new ColumnDfn(11,"CreateOn",9,93,false,23),
|
||||
new ColumnDfn(11,"CreateBy",4,4,false,10),
|
||||
new ColumnDfn(11,"CreateHost",0,12,false,100),
|
||||
new ColumnDfn(11,"UpdateOn",9,93,false,23),
|
||||
new ColumnDfn(12,"Id",4,4,true,10),
|
||||
new ColumnDfn(11,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(11,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(12,"UserAccountId",4,4,false,10),
|
||||
new ColumnDfn(12,"SportId",4,4,false,10),
|
||||
new ColumnDfn(12,"Participation",3,5,false,5),
|
||||
new ColumnDfn(12,"Officiating",3,5,false,5),
|
||||
new ColumnDfn(12,"UserSportData",0,-9,false,0),
|
||||
new ColumnDfn(12,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(12,"ActivityIndexIds",0,-9,false,0),
|
||||
new ColumnDfn(12,"UserSessionData",0,-9,false,0),
|
||||
new ColumnDfn(12,"Flags",3,5,false,5),
|
||||
new ColumnDfn(12,"Status",0,12,false,3),
|
||||
new ColumnDfn(12,"CreateOn",9,93,false,23),
|
||||
new ColumnDfn(12,"CreateBy",4,4,false,10),
|
||||
new ColumnDfn(12,"CreateHost",0,12,false,100),
|
||||
new ColumnDfn(12,"UpdateOn",9,93,false,23),
|
||||
new ColumnDfn(12,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(12,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(13,"Id",4,4,true,10),
|
||||
new ColumnDfn(13,"UserAccountId",4,4,false,10),
|
||||
new ColumnDfn(13,"SportId",4,4,false,10),
|
||||
new ColumnDfn(13,"Participation",3,5,false,5),
|
||||
new ColumnDfn(13,"Officiating",3,5,false,5),
|
||||
new ColumnDfn(13,"UserSportData",0,-9,false,0),
|
||||
new ColumnDfn(13,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(13,"Flags",3,5,false,5),
|
||||
new ColumnDfn(13,"Status",0,12,false,3),
|
||||
new ColumnDfn(13,"CreateOn",9,93,false,23),
|
||||
new ColumnDfn(13,"CreateBy",4,4,false,10),
|
||||
new ColumnDfn(13,"CreateHost",0,12,false,100),
|
||||
new ColumnDfn(13,"UpdateOn",9,93,false,23),
|
||||
new ColumnDfn(13,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(13,"UpdateHost",0,12,false,100),
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -20,6 +20,7 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
private static readonly List<TypeCodeDesc> regionTypeCodes = new List<TypeCodeDesc>();
|
||||
private static readonly List<TypeCodeDesc> userRoleCodes = new List<TypeCodeDesc>();
|
||||
private static readonly List<TypeCodeDesc> titleCodes = new List<TypeCodeDesc>();
|
||||
private static readonly List<TypeCodeDesc> imageTypeCodes = new List<TypeCodeDesc>();
|
||||
private static readonly List<TypeCodeDesc> organisationTypeCodes = new List<TypeCodeDesc>();
|
||||
private static readonly List<TypeCodeDesc> organisationCategoryCodes = new List<TypeCodeDesc>();
|
||||
private static readonly List<TypeCodeDesc> organisationRoleCodes = new List<TypeCodeDesc>();
|
||||
@@ -71,6 +72,11 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
titleCodes.Add(Sax.Title.Lord, "Lord", "Lord");
|
||||
titleCodes.Add(Sax.Title.Lady, "Lady", "Lady");
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Image types.
|
||||
imageTypeCodes.Add(Sax.ImageType.Avatar, "Avatar", "Avatar");
|
||||
imageTypeCodes.Add(Sax.ImageType.AvatarUpload, "AvatarUpload", "Avatar - upload");
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Organisation types.
|
||||
organisationTypeCodes.Add(Sax.OrganisationType.SocialEnterprise, "SEN", "Social Enterprise");
|
||||
|
||||
@@ -48,6 +48,8 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
return new List<TypeCodeDesc>(userRoleCodes);
|
||||
case Sax.CodeType.Title:
|
||||
return new List<TypeCodeDesc>(titleCodes);
|
||||
case Sax.CodeType.ImageType:
|
||||
return new List<TypeCodeDesc>(imageTypeCodes);
|
||||
case Sax.CodeType.OrganisationType:
|
||||
return new List<TypeCodeDesc>(organisationTypeCodes);
|
||||
case Sax.CodeType.OrganisationCategory:
|
||||
|
||||
@@ -0,0 +1,300 @@
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Saxonite.Net.Standard.Base.App;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Saxonite.Net.Standard.Base.Bus
|
||||
{
|
||||
//=======================================================================
|
||||
// ItemImage.
|
||||
//=======================================================================
|
||||
public abstract class SaxItemImage : SacsHierarchyItem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Columns.
|
||||
public enum Column
|
||||
{
|
||||
Pos,
|
||||
Id,
|
||||
// Item.
|
||||
ItemType,
|
||||
ItemType_Code,
|
||||
ItemType_Desc,
|
||||
ItemId,
|
||||
Item_Caption,
|
||||
// Image.
|
||||
ImageType,
|
||||
ImageType_Code,
|
||||
ImageType_Desc,
|
||||
ImageSeq,
|
||||
Filename,
|
||||
Mime,
|
||||
ContentType,
|
||||
Width,
|
||||
Height,
|
||||
DataSize,
|
||||
// Associated data.
|
||||
// Common.
|
||||
Notes,
|
||||
Flags,
|
||||
Status,
|
||||
Status_Desc,
|
||||
Status_Ind,
|
||||
CreateOn_Date,
|
||||
UpdateOn_Date,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Properties other than common.</summary>
|
||||
public class DataProperties
|
||||
{
|
||||
public ItemId ItemId { get; set; }
|
||||
public Sax.ImageType ImageType { get; set; }
|
||||
public byte ImageSeq { get; set; }
|
||||
public String Filename { get; set; }
|
||||
public String Mime { get; set; }
|
||||
public String ContentType { get; set; }
|
||||
public int Width { get; set; }
|
||||
public int Height { get; set; }
|
||||
public byte[] ImageData { get; set; }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data.
|
||||
public new class Data : SacsHierarchyItem.Data
|
||||
{
|
||||
// Data members.
|
||||
private readonly DataProperties data = new DataProperties();
|
||||
// Construction.
|
||||
public Data()
|
||||
{
|
||||
Status = DefaultStatus;
|
||||
}
|
||||
// Properties.
|
||||
public ItemId ItemId
|
||||
{
|
||||
get { return data.ItemId; }
|
||||
set { CheckChanged(data.ItemId, value); data.ItemId = value; }
|
||||
}
|
||||
public Sax.ImageType ImageType
|
||||
{
|
||||
get { return data.ImageType; }
|
||||
set { CheckChanged((int)data.ImageType, (int)value); data.ImageType = value; }
|
||||
}
|
||||
public byte ImageSeq
|
||||
{
|
||||
get { return data.ImageSeq; }
|
||||
set { CheckChanged(data.ImageSeq, value); data.ImageSeq = value; }
|
||||
}
|
||||
public String Filename
|
||||
{
|
||||
get { return data.Filename; }
|
||||
set { CheckChanged(data.Filename, value); data.Filename = value; }
|
||||
}
|
||||
public String Mime
|
||||
{
|
||||
get { return data.Mime; }
|
||||
set { CheckChanged(data.Mime, value); data.Mime = value; }
|
||||
}
|
||||
public String ContentType
|
||||
{
|
||||
get { return data.ContentType; }
|
||||
set { CheckChanged(data.ContentType, value); data.ContentType = value; }
|
||||
}
|
||||
public int Width
|
||||
{
|
||||
get { return data.Width; }
|
||||
set { CheckChanged(data.Width, value); data.Width = value; }
|
||||
}
|
||||
public int Height
|
||||
{
|
||||
get { return data.Height; }
|
||||
set { CheckChanged(data.Height, value); data.Height = value; }
|
||||
}
|
||||
public byte[] ImageData
|
||||
{
|
||||
get { return data.ImageData; }
|
||||
set { CheckChanged(data.ImageData, value); data.ImageData = value; }
|
||||
}
|
||||
// Population.
|
||||
internal void PopulateFrom(Data data)
|
||||
{
|
||||
ItemId = data.ItemId;
|
||||
ImageType = data.ImageType;
|
||||
ImageSeq = data.ImageSeq;
|
||||
Filename = data.Filename;
|
||||
Mime = data.Mime;
|
||||
ContentType = data.ContentType;
|
||||
Width = data.Width;
|
||||
Height = data.Height;
|
||||
ImageData = data.ImageData;
|
||||
base.PopulateFrom(data);
|
||||
}
|
||||
public Data Clone()
|
||||
{
|
||||
Data data = new Data();
|
||||
data.PopulateFrom(this);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Error field - identify properties with validation error.
|
||||
public new class ErrField : SacsHierarchyItem.ErrField
|
||||
{
|
||||
// Identifies the field that has invalid data.
|
||||
public ValidValue ItemId { get; set; } = ValidValue.Valid;
|
||||
public ValidValue ImageType { get; set; } = ValidValue.Valid;
|
||||
public ValidValue ImageSeq { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Filename { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Mime { get; set; } = ValidValue.Valid;
|
||||
public ValidValue ContentType { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Width { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Height { get; set; } = ValidValue.Valid;
|
||||
public ValidValue ImageData { get; set; } = ValidValue.Valid;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private readonly Data data = new Data();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SaxItemImage(SysId id, ItemId itemId, Sax.ImageType imageType) : base(id)
|
||||
{
|
||||
base.SetData(data);
|
||||
ItemId = itemId;
|
||||
ImageType = imageType;
|
||||
Status = DefaultStatus;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Status.
|
||||
private static readonly List<SaStatus> validStatuses = new List<SaStatus>()
|
||||
{
|
||||
SaStatus.Active,
|
||||
SaStatus.Inactive,
|
||||
SaStatus.Deleted,
|
||||
};
|
||||
public static SaStatus DefaultStatus { get { return SaStatus.Active; } }
|
||||
public static List<SaStatus> ValidStatuses { get { return new List<SaStatus>(validStatuses); } }
|
||||
public static DataValue.TriStateType GetStatusTriState(SaStatus status)
|
||||
{
|
||||
if (status == SaStatus.Active) return DataValue.TriStateType.Green;
|
||||
if (status == SaStatus.Inactive) return DataValue.TriStateType.Red;
|
||||
if (status == SaStatus.Deleted) return DataValue.TriStateType.Purple;
|
||||
return DataValue.TriStateType.Unknown;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities.
|
||||
public ItemId GetItemId()
|
||||
{
|
||||
return new ItemId((short)Sax.DataItemType.ItemImage, Id);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException(fn + " Id cannot be changed");
|
||||
if (ItemId.IsValid(ItemId) && ItemId.Type != data.ItemId.Type && SysId.ToInt(ItemId.Id) != SysId.ToInt(data.ItemId.Id))
|
||||
throw new NotSupportedException(fn + " Item Id cannot be changed");
|
||||
if (ImageType > 0 && ImageType != data.ImageType)
|
||||
throw new NotSupportedException(fn + " Image Type cannot be changed");
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
public ItemId ItemId
|
||||
{
|
||||
get { return data.ItemId; }
|
||||
protected set { data.ItemId = value; }
|
||||
}
|
||||
public Sax.ImageType ImageType
|
||||
{
|
||||
get { return data.ImageType; }
|
||||
protected set { data.ImageType = value; }
|
||||
}
|
||||
public byte ImageSeq
|
||||
{
|
||||
get { return data.ImageSeq; }
|
||||
set { data.ImageSeq = value; }
|
||||
}
|
||||
public String Filename
|
||||
{
|
||||
get { return data.Filename; }
|
||||
set { data.Filename = value; }
|
||||
}
|
||||
public String Mime
|
||||
{
|
||||
get { return data.Mime; }
|
||||
set { data.Mime = value; }
|
||||
}
|
||||
public String ContentType
|
||||
{
|
||||
get { return data.ContentType; }
|
||||
set { data.ContentType = value; }
|
||||
}
|
||||
public int Width
|
||||
{
|
||||
get { return data.Width; }
|
||||
set { data.Width = value; }
|
||||
}
|
||||
public int Height
|
||||
{
|
||||
get { return data.Height; }
|
||||
set { data.Height = value; }
|
||||
}
|
||||
public byte[] ImageData
|
||||
{
|
||||
get { return data.ImageData; }
|
||||
set { data.ImageData = value; }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Flags - positions 1-16 available.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// A s s o c i a t e d D a t a
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// P a r a m s
|
||||
//-------------------------------------------------------------------
|
||||
// List parameters.
|
||||
public enum StatusCat
|
||||
{
|
||||
Any,
|
||||
NotDeleted,
|
||||
ActiveOnly,
|
||||
InctiveOnly,
|
||||
}
|
||||
/// <summary>
|
||||
/// Item list parameters.
|
||||
/// </summary>
|
||||
public new class Params : SacsHierarchyItem.Params
|
||||
{
|
||||
// List filtering.
|
||||
public List<SysId> IdsIncluded { get; } = new List<SysId>();
|
||||
public List<SysId> IdsExcluded { get; } = new List<SysId>();
|
||||
public List<ItemId> ItemIdsIncluded { get; } = new List<ItemId>();
|
||||
public List<Sax.ImageType> ImageTypesIncluded { get; } = new List<Sax.ImageType>();
|
||||
public String NotesPartial { get; set; }
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.NotDeleted;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
// Item list extension methods.
|
||||
public static class SaxItemImageList
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,214 @@
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Saxonite.Base.App;
|
||||
using Saxonite.Net.Standard.Base.App;
|
||||
using Saxonite.Net.Standard.Base.Bus;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Saxonite.Net.Standard.Base.Mgr
|
||||
{
|
||||
//=======================================================================
|
||||
partial class SaxItemDataMgr
|
||||
{
|
||||
//*******************************************************************
|
||||
// Item Data Mgr - Item Image
|
||||
//*******************************************************************
|
||||
// Utilities.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Create item.
|
||||
public abstract SaxItemImage CreateItemImage(ItemId itemId, Sax.ImageType imageType);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item exists.
|
||||
public bool ItemImageExistsById(SysId id)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!SysId.IsValid(id)) return false;
|
||||
SaxItemImage.Params prmItemImage = new SaxItemImage.Params();
|
||||
prmItemImage.IdsIncluded.Add(id);
|
||||
prmItemImage.StatusCat = SaxItemImage.StatusCat.Any;
|
||||
return GetItemImageCount(prmItemImage) == 1;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Retrieve individual items.
|
||||
public abstract SaxItemImage GetItemImage(SaxItemImage.Params prmItemImage);
|
||||
public SaxItemImage GetItemImageById(SysId id)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!SysId.IsValid(id)) return null;
|
||||
SaxItemImage.Params prmItemImage = new SaxItemImage.Params();
|
||||
prmItemImage.IdsIncluded.Add(id);
|
||||
prmItemImage.StatusCat = SaxItemImage.StatusCat.Any;
|
||||
return GetItemImage(prmItemImage);
|
||||
}
|
||||
public SaxItemImage GetItemImage(ItemId itemId, Sax.ImageType imageType, SaxItemImage.StatusCat statusCat)
|
||||
{
|
||||
if (!ItemId.IsValid(itemId) || imageType <= 0) return null;
|
||||
SaxItemImage.Params prmItemImage = new SaxItemImage.Params();
|
||||
prmItemImage.ItemIdsIncluded.Add(itemId);
|
||||
prmItemImage.ImageTypesIncluded.Add(imageType);
|
||||
prmItemImage.StatusCat = statusCat;
|
||||
return GetItemImage(prmItemImage);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validate item data.
|
||||
public bool IsValidItemImage(SaxItemImage itemImage)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (itemImage == null) return SetErrorState(ErrorMessage.ItemNotSpecified);
|
||||
return IsValidItemImageData(itemImage.GetData(), new SaxItemImage.ErrField());
|
||||
}
|
||||
public virtual bool IsValidItemImageData(SaxItemImage.Data data, SaxItemImage.ErrField errField)
|
||||
{
|
||||
ClearErrorState();
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Item Id.
|
||||
if (errField.ItemId != SacsHierarchyItem.ValidValue.Ignore && !ItemId.IsValid(data.ItemId))
|
||||
{
|
||||
errField.ItemId = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Item Id must be specified");
|
||||
}
|
||||
// Image type.
|
||||
if (errField.ImageType != SacsHierarchyItem.ValidValue.Ignore && (int)data.ImageType < 1)
|
||||
{
|
||||
errField.ImageType = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Image type must be specified");
|
||||
}
|
||||
// Filename
|
||||
if (errField.Filename != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Filename, "filename", (long)SaxDbDfn_Core.GetColTextLen(SaxDbDfn_Core.ColumnIdx.ItemImage_Filename), true))
|
||||
{
|
||||
errField.Filename = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
// Mime
|
||||
if (errField.Mime != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Mime, "mime", (long)SaxDbDfn_Core.GetColTextLen(SaxDbDfn_Core.ColumnIdx.ItemImage_Mime), true))
|
||||
{
|
||||
errField.Mime = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
// Content Type
|
||||
if (errField.ContentType != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.ContentType, "content type", (long)SaxDbDfn_Core.GetColTextLen(SaxDbDfn_Core.ColumnIdx.ItemImage_ContentType), true))
|
||||
{
|
||||
errField.ContentType = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
// Image data.
|
||||
if (errField.ImageData != SacsHierarchyItem.ValidValue.Ignore && (data.ImageData == null || data.ImageData.Length < 1))
|
||||
{
|
||||
errField.ImageData = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Image data must be specified");
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Common properties.
|
||||
if (errField.Notes != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Notes, "notes", (long)SaxDbDfn_Core.GetColTextLen(SaxDbDfn_Core.ColumnIdx.ItemImage_Notes)))
|
||||
{
|
||||
errField.Notes = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.Status != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
if (!IsValidValue(data.StatusCode, "status", (long)SaxDbDfn_Core.GetColTextLen(SaxDbDfn_Core.ColumnIdx.ItemImage_Status), true, true))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (!SaxItemImage.ValidStatuses.Contains(data.Status))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState(ErrorMessage.InvalidStatus);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Dependencies - only tested if not deleted.
|
||||
if (data.Status != SaStatus.Deleted)
|
||||
{
|
||||
// Item must exist.
|
||||
// ...
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
return true;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item database interface.
|
||||
public abstract bool InsertItemImage(SaxItemImage itemImage, DbUpdateInfo dbUpdateInfo);
|
||||
public abstract bool UpdateItemImage(SaxItemImage itemImage, DbUpdateInfo dbUpdateInfo);
|
||||
public virtual bool ItemImageCanBeDeleted(SaxItemImage itemImage)
|
||||
{
|
||||
ClearErrorState();
|
||||
return true;
|
||||
}
|
||||
public abstract bool DeleteItemImage(SaxItemImage itemImage, DbUpdateInfo dbUpdateInfo);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item list.
|
||||
public abstract ColumnDfn GetItemImageColumnDfn(SaxItemImage.Column columnId, String caption = "", int width = 0);
|
||||
public abstract List<String> GetItemImageQueryFilter(SaxItemImage.Params prmItemImage);
|
||||
public abstract long GetItemImageCount(SaxItemImage.Params prmItemImage);
|
||||
public abstract List<SaxItemImage> GetItemImageList(SaxItemImage.Params prmItemImage);
|
||||
public abstract DbResultSet ExecuteItemImageQuery(List<ColumnDfn> columns, SaxItemImage.Params prmItemImage);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// Extract and format result set data value where specific handling is required.
|
||||
/// <para>Where response is an invalid data value, format value using column.FormatValue(values).</para>
|
||||
/// </summary>
|
||||
public virtual DataValue GetItemImageDataValue(ColumnDfn column, NamedValue.Map values)
|
||||
{
|
||||
DataValue value = new DataValue();
|
||||
switch ((SaxItemImage.Column)column.Id)
|
||||
{
|
||||
//-----------------------------------------------------------
|
||||
// Data item type.
|
||||
case SaxItemImage.Column.ItemType_Code:
|
||||
{
|
||||
value = new DataValue(DataItemTypeCodes.GetCodeForType(values.GetLong(column.DataName)));
|
||||
}
|
||||
break;
|
||||
case SaxItemImage.Column.ItemType_Desc:
|
||||
{
|
||||
value = new DataValue(DataItemTypeCodes.GetDescForType(values.GetLong(column.DataName)));
|
||||
}
|
||||
break;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// Notes.
|
||||
case SaxItemImage.Column.Notes:
|
||||
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
|
||||
break;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// Status.
|
||||
case SaxItemImage.Column.Status_Desc:
|
||||
case SaxItemImage.Column.Status_Ind:
|
||||
{
|
||||
String statusCode = values.GetValue(column.DataName).ToString();
|
||||
SaStatus status = SacsSystem.GetStatusForCode(statusCode);
|
||||
if (column.Id == (int)SaxItemImage.Column.Status_Desc)
|
||||
value = new DataValue(SacsSystem.GetStatusDesc(status));
|
||||
else if (column.Id == (int)SaxItemImage.Column.Status_Ind)
|
||||
value = new DataValue(SaxItemImage.GetStatusTriState(status));
|
||||
}
|
||||
break;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Saxonite.Net.Standard.Base.App;
|
||||
using Saxonite.Net.Standard.Base.Bus;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Saxonite.Net.Standard.Dbas.Bus
|
||||
{
|
||||
//=======================================================================
|
||||
public class SaxItemImage_Dbas : SaxItemImage
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private ISacsDatabase database;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SaxItemImage_Dbas (ISacsDatabase database, SysId id, ItemId itemId, Sax.ImageType ImageType, UInt16 flags) :
|
||||
base(id, itemId, ImageType)
|
||||
{
|
||||
this.database = database;
|
||||
Flags = flags;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Associated data.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Wed 2-Jun-2021 17:55:46
|
||||
// Code generated by Sarand Database Utilities Fri 4-Jun-2021 17:09:14
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -0,0 +1,260 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Saxonite.Net.Standard.Dbas.Data;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Fri 4-Jun-2021 17:09:14
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
internal class ItemImage_Db : SaxDbDataItem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Column definitions.
|
||||
public class ColumnsData
|
||||
{
|
||||
public ColumnDataInt64 _Id { get; } = new ColumnDataInt64("Id", true);
|
||||
public ColumnDataInt16 _ItemType { get; } = new ColumnDataInt16("ItemType");
|
||||
public ColumnDataInt32 _ItemId { get; } = new ColumnDataInt32("ItemId");
|
||||
public ColumnDataInt16 _ImageType { get; } = new ColumnDataInt16("ImageType");
|
||||
public ColumnDataByte _ImageSeq { get; } = new ColumnDataByte("ImageSeq");
|
||||
public ColumnDataString _Filename { get; } = new ColumnDataString("Filename");
|
||||
public ColumnDataString _Mime { get; } = new ColumnDataString("Mime");
|
||||
public ColumnDataString _ContentType { get; } = new ColumnDataString("ContentType");
|
||||
public ColumnDataInt32 _Width { get; } = new ColumnDataInt32("Width");
|
||||
public ColumnDataInt32 _Height { get; } = new ColumnDataInt32("Height");
|
||||
public ColumnDataByteArray _ImageData { get; } = new ColumnDataByteArray("ImageData");
|
||||
public ColumnDataString _Notes { get; } = new ColumnDataString("Notes");
|
||||
public ColumnDataInt16 _Flags { get; } = new ColumnDataInt16("Flags");
|
||||
public ColumnDataString _Status { get; } = new ColumnDataString("Status");
|
||||
public ColumnDataDateTime _CreateOn { get; } = new ColumnDataDateTime("CreateOn");
|
||||
public ColumnDataInt32 _CreateBy { get; } = new ColumnDataInt32("CreateBy");
|
||||
public ColumnDataString _CreateHost { get; } = new ColumnDataString("CreateHost");
|
||||
public ColumnDataDateTime _UpdateOn { get; } = new ColumnDataDateTime("UpdateOn");
|
||||
public ColumnDataInt32 _UpdateBy { get; } = new ColumnDataInt32("UpdateBy");
|
||||
public ColumnDataString _UpdateHost { get; } = new ColumnDataString("UpdateHost");
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
protected static List<String> fields { get; } = new List<String>()
|
||||
{
|
||||
"Id",
|
||||
"ItemType",
|
||||
"ItemId",
|
||||
"ImageType",
|
||||
"ImageSeq",
|
||||
"Filename",
|
||||
"Mime",
|
||||
"ContentType",
|
||||
"Width",
|
||||
"Height",
|
||||
"ImageData",
|
||||
"Notes",
|
||||
"Flags",
|
||||
"Status",
|
||||
"CreateOn",
|
||||
"CreateBy",
|
||||
"CreateHost",
|
||||
"UpdateOn",
|
||||
"UpdateBy",
|
||||
"UpdateHost",
|
||||
};
|
||||
protected static List<String> fieldsId { get; } = new List<String>()
|
||||
{
|
||||
"Id",
|
||||
};
|
||||
protected static List<String> fieldsPrimary { get; } = new List<String>()
|
||||
{
|
||||
"Id",
|
||||
};
|
||||
protected static List<String> fieldsIgnoreOnUpdate { get; } = new List<String>()
|
||||
{
|
||||
"CreateOn",
|
||||
"CreateBy",
|
||||
"CreateHost",
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
internal ItemImage_Db (IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public override String SchemaName { get; } = "dbo";
|
||||
public override String TableName { get; } = "ItemImage";
|
||||
public String TableNameFmt { get { return (!String.IsNullOrEmpty(SchemaName) ? "[" + SchemaName + "]." : "") + "[" + TableName + "]"; } }
|
||||
public static List<String> Fields { get { return new List<String>(fields); } }
|
||||
public static List<String> FieldsId { get { return new List<String>(fieldsId); } }
|
||||
public static List<String> FieldsNonId { get { return fields.FindAll(item => !fieldsId.ContainsCI(item)); } }
|
||||
// Columns.
|
||||
public ColumnsData Cols { get; } = new ColumnsData();
|
||||
public Int64 _Id { get { return Cols._Id.Value; } set { Cols._Id.Value = value; } }
|
||||
public Int16 _ItemType { get { return Cols._ItemType.Value; } set { Cols._ItemType.Value = value; } }
|
||||
public Int32 _ItemId { get { return Cols._ItemId.Value; } set { Cols._ItemId.Value = value; } }
|
||||
public Int16 _ImageType { get { return Cols._ImageType.Value; } set { Cols._ImageType.Value = value; } }
|
||||
public Byte _ImageSeq { get { return Cols._ImageSeq.Value; } set { Cols._ImageSeq.Value = value; } }
|
||||
public String _Filename { get { return Cols._Filename.Value; } set { Cols._Filename.Value = value; } }
|
||||
public String _Mime { get { return Cols._Mime.Value; } set { Cols._Mime.Value = value; } }
|
||||
public String _ContentType { get { return Cols._ContentType.Value; } set { Cols._ContentType.Value = value; } }
|
||||
public Int32 _Width { get { return Cols._Width.Value; } set { Cols._Width.Value = value; } }
|
||||
public Int32 _Height { get { return Cols._Height.Value; } set { Cols._Height.Value = value; } }
|
||||
public Byte[] _ImageData { get { return Cols._ImageData.Value; } set { Cols._ImageData.Value = value; } }
|
||||
public String _Notes { get { return Cols._Notes.Value; } set { Cols._Notes.Value = value; } }
|
||||
public Int16 _Flags { get { return Cols._Flags.Value; } set { Cols._Flags.Value = value; } }
|
||||
public String _Status { get { return Cols._Status.Value; } set { Cols._Status.Value = value; } }
|
||||
public DateTime _CreateOn { get { return Cols._CreateOn.Value; } set { Cols._CreateOn.Value = value; } }
|
||||
public Int32 _CreateBy { get { return Cols._CreateBy.Value; } set { Cols._CreateBy.Value = value; } }
|
||||
public String _CreateHost { get { return Cols._CreateHost.Value; } set { Cols._CreateHost.Value = value; } }
|
||||
public DateTime _UpdateOn { get { return Cols._UpdateOn.Value; } set { Cols._UpdateOn.Value = value; } }
|
||||
public Int32 _UpdateBy { get { return Cols._UpdateBy.Value; } set { Cols._UpdateBy.Value = value; } }
|
||||
public String _UpdateHost { get { return Cols._UpdateHost.Value; } set { Cols._UpdateHost.Value = value; } }
|
||||
// Existing columns - confirmed on database if table exists.
|
||||
public List<String> ExistingColumnNames { get { return GetExistingColumnNames(Fields); } }
|
||||
public List<String> ExistingColumnNamesNonId { get { return GetExistingColumnNames(FieldsNonId); } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Population.
|
||||
public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
|
||||
{
|
||||
dbCommand.CommandText =
|
||||
"SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
(!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
|
||||
Log(GetType().Name + ".PopulateFrom", dbCommand.CommandText);
|
||||
using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
|
||||
{
|
||||
dbDataReader.Read();
|
||||
PopulateFrom(dbDataReader);
|
||||
}
|
||||
}
|
||||
public override void PopulateFrom (DbDataReader dbDataReader)
|
||||
{
|
||||
_Id = GetFieldInt64(dbDataReader, "Id", _Id);
|
||||
_ItemType = GetFieldInt16(dbDataReader, "ItemType", _ItemType);
|
||||
_ItemId = GetFieldInt32(dbDataReader, "ItemId", _ItemId);
|
||||
_ImageType = GetFieldInt16(dbDataReader, "ImageType", _ImageType);
|
||||
_ImageSeq = GetFieldByte(dbDataReader, "ImageSeq", _ImageSeq);
|
||||
_Filename = GetFieldString(dbDataReader, "Filename", _Filename);
|
||||
_Mime = GetFieldString(dbDataReader, "Mime", _Mime);
|
||||
_ContentType = GetFieldString(dbDataReader, "ContentType", _ContentType);
|
||||
_Width = GetFieldInt32(dbDataReader, "Width", _Width);
|
||||
_Height = GetFieldInt32(dbDataReader, "Height", _Height);
|
||||
_ImageData = GetFieldByteArray(dbDataReader, "ImageData", _ImageData);
|
||||
_Notes = GetFieldString(dbDataReader, "Notes", _Notes);
|
||||
_Flags = GetFieldInt16(dbDataReader, "Flags", _Flags);
|
||||
_Status = GetFieldString(dbDataReader, "Status", _Status);
|
||||
_CreateOn = GetFieldDateTime(dbDataReader, "CreateOn", _CreateOn);
|
||||
_CreateBy = GetFieldInt32(dbDataReader, "CreateBy", _CreateBy);
|
||||
_CreateHost = GetFieldString(dbDataReader, "CreateHost", _CreateHost);
|
||||
_UpdateOn = GetFieldDateTime(dbDataReader, "UpdateOn", _UpdateOn);
|
||||
_UpdateBy = GetFieldInt32(dbDataReader, "UpdateBy", _UpdateBy);
|
||||
_UpdateHost = GetFieldString(dbDataReader, "UpdateHost", _UpdateHost);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert command.
|
||||
public override bool ExecuteInsertCommand (DbCommand dbCommand)
|
||||
{
|
||||
List<String> columnNames = ExistingColumnNamesNonId;
|
||||
// Avoid insert if Identity field is already valid.
|
||||
if (_Id != 0) throw new Exception("Invalid for Insert - item already has a valid Id");
|
||||
// Construct query.
|
||||
String query =
|
||||
"INSERT INTO " + TableNameFmt + " " +
|
||||
"("+columnNames.Concat(",","[","]")+") ";
|
||||
query += "Output Inserted.Id ";
|
||||
if (dbCommand is SqlCommand)
|
||||
query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
|
||||
else query += "VALUES (" + StringListUtil.CreateList("?", columnNames.Count).Concat(",") + ") ";
|
||||
dbCommand.CommandText = query;
|
||||
Log(GetType().Name + ".ExecuteInsertCommand", dbCommand.CommandText);
|
||||
// Populate parameters.
|
||||
dbCommand.Parameters.Clear();
|
||||
if (columnNames.ContainsCI("ItemType")) AddCommandParameter(dbCommand, "@ItemType", _ItemType);
|
||||
if (columnNames.ContainsCI("ItemId")) AddCommandParameter(dbCommand, "@ItemId", _ItemId);
|
||||
if (columnNames.ContainsCI("ImageType")) AddCommandParameter(dbCommand, "@ImageType", _ImageType);
|
||||
if (columnNames.ContainsCI("ImageSeq")) AddCommandParameter(dbCommand, "@ImageSeq", _ImageSeq);
|
||||
if (columnNames.ContainsCI("Filename")) AddCommandParameter(dbCommand, "@Filename", _Filename);
|
||||
if (columnNames.ContainsCI("Mime")) AddCommandParameter(dbCommand, "@Mime", _Mime);
|
||||
if (columnNames.ContainsCI("ContentType")) AddCommandParameter(dbCommand, "@ContentType", _ContentType);
|
||||
if (columnNames.ContainsCI("Width")) AddCommandParameter(dbCommand, "@Width", _Width);
|
||||
if (columnNames.ContainsCI("Height")) AddCommandParameter(dbCommand, "@Height", _Height);
|
||||
if (columnNames.ContainsCI("ImageData")) AddCommandParameter(dbCommand, "@ImageData", _ImageData);
|
||||
if (columnNames.ContainsCI("Notes")) AddCommandParameter(dbCommand, "@Notes", _Notes);
|
||||
if (columnNames.ContainsCI("Flags")) AddCommandParameter(dbCommand, "@Flags", _Flags);
|
||||
if (columnNames.ContainsCI("Status")) AddCommandParameter(dbCommand, "@Status", _Status);
|
||||
if (columnNames.ContainsCI("CreateOn")) AddCommandParameter(dbCommand, "@CreateOn", _CreateOn);
|
||||
if (columnNames.ContainsCI("CreateBy")) AddCommandParameter(dbCommand, "@CreateBy", _CreateBy);
|
||||
if (columnNames.ContainsCI("CreateHost")) AddCommandParameter(dbCommand, "@CreateHost", _CreateHost);
|
||||
if (columnNames.ContainsCI("UpdateOn")) AddCommandParameter(dbCommand, "@UpdateOn", _UpdateOn);
|
||||
if (columnNames.ContainsCI("UpdateBy")) AddCommandParameter(dbCommand, "@UpdateBy", _UpdateBy);
|
||||
if (columnNames.ContainsCI("UpdateHost")) AddCommandParameter(dbCommand, "@UpdateHost", _UpdateHost);
|
||||
// Execute insert command.
|
||||
bool commandSuccess = false;
|
||||
int executeNonQuery = dbCommand.ExecuteNonQuery();
|
||||
if (executeNonQuery == 1)
|
||||
{
|
||||
dbCommand.CommandText = "SELECT Max(Id) FROM " + TableNameFmt + ";";
|
||||
_Id = Convert.ToInt64(dbCommand.ExecuteScalar());
|
||||
commandSuccess = (_Id > 0);
|
||||
}
|
||||
return commandSuccess;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update command.
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
|
||||
{
|
||||
// Avoid update if Identity field isn't valid.
|
||||
if (_Id == 0) throw new Exception("Invalid for Update - item has an invalid Id");
|
||||
// Columns to update.
|
||||
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
|
||||
// Construct query.
|
||||
String query = "UPDATE " + TableNameFmt + " SET ";
|
||||
if (dbCommand is SqlCommand)
|
||||
{
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[","]"),columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += "WHERE Id=@Id;";
|
||||
}
|
||||
else
|
||||
{
|
||||
query += columnNames.Concat(", ", "", "=?") + " ";
|
||||
query += "WHERE Id=?;";
|
||||
}
|
||||
dbCommand.CommandText = query;
|
||||
Log(GetType().Name + ".ExecuteUpdateCommand", dbCommand.CommandText);
|
||||
// Populate parameters.
|
||||
dbCommand.Parameters.Clear();
|
||||
if (columnNames.ContainsCI("ItemType")) AddCommandParameter(dbCommand, "@ItemType", _ItemType);
|
||||
if (columnNames.ContainsCI("ItemId")) AddCommandParameter(dbCommand, "@ItemId", _ItemId);
|
||||
if (columnNames.ContainsCI("ImageType")) AddCommandParameter(dbCommand, "@ImageType", _ImageType);
|
||||
if (columnNames.ContainsCI("ImageSeq")) AddCommandParameter(dbCommand, "@ImageSeq", _ImageSeq);
|
||||
if (columnNames.ContainsCI("Filename")) AddCommandParameter(dbCommand, "@Filename", _Filename);
|
||||
if (columnNames.ContainsCI("Mime")) AddCommandParameter(dbCommand, "@Mime", _Mime);
|
||||
if (columnNames.ContainsCI("ContentType")) AddCommandParameter(dbCommand, "@ContentType", _ContentType);
|
||||
if (columnNames.ContainsCI("Width")) AddCommandParameter(dbCommand, "@Width", _Width);
|
||||
if (columnNames.ContainsCI("Height")) AddCommandParameter(dbCommand, "@Height", _Height);
|
||||
if (columnNames.ContainsCI("ImageData")) AddCommandParameter(dbCommand, "@ImageData", _ImageData);
|
||||
if (columnNames.ContainsCI("Notes")) AddCommandParameter(dbCommand, "@Notes", _Notes);
|
||||
if (columnNames.ContainsCI("Flags")) AddCommandParameter(dbCommand, "@Flags", _Flags);
|
||||
if (columnNames.ContainsCI("Status")) AddCommandParameter(dbCommand, "@Status", _Status);
|
||||
if (columnNames.ContainsCI("UpdateOn")) AddCommandParameter(dbCommand, "@UpdateOn", _UpdateOn);
|
||||
if (columnNames.ContainsCI("UpdateBy")) AddCommandParameter(dbCommand, "@UpdateBy", _UpdateBy);
|
||||
if (columnNames.ContainsCI("UpdateHost")) AddCommandParameter(dbCommand, "@UpdateHost", _UpdateHost);
|
||||
AddCommandParameter(dbCommand, "@Id", _Id);
|
||||
int executeNonQueryResult = dbCommand.ExecuteNonQuery();
|
||||
return (executeNonQueryResult == 1);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Wed 2-Jun-2021 17:55:46
|
||||
// Code generated by Sarand Database Utilities Fri 4-Jun-2021 17:09:14
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Wed 2-Jun-2021 17:55:46
|
||||
// Code generated by Sarand Database Utilities Fri 4-Jun-2021 17:09:14
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Wed 2-Jun-2021 17:55:46
|
||||
// Code generated by Sarand Database Utilities Fri 4-Jun-2021 17:09:14
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Wed 2-Jun-2021 17:55:46
|
||||
// Code generated by Sarand Database Utilities Fri 4-Jun-2021 17:09:14
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Wed 2-Jun-2021 17:55:46
|
||||
// Code generated by Sarand Database Utilities Fri 4-Jun-2021 17:09:14
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Wed 2-Jun-2021 17:55:46
|
||||
// Code generated by Sarand Database Utilities Fri 4-Jun-2021 17:09:14
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Wed 2-Jun-2021 17:55:46
|
||||
// Code generated by Sarand Database Utilities Fri 4-Jun-2021 17:09:14
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Wed 2-Jun-2021 17:55:46
|
||||
// Code generated by Sarand Database Utilities Fri 4-Jun-2021 17:09:14
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Wed 2-Jun-2021 17:55:46
|
||||
// Code generated by Sarand Database Utilities Fri 4-Jun-2021 17:09:14
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Wed 2-Jun-2021 17:55:46
|
||||
// Code generated by Sarand Database Utilities Fri 4-Jun-2021 17:09:14
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Wed 2-Jun-2021 17:55:46
|
||||
// Code generated by Sarand Database Utilities Fri 4-Jun-2021 17:09:14
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -0,0 +1,564 @@
|
||||
using Sarand.Net.Standard.Dbas.Data;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Saxonite.Base.App;
|
||||
using Saxonite.Net.Standard.Dbas.Bus;
|
||||
using Saxonite.Net.Standard.Dbas.Internal;
|
||||
using Saxonite.Net.Standard.Base.Bus;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Text;
|
||||
using Saxonite.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System.Linq;
|
||||
|
||||
namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
{
|
||||
//=======================================================================
|
||||
partial class SaxItemDataMgr_Dbas
|
||||
{
|
||||
//*******************************************************************
|
||||
// Item Data Mgr - Item Image
|
||||
//*******************************************************************
|
||||
// Utilities.
|
||||
private List<StringPair> GetLogProperties(SaxItemImage itemImage)
|
||||
{
|
||||
return new List<StringPair>()
|
||||
{
|
||||
new StringPair("Id", SysId.ToString(itemImage.Id)),
|
||||
new StringPair("ItemId", ItemId.ToString(itemImage.ItemId)),
|
||||
new StringPair("ImageType", itemImage.ImageType.ToString()),
|
||||
new StringPair("Status", itemImage.StatusCode)
|
||||
};
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Create item.
|
||||
public override SaxItemImage CreateItemImage(ItemId itemId, Sax.ImageType imageType)
|
||||
{
|
||||
ClearErrorState();
|
||||
return new SaxItemImage_Dbas(CoreDatabase, null, itemId, imageType, 0);
|
||||
}
|
||||
private SaxItemImage_Dbas CreateItemImage(ItemImage_Db dbItemImage)
|
||||
{
|
||||
ClearErrorState();
|
||||
ItemId itemId = new ItemId(dbItemImage._ItemType, new SysId(dbItemImage._ItemId));
|
||||
SaxItemImage_Dbas itemImage = new SaxItemImage_Dbas(CoreDatabase, new SysId(dbItemImage._Id), itemId, (Sax.ImageType)dbItemImage._ImageType, (ushort)dbItemImage._Flags);
|
||||
PopulateFrom(dbItemImage, itemImage);
|
||||
return itemImage;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Get item.
|
||||
public override SaxItemImage GetItemImage(SaxItemImage.Params prm)
|
||||
{
|
||||
ClearErrorState();
|
||||
return GetItemImage(GetItemImageQueryFilter(prm).Concat(" And ", "(", ")"));
|
||||
}
|
||||
private SaxItemImage GetItemImage(String filter)
|
||||
{
|
||||
ClearErrorState();
|
||||
long count = GetItemImageCount(filter);
|
||||
if (count == 0) return null;
|
||||
if (count != 1)
|
||||
{
|
||||
SetErrorState("Multiple items found");
|
||||
return null;
|
||||
}
|
||||
SaxItemImage itemImage = null;
|
||||
// Query data.
|
||||
using (var dbConnection = CoreDatabase.CreateConnection())
|
||||
using (var dbCommand = dbConnection.CreateCommand())
|
||||
{
|
||||
try
|
||||
{
|
||||
dbConnection.Open();
|
||||
ItemImage_Db dbItemImage = new ItemImage_Db(CoreDbInfo);
|
||||
dbItemImage.PopulateFrom(dbCommand, aliasItemImage, filter);
|
||||
itemImage = CreateItemImage(dbItemImage);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SaLogger.Warn(GetType().Name + ".GetItemImage\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc));
|
||||
}
|
||||
}
|
||||
return itemImage;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validate item.
|
||||
public override bool IsValidItemImageData(SaxItemImage.Data data, SaxItemImage.ErrField errField)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!base.IsValidItemImageData(data, errField)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert item.
|
||||
public override bool InsertItemImage(SaxItemImage itemImage, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".InsertItemImage";
|
||||
ClearErrorState();
|
||||
if (!IsValidItemImage(itemImage)) return false;
|
||||
if (SysId.IsValid(itemImage.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
||||
using (var dbConnection = CoreDatabase.CreateConnection())
|
||||
using (var dbCommand = dbConnection.CreateCommand())
|
||||
{
|
||||
try
|
||||
{
|
||||
dbConnection.Open();
|
||||
ItemImage_Db dbItemImage = new ItemImage_Db(CoreDbInfo);
|
||||
PopulateTo(dbItemImage, itemImage, dbUpdateInfo);
|
||||
if (ItemImage_Db.FieldsNonId.Contains("Id"))
|
||||
{
|
||||
// Generate next Id.
|
||||
dbItemImage._Id = CoreDatabase.GetNextIdFromTable("ItemImage");
|
||||
}
|
||||
dbItemImage.ExecuteInsertCommand(dbCommand);
|
||||
itemImage.Id = new SysId(dbItemImage._Id);
|
||||
itemImage.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Inserted. " + GetLogProperties(itemImage).Concat(": ").Concat("", "\n\t"));
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update item.
|
||||
public override bool UpdateItemImage(SaxItemImage itemImage, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".UpdateItemImage";
|
||||
ClearErrorState();
|
||||
if (!IsValidItemImage(itemImage)) return false;
|
||||
if (!SysId.IsValid(itemImage.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
||||
if (!itemImage.Changed)
|
||||
{
|
||||
if (DebugMode) SaLogger.Debug(fn + " Data not changed. " + GetLogProperties(itemImage).Concat(": ").Concat("", "\n\t"));
|
||||
return true;
|
||||
}
|
||||
using (var dbConnection = CoreDatabase.CreateConnection())
|
||||
using (var dbCommand = dbConnection.CreateCommand())
|
||||
{
|
||||
try
|
||||
{
|
||||
// Retrieve item.
|
||||
dbConnection.Open();
|
||||
ItemImage_Db dbItemImage = new ItemImage_Db(CoreDbInfo);
|
||||
dbItemImage.PopulateFrom(dbCommand, aliasItemImage, "Id=" + SysId.ToString(itemImage.Id));
|
||||
// ToDo SaxUpdateLogItemMonitor_ItemImage updateLogMonitor = new SaxUpdateLogItemMonitor_ItemImage(SessionContext, CreateItemImage(dbItemImage), dbUpdateInfo);
|
||||
// Update properties.
|
||||
PopulateTo(dbItemImage, itemImage, dbUpdateInfo);
|
||||
dbItemImage.ExecuteUpdateCommand(dbCommand);
|
||||
itemImage.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Updated. " + GetLogProperties(itemImage).Concat(": ").Concat("", "\n\t"));
|
||||
// Record updates.
|
||||
// ToDo updateLogMonitor.RecordUpdatedValues(itemImage);
|
||||
// ToDo updateLogMonitor.LogUpdates();
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Delete item.
|
||||
public override bool ItemImageCanBeDeleted(SaxItemImage itemImage)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!base.ItemImageCanBeDeleted(itemImage)) return false;
|
||||
return true;
|
||||
}
|
||||
public override bool DeleteItemImage(SaxItemImage itemImage, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".DeleteItemImage";
|
||||
ClearErrorState();
|
||||
if (!ItemImageCanBeDeleted(itemImage)) return false;
|
||||
using (var dbConnection = CoreDatabase.CreateConnection())
|
||||
using (var dbCommand = dbConnection.CreateCommand())
|
||||
{
|
||||
try
|
||||
{
|
||||
// Retrieve itemImage.
|
||||
dbConnection.Open();
|
||||
ItemImage_Db dbItemImage = new ItemImage_Db(CoreDbInfo);
|
||||
dbItemImage.PopulateFrom(dbCommand, aliasItemImage, "Id=" + itemImage.Id.ToString());
|
||||
// Delete itemImage.
|
||||
dbCommand.CommandType = System.Data.CommandType.Text;
|
||||
dbCommand.CommandText = "DELETE FROM " + SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.ItemImage) + " WHERE Id=" + SysId.ToString(itemImage.Id) + ";";
|
||||
dbCommand.ExecuteNonQuery();
|
||||
itemImage.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Deleted. " + GetLogProperties(itemImage).Concat(": ").Concat("", "\n\t"));
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Copy data properties to and from database.
|
||||
private void PopulateTo(ItemImage_Db dbItemImage, SaxItemImage itemImage, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
dbItemImage._Id = SysId.ToInt(itemImage.Id);
|
||||
dbItemImage._ItemType = itemImage.ItemId.Type;
|
||||
dbItemImage._ItemId = SysId.ToInt(itemImage.ItemId.Id);
|
||||
dbItemImage._ImageType = (short)itemImage.ImageType;
|
||||
dbItemImage._ImageSeq = itemImage.ImageSeq;
|
||||
dbItemImage._Filename = itemImage.Filename;
|
||||
dbItemImage._Mime = itemImage.Mime;
|
||||
dbItemImage._ContentType = itemImage.ContentType;
|
||||
dbItemImage._Width = itemImage.Width;
|
||||
dbItemImage._Height = itemImage.Height;
|
||||
dbItemImage._ImageData = itemImage.ImageData;
|
||||
// Common.
|
||||
dbItemImage._Notes = itemImage.Notes;
|
||||
dbItemImage._Status = SacsSystem.GetStatusCode(itemImage.Status);
|
||||
dbItemImage._Flags = (short)itemImage.Flags;
|
||||
if (!SysId.IsValid(itemImage.Id))
|
||||
{
|
||||
dbItemImage._CreateOn = DateTime.Now;
|
||||
dbItemImage._CreateBy = dbUpdateInfo.UserId.ToInt();
|
||||
dbItemImage._CreateHost = dbUpdateInfo.Host;
|
||||
}
|
||||
dbItemImage._UpdateOn = DateTime.Now;
|
||||
dbItemImage._UpdateBy = dbUpdateInfo.UserId.ToInt();
|
||||
dbItemImage._UpdateHost = dbUpdateInfo.Host;
|
||||
}
|
||||
private void PopulateFrom(ItemImage_Db dbItemImage, SaxItemImage itemImage)
|
||||
{
|
||||
itemImage.Id = new SysId(dbItemImage._Id);
|
||||
//itemImage.ItemId = new ItemId(dbItemImage._ItemType, new SysId(dbItemImage._ItemId);
|
||||
//itemImage.ImageType = (Sax.ImageType)dbItemImage._ImageType;
|
||||
itemImage.ImageSeq = dbItemImage._ImageSeq;
|
||||
itemImage.Filename = dbItemImage._Filename;
|
||||
itemImage.Mime = dbItemImage._Mime;
|
||||
itemImage.ContentType = dbItemImage._ContentType;
|
||||
itemImage.Width = dbItemImage._Width;
|
||||
itemImage.Height = dbItemImage._Height;
|
||||
itemImage.ImageData = dbItemImage._ImageData;
|
||||
// Common.
|
||||
itemImage.Notes = dbItemImage._Notes;
|
||||
itemImage.Status = SacsSystem.GetStatusForCode(dbItemImage._Status);
|
||||
itemImage.SetCreateStamp(dbItemImage._CreateOn, new SysId(dbItemImage._CreateBy), dbItemImage._CreateHost);
|
||||
itemImage.SetUpdateStamp(dbItemImage._UpdateOn, new SysId(dbItemImage._UpdateBy), dbItemImage._UpdateHost);
|
||||
itemImage.AcceptChanges();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item column definitions.
|
||||
private static readonly String aliasItemImage = "ItmSpt";
|
||||
private void SetItemImageColDfn
|
||||
(ColumnDfn col, String caption, int width, SaxDbDfn_Core.ColumnIdx dbCol,
|
||||
ColumnAlignment align = ColumnAlignment.Default, DataValue.DataType dataType = DataValue.DataType.String,
|
||||
String alias = "", String prefix = "")
|
||||
{
|
||||
if (String.IsNullOrEmpty(alias) && SaxDbDfn_Core.GetTableForColumn(dbCol) == SaxDbDfn_Core.TableIdx.ItemImage)
|
||||
alias = aliasItemImage;
|
||||
col.Set(caption, width, (int)dbCol, prefix + SaxDbDfn_Core.GetColumnName(dbCol, false), SaxDbDfn_Core.GetColumnNameQual(dbCol, alias), dataType, align);
|
||||
if (dataType == DataValue.DataType.String && dbCol != SaxDbDfn_Core.ColumnIdx.Unknown)
|
||||
col.MaxLength = (int)SaxDbDfn_Core.GetColTextLen(dbCol);
|
||||
}
|
||||
public override ColumnDfn GetItemImageColumnDfn(SaxItemImage.Column columnId, string caption = "", int width = 0)
|
||||
{
|
||||
ColumnDfn columnDfn = new ColumnDfn((int)columnId, caption, width);
|
||||
switch (columnId)
|
||||
{
|
||||
//-----------------------------------------------------------
|
||||
case SaxItemImage.Column.Pos:
|
||||
SetItemImageColDfn(columnDfn, "Pos", 60, SaxDbDfn_Core.ColumnIdx.Unknown, ColumnAlignment.Right);
|
||||
columnDfn.SortMode = ColumnDfn.ColumnSortMode.Off;
|
||||
columnDfn.ReadOnly = true;
|
||||
columnDfn.Resizable = false;
|
||||
break;
|
||||
case SaxItemImage.Column.Id:
|
||||
SetItemImageColDfn(columnDfn, "Id", 80, SaxDbDfn_Core.ColumnIdx.ItemImage_Id, ColumnAlignment.Right, DataValue.DataType.Long);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
case SaxItemImage.Column.ItemType:
|
||||
SetItemImageColDfn(columnDfn, "Item type", 80, SaxDbDfn_Core.ColumnIdx.ItemImage_ItemType, ColumnAlignment.Center, DataValue.DataType.Long);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
case SaxItemImage.Column.ItemType_Code:
|
||||
SetItemImageColDfn(columnDfn, "Item type", 80, SaxDbDfn_Core.ColumnIdx.ItemImage_ItemType, ColumnAlignment.Center);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
case SaxItemImage.Column.ItemType_Desc:
|
||||
SetItemImageColDfn(columnDfn, "Item type", 80, SaxDbDfn_Core.ColumnIdx.ItemImage_ItemType, ColumnAlignment.Center);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
case SaxItemImage.Column.ItemId:
|
||||
SetItemImageColDfn(columnDfn, "Item Id", 80, SaxDbDfn_Core.ColumnIdx.ItemImage_ItemId, ColumnAlignment.Right, DataValue.DataType.Long);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
|
||||
// Image type.
|
||||
case SaxItemImage.Column.ImageType:
|
||||
SetItemImageColDfn(columnDfn, "Image type", 80, SaxDbDfn_Core.ColumnIdx.ItemImage_ImageType, ColumnAlignment.Center, DataValue.DataType.Long);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
case SaxItemImage.Column.ImageType_Code:
|
||||
SetItemImageColDfn(columnDfn, "Image type", 100, SaxDbDfn_Core.ColumnIdx.ItemImage_ImageType, ColumnAlignment.Center, DataValue.DataType.String);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
case SaxItemImage.Column.ImageType_Desc:
|
||||
SetItemImageColDfn(columnDfn, "Image type", 120, SaxDbDfn_Core.ColumnIdx.ItemImage_ImageType, ColumnAlignment.Center, DataValue.DataType.String);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
|
||||
// Image properties.
|
||||
case SaxItemImage.Column.ImageSeq:
|
||||
SetItemImageColDfn(columnDfn, "Seq", 60, SaxDbDfn_Core.ColumnIdx.ItemImage_ImageSeq, ColumnAlignment.Center, DataValue.DataType.Long);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
case SaxItemImage.Column.Filename:
|
||||
SetItemImageColDfn(columnDfn, "Filename", 160, SaxDbDfn_Core.ColumnIdx.ItemImage_Filename);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
case SaxItemImage.Column.Mime:
|
||||
SetItemImageColDfn(columnDfn, "Mime", 100, SaxDbDfn_Core.ColumnIdx.ItemImage_Mime);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
case SaxItemImage.Column.ContentType:
|
||||
SetItemImageColDfn(columnDfn, "Content Type", 120, SaxDbDfn_Core.ColumnIdx.ItemImage_ContentType);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// Derived properties.
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// Common properties.
|
||||
case SaxItemImage.Column.Notes:
|
||||
SetItemImageColDfn(columnDfn, "Notes", 240, SaxDbDfn_Core.ColumnIdx.ItemImage_Notes);
|
||||
break;
|
||||
case SaxItemImage.Column.Flags:
|
||||
SetItemImageColDfn(columnDfn, "Flags", 60, SaxDbDfn_Core.ColumnIdx.ItemImage_Flags, ColumnAlignment.Center, DataValue.DataType.Long);
|
||||
break;
|
||||
case SaxItemImage.Column.Status:
|
||||
SetItemImageColDfn(columnDfn, "Status", 80, SaxDbDfn_Core.ColumnIdx.ItemImage_Status, ColumnAlignment.Center);
|
||||
break;
|
||||
case SaxItemImage.Column.Status_Desc:
|
||||
SetItemImageColDfn(columnDfn, "Status", 90, SaxDbDfn_Core.ColumnIdx.ItemImage_Status, ColumnAlignment.Center);
|
||||
break;
|
||||
case SaxItemImage.Column.Status_Ind:
|
||||
SetItemImageColDfn(columnDfn, "Status", 80, SaxDbDfn_Core.ColumnIdx.ItemImage_Status, ColumnAlignment.Center, DataValue.DataType.TriState);
|
||||
columnDfn.TriStateFormat = ColumnTriStateFormat.Lights;
|
||||
break;
|
||||
case SaxItemImage.Column.CreateOn_Date:
|
||||
SetItemImageColDfn(columnDfn, "Created", 80, SaxDbDfn_Core.ColumnIdx.ItemImage_CreateOn, ColumnAlignment.Center, DataValue.DataType.Date);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
case SaxItemImage.Column.UpdateOn_Date:
|
||||
SetItemImageColDfn(columnDfn, "Updated", 80, SaxDbDfn_Core.ColumnIdx.ItemImage_UpdateOn, ColumnAlignment.Center, DataValue.DataType.Date);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
//-----------------------------------------------------------
|
||||
}
|
||||
if (!String.IsNullOrEmpty(caption))
|
||||
columnDfn.Caption = caption;
|
||||
if (width > 0)
|
||||
columnDfn.Width = width;
|
||||
return columnDfn;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item query filter.
|
||||
public override List<string> GetItemImageQueryFilter(SaxItemImage.Params prm)
|
||||
{
|
||||
List<String> filter = new List<String>();
|
||||
|
||||
// Item Ids.
|
||||
String idsIncluded = prm.IdsIncluded.Concat(",");
|
||||
if (!idsIncluded.IsEmpty())
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemImage_Id, aliasItemImage) + " IN (" + idsIncluded + ")");
|
||||
String idsExcluded = prm.IdsExcluded.Concat(",");
|
||||
if (!idsExcluded.IsEmpty())
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemImage_Id, aliasItemImage) + " NOT IN (" + idsExcluded + ")");
|
||||
|
||||
// Item Ids.
|
||||
if (!prm.ItemIdsIncluded.IsEmpty())
|
||||
{
|
||||
List<String> itemIdFilters = new List<string>();
|
||||
foreach (ItemId itemId in prm.ItemIdsIncluded)
|
||||
{
|
||||
if (!ItemId.IsValid(itemId)) continue;
|
||||
String itemIdFilter =
|
||||
SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemImage_ItemType, aliasItemImage) + "=" + itemId.Type +
|
||||
" AND " + SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemImage_ItemId, aliasItemImage) + "=" + SysId.ToInt(itemId.Id);
|
||||
itemIdFilters.Add(itemIdFilter);
|
||||
}
|
||||
if (!itemIdFilters.IsEmpty())
|
||||
filter.Add(itemIdFilters.Concat(" OR ", "(", ")"));
|
||||
}
|
||||
|
||||
// Image Type.
|
||||
if (!prm.ImageTypesIncluded.IsEmpty())
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemImage_ImageType, aliasItemImage) + " IN (" + prm.ImageTypesIncluded.Select(item => ((int)item).ToString()).Concat(",") + ")");
|
||||
|
||||
// Notes.
|
||||
if (!StringUtil.IsEmpty(prm.NotesPartial))
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemImage_Notes, aliasItemImage) + " LIKE '%" + DbQuery.FormatForLike(prm.NotesPartial) + "%'");
|
||||
|
||||
// Status.
|
||||
if (prm.StatusCat == SaxItemImage.StatusCat.ActiveOnly)
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemImage_Status, aliasItemImage) + "='" + SacsSystem.GetStatusCode(SaStatus.Active) + "'");
|
||||
else if (prm.StatusCat == SaxItemImage.StatusCat.NotDeleted)
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemImage_Status, aliasItemImage) + "!='" + SacsSystem.GetStatusCode(SaStatus.Deleted) + "'");
|
||||
|
||||
if (filter.Count < 1) filter.Add("1=1");
|
||||
return filter;
|
||||
}
|
||||
// Item sort columns.
|
||||
public List<String> GetItemImageSortColumns(SaxItemImage.Params prm)
|
||||
{
|
||||
// Sort sequence:
|
||||
List<String> sortColumnNames = new List<String>();
|
||||
foreach (var columnDfn in prm.SortColumns)
|
||||
{
|
||||
// Need to ensure correct alias used for ItemImage columns in case of conflict.
|
||||
String sortCol = String.Empty;
|
||||
if (SaxDbDfn_Core.GetTableForColumn((SaxDbDfn_Core.ColumnIdx)columnDfn.DbColumn) == SaxDbDfn_Core.TableIdx.ItemImage)
|
||||
{
|
||||
sortCol = SaxDbDfn_Core.GetColumnNameQual((SaxDbDfn_Core.ColumnIdx)columnDfn.DbColumn, aliasItemImage);
|
||||
}
|
||||
else
|
||||
{
|
||||
sortCol = columnDfn.DataName;
|
||||
if (!StringUtil.IsEmpty(columnDfn.SortDataName))
|
||||
sortCol = columnDfn.SortDataName;
|
||||
}
|
||||
if (!sortCol.IsEmpty())
|
||||
{
|
||||
DbOrderByNullMode orderByNullMode = DbOrderByNullMode.Default; // eSaOrderByDemoteNulls, eSaOrderByPromoteNulls
|
||||
sortColumnNames.Add(DbQuery.FormatForOrderBy(sortCol, columnDfn.SortAscending, orderByNullMode).Concat(", "));
|
||||
}
|
||||
}
|
||||
sortColumnNames.RemoveBlanks();
|
||||
if (sortColumnNames.IsEmpty())
|
||||
{
|
||||
// Default sort columns.
|
||||
sortColumnNames.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemImage_ItemType, aliasItemImage) + " ASC");
|
||||
sortColumnNames.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemImage_ItemId, aliasItemImage) + " ASC");
|
||||
}
|
||||
return sortColumnNames;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item count.
|
||||
private long GetItemImageCount(String filter)
|
||||
{
|
||||
ClearErrorState();
|
||||
return CoreDatabase.GetRowCount(SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.ItemImage) + " As " + aliasItemImage, filter);
|
||||
}
|
||||
public override long GetItemImageCount(SaxItemImage.Params prm)
|
||||
{
|
||||
ClearErrorState();
|
||||
return GetItemImageCount(GetItemImageQueryFilter(prm).Concat(" AND ", "(", ")"));
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item list.
|
||||
public override List<SaxItemImage> GetItemImageList(SaxItemImage.Params prm)
|
||||
{
|
||||
List<SaxItemImage> itemImages = new List<SaxItemImage>();
|
||||
DbQuery qry = new DbQuery(CoreDatabase.DbmsType);
|
||||
qry.Tables.Add(SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.ItemImage), aliasItemImage);
|
||||
ItemImage_Db dbItemImage = new ItemImage_Db(CoreDbInfo);
|
||||
qry.Columns.AddRange(dbItemImage.ExistingColumnNames);
|
||||
qry.Filters.AddRange(GetItemImageQueryFilter(prm));
|
||||
qry.OrderBy.AddRange(GetItemImageSortColumns(prm));
|
||||
// Query data.
|
||||
using (var dbConnection = CoreDatabase.CreateConnection())
|
||||
using (var dbCommand = dbConnection.CreateCommand())
|
||||
{
|
||||
try
|
||||
{
|
||||
dbConnection.Open();
|
||||
dbCommand.CommandText = qry.BuildQuery(prm.ResultsPaging);
|
||||
using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
|
||||
{
|
||||
while (dbDataReader.Read())
|
||||
{
|
||||
dbItemImage = new ItemImage_Db(CoreDbInfo);
|
||||
dbItemImage.PopulateFrom(dbDataReader);
|
||||
itemImages.Add(CreateItemImage(dbItemImage));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SaLogger.Warn(GetType().Name + ".GetItemImageList\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc));
|
||||
}
|
||||
}
|
||||
return itemImages;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item query execution.
|
||||
public override DbResultSet ExecuteItemImageQuery(List<ColumnDfn> columns, SaxItemImage.Params prm)
|
||||
{
|
||||
ClearErrorState();
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// Construct query.
|
||||
DbQuery query = new DbQuery(CoreDatabase.DbmsType);
|
||||
query.Tables.Add(SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.ItemImage), aliasItemImage);
|
||||
|
||||
// Add columns as defined in query list.
|
||||
if (columns.HasId(SaxItemImage.Column.Id))
|
||||
query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemImage_Id, aliasItemImage));
|
||||
if (columns.HasId(SaxItemImage.Column.ItemType) || columns.HasId(SaxItemImage.Column.ItemType_Code) || columns.HasId(SaxItemImage.Column.ItemType_Desc))
|
||||
query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemImage_ItemType, aliasItemImage));
|
||||
if (columns.HasId(SaxItemImage.Column.ItemId))
|
||||
query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemImage_ItemId, aliasItemImage));
|
||||
if (columns.HasId(SaxItemImage.Column.ImageType))
|
||||
query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemImage_ImageType, aliasItemImage));
|
||||
if (columns.HasId(SaxItemImage.Column.ImageSeq))
|
||||
query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemImage_ImageSeq, aliasItemImage));
|
||||
if (columns.HasId(SaxItemImage.Column.Filename))
|
||||
query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemImage_Filename, aliasItemImage));
|
||||
if (columns.HasId(SaxItemImage.Column.Mime))
|
||||
query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemImage_Mime, aliasItemImage));
|
||||
if (columns.HasId(SaxItemImage.Column.ContentType))
|
||||
query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemImage_ContentType, aliasItemImage));
|
||||
if (columns.HasId(SaxItemImage.Column.Width))
|
||||
query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemImage_Width, aliasItemImage));
|
||||
if (columns.HasId(SaxItemImage.Column.Height))
|
||||
query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemImage_Height, aliasItemImage));
|
||||
// Common properties.
|
||||
if (columns.HasId(SaxItemImage.Column.Notes))
|
||||
query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemImage_Notes, aliasItemImage));
|
||||
if (columns.HasId(SaxItemImage.Column.Flags))
|
||||
query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemImage_Flags, aliasItemImage));
|
||||
if (columns.HasId(SaxItemImage.Column.Status) || columns.HasId(SaxItemImage.Column.Status_Desc) || columns.HasId(SaxItemImage.Column.Status_Ind))
|
||||
query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemImage_Status, aliasItemImage));
|
||||
if (columns.HasId(SaxItemImage.Column.CreateOn_Date))
|
||||
query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemImage_CreateOn, aliasItemImage));
|
||||
if (columns.HasId(SaxItemImage.Column.UpdateOn_Date))
|
||||
query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemImage_UpdateOn, aliasItemImage));
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// Populate filter.
|
||||
query.Filters.AddRange(GetItemImageQueryFilter(prm));
|
||||
|
||||
if (prm.IdsIncluded.Count != 1)
|
||||
{
|
||||
// Configure sort sequence.
|
||||
foreach (String sortColumn in GetItemImageSortColumns(prm))
|
||||
query.OrderBy.Add(sortColumn);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
//return new DbResultSet_DataTableReader(db, query.BuildQuery(prm.ResultsPaging));
|
||||
return DbResultSet_DataReader.ExecuteQuery(CoreDatabase, query.BuildQuery(prm.ResultsPaging));
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -343,6 +343,430 @@
|
||||
</DbDfnIndex>
|
||||
</Indices>
|
||||
</DbDfnTable>
|
||||
<DbDfnTable>
|
||||
<Schema>dbo</Schema>
|
||||
<Name>ItemImage</Name>
|
||||
<Remarks />
|
||||
<Columns>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemImage</Table>
|
||||
<Pos>1</Pos>
|
||||
<Name>Id</Name>
|
||||
<DataType>BigInt</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>-5</DataTypeNative>
|
||||
<DataTypeNameNative>bigint</DataTypeNameNative>
|
||||
<IsIdentity>true</IsIdentity>
|
||||
<Size>19</Size>
|
||||
<BufferLen>8</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemImage</Table>
|
||||
<Pos>2</Pos>
|
||||
<Name>ItemType</Name>
|
||||
<DataType>SmallInt</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>5</DataTypeNative>
|
||||
<DataTypeNameNative>smallint</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>5</Size>
|
||||
<BufferLen>2</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemImage</Table>
|
||||
<Pos>3</Pos>
|
||||
<Name>ItemId</Name>
|
||||
<DataType>Int</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>4</DataTypeNative>
|
||||
<DataTypeNameNative>int</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>10</Size>
|
||||
<BufferLen>4</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemImage</Table>
|
||||
<Pos>4</Pos>
|
||||
<Name>ImageType</Name>
|
||||
<DataType>SmallInt</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>5</DataTypeNative>
|
||||
<DataTypeNameNative>smallint</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>5</Size>
|
||||
<BufferLen>2</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemImage</Table>
|
||||
<Pos>5</Pos>
|
||||
<Name>ImageSeq</Name>
|
||||
<DataType>TinyInt</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>-6</DataTypeNative>
|
||||
<DataTypeNameNative>tinyint</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>3</Size>
|
||||
<BufferLen>1</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemImage</Table>
|
||||
<Pos>6</Pos>
|
||||
<Name>Filename</Name>
|
||||
<DataType>VarChar</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>-9</DataTypeNative>
|
||||
<DataTypeNameNative>nvarchar</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>1024</Size>
|
||||
<BufferLen>2048</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemImage</Table>
|
||||
<Pos>7</Pos>
|
||||
<Name>Mime</Name>
|
||||
<DataType>VarChar</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>12</DataTypeNative>
|
||||
<DataTypeNameNative>varchar</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>64</Size>
|
||||
<BufferLen>64</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemImage</Table>
|
||||
<Pos>8</Pos>
|
||||
<Name>ContentType</Name>
|
||||
<DataType>VarChar</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>12</DataTypeNative>
|
||||
<DataTypeNameNative>varchar</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>128</Size>
|
||||
<BufferLen>128</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemImage</Table>
|
||||
<Pos>9</Pos>
|
||||
<Name>Width</Name>
|
||||
<DataType>Int</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>4</DataTypeNative>
|
||||
<DataTypeNameNative>int</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>10</Size>
|
||||
<BufferLen>4</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemImage</Table>
|
||||
<Pos>10</Pos>
|
||||
<Name>Height</Name>
|
||||
<DataType>Int</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>4</DataTypeNative>
|
||||
<DataTypeNameNative>int</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>10</Size>
|
||||
<BufferLen>4</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemImage</Table>
|
||||
<Pos>11</Pos>
|
||||
<Name>ImageData</Name>
|
||||
<DataType>Binary</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>-3</DataTypeNative>
|
||||
<DataTypeNameNative>varbinary</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>0</Size>
|
||||
<BufferLen>0</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemImage</Table>
|
||||
<Pos>12</Pos>
|
||||
<Name>Notes</Name>
|
||||
<DataType>VarChar</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>-9</DataTypeNative>
|
||||
<DataTypeNameNative>nvarchar</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>2000</Size>
|
||||
<BufferLen>4000</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemImage</Table>
|
||||
<Pos>13</Pos>
|
||||
<Name>Flags</Name>
|
||||
<DataType>SmallInt</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>5</DataTypeNative>
|
||||
<DataTypeNameNative>smallint</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>5</Size>
|
||||
<BufferLen>2</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemImage</Table>
|
||||
<Pos>14</Pos>
|
||||
<Name>Status</Name>
|
||||
<DataType>VarChar</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>12</DataTypeNative>
|
||||
<DataTypeNameNative>varchar</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>3</Size>
|
||||
<BufferLen>3</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemImage</Table>
|
||||
<Pos>15</Pos>
|
||||
<Name>CreateOn</Name>
|
||||
<DataType>DateTime</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>93</DataTypeNative>
|
||||
<DataTypeNameNative>datetime</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>23</Size>
|
||||
<BufferLen>16</BufferLen>
|
||||
<DecimalDigits>3</DecimalDigits>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemImage</Table>
|
||||
<Pos>16</Pos>
|
||||
<Name>CreateBy</Name>
|
||||
<DataType>Int</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>4</DataTypeNative>
|
||||
<DataTypeNameNative>int</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>10</Size>
|
||||
<BufferLen>4</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemImage</Table>
|
||||
<Pos>17</Pos>
|
||||
<Name>CreateHost</Name>
|
||||
<DataType>VarChar</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>12</DataTypeNative>
|
||||
<DataTypeNameNative>varchar</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>100</Size>
|
||||
<BufferLen>100</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemImage</Table>
|
||||
<Pos>18</Pos>
|
||||
<Name>UpdateOn</Name>
|
||||
<DataType>DateTime</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>93</DataTypeNative>
|
||||
<DataTypeNameNative>datetime</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>23</Size>
|
||||
<BufferLen>16</BufferLen>
|
||||
<DecimalDigits>3</DecimalDigits>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemImage</Table>
|
||||
<Pos>19</Pos>
|
||||
<Name>UpdateBy</Name>
|
||||
<DataType>Int</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>4</DataTypeNative>
|
||||
<DataTypeNameNative>int</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>10</Size>
|
||||
<BufferLen>4</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemImage</Table>
|
||||
<Pos>20</Pos>
|
||||
<Name>UpdateHost</Name>
|
||||
<DataType>VarChar</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>12</DataTypeNative>
|
||||
<DataTypeNameNative>varchar</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>100</Size>
|
||||
<BufferLen>100</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
</Columns>
|
||||
<Indices>
|
||||
<DbDfnIndex>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemImage</Table>
|
||||
<Name>PK_ItemImage</Name>
|
||||
<IndexType>1</IndexType>
|
||||
<Unique>true</Unique>
|
||||
<Primary>false</Primary>
|
||||
<Clustered>false</Clustered>
|
||||
<Nullable>false</Nullable>
|
||||
<Pages>0</Pages>
|
||||
<UniqueValues>0</UniqueValues>
|
||||
<HasColumns>false</HasColumns>
|
||||
<Columns>
|
||||
<DbDfnIndexColumn>
|
||||
<Seq>1</Seq>
|
||||
<Name>Id</Name>
|
||||
<Ascend>true</Ascend>
|
||||
</DbDfnIndexColumn>
|
||||
</Columns>
|
||||
</DbDfnIndex>
|
||||
<DbDfnIndex>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemImage</Table>
|
||||
<Name>IDX_ItemImage_</Name>
|
||||
<IndexType>3</IndexType>
|
||||
<Unique>false</Unique>
|
||||
<Primary>false</Primary>
|
||||
<Clustered>false</Clustered>
|
||||
<Nullable>false</Nullable>
|
||||
<Pages>0</Pages>
|
||||
<UniqueValues>0</UniqueValues>
|
||||
<HasColumns>false</HasColumns>
|
||||
<Columns>
|
||||
<DbDfnIndexColumn>
|
||||
<Seq>1</Seq>
|
||||
<Name>ItemType</Name>
|
||||
<Ascend>true</Ascend>
|
||||
</DbDfnIndexColumn>
|
||||
<DbDfnIndexColumn>
|
||||
<Seq>2</Seq>
|
||||
<Name>ItemId</Name>
|
||||
<Ascend>true</Ascend>
|
||||
</DbDfnIndexColumn>
|
||||
</Columns>
|
||||
</DbDfnIndex>
|
||||
<DbDfnIndex>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemImage</Table>
|
||||
<Name>IDX_ItemImage_Item_Type</Name>
|
||||
<IndexType>3</IndexType>
|
||||
<Unique>false</Unique>
|
||||
<Primary>false</Primary>
|
||||
<Clustered>false</Clustered>
|
||||
<Nullable>false</Nullable>
|
||||
<Pages>0</Pages>
|
||||
<UniqueValues>0</UniqueValues>
|
||||
<HasColumns>false</HasColumns>
|
||||
<Columns>
|
||||
<DbDfnIndexColumn>
|
||||
<Seq>1</Seq>
|
||||
<Name>ItemType</Name>
|
||||
<Ascend>true</Ascend>
|
||||
</DbDfnIndexColumn>
|
||||
<DbDfnIndexColumn>
|
||||
<Seq>2</Seq>
|
||||
<Name>ItemId</Name>
|
||||
<Ascend>true</Ascend>
|
||||
</DbDfnIndexColumn>
|
||||
<DbDfnIndexColumn>
|
||||
<Seq>3</Seq>
|
||||
<Name>ImageType</Name>
|
||||
<Ascend>true</Ascend>
|
||||
</DbDfnIndexColumn>
|
||||
</Columns>
|
||||
</DbDfnIndex>
|
||||
</Indices>
|
||||
</DbDfnTable>
|
||||
<DbDfnTable>
|
||||
<Schema>dbo</Schema>
|
||||
<Name>ItemSport</Name>
|
||||
|
||||
Reference in New Issue
Block a user