Initial commit
This commit is contained in:
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
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user