Initial commit
This commit is contained in:
29
Server/Core/Bring2mind.InMemoriam.Core.csproj
Normal file
29
Server/Core/Bring2mind.InMemoriam.Core.csproj
Normal file
@@ -0,0 +1,29 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<AssemblyName>Bring2mind.InMemoriam.Core</AssemblyName>
|
||||
<TargetFramework>net472</TargetFramework>
|
||||
<OutputPath>..\..\bin</OutputPath>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
|
||||
<Authors>Peter Donker</Authors>
|
||||
<Company>Bring2mind</Company>
|
||||
<Product>inmemoriam</Product>
|
||||
<Copyright>Copyright 2025 by Bring2mind</Copyright>
|
||||
<PackageId>InMemoriam</PackageId>
|
||||
<AssemblyVersion>1.0.2</AssemblyVersion>
|
||||
<FileVersion>1.0.2</FileVersion>
|
||||
<Description>In Memoriam module</Description>
|
||||
<NeutralLanguage>en-US</NeutralLanguage>
|
||||
<ApplicationIcon />
|
||||
<OutputType>Library</OutputType>
|
||||
<StartupObject />
|
||||
<DebugType>Portable</DebugType>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Web" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="DotNetNuke.Core" Version="9.13.0" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
7
Server/Core/Common/Globals.cs
Normal file
7
Server/Core/Common/Globals.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace Bring2mind.InMemoriam.Core.Common
|
||||
{
|
||||
public static class Globals
|
||||
{
|
||||
public const string uploadPath = @"InMemoriam\Pictures";
|
||||
}
|
||||
}
|
||||
43
Server/Core/Common/Image.cs
Normal file
43
Server/Core/Common/Image.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using System.IO;
|
||||
|
||||
namespace Bring2mind.InMemoriam.Core.Common
|
||||
{
|
||||
public class Image
|
||||
{
|
||||
public string ResizedFile { get; set; }
|
||||
public bool ImageExists { get; set; }
|
||||
private string Location { get; set; }
|
||||
|
||||
public Image(string location, string id, int width, int height, string method)
|
||||
{
|
||||
Location = location;
|
||||
var filePath = Path.Combine(location, id + ".resources");
|
||||
ImageExists = File.Exists(filePath);
|
||||
if (ImageExists)
|
||||
{
|
||||
ResizedFile = $"{id}_{width}_{height}_{method}.jpg";
|
||||
var m = ImageResizer.ResizeMethod.Stretch;
|
||||
switch (method)
|
||||
{
|
||||
case "b":
|
||||
m = ImageResizer.ResizeMethod.Box;
|
||||
break;
|
||||
case "c":
|
||||
m = ImageResizer.ResizeMethod.Crop;
|
||||
break;
|
||||
}
|
||||
ImageResizer.ResizeImage(filePath, $"{location}\\{ResizedFile}", width, height, m);
|
||||
}
|
||||
}
|
||||
|
||||
public void CopyToStream(Stream s)
|
||||
{
|
||||
var imgFile = ImageExists ? string.Format("{0}\\{1}", Location, ResizedFile) : string.Format("{0}\\images\\no-content.png", DotNetNuke.Common.Globals.ApplicationMapPath);
|
||||
using (var fs = new FileStream(imgFile, FileMode.Open, FileAccess.Read))
|
||||
{
|
||||
fs.CopyTo(s);
|
||||
fs.Flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
15
Server/Core/Common/ImageOrientation.cs
Normal file
15
Server/Core/Common/ImageOrientation.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
namespace Bring2mind.InMemoriam.Core.Common
|
||||
{
|
||||
public enum ImageOrientation
|
||||
{
|
||||
Unknown = 0,
|
||||
Normal = 1,
|
||||
FlipHorizontal = 2,
|
||||
Rotate180 = 3,
|
||||
FlipVertical = 4,
|
||||
Transpose = 5,
|
||||
Rotate270 = 6,
|
||||
Transverse = 7,
|
||||
Rotate90 = 8
|
||||
}
|
||||
}
|
||||
134
Server/Core/Common/ImageResizer.cs
Normal file
134
Server/Core/Common/ImageResizer.cs
Normal file
@@ -0,0 +1,134 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
|
||||
namespace Bring2mind.InMemoriam.Core.Common
|
||||
{
|
||||
public class ImageResizer
|
||||
{
|
||||
public enum ResizeMethod
|
||||
{
|
||||
Box,
|
||||
Crop,
|
||||
Stretch
|
||||
}
|
||||
|
||||
public static void ResizeImage(string source, string destination, int desiredWidth, int desiredHeight, ResizeMethod method)
|
||||
{
|
||||
var format = ImageFormat.Jpeg;
|
||||
var target = Resize(source, desiredWidth, desiredHeight, method);
|
||||
target.Save(destination, format);
|
||||
}
|
||||
|
||||
private static System.Drawing.Image Resize(string sourceImageMapPath, int desiredWidth, int desiredHeight, ResizeMethod method)
|
||||
{
|
||||
//throw error if bouning box is to small
|
||||
if (desiredWidth < 4 || desiredHeight < 4)
|
||||
throw new InvalidOperationException("Bounding Box of Resize Photo must be larger than 4X4 pixels.");
|
||||
var original = Bitmap.FromFile(sourceImageMapPath);
|
||||
|
||||
try
|
||||
{
|
||||
var orientation = (ImageOrientation)original.GetPropertyItem(274).Value[0];
|
||||
switch (orientation)
|
||||
{
|
||||
case ImageOrientation.FlipHorizontal:
|
||||
original.RotateFlip(RotateFlipType.RotateNoneFlipX);
|
||||
break;
|
||||
case ImageOrientation.Rotate180:
|
||||
original.RotateFlip(RotateFlipType.Rotate180FlipNone);
|
||||
break;
|
||||
case ImageOrientation.FlipVertical:
|
||||
original.RotateFlip(RotateFlipType.RotateNoneFlipY);
|
||||
break;
|
||||
case
|
||||
ImageOrientation.Transpose:
|
||||
original.RotateFlip(RotateFlipType.RotateNoneFlipXY);
|
||||
break;
|
||||
case ImageOrientation.Rotate270:
|
||||
original.RotateFlip(RotateFlipType.Rotate90FlipNone);
|
||||
break;
|
||||
case
|
||||
ImageOrientation.Transverse:
|
||||
original.RotateFlip(RotateFlipType.Rotate90FlipXY);
|
||||
break;
|
||||
case ImageOrientation.Rotate90:
|
||||
original.RotateFlip(RotateFlipType.Rotate270FlipNone);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
|
||||
//store image widths in variable for easier use
|
||||
var oW = (decimal)original.Width;
|
||||
var oH = (decimal)original.Height;
|
||||
var dW = (decimal)desiredWidth;
|
||||
var dH = (decimal)desiredHeight;
|
||||
|
||||
var scaleWidth = dW / oW;
|
||||
var scaleHeight = dH / oH;
|
||||
|
||||
int tW = desiredWidth;
|
||||
int tH = desiredHeight;
|
||||
int tX = 0;
|
||||
int tY = 0;
|
||||
int tDX = desiredWidth;
|
||||
int tDY = desiredHeight;
|
||||
|
||||
//check if image already fits
|
||||
if (oW <= dW && oH <= dH)
|
||||
return original; //image fits in bounding box, keep size (center with css) If we made it bigger it would stretch the image resulting in loss of quality.
|
||||
|
||||
//check for double squares or plain stretch resizing
|
||||
if ((oW == oH && dW == dH) || method == ResizeMethod.Stretch)
|
||||
{
|
||||
// don't do anything
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (method)
|
||||
{
|
||||
case ResizeMethod.Crop:
|
||||
var scaleMax = Math.Max(scaleHeight, scaleWidth);
|
||||
if (scaleHeight > scaleWidth)
|
||||
{
|
||||
tX = -1 * Convert.ToInt32(((scaleMax * oW) - dW) / 2);
|
||||
tDX = Convert.ToInt32(scaleMax * oW);
|
||||
}
|
||||
else
|
||||
{
|
||||
tY = -1 * Convert.ToInt32(((scaleMax * oH) - dH) / 2);
|
||||
tDY = Convert.ToInt32(scaleMax * oH);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
var scaleMin = Math.Min(scaleHeight, scaleWidth);
|
||||
tW = Convert.ToInt32(oW * scaleMin);
|
||||
tH = Convert.ToInt32(oH * scaleMin);
|
||||
tDX = tW;
|
||||
tDY = tH;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
var destImage = new Bitmap(tW, tH);
|
||||
using (var graphics = Graphics.FromImage(destImage))
|
||||
{
|
||||
graphics.CompositingMode = CompositingMode.SourceCopy;
|
||||
graphics.CompositingQuality = CompositingQuality.HighQuality;
|
||||
graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
|
||||
graphics.SmoothingMode = SmoothingMode.HighQuality;
|
||||
graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
|
||||
graphics.DrawImage(original, tX, tY, tDX, tDY);
|
||||
}
|
||||
|
||||
return destImage;
|
||||
}
|
||||
}
|
||||
}
|
||||
9
Server/Core/Common/Visibility.cs
Normal file
9
Server/Core/Common/Visibility.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace Bring2mind.InMemoriam.Core.Common
|
||||
{
|
||||
public enum Visibility
|
||||
{
|
||||
Public = 0,
|
||||
Friends = 1,
|
||||
Private = 2
|
||||
}
|
||||
}
|
||||
46
Server/Core/Data/AuditableEntity.cs
Normal file
46
Server/Core/Data/AuditableEntity.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Runtime.Serialization;
|
||||
using DotNetNuke.Common.Utilities;
|
||||
|
||||
namespace Bring2mind.InMemoriam.Core.Data
|
||||
{
|
||||
[DataContract]
|
||||
public abstract class AuditableEntity
|
||||
{
|
||||
|
||||
public void FillAuditFields(IDataReader dr)
|
||||
{
|
||||
CreatedByUserID = Convert.ToInt32(Null.SetNull(dr["CreatedByUserID"], CreatedByUserID));
|
||||
CreatedOnDate = Convert.ToDateTime(Null.SetNull(dr["CreatedOnDate"], CreatedOnDate));
|
||||
LastModifiedByUserID = Convert.ToInt32(Null.SetNull(dr["LastModifiedByUserID"], LastModifiedByUserID));
|
||||
LastModifiedOnDate = Convert.ToDateTime(Null.SetNull(dr["LastModifiedOnDate"], LastModifiedOnDate));
|
||||
}
|
||||
|
||||
public void SetAddingUser(int userId)
|
||||
{
|
||||
CreatedByUserID = userId;
|
||||
CreatedOnDate = DateTime.Now;
|
||||
SetModifyingUser(userId);
|
||||
}
|
||||
|
||||
public void SetModifyingUser(int userId)
|
||||
{
|
||||
LastModifiedByUserID = userId;
|
||||
LastModifiedOnDate = DateTime.Now;
|
||||
}
|
||||
|
||||
#region Public Properties
|
||||
[DataMember]
|
||||
public int CreatedByUserID { get; set; }
|
||||
[DataMember]
|
||||
public DateTime CreatedOnDate { get; set; }
|
||||
[DataMember]
|
||||
public int LastModifiedByUserID { get; set; }
|
||||
[DataMember]
|
||||
public DateTime LastModifiedOnDate { get; set; }
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
132
Server/Core/Data/RepositoryImpl.cs
Normal file
132
Server/Core/Data/RepositoryImpl.cs
Normal file
@@ -0,0 +1,132 @@
|
||||
using System.Collections.Generic;
|
||||
using DotNetNuke.Collections;
|
||||
using DotNetNuke.Data;
|
||||
|
||||
namespace Bring2mind.InMemoriam.Core.Data
|
||||
{
|
||||
public abstract class RepositoryImpl<T> : IRepository<T> where T : class
|
||||
{
|
||||
|
||||
public virtual void Delete(T item)
|
||||
{
|
||||
using (IDataContext db = DataContext.Instance()) {
|
||||
IRepository<T> repo = db.GetRepository<T>();
|
||||
repo.Delete(item);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void Delete(string sqlCondition, params object[] args)
|
||||
{
|
||||
using (IDataContext db = DataContext.Instance()) {
|
||||
IRepository<T> repo = db.GetRepository<T>();
|
||||
repo.Delete(sqlCondition, args);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual IEnumerable<T> Find(string sqlCondition, params object[] args)
|
||||
{
|
||||
IEnumerable<T> list = null;
|
||||
using (IDataContext db = DataContext.Instance()) {
|
||||
IRepository<T> repo = db.GetRepository<T>();
|
||||
list = repo.Find(sqlCondition, args);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public virtual IPagedList<T> Find(int pageIndex, int pageSize, string sqlCondition, params object[] args)
|
||||
{
|
||||
IPagedList<T> list = null;
|
||||
using (IDataContext db = DataContext.Instance()) {
|
||||
IRepository<T> repo = db.GetRepository<T>();
|
||||
list = repo.Find(pageIndex, pageSize, sqlCondition, args);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public virtual IEnumerable<T> Get()
|
||||
{
|
||||
IEnumerable<T> list = null;
|
||||
using (IDataContext db = DataContext.Instance()) {
|
||||
IRepository<T> repo = db.GetRepository<T>();
|
||||
list = repo.Get();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public virtual IEnumerable<T> Get<TScopeType>(TScopeType scopeValue)
|
||||
{
|
||||
IEnumerable<T> list = null;
|
||||
using (IDataContext db = DataContext.Instance()) {
|
||||
IRepository<T> repo = db.GetRepository<T>();
|
||||
list = repo.Get<TScopeType>(scopeValue);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public virtual T GetById<TProperty>(TProperty id)
|
||||
{
|
||||
T item = null;
|
||||
using (IDataContext db = DataContext.Instance()) {
|
||||
IRepository<T> repo = db.GetRepository<T>();
|
||||
item = repo.GetById<TProperty>(id);
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
public virtual T GetById<TProperty, TScopeType>(TProperty id, TScopeType scopeValue)
|
||||
{
|
||||
T item = null;
|
||||
using (IDataContext db = DataContext.Instance()) {
|
||||
IRepository<T> repo = db.GetRepository<T>();
|
||||
item = repo.GetById<TProperty, TScopeType>(id, scopeValue);
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
public virtual IPagedList<T> GetPage(int pageIndex, int pageSize)
|
||||
{
|
||||
IPagedList<T> list = null;
|
||||
using (IDataContext db = DataContext.Instance()) {
|
||||
IRepository<T> repo = db.GetRepository<T>();
|
||||
list = repo.GetPage(pageIndex, pageSize);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public virtual IPagedList<T> GetPage<TScopeType>(TScopeType scopeValue, int pageIndex, int pageSize)
|
||||
{
|
||||
IPagedList<T> list = null;
|
||||
using (IDataContext db = DataContext.Instance()) {
|
||||
IRepository<T> repo = db.GetRepository<T>();
|
||||
list = repo.GetPage<TScopeType>(scopeValue, pageIndex, pageSize);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public virtual void Insert(T item)
|
||||
{
|
||||
using (IDataContext db = DataContext.Instance()) {
|
||||
IRepository<T> repo = db.GetRepository<T>();
|
||||
repo.Insert(item);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void Update(T item)
|
||||
{
|
||||
using (IDataContext db = DataContext.Instance()) {
|
||||
IRepository<T> repo = db.GetRepository<T>();
|
||||
repo.Update(item);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void Update(string sqlCondition, params object[] args)
|
||||
{
|
||||
using (IDataContext db = DataContext.Instance()) {
|
||||
IRepository<T> repo = db.GetRepository<T>();
|
||||
repo.Update(sqlCondition, args);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
10
Server/Core/Data/Sprocs.cs
Normal file
10
Server/Core/Data/Sprocs.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using DotNetNuke.Data;
|
||||
|
||||
namespace Bring2mind.InMemoriam.Core.Data
|
||||
{
|
||||
public class Sprocs
|
||||
{
|
||||
}
|
||||
}
|
||||
6
Server/Core/Models/Messages/Message.cs
Normal file
6
Server/Core/Models/Messages/Message.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace Bring2mind.InMemoriam.Core.Models.Messages
|
||||
{
|
||||
public partial class Message
|
||||
{
|
||||
}
|
||||
}
|
||||
63
Server/Core/Models/Messages/Message_Declaration.cs
Normal file
63
Server/Core/Models/Messages/Message_Declaration.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using DotNetNuke.ComponentModel.DataAnnotations;
|
||||
using Bring2mind.InMemoriam.Core.Data;
|
||||
|
||||
namespace Bring2mind.InMemoriam.Core.Models.Messages
|
||||
{
|
||||
[TableName("B2M_InMemoriam_Messages")]
|
||||
[PrimaryKey("MessageId", AutoIncrement = true)]
|
||||
[DataContract]
|
||||
[Scope("ModuleId")]
|
||||
public partial class Message {
|
||||
|
||||
#region .ctor
|
||||
public Message()
|
||||
{
|
||||
MessageId = -1;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
[DataMember]
|
||||
public int MessageId { get; set; }
|
||||
[DataMember]
|
||||
public int ModuleId { get; set; }
|
||||
[DataMember]
|
||||
public string Contents { get; set; }
|
||||
[DataMember]
|
||||
public string SenderName { get; set; }
|
||||
[DataMember]
|
||||
public string SenderEmail { get; set; }
|
||||
[DataMember]
|
||||
public DateTime CreatedOn { get; set; }
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
public void ReadMessage(Message message)
|
||||
{
|
||||
if (message.MessageId > -1)
|
||||
MessageId = message.MessageId;
|
||||
|
||||
if (message.ModuleId > -1)
|
||||
ModuleId = message.ModuleId;
|
||||
|
||||
if (!String.IsNullOrEmpty(message.Contents))
|
||||
Contents = message.Contents;
|
||||
|
||||
if (!String.IsNullOrEmpty(message.SenderName))
|
||||
SenderName = message.SenderName;
|
||||
|
||||
if (!String.IsNullOrEmpty(message.SenderEmail))
|
||||
SenderEmail = message.SenderEmail;
|
||||
|
||||
CreatedOn = message.CreatedOn;
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
76
Server/Core/Models/Messages/Message_Interfaces.cs
Normal file
76
Server/Core/Models/Messages/Message_Interfaces.cs
Normal file
@@ -0,0 +1,76 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
|
||||
using DotNetNuke.Common.Utilities;
|
||||
using DotNetNuke.ComponentModel.DataAnnotations;
|
||||
using DotNetNuke.Entities.Modules;
|
||||
using DotNetNuke.Services.Tokens;
|
||||
|
||||
namespace Bring2mind.InMemoriam.Core.Models.Messages
|
||||
{
|
||||
public partial class Message : IHydratable, IPropertyAccess
|
||||
{
|
||||
|
||||
#region IHydratable
|
||||
|
||||
public virtual void Fill(IDataReader dr)
|
||||
{
|
||||
MessageId = Convert.ToInt32(Null.SetNull(dr["MessageId"], MessageId));
|
||||
ModuleId = Convert.ToInt32(Null.SetNull(dr["ModuleId"], ModuleId));
|
||||
Contents = Convert.ToString(Null.SetNull(dr["Contents"], Contents));
|
||||
SenderName = Convert.ToString(Null.SetNull(dr["SenderName"], SenderName));
|
||||
SenderEmail = Convert.ToString(Null.SetNull(dr["SenderEmail"], SenderEmail));
|
||||
CreatedOn = (DateTime)(Null.SetNull(dr["CreatedOn"], CreatedOn));
|
||||
}
|
||||
|
||||
[IgnoreColumn()]
|
||||
public int KeyID
|
||||
{
|
||||
get { return MessageId; }
|
||||
set { MessageId = value; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region IPropertyAccess
|
||||
public virtual string GetProperty(string strPropertyName, string strFormat, System.Globalization.CultureInfo formatProvider, DotNetNuke.Entities.Users.UserInfo accessingUser, DotNetNuke.Services.Tokens.Scope accessLevel, ref bool propertyNotFound)
|
||||
{
|
||||
switch (strPropertyName.ToLower())
|
||||
{
|
||||
case "messageid": // Int
|
||||
return MessageId.ToString(strFormat, formatProvider);
|
||||
case "moduleid": // Int
|
||||
return ModuleId.ToString(strFormat, formatProvider);
|
||||
case "contents": // NVarCharMax
|
||||
return PropertyAccess.FormatString(Contents, strFormat);
|
||||
case "sendername": // NVarChar
|
||||
if (SenderName == null)
|
||||
{
|
||||
return "";
|
||||
};
|
||||
return PropertyAccess.FormatString(SenderName, strFormat);
|
||||
case "senderemail": // NVarChar
|
||||
if (SenderEmail == null)
|
||||
{
|
||||
return "";
|
||||
};
|
||||
return PropertyAccess.FormatString(SenderEmail, strFormat);
|
||||
case "createdon": // DateTime
|
||||
return CreatedOn.ToString(strFormat, formatProvider);
|
||||
default:
|
||||
propertyNotFound = true;
|
||||
break;
|
||||
}
|
||||
|
||||
return Null.NullString;
|
||||
}
|
||||
|
||||
[IgnoreColumn()]
|
||||
public CacheLevel Cacheability
|
||||
{
|
||||
get { return CacheLevel.fullyCacheable; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
94
Server/Core/Models/Pictures/PictureBase.cs
Normal file
94
Server/Core/Models/Pictures/PictureBase.cs
Normal file
@@ -0,0 +1,94 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using DotNetNuke.ComponentModel.DataAnnotations;
|
||||
using Bring2mind.InMemoriam.Core.Data;
|
||||
|
||||
namespace Bring2mind.InMemoriam.Core.Models.Pictures
|
||||
{
|
||||
[TableName("B2M_InMemoriam_Pictures")]
|
||||
[PrimaryKey("PictureId", AutoIncrement = true)]
|
||||
[DataContract]
|
||||
[Scope("ModuleId")]
|
||||
public partial class PictureBase : AuditableEntity
|
||||
{
|
||||
|
||||
#region .ctor
|
||||
public PictureBase()
|
||||
{
|
||||
PictureId = -1;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
[DataMember]
|
||||
public int PictureId { get; set; }
|
||||
[DataMember]
|
||||
public int ModuleId { get; set; }
|
||||
[DataMember]
|
||||
public Guid ImageIdentifier { get; set; }
|
||||
[DataMember]
|
||||
public int OriginalWidth { get; set; }
|
||||
[DataMember]
|
||||
public int OriginalHeight { get; set; }
|
||||
[DataMember]
|
||||
public string OriginalName { get; set; }
|
||||
[DataMember]
|
||||
public string Title { get; set; }
|
||||
[DataMember]
|
||||
public string Description { get; set; }
|
||||
[DataMember]
|
||||
public int PictureYear { get; set; }
|
||||
[DataMember]
|
||||
public int PictureMonth { get; set; }
|
||||
[DataMember]
|
||||
public int PictureDay { get; set; }
|
||||
[DataMember]
|
||||
public int Visibility { get; set; }
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
public void ReadPictureBase(PictureBase picture)
|
||||
{
|
||||
if (picture.PictureId > -1)
|
||||
PictureId = picture.PictureId;
|
||||
|
||||
if (picture.ModuleId > -1)
|
||||
ModuleId = picture.ModuleId;
|
||||
|
||||
ImageIdentifier = picture.ImageIdentifier;
|
||||
|
||||
if (picture.OriginalWidth > -1)
|
||||
OriginalWidth = picture.OriginalWidth;
|
||||
|
||||
if (picture.OriginalHeight > -1)
|
||||
OriginalHeight = picture.OriginalHeight;
|
||||
|
||||
if (!String.IsNullOrEmpty(picture.OriginalName))
|
||||
OriginalName = picture.OriginalName;
|
||||
|
||||
if (!String.IsNullOrEmpty(picture.Title))
|
||||
Title = picture.Title;
|
||||
|
||||
if (!String.IsNullOrEmpty(picture.Description))
|
||||
Description = picture.Description;
|
||||
|
||||
if (picture.PictureYear > -1)
|
||||
PictureYear = picture.PictureYear;
|
||||
|
||||
if (picture.PictureMonth > -1)
|
||||
PictureMonth = picture.PictureMonth;
|
||||
|
||||
if (picture.PictureDay > -1)
|
||||
PictureDay = picture.PictureDay;
|
||||
|
||||
if (picture.Visibility > -1)
|
||||
Visibility = picture.Visibility;
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
20
Server/Core/Models/Pictures/PictureBaseMore.cs
Normal file
20
Server/Core/Models/Pictures/PictureBaseMore.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using Bring2mind.InMemoriam.Core.Data;
|
||||
|
||||
namespace Bring2mind.InMemoriam.Core.Models.Pictures
|
||||
{
|
||||
public partial class PictureBase : AuditableEntity
|
||||
{
|
||||
public void ReadEditedPictureBase(PictureBase picture)
|
||||
{
|
||||
Title = picture.Title.Trim();
|
||||
Description = picture.Description.Trim();
|
||||
PictureYear = picture.PictureYear;
|
||||
PictureMonth = picture.PictureMonth;
|
||||
PictureDay = picture.PictureDay;
|
||||
Visibility = picture.Visibility;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
99
Server/Core/Models/Pictures/PictureBase_Interfaces.cs
Normal file
99
Server/Core/Models/Pictures/PictureBase_Interfaces.cs
Normal file
@@ -0,0 +1,99 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
|
||||
using DotNetNuke.Common.Utilities;
|
||||
using DotNetNuke.ComponentModel.DataAnnotations;
|
||||
using DotNetNuke.Entities.Modules;
|
||||
using DotNetNuke.Services.Tokens;
|
||||
|
||||
namespace Bring2mind.InMemoriam.Core.Models.Pictures
|
||||
{
|
||||
public partial class PictureBase : IHydratable, IPropertyAccess
|
||||
{
|
||||
|
||||
#region IHydratable
|
||||
|
||||
public virtual void Fill(IDataReader dr)
|
||||
{
|
||||
FillAuditFields(dr);
|
||||
PictureId = Convert.ToInt32(Null.SetNull(dr["PictureId"], PictureId));
|
||||
ModuleId = Convert.ToInt32(Null.SetNull(dr["ModuleId"], ModuleId));
|
||||
ImageIdentifier = new Guid(Convert.ToString(Null.SetNull(dr["ImageIdentifier"], ImageIdentifier)));
|
||||
OriginalWidth = Convert.ToInt32(Null.SetNull(dr["OriginalWidth"], OriginalWidth));
|
||||
OriginalHeight = Convert.ToInt32(Null.SetNull(dr["OriginalHeight"], OriginalHeight));
|
||||
OriginalName = Convert.ToString(Null.SetNull(dr["OriginalName"], OriginalName));
|
||||
Title = Convert.ToString(Null.SetNull(dr["Title"], Title));
|
||||
Description = Convert.ToString(Null.SetNull(dr["Description"], Description));
|
||||
PictureYear = Convert.ToInt32(Null.SetNull(dr["PictureYear"], PictureYear));
|
||||
PictureMonth = Convert.ToInt32(Null.SetNull(dr["PictureMonth"], PictureMonth));
|
||||
PictureDay = Convert.ToInt32(Null.SetNull(dr["PictureDay"], PictureDay));
|
||||
Visibility = Convert.ToInt32(Null.SetNull(dr["Visibility"], Visibility));
|
||||
}
|
||||
|
||||
[IgnoreColumn()]
|
||||
public int KeyID
|
||||
{
|
||||
get { return PictureId; }
|
||||
set { PictureId = value; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region IPropertyAccess
|
||||
public virtual string GetProperty(string strPropertyName, string strFormat, System.Globalization.CultureInfo formatProvider, DotNetNuke.Entities.Users.UserInfo accessingUser, DotNetNuke.Services.Tokens.Scope accessLevel, ref bool propertyNotFound)
|
||||
{
|
||||
switch (strPropertyName.ToLower())
|
||||
{
|
||||
case "pictureid": // Int
|
||||
return PictureId.ToString(strFormat, formatProvider);
|
||||
case "moduleid": // Int
|
||||
return ModuleId.ToString(strFormat, formatProvider);
|
||||
case "imageidentifier": // UniqueIdentifier
|
||||
return ImageIdentifier.ToString(strFormat, formatProvider);
|
||||
case "originalwidth": // Int
|
||||
return OriginalWidth.ToString(strFormat, formatProvider);
|
||||
case "originalheight": // Int
|
||||
return OriginalHeight.ToString(strFormat, formatProvider);
|
||||
case "originalname": // NVarChar
|
||||
if (OriginalName == null)
|
||||
{
|
||||
return "";
|
||||
};
|
||||
return PropertyAccess.FormatString(OriginalName, strFormat);
|
||||
case "title": // NVarChar
|
||||
if (Title == null)
|
||||
{
|
||||
return "";
|
||||
};
|
||||
return PropertyAccess.FormatString(Title, strFormat);
|
||||
case "description": // NVarCharMax
|
||||
if (Description == null)
|
||||
{
|
||||
return "";
|
||||
};
|
||||
return PropertyAccess.FormatString(Description, strFormat);
|
||||
case "pictureyear": // Int
|
||||
return PictureYear.ToString(strFormat, formatProvider);
|
||||
case "picturemonth": // Int
|
||||
return PictureMonth.ToString(strFormat, formatProvider);
|
||||
case "pictureday": // Int
|
||||
return PictureDay.ToString(strFormat, formatProvider);
|
||||
case "visibility": // Int
|
||||
return Visibility.ToString(strFormat, formatProvider);
|
||||
default:
|
||||
propertyNotFound = true;
|
||||
break;
|
||||
}
|
||||
|
||||
return Null.NullString;
|
||||
}
|
||||
|
||||
[IgnoreColumn()]
|
||||
public CacheLevel Cacheability
|
||||
{
|
||||
get { return CacheLevel.fullyCacheable; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
76
Server/Core/Models/Pictures/Picture_Declaration.cs
Normal file
76
Server/Core/Models/Pictures/Picture_Declaration.cs
Normal file
@@ -0,0 +1,76 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using DotNetNuke.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Bring2mind.InMemoriam.Core.Models.Pictures
|
||||
{
|
||||
|
||||
[TableName("vw_B2M_InMemoriam_Pictures")]
|
||||
[PrimaryKey("PictureId", AutoIncrement = true)]
|
||||
[DataContract]
|
||||
[Scope("ModuleId")]
|
||||
public partial class Picture : PictureBase
|
||||
{
|
||||
|
||||
#region .ctor
|
||||
public Picture() : base()
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
[DataMember]
|
||||
public string CreatedByUser { get; set; }
|
||||
[DataMember]
|
||||
public string LastModifiedByUser { get; set; }
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
public PictureBase GetPictureBase()
|
||||
{
|
||||
PictureBase res = new PictureBase();
|
||||
res.PictureId = PictureId;
|
||||
res.ModuleId = ModuleId;
|
||||
res.ImageIdentifier = ImageIdentifier;
|
||||
res.OriginalWidth = OriginalWidth;
|
||||
res.OriginalHeight = OriginalHeight;
|
||||
res.OriginalName = OriginalName;
|
||||
res.Title = Title;
|
||||
res.Description = Description;
|
||||
res.PictureYear = PictureYear;
|
||||
res.PictureMonth = PictureMonth;
|
||||
res.PictureDay = PictureDay;
|
||||
res.Visibility = Visibility;
|
||||
res.CreatedByUserID = CreatedByUserID;
|
||||
res.CreatedOnDate = CreatedOnDate;
|
||||
res.LastModifiedByUserID = LastModifiedByUserID;
|
||||
res.LastModifiedOnDate = LastModifiedOnDate;
|
||||
return res;
|
||||
}
|
||||
public Picture Clone()
|
||||
{
|
||||
Picture res = new Picture();
|
||||
res.PictureId = PictureId;
|
||||
res.ModuleId = ModuleId;
|
||||
res.ImageIdentifier = ImageIdentifier;
|
||||
res.OriginalWidth = OriginalWidth;
|
||||
res.OriginalHeight = OriginalHeight;
|
||||
res.OriginalName = OriginalName;
|
||||
res.Title = Title;
|
||||
res.Description = Description;
|
||||
res.PictureYear = PictureYear;
|
||||
res.PictureMonth = PictureMonth;
|
||||
res.PictureDay = PictureDay;
|
||||
res.Visibility = Visibility;
|
||||
res.CreatedByUser = CreatedByUser;
|
||||
res.LastModifiedByUser = LastModifiedByUser;
|
||||
res.CreatedByUserID = CreatedByUserID;
|
||||
res.CreatedOnDate = CreatedOnDate;
|
||||
res.LastModifiedByUserID = LastModifiedByUserID;
|
||||
res.LastModifiedOnDate = LastModifiedOnDate;
|
||||
return res;
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
48
Server/Core/Models/Pictures/Picture_Interfaces.cs
Normal file
48
Server/Core/Models/Pictures/Picture_Interfaces.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
using DotNetNuke.Common.Utilities;
|
||||
using DotNetNuke.Services.Tokens;
|
||||
|
||||
namespace Bring2mind.InMemoriam.Core.Models.Pictures
|
||||
{
|
||||
|
||||
[Serializable(), XmlRoot("Picture")]
|
||||
public partial class Picture
|
||||
{
|
||||
|
||||
#region IHydratable
|
||||
public override void Fill(IDataReader dr)
|
||||
{
|
||||
base.Fill(dr);
|
||||
CreatedByUser = Convert.ToString(Null.SetNull(dr["CreatedByUser"], CreatedByUser));
|
||||
LastModifiedByUser = Convert.ToString(Null.SetNull(dr["LastModifiedByUser"], LastModifiedByUser));
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region IPropertyAccess
|
||||
public override string GetProperty(string strPropertyName, string strFormat, System.Globalization.CultureInfo formatProvider, DotNetNuke.Entities.Users.UserInfo accessingUser, DotNetNuke.Services.Tokens.Scope accessLevel, ref bool propertyNotFound)
|
||||
{
|
||||
switch (strPropertyName.ToLower()) {
|
||||
case "createdbyuser": // NVarChar
|
||||
if (CreatedByUser == null)
|
||||
{
|
||||
return "";
|
||||
};
|
||||
return PropertyAccess.FormatString(CreatedByUser, strFormat);
|
||||
case "lastmodifiedbyuser": // NVarChar
|
||||
if (LastModifiedByUser == null)
|
||||
{
|
||||
return "";
|
||||
};
|
||||
return PropertyAccess.FormatString(LastModifiedByUser, strFormat);
|
||||
default:
|
||||
return base.GetProperty(strPropertyName, strFormat, formatProvider, accessingUser, accessLevel, ref propertyNotFound);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
75
Server/Core/Models/Stories/StoryBase.cs
Normal file
75
Server/Core/Models/Stories/StoryBase.cs
Normal file
@@ -0,0 +1,75 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using DotNetNuke.ComponentModel.DataAnnotations;
|
||||
using Bring2mind.InMemoriam.Core.Data;
|
||||
|
||||
namespace Bring2mind.InMemoriam.Core.Models.Stories
|
||||
{
|
||||
[TableName("B2M_InMemoriam_Stories")]
|
||||
[PrimaryKey("StoryId", AutoIncrement = true)]
|
||||
[DataContract]
|
||||
[Scope("ModuleId")]
|
||||
public partial class StoryBase : AuditableEntity
|
||||
{
|
||||
|
||||
#region .ctor
|
||||
public StoryBase()
|
||||
{
|
||||
StoryId = -1;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
[DataMember]
|
||||
public int StoryId { get; set; }
|
||||
[DataMember]
|
||||
public int ModuleId { get; set; }
|
||||
[DataMember]
|
||||
public string Title { get; set; }
|
||||
[DataMember]
|
||||
public string Contents { get; set; }
|
||||
[DataMember]
|
||||
public int StoryYear { get; set; }
|
||||
[DataMember]
|
||||
public int StoryMonth { get; set; }
|
||||
[DataMember]
|
||||
public int StoryDay { get; set; }
|
||||
[DataMember]
|
||||
public int Visibility { get; set; }
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
public void ReadStoryBase(StoryBase story)
|
||||
{
|
||||
if (story.StoryId > -1)
|
||||
StoryId = story.StoryId;
|
||||
|
||||
if (story.ModuleId > -1)
|
||||
ModuleId = story.ModuleId;
|
||||
|
||||
if (!String.IsNullOrEmpty(story.Title))
|
||||
Title = story.Title;
|
||||
|
||||
if (!String.IsNullOrEmpty(story.Contents))
|
||||
Contents = story.Contents;
|
||||
|
||||
if (story.StoryYear > -1)
|
||||
StoryYear = story.StoryYear;
|
||||
|
||||
if (story.StoryMonth > -1)
|
||||
StoryMonth = story.StoryMonth;
|
||||
|
||||
if (story.StoryDay > -1)
|
||||
StoryDay = story.StoryDay;
|
||||
|
||||
if (story.Visibility > -1)
|
||||
Visibility = story.Visibility;
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
23
Server/Core/Models/Stories/StoryBaseMore.cs
Normal file
23
Server/Core/Models/Stories/StoryBaseMore.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using DotNetNuke.ComponentModel.DataAnnotations;
|
||||
using Bring2mind.InMemoriam.Core.Data;
|
||||
|
||||
namespace Bring2mind.InMemoriam.Core.Models.Stories
|
||||
{
|
||||
public partial class StoryBase : AuditableEntity
|
||||
{
|
||||
public void ReadEditedStoryBase(StoryBase story)
|
||||
{
|
||||
Title = story.Title.Trim();
|
||||
Contents = story.Contents.Trim();
|
||||
StoryYear = story.StoryYear;
|
||||
StoryMonth = story.StoryMonth;
|
||||
StoryDay = story.StoryDay;
|
||||
Visibility = story.Visibility;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
83
Server/Core/Models/Stories/StoryBase_Interfaces.cs
Normal file
83
Server/Core/Models/Stories/StoryBase_Interfaces.cs
Normal file
@@ -0,0 +1,83 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
|
||||
using DotNetNuke.Common.Utilities;
|
||||
using DotNetNuke.ComponentModel.DataAnnotations;
|
||||
using DotNetNuke.Entities.Modules;
|
||||
using DotNetNuke.Services.Tokens;
|
||||
|
||||
namespace Bring2mind.InMemoriam.Core.Models.Stories
|
||||
{
|
||||
public partial class StoryBase : IHydratable, IPropertyAccess
|
||||
{
|
||||
|
||||
#region IHydratable
|
||||
|
||||
public virtual void Fill(IDataReader dr)
|
||||
{
|
||||
FillAuditFields(dr);
|
||||
StoryId = Convert.ToInt32(Null.SetNull(dr["StoryId"], StoryId));
|
||||
ModuleId = Convert.ToInt32(Null.SetNull(dr["ModuleId"], ModuleId));
|
||||
Title = Convert.ToString(Null.SetNull(dr["Title"], Title));
|
||||
Contents = Convert.ToString(Null.SetNull(dr["Contents"], Contents));
|
||||
StoryYear = Convert.ToInt32(Null.SetNull(dr["StoryYear"], StoryYear));
|
||||
StoryMonth = Convert.ToInt32(Null.SetNull(dr["StoryMonth"], StoryMonth));
|
||||
StoryDay = Convert.ToInt32(Null.SetNull(dr["StoryDay"], StoryDay));
|
||||
Visibility = Convert.ToInt32(Null.SetNull(dr["Visibility"], Visibility));
|
||||
}
|
||||
|
||||
[IgnoreColumn()]
|
||||
public int KeyID
|
||||
{
|
||||
get { return StoryId; }
|
||||
set { StoryId = value; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region IPropertyAccess
|
||||
public virtual string GetProperty(string strPropertyName, string strFormat, System.Globalization.CultureInfo formatProvider, DotNetNuke.Entities.Users.UserInfo accessingUser, DotNetNuke.Services.Tokens.Scope accessLevel, ref bool propertyNotFound)
|
||||
{
|
||||
switch (strPropertyName.ToLower())
|
||||
{
|
||||
case "storyid": // Int
|
||||
return StoryId.ToString(strFormat, formatProvider);
|
||||
case "moduleid": // Int
|
||||
return ModuleId.ToString(strFormat, formatProvider);
|
||||
case "title": // NVarChar
|
||||
if (Title == null)
|
||||
{
|
||||
return "";
|
||||
};
|
||||
return PropertyAccess.FormatString(Title, strFormat);
|
||||
case "contents": // NVarCharMax
|
||||
if (Contents == null)
|
||||
{
|
||||
return "";
|
||||
};
|
||||
return PropertyAccess.FormatString(Contents, strFormat);
|
||||
case "storyyear": // Int
|
||||
return StoryYear.ToString(strFormat, formatProvider);
|
||||
case "storymonth": // Int
|
||||
return StoryMonth.ToString(strFormat, formatProvider);
|
||||
case "storyday": // Int
|
||||
return StoryDay.ToString(strFormat, formatProvider);
|
||||
case "visibility": // Int
|
||||
return Visibility.ToString(strFormat, formatProvider);
|
||||
default:
|
||||
propertyNotFound = true;
|
||||
break;
|
||||
}
|
||||
|
||||
return Null.NullString;
|
||||
}
|
||||
|
||||
[IgnoreColumn()]
|
||||
public CacheLevel Cacheability
|
||||
{
|
||||
get { return CacheLevel.fullyCacheable; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
68
Server/Core/Models/Stories/Story_Declaration.cs
Normal file
68
Server/Core/Models/Stories/Story_Declaration.cs
Normal file
@@ -0,0 +1,68 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using DotNetNuke.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Bring2mind.InMemoriam.Core.Models.Stories
|
||||
{
|
||||
|
||||
[TableName("vw_B2M_InMemoriam_Stories")]
|
||||
[PrimaryKey("StoryId", AutoIncrement = true)]
|
||||
[DataContract]
|
||||
[Scope("ModuleId")]
|
||||
public partial class Story : StoryBase
|
||||
{
|
||||
|
||||
#region .ctor
|
||||
public Story() : base()
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
[DataMember]
|
||||
public string CreatedByUser { get; set; }
|
||||
[DataMember]
|
||||
public string LastModifiedByUser { get; set; }
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
public StoryBase GetStoryBase()
|
||||
{
|
||||
StoryBase res = new StoryBase();
|
||||
res.StoryId = StoryId;
|
||||
res.ModuleId = ModuleId;
|
||||
res.Title = Title;
|
||||
res.Contents = Contents;
|
||||
res.StoryYear = StoryYear;
|
||||
res.StoryMonth = StoryMonth;
|
||||
res.StoryDay = StoryDay;
|
||||
res.Visibility = Visibility;
|
||||
res.CreatedByUserID = CreatedByUserID;
|
||||
res.CreatedOnDate = CreatedOnDate;
|
||||
res.LastModifiedByUserID = LastModifiedByUserID;
|
||||
res.LastModifiedOnDate = LastModifiedOnDate;
|
||||
return res;
|
||||
}
|
||||
public Story Clone()
|
||||
{
|
||||
Story res = new Story();
|
||||
res.StoryId = StoryId;
|
||||
res.ModuleId = ModuleId;
|
||||
res.Title = Title;
|
||||
res.Contents = Contents;
|
||||
res.StoryYear = StoryYear;
|
||||
res.StoryMonth = StoryMonth;
|
||||
res.StoryDay = StoryDay;
|
||||
res.Visibility = Visibility;
|
||||
res.CreatedByUser = CreatedByUser;
|
||||
res.LastModifiedByUser = LastModifiedByUser;
|
||||
res.CreatedByUserID = CreatedByUserID;
|
||||
res.CreatedOnDate = CreatedOnDate;
|
||||
res.LastModifiedByUserID = LastModifiedByUserID;
|
||||
res.LastModifiedOnDate = LastModifiedOnDate;
|
||||
return res;
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
48
Server/Core/Models/Stories/Story_Interfaces.cs
Normal file
48
Server/Core/Models/Stories/Story_Interfaces.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
using DotNetNuke.Common.Utilities;
|
||||
using DotNetNuke.Services.Tokens;
|
||||
|
||||
namespace Bring2mind.InMemoriam.Core.Models.Stories
|
||||
{
|
||||
|
||||
[Serializable(), XmlRoot("Story")]
|
||||
public partial class Story
|
||||
{
|
||||
|
||||
#region IHydratable
|
||||
public override void Fill(IDataReader dr)
|
||||
{
|
||||
base.Fill(dr);
|
||||
CreatedByUser = Convert.ToString(Null.SetNull(dr["CreatedByUser"], CreatedByUser));
|
||||
LastModifiedByUser = Convert.ToString(Null.SetNull(dr["LastModifiedByUser"], LastModifiedByUser));
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region IPropertyAccess
|
||||
public override string GetProperty(string strPropertyName, string strFormat, System.Globalization.CultureInfo formatProvider, DotNetNuke.Entities.Users.UserInfo accessingUser, DotNetNuke.Services.Tokens.Scope accessLevel, ref bool propertyNotFound)
|
||||
{
|
||||
switch (strPropertyName.ToLower()) {
|
||||
case "createdbyuser": // NVarChar
|
||||
if (CreatedByUser == null)
|
||||
{
|
||||
return "";
|
||||
};
|
||||
return PropertyAccess.FormatString(CreatedByUser, strFormat);
|
||||
case "lastmodifiedbyuser": // NVarChar
|
||||
if (LastModifiedByUser == null)
|
||||
{
|
||||
return "";
|
||||
};
|
||||
return PropertyAccess.FormatString(LastModifiedByUser, strFormat);
|
||||
default:
|
||||
return base.GetProperty(strPropertyName, strFormat, formatProvider, accessingUser, accessLevel, ref propertyNotFound);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
54
Server/Core/PicturesService.cs
Normal file
54
Server/Core/PicturesService.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
using Bring2mind.InMemoriam.Core.Models.Pictures;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Web;
|
||||
|
||||
namespace Bring2mind.InMemoriam.Core
|
||||
{
|
||||
public class PicturesService
|
||||
{
|
||||
public static PictureBase UploadPicture(string portalMapPath, int moduleId, HttpPostedFile file)
|
||||
{
|
||||
var newGuid = Guid.NewGuid();
|
||||
var filePath = Path.Combine(portalMapPath, Common.Globals.uploadPath, moduleId.ToString());
|
||||
if (!Directory.Exists(filePath))
|
||||
{
|
||||
Directory.CreateDirectory(filePath);
|
||||
}
|
||||
var fileName = Path.Combine(filePath, newGuid.ToString() + ".resources");
|
||||
file.SaveAs(fileName);
|
||||
|
||||
var res = new PictureBase
|
||||
{
|
||||
ImageIdentifier = newGuid,
|
||||
OriginalName = file.FileName,
|
||||
OriginalWidth = 0,
|
||||
OriginalHeight = 0
|
||||
};
|
||||
|
||||
// detect image size
|
||||
using (var img = System.Drawing.Image.FromFile(fileName))
|
||||
{
|
||||
res.OriginalHeight = img.Height;
|
||||
res.OriginalWidth = img.Width;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public static void DeletePicture(string portalMapPath, int moduleId, Guid fileId)
|
||||
{
|
||||
var imagesDir = new DirectoryInfo(Path.Combine(portalMapPath, Common.Globals.uploadPath, moduleId.ToString()));
|
||||
var files = imagesDir.GetFiles($"{fileId}*.jpg");
|
||||
foreach (var file in files)
|
||||
{
|
||||
file.Delete();
|
||||
}
|
||||
var originalFile = Path.Combine(portalMapPath, Common.Globals.uploadPath, fileId.ToString() + ".resources");
|
||||
if (File.Exists(originalFile))
|
||||
{
|
||||
File.Delete(originalFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
18
Server/Core/Repositories/MessageRepository.cs
Normal file
18
Server/Core/Repositories/MessageRepository.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using DotNetNuke.Common;
|
||||
using DotNetNuke.Data;
|
||||
using DotNetNuke.Framework;
|
||||
using Bring2mind.InMemoriam.Core.Models.Messages;
|
||||
|
||||
namespace Bring2mind.InMemoriam.Core.Repositories
|
||||
{
|
||||
public partial class MessageRepository : ServiceLocator<IMessageRepository, MessageRepository>, IMessageRepository
|
||||
{
|
||||
}
|
||||
public partial interface IMessageRepository
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
84
Server/Core/Repositories/MessageRepository_Core.cs
Normal file
84
Server/Core/Repositories/MessageRepository_Core.cs
Normal file
@@ -0,0 +1,84 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using DotNetNuke.Common;
|
||||
using DotNetNuke.Data;
|
||||
using DotNetNuke.Framework;
|
||||
using Bring2mind.InMemoriam.Core.Models.Messages;
|
||||
|
||||
namespace Bring2mind.InMemoriam.Core.Repositories
|
||||
{
|
||||
|
||||
public partial class MessageRepository : ServiceLocator<IMessageRepository, MessageRepository>, IMessageRepository
|
||||
{
|
||||
protected override Func<IMessageRepository> GetFactory()
|
||||
{
|
||||
return () => new MessageRepository();
|
||||
}
|
||||
public IEnumerable<Message> GetMessages(int moduleId)
|
||||
{
|
||||
using (var context = DataContext.Instance())
|
||||
{
|
||||
var rep = context.GetRepository<Message>();
|
||||
return rep.Get(moduleId);
|
||||
}
|
||||
}
|
||||
public Message GetMessage(int moduleId, int messageId)
|
||||
{
|
||||
using (var context = DataContext.Instance())
|
||||
{
|
||||
var rep = context.GetRepository<Message>();
|
||||
return rep.GetById(messageId, moduleId);
|
||||
}
|
||||
}
|
||||
public Message AddMessage(Message message)
|
||||
{
|
||||
Requires.NotNull(message);
|
||||
Requires.PropertyNotNegative(message, "ModuleId");
|
||||
using (var context = DataContext.Instance())
|
||||
{
|
||||
var rep = context.GetRepository<Message>();
|
||||
rep.Insert(message);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
public void DeleteMessage(Message message)
|
||||
{
|
||||
Requires.NotNull(message);
|
||||
Requires.PropertyNotNegative(message, "MessageId");
|
||||
using (var context = DataContext.Instance())
|
||||
{
|
||||
var rep = context.GetRepository<Message>();
|
||||
rep.Delete(message);
|
||||
}
|
||||
}
|
||||
public void DeleteMessage(int moduleId, int messageId)
|
||||
{
|
||||
using (var context = DataContext.Instance())
|
||||
{
|
||||
var rep = context.GetRepository<Message>();
|
||||
rep.Delete("WHERE ModuleId = @0 AND MessageId = @1", moduleId, messageId);
|
||||
}
|
||||
}
|
||||
public void UpdateMessage(Message message)
|
||||
{
|
||||
Requires.NotNull(message);
|
||||
Requires.PropertyNotNegative(message, "MessageId");
|
||||
using (var context = DataContext.Instance())
|
||||
{
|
||||
var rep = context.GetRepository<Message>();
|
||||
rep.Update(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
public partial interface IMessageRepository
|
||||
{
|
||||
IEnumerable<Message> GetMessages(int moduleId);
|
||||
Message GetMessage(int moduleId, int messageId);
|
||||
Message AddMessage(Message message);
|
||||
void DeleteMessage(Message message);
|
||||
void DeleteMessage(int moduleId, int messageId);
|
||||
void UpdateMessage(Message message);
|
||||
}
|
||||
}
|
||||
|
||||
26
Server/Core/Repositories/PictureRepository.cs
Normal file
26
Server/Core/Repositories/PictureRepository.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using Bring2mind.InMemoriam.Core.Models.Pictures;
|
||||
using DotNetNuke.Data;
|
||||
using DotNetNuke.Framework;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Bring2mind.InMemoriam.Core.Repositories
|
||||
{
|
||||
public partial class PictureRepository : ServiceLocator<IPictureRepository, PictureRepository>, IPictureRepository
|
||||
{
|
||||
public IEnumerable<Picture> GetPictures(int moduleId, int userId, string sortBy, string sortOrder)
|
||||
{
|
||||
using (var context = DataContext.Instance())
|
||||
{
|
||||
var rep = context.GetRepository<Picture>();
|
||||
var sql = userId == -1 ? "WHERE ModuleId=@0 AND Visibility=0" : "WHERE ModuleId=@0 AND (CreatedByUserID=@1 OR Visibility<2)";
|
||||
sql += " ORDER BY " + sortBy + " " + sortOrder;
|
||||
return rep.Find(sql, moduleId, userId);
|
||||
}
|
||||
}
|
||||
}
|
||||
public partial interface IPictureRepository
|
||||
{
|
||||
IEnumerable<Picture> GetPictures(int moduleId, int userId, string sortBy, string sortOrder);
|
||||
}
|
||||
}
|
||||
|
||||
90
Server/Core/Repositories/PictureRepository_Core.cs
Normal file
90
Server/Core/Repositories/PictureRepository_Core.cs
Normal file
@@ -0,0 +1,90 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using DotNetNuke.Common;
|
||||
using DotNetNuke.Data;
|
||||
using DotNetNuke.Framework;
|
||||
using Bring2mind.InMemoriam.Core.Models.Pictures;
|
||||
|
||||
namespace Bring2mind.InMemoriam.Core.Repositories
|
||||
{
|
||||
|
||||
public partial class PictureRepository : ServiceLocator<IPictureRepository, PictureRepository>, IPictureRepository
|
||||
{
|
||||
protected override Func<IPictureRepository> GetFactory()
|
||||
{
|
||||
return () => new PictureRepository();
|
||||
}
|
||||
public IEnumerable<Picture> GetPictures(int moduleId)
|
||||
{
|
||||
using (var context = DataContext.Instance())
|
||||
{
|
||||
var rep = context.GetRepository<Picture>();
|
||||
return rep.Get(moduleId);
|
||||
}
|
||||
}
|
||||
public Picture GetPicture(int moduleId, int pictureId)
|
||||
{
|
||||
using (var context = DataContext.Instance())
|
||||
{
|
||||
var rep = context.GetRepository<Picture>();
|
||||
return rep.GetById(pictureId, moduleId);
|
||||
}
|
||||
}
|
||||
public PictureBase AddPicture(PictureBase picture, int userId)
|
||||
{
|
||||
Requires.NotNull(picture);
|
||||
Requires.PropertyNotNegative(picture, "ModuleId");
|
||||
picture.CreatedByUserID = userId;
|
||||
picture.CreatedOnDate = DateTime.Now;
|
||||
picture.LastModifiedByUserID = userId;
|
||||
picture.LastModifiedOnDate = DateTime.Now;
|
||||
using (var context = DataContext.Instance())
|
||||
{
|
||||
var rep = context.GetRepository<PictureBase>();
|
||||
rep.Insert(picture);
|
||||
}
|
||||
return picture;
|
||||
}
|
||||
public void DeletePicture(PictureBase picture)
|
||||
{
|
||||
Requires.NotNull(picture);
|
||||
Requires.PropertyNotNegative(picture, "PictureId");
|
||||
using (var context = DataContext.Instance())
|
||||
{
|
||||
var rep = context.GetRepository<PictureBase>();
|
||||
rep.Delete(picture);
|
||||
}
|
||||
}
|
||||
public void DeletePicture(int moduleId, int pictureId)
|
||||
{
|
||||
using (var context = DataContext.Instance())
|
||||
{
|
||||
var rep = context.GetRepository<PictureBase>();
|
||||
rep.Delete("WHERE ModuleId = @0 AND PictureId = @1", moduleId, pictureId);
|
||||
}
|
||||
}
|
||||
public void UpdatePicture(PictureBase picture, int userId)
|
||||
{
|
||||
Requires.NotNull(picture);
|
||||
Requires.PropertyNotNegative(picture, "PictureId");
|
||||
picture.LastModifiedByUserID = userId;
|
||||
picture.LastModifiedOnDate = DateTime.Now;
|
||||
using (var context = DataContext.Instance())
|
||||
{
|
||||
var rep = context.GetRepository<PictureBase>();
|
||||
rep.Update(picture);
|
||||
}
|
||||
}
|
||||
}
|
||||
public partial interface IPictureRepository
|
||||
{
|
||||
IEnumerable<Picture> GetPictures(int moduleId);
|
||||
Picture GetPicture(int moduleId, int pictureId);
|
||||
PictureBase AddPicture(PictureBase picture, int userId);
|
||||
void DeletePicture(PictureBase picture);
|
||||
void DeletePicture(int moduleId, int pictureId);
|
||||
void UpdatePicture(PictureBase picture, int userId);
|
||||
}
|
||||
}
|
||||
|
||||
18
Server/Core/Repositories/StoryRepository.cs
Normal file
18
Server/Core/Repositories/StoryRepository.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using DotNetNuke.Common;
|
||||
using DotNetNuke.Data;
|
||||
using DotNetNuke.Framework;
|
||||
using Bring2mind.InMemoriam.Core.Models.Stories;
|
||||
|
||||
namespace Bring2mind.InMemoriam.Core.Repositories
|
||||
{
|
||||
public partial class StoryRepository : ServiceLocator<IStoryRepository, StoryRepository>, IStoryRepository
|
||||
{
|
||||
}
|
||||
public partial interface IStoryRepository
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
90
Server/Core/Repositories/StoryRepository_Core.cs
Normal file
90
Server/Core/Repositories/StoryRepository_Core.cs
Normal file
@@ -0,0 +1,90 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using DotNetNuke.Common;
|
||||
using DotNetNuke.Data;
|
||||
using DotNetNuke.Framework;
|
||||
using Bring2mind.InMemoriam.Core.Models.Stories;
|
||||
|
||||
namespace Bring2mind.InMemoriam.Core.Repositories
|
||||
{
|
||||
|
||||
public partial class StoryRepository : ServiceLocator<IStoryRepository, StoryRepository>, IStoryRepository
|
||||
{
|
||||
protected override Func<IStoryRepository> GetFactory()
|
||||
{
|
||||
return () => new StoryRepository();
|
||||
}
|
||||
public IEnumerable<Story> GetStories(int moduleId)
|
||||
{
|
||||
using (var context = DataContext.Instance())
|
||||
{
|
||||
var rep = context.GetRepository<Story>();
|
||||
return rep.Get(moduleId);
|
||||
}
|
||||
}
|
||||
public Story GetStory(int moduleId, int storyId)
|
||||
{
|
||||
using (var context = DataContext.Instance())
|
||||
{
|
||||
var rep = context.GetRepository<Story>();
|
||||
return rep.GetById(storyId, moduleId);
|
||||
}
|
||||
}
|
||||
public StoryBase AddStory(StoryBase story, int userId)
|
||||
{
|
||||
Requires.NotNull(story);
|
||||
Requires.PropertyNotNegative(story, "ModuleId");
|
||||
story.CreatedByUserID = userId;
|
||||
story.CreatedOnDate = DateTime.Now;
|
||||
story.LastModifiedByUserID = userId;
|
||||
story.LastModifiedOnDate = DateTime.Now;
|
||||
using (var context = DataContext.Instance())
|
||||
{
|
||||
var rep = context.GetRepository<StoryBase>();
|
||||
rep.Insert(story);
|
||||
}
|
||||
return story;
|
||||
}
|
||||
public void DeleteStory(StoryBase story)
|
||||
{
|
||||
Requires.NotNull(story);
|
||||
Requires.PropertyNotNegative(story, "StoryId");
|
||||
using (var context = DataContext.Instance())
|
||||
{
|
||||
var rep = context.GetRepository<StoryBase>();
|
||||
rep.Delete(story);
|
||||
}
|
||||
}
|
||||
public void DeleteStory(int moduleId, int storyId)
|
||||
{
|
||||
using (var context = DataContext.Instance())
|
||||
{
|
||||
var rep = context.GetRepository<StoryBase>();
|
||||
rep.Delete("WHERE ModuleId = @0 AND StoryId = @1", moduleId, storyId);
|
||||
}
|
||||
}
|
||||
public void UpdateStory(StoryBase story, int userId)
|
||||
{
|
||||
Requires.NotNull(story);
|
||||
Requires.PropertyNotNegative(story, "StoryId");
|
||||
story.LastModifiedByUserID = userId;
|
||||
story.LastModifiedOnDate = DateTime.Now;
|
||||
using (var context = DataContext.Instance())
|
||||
{
|
||||
var rep = context.GetRepository<StoryBase>();
|
||||
rep.Update(story);
|
||||
}
|
||||
}
|
||||
}
|
||||
public partial interface IStoryRepository
|
||||
{
|
||||
IEnumerable<Story> GetStories(int moduleId);
|
||||
Story GetStory(int moduleId, int storyId);
|
||||
StoryBase AddStory(StoryBase story, int userId);
|
||||
void DeleteStory(StoryBase story);
|
||||
void DeleteStory(int moduleId, int storyId);
|
||||
void UpdateStory(StoryBase story, int userId);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user