Add Edit Mode for Administration

This commit is contained in:
Shaun Walker 2019-09-04 11:07:48 -04:00
parent 1e4c07889b
commit e1cc1ce973
14 changed files with 253 additions and 192 deletions

View File

@ -11,7 +11,7 @@
<ModuleMessage Message="@message" /> <ModuleMessage Message="@message" />
@if (profiles != null) @if (PageState.User != null && profiles != null)
{ {
<table class="table table-borderless"> <table class="table table-borderless">
<tr> <tr>
@ -55,6 +55,7 @@
</table> </table>
<button type="button" class="btn btn-primary" @onclick="@SaveUser">Save</button> <button type="button" class="btn btn-primary" @onclick="@SaveUser">Save</button>
<button type="button" class="btn btn-secondary" @onclick="@Cancel">Cancel</button> <button type="button" class="btn btn-secondary" @onclick="@Cancel">Cancel</button>
<br /><br />
} }
@code { @code {
@ -71,10 +72,17 @@
{ {
try try
{ {
displayname = PageState.User.DisplayName; if (PageState.User != null)
email = PageState.User.Email; {
profiles = await ProfileService.GetProfilesAsync(ModuleState.SiteId); displayname = PageState.User.DisplayName;
settings = await SettingService.GetUserSettingsAsync(PageState.User.UserId); email = PageState.User.Email;
profiles = await ProfileService.GetProfilesAsync(ModuleState.SiteId);
settings = await SettingService.GetUserSettingsAsync(PageState.User.UserId);
}
else
{
message = "Current User Is Not Logged In";
}
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -89,23 +97,30 @@
private async Task SaveUser() private async Task SaveUser()
{ {
User user = PageState.User; try
user.DisplayName = displayname;
user.Email = email;
await UserService.UpdateUserAsync(user);
foreach (Profile profile in profiles)
{ {
string value = SettingService.GetSetting(settings, profile.Name, ""); User user = PageState.User;
await SettingService.UpdateUserSettingsAsync(settings, PageState.User.UserId, profile.Name, value); user.DisplayName = displayname;
} user.Email = email;
await UserService.UpdateUserAsync(user);
UriHelper.NavigateTo(""); foreach (Profile profile in profiles)
{
string value = SettingService.GetSetting(settings, profile.Name, "");
await SettingService.UpdateUserSettingsAsync(settings, PageState.User.UserId, profile.Name, value);
}
UriHelper.NavigateTo("");
}
catch (Exception ex)
{
message = ex.Message;
}
} }
private void Cancel() private void Cancel()
{ {
UriHelper.NavigateTo(NavigateUrl("")); // navigate to home UriHelper.NavigateTo(NavigateUrl(""));
} }
private void ProfileChanged(UIChangeEventArgs e, string SettingName) private void ProfileChanged(UIChangeEventArgs e, string SettingName)

View File

@ -34,7 +34,7 @@
string style = ""; string style = "";
bool authorized = false; bool authorized = false;
protected override void OnInitialized() protected override void OnParametersSet()
{ {
text = Action; text = Action;
if (!String.IsNullOrEmpty(Text)) if (!String.IsNullOrEmpty(Text))
@ -49,39 +49,42 @@
if (!string.IsNullOrEmpty(Class)) if (!string.IsNullOrEmpty(Class))
{ {
classname = Class; classname = Class;
} }
if (!string.IsNullOrEmpty(Style)) if (!string.IsNullOrEmpty(Style))
{ {
style = Style; style = Style;
} }
url = EditUrl(Action, parameters); url = EditUrl(Action, parameters);
string typename = ModuleState.ModuleType.Replace(Utilities.GetTypeNameClass(ModuleState.ModuleType) + ",", Action + ","); if (PageState.EditMode)
Type moduleType = Type.GetType(typename);
if (moduleType != null)
{ {
var moduleobject = Activator.CreateInstance(moduleType); string typename = ModuleState.ModuleType.Replace(Utilities.GetTypeNameClass(ModuleState.ModuleType) + ",", Action + ",");
SecurityAccessLevel SecurityAccessLevel = (SecurityAccessLevel)moduleType.GetProperty("SecurityAccessLevel").GetValue(moduleobject, null); Type moduleType = Type.GetType(typename);
switch (SecurityAccessLevel) if (moduleType != null)
{ {
case SecurityAccessLevel.Anonymous: var moduleobject = Activator.CreateInstance(moduleType);
authorized = true; SecurityAccessLevel SecurityAccessLevel = (SecurityAccessLevel)moduleType.GetProperty("SecurityAccessLevel").GetValue(moduleobject, null);
break; switch (SecurityAccessLevel)
case SecurityAccessLevel.View: {
authorized = UserSecurity.IsAuthorized(PageState.User, "View", ModuleState.Permissions); case SecurityAccessLevel.Anonymous:
break; authorized = true;
case SecurityAccessLevel.Edit: break;
authorized = UserSecurity.IsAuthorized(PageState.User, "Edit", ModuleState.Permissions); case SecurityAccessLevel.View:
break; authorized = UserSecurity.IsAuthorized(PageState.User, "View", ModuleState.Permissions);
case SecurityAccessLevel.Admin: break;
authorized = UserSecurity.IsAuthorized(PageState.User, Constants.AdminRole); case SecurityAccessLevel.Edit:
break; authorized = UserSecurity.IsAuthorized(PageState.User, "Edit", ModuleState.Permissions);
case SecurityAccessLevel.Host: break;
authorized = UserSecurity.IsAuthorized(PageState.User, Constants.HostRole); case SecurityAccessLevel.Admin:
break; authorized = UserSecurity.IsAuthorized(PageState.User, Constants.AdminRole);
break;
case SecurityAccessLevel.Host:
authorized = UserSecurity.IsAuthorized(PageState.User, Constants.HostRole);
break;
}
} }
} }
} }

View File

@ -18,7 +18,7 @@
RenderFragment DynamicComponent { get; set; } RenderFragment DynamicComponent { get; set; }
protected override void OnInitialized() protected override void OnParametersSet()
{ {
DynamicComponent = builder => DynamicComponent = builder =>
{ {

View File

@ -13,7 +13,7 @@
RenderFragment DynamicComponent { get; set; } RenderFragment DynamicComponent { get; set; }
protected override void OnInitialized() protected override void OnParametersSet()
{ {
DynamicComponent = builder => DynamicComponent = builder =>
{ {

View File

@ -19,6 +19,7 @@ namespace Oqtane.Shared
public Dictionary<string, string> QueryString { get; set; } public Dictionary<string, string> QueryString { get; set; }
public int ModuleId { get; set; } public int ModuleId { get; set; }
public string Control { get; set; } public string Control { get; set; }
public bool EditMode { get; set; }
public int Reload { get; set; } public int Reload { get; set; }
} }
} }

View File

@ -26,9 +26,9 @@
string paneadminborder = ""; string paneadminborder = "";
string panetitle = ""; string panetitle = "";
protected override void OnInitialized() protected override void OnParametersSet()
{ {
if (UserSecurity.IsAuthorized(PageState.User, "Edit", PageState.Page.Permissions) && Name != Constants.AdminPane) if (PageState.EditMode && UserSecurity.IsAuthorized(PageState.User, "Edit", PageState.Page.Permissions) && Name != Constants.AdminPane)
{ {
paneadminborder = "pane-admin-border"; paneadminborder = "pane-admin-border";
panetitle = "<div class=\"pane-admin-title\">" + Name + " Pane</div>"; panetitle = "<div class=\"pane-admin-title\">" + Name + " Pane</div>";

View File

@ -9,7 +9,7 @@
RenderFragment DynamicComponent { get; set; } RenderFragment DynamicComponent { get; set; }
protected override void OnInitialized() protected override void OnParametersSet()
{ {
DynamicComponent = builder => DynamicComponent = builder =>
{ {

View File

@ -86,11 +86,13 @@
List<Module> modules; List<Module> modules;
int moduleid = -1; int moduleid = -1;
string control = ""; string control = "";
bool editmode = false;
int reload = 0; int reload = 0;
if (PageState != null) if (PageState != null)
{ {
reload = PageState.Reload; reload = PageState.Reload;
editmode = PageState.EditMode;
} }
if (PageState == null || reload == Constants.ReloadApplication) if (PageState == null || reload == Constants.ReloadApplication)
@ -188,6 +190,7 @@
{ {
page = pages.Where(item => item.Path == path).FirstOrDefault(); page = pages.Where(item => item.Path == path).FirstOrDefault();
reload = Constants.ReloadPage; reload = Constants.ReloadPage;
editmode = false;
} }
user = null; user = null;
@ -238,6 +241,7 @@
modules = PageState.Modules; modules = PageState.Modules;
} }
pagestate.Modules = modules; pagestate.Modules = modules;
pagestate.EditMode = editmode;
pagestate.Reload = 0; pagestate.Reload = 0;
OnStateChange?.Invoke(pagestate); OnStateChange?.Invoke(pagestate);

View File

@ -8,7 +8,7 @@
RenderFragment DynamicComponent { get; set; } RenderFragment DynamicComponent { get; set; }
protected override void OnInitialized() protected override void OnParametersSet()
{ {
DynamicComponent = builder => DynamicComponent = builder =>
{ {

View File

@ -12,67 +12,83 @@
@inject IModuleService ModuleService @inject IModuleService ModuleService
@inject IPageModuleService PageModuleService @inject IPageModuleService PageModuleService
<div id="actions" class="overlay"> @if (UserSecurity.IsAuthorized(PageState.User, "Edit", PageState.Page.Permissions))
<a href="javascript:void(0)" class="closebtn" onclick="closeActions()">x</a> {
<div class="overlay-content"> <div id="actions" class="overlay">
<ul class="nav flex-column"> <a href="javascript:void(0)" class="closebtn" onclick="closeActions()">x</a>
<li class="nav-item px-3"> <div class="overlay-content">
<NavLink class="btn btn-primary" href="@PageUrl("Add")" Match="NavLinkMatch.All">Add Page</NavLink> <ul class="nav flex-column">
</li> <li class="nav-item px-3">
<li class="nav-item px-3"> <NavLink class="btn btn-primary" href="@PageUrl("Add")" Match="NavLinkMatch.All">Add Page</NavLink>
<NavLink class="btn btn-primary" href="@PageUrl("Edit")" Match="NavLinkMatch.All">Edit Page</NavLink> </li>
</li> <li class="nav-item px-3">
<li class="nav-item px-3"> <NavLink class="btn btn-primary" href="@PageUrl("Edit")" Match="NavLinkMatch.All">Edit Page</NavLink>
<NavLink class="btn btn-primary" href="@PageUrl("Delete")" Match="NavLinkMatch.All">Delete Page</NavLink> </li>
</li> <li class="nav-item px-3">
</ul> <NavLink class="btn btn-primary" href="@PageUrl("Delete")" Match="NavLinkMatch.All">Delete Page</NavLink>
<hr style="width: 100%; color: white; height: 1px; background-color:white;" /> </li>
<div class="container"> </ul>
<div class="form-group"> <hr style="width: 100%; color: white; height: 1px; background-color:white;" />
<label for="Module" class="control-label" style="color: white !important;">Module: </label> <div class="container">
@if (moduledefinitions != null) <div class="form-group">
{ <label for="Module" class="control-label" style="color: white !important;">Module: </label>
<select class="form-control" @bind="@moduledefinitionname"> @if (moduledefinitions != null)
<option value="">&lt;Select Module&gt;</option> {
@foreach (var moduledefinition in moduledefinitions) <select class="form-control" @bind="@moduledefinitionname">
<option value="">&lt;Select Module&gt;</option>
@foreach (var moduledefinition in moduledefinitions)
{
<option value="@moduledefinition.ModuleDefinitionName">@moduledefinition.Name</option>
}
</select>
}
</div>
<div class="form-group">
<label for="Pane" class="control-label" style="color: white !important;">Pane: </label>
<select class="form-control" @bind="@pane">
<option value="">&lt;Select Pane&gt;</option>
@foreach (string pane in PageState.Page.Panes.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries))
{ {
<option value="@moduledefinition.ModuleDefinitionName">@moduledefinition.Name</option> <option value="@pane">@pane Pane</option>
} }
</select> </select>
} </div>
<div class="form-group">
<label for="Title" class="control-label" style="color: white !important;">Title: </label>
<input type="text" name="Title" class="form-control" @bind="@title" />
</div>
<div class="form-group">
<label for="Container" class="control-label" style="color: white !important;">Container: </label>
<select class="form-control" @bind="@containertype">
<option value="">&lt;Select Container&gt;</option>
@foreach (KeyValuePair<string, string> container in containers)
{
<option value="@container.Key">@container.Value</option>
}
</select>
</div>
<button type="button" class="btn btn-primary" @onclick="@AddModule">Add Module To Page</button>
</div> </div>
<div class="form-group">
<label for="Pane" class="control-label" style="color: white !important;">Pane: </label>
<select class="form-control" @bind="@pane">
<option value="">&lt;Select Pane&gt;</option>
@foreach (string pane in PageState.Page.Panes.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries))
{
<option value="@pane">@pane Pane</option>
}
</select>
</div>
<div class="form-group">
<label for="Title" class="control-label" style="color: white !important;">Title: </label>
<input type="text" name="Title" class="form-control" @bind="@title" />
</div>
<div class="form-group">
<label for="Container" class="control-label" style="color: white !important;">Container: </label>
<select class="form-control" @bind="@containertype">
<option value="">&lt;Select Container&gt;</option>
@foreach (KeyValuePair<string, string> container in containers)
{
<option value="@container.Key">@container.Value</option>
}
</select>
</div>
<button type="button" class="btn btn-primary" @onclick="@AddModule">Add Module To Page</button>
</div> </div>
</div> </div>
</div>
<span class="oi oi-menu" style="@display" onclick="openActions()"></span> @if (PageState.EditMode)
{
<button type="button" class="btn btn-outline-primary active" data-toggle="button" aria-pressed="true" autocomplete="off" @onclick="EditMode">
<span class="oi oi-pencil"></span>
</button>
}
else
{
<button type="button" class="btn btn-outline-primary" data-toggle="button" aria-pressed="false" autocomplete="off" @onclick="EditMode">
<span class="oi oi-pencil"></span>
</button>
}
<span class="oi oi-menu" onclick="openActions()"></span>
}
@code { @code {
string display = "display: none";
List<ModuleDefinition> moduledefinitions; List<ModuleDefinition> moduledefinitions;
Dictionary<string, string> containers = new Dictionary<string, string>(); Dictionary<string, string> containers = new Dictionary<string, string>();
int pagemanagementmoduleid = -1; int pagemanagementmoduleid = -1;
@ -83,45 +99,47 @@
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
moduledefinitions = PageState.ModuleDefinitions;
containers = ThemeService.GetContainerTypes(PageState.Themes);
List<Module> modules = await ModuleService.GetModulesAsync(PageState.Site.SiteId, Constants.PageManagementModule);
if (modules.Count > 0)
{
pagemanagementmoduleid = modules.FirstOrDefault().ModuleId;
}
if (UserSecurity.IsAuthorized(PageState.User, "Edit", PageState.Page.Permissions)) if (UserSecurity.IsAuthorized(PageState.User, "Edit", PageState.Page.Permissions))
{ {
display = "display: inline"; moduledefinitions = PageState.ModuleDefinitions;
containers = ThemeService.GetContainerTypes(PageState.Themes);
List<Module> modules = await ModuleService.GetModulesAsync(PageState.Site.SiteId, Constants.PageManagementModule);
if (modules.Count > 0)
{
pagemanagementmoduleid = modules.FirstOrDefault().ModuleId;
}
} }
} }
private async Task AddModule() private async Task AddModule()
{ {
Module module = new Module(); if (UserSecurity.IsAuthorized(PageState.User, "Edit", PageState.Page.Permissions))
module.SiteId = PageState.Site.SiteId;
module.ModuleDefinitionName = moduledefinitionname;
module.Permissions = PageState.Page.Permissions;
await ModuleService.AddModuleAsync(module);
List<Module> modules = await ModuleService.GetModulesAsync(PageState.Site.SiteId, moduledefinitionname);
int ModuleId = modules.LastOrDefault().ModuleId;
PageModule pagemodule = new PageModule();
pagemodule.PageId = PageState.Page.PageId;
pagemodule.ModuleId = ModuleId;
if (title == "")
{ {
title = moduledefinitions.Where(item => item.ModuleDefinitionName == moduledefinitionname).FirstOrDefault().Name; Module module = new Module();
} module.SiteId = PageState.Site.SiteId;
pagemodule.Title = title; module.ModuleDefinitionName = moduledefinitionname;
pagemodule.Pane = pane; module.Permissions = PageState.Page.Permissions;
pagemodule.Order = 0; await ModuleService.AddModuleAsync(module);
pagemodule.ContainerType = containertype;
await PageModuleService.AddPageModuleAsync(pagemodule);
PageState.Reload = Constants.ReloadPage; List<Module> modules = await ModuleService.GetModulesAsync(PageState.Site.SiteId, moduledefinitionname);
UriHelper.NavigateTo(NavigateUrl()); int ModuleId = modules.LastOrDefault().ModuleId;
PageModule pagemodule = new PageModule();
pagemodule.PageId = PageState.Page.PageId;
pagemodule.ModuleId = ModuleId;
if (title == "")
{
title = moduledefinitions.Where(item => item.ModuleDefinitionName == moduledefinitionname).FirstOrDefault().Name;
}
pagemodule.Title = title;
pagemodule.Pane = pane;
pagemodule.Order = 0;
pagemodule.ContainerType = containertype;
await PageModuleService.AddPageModuleAsync(pagemodule);
PageState.Reload = Constants.ReloadPage;
UriHelper.NavigateTo(NavigateUrl());
}
} }
private string PageUrl(string action) private string PageUrl(string action)
@ -144,4 +162,21 @@
} }
return url; return url;
} }
private void EditMode()
{
if (UserSecurity.IsAuthorized(PageState.User, "Edit", PageState.Page.Permissions))
{
if (PageState.EditMode)
{
PageState.EditMode = false;
}
else
{
PageState.EditMode = true;
}
PageState.Reload = Constants.ReloadPage;
UriHelper.NavigateTo(NavigateUrl(PageState.Page.Path, "edit=" + PageState.EditMode.ToString().ToLower()));
}
}
} }

View File

@ -8,75 +8,78 @@
@inject IUserService UserService @inject IUserService UserService
@inject IPageModuleService PageModuleService @inject IPageModuleService PageModuleService
<div class="dropdown" style="@display"> @if (PageState.EditMode && UserSecurity.IsAuthorized(PageState.User, "Edit", ModuleState.Permissions))
<button type="button" class="btn dropdown-toggle" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></button> {
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton"> <div class="dropdown">
@foreach (var action in actions) <button type="button" class="btn dropdown-toggle" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></button>
{ <div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a class="dropdown-item" @onclick="@(async () => await ModuleAction(action.Action))">@action.Name</a> @foreach (var action in actions)
} {
<a class="dropdown-item" @onclick="@(async () => await ModuleAction(action.Action))">@action.Name</a>
}
</div>
</div> </div>
</div> }
@code { @code {
string display = "display: none";
List<ActionViewModel> actions; List<ActionViewModel> actions;
protected override void OnInitialized() protected override void OnParametersSet()
{ {
actions = new List<ActionViewModel>(); if (PageState.EditMode && UserSecurity.IsAuthorized(PageState.User, "Edit", ModuleState.Permissions))
if (ModuleState.PaneModuleIndex > 0)
{ {
actions.Add(new ActionViewModel { Action = "up", Name = "Move Up" }); actions = new List<ActionViewModel>();
} if (ModuleState.PaneModuleIndex > 0)
if (ModuleState.PaneModuleIndex < (ModuleState.PaneModuleCount - 1))
{
actions.Add(new ActionViewModel { Action = "down", Name = "Move Down" });
}
foreach (string pane in PageState.Page.Panes.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries))
{
if (pane != ModuleState.Pane)
{ {
actions.Add(new ActionViewModel { Action = pane, Name = "Move To " + pane + " Pane" }); actions.Add(new ActionViewModel { Action = "up", Name = "Move Up" });
} }
} if (ModuleState.PaneModuleIndex < (ModuleState.PaneModuleCount - 1))
actions.Add(new ActionViewModel { Action = "settings", Name = "Settings" }); {
actions.Add(new ActionViewModel { Action = "delete", Name = "Delete" }); actions.Add(new ActionViewModel { Action = "down", Name = "Move Down" });
}
if (UserSecurity.IsAuthorized(PageState.User, "Edit", ModuleState.Permissions)) foreach (string pane in PageState.Page.Panes.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries))
{ {
display = "display: inline"; if (pane != ModuleState.Pane)
{
actions.Add(new ActionViewModel { Action = pane, Name = "Move To " + pane + " Pane" });
}
}
actions.Add(new ActionViewModel { Action = "settings", Name = "Settings" });
actions.Add(new ActionViewModel { Action = "delete", Name = "Delete" });
} }
} }
protected async Task ModuleAction(string action) protected async Task ModuleAction(string action)
{ {
PageModule pagemodule = await PageModuleService.GetPageModuleAsync(ModuleState.PageModuleId); if (PageState.EditMode && UserSecurity.IsAuthorized(PageState.User, "Edit", ModuleState.Permissions))
string url = NavigateUrl();
switch (action)
{ {
case "up": PageModule pagemodule = await PageModuleService.GetPageModuleAsync(ModuleState.PageModuleId);
pagemodule.Order += -1;
await PageModuleService.UpdatePageModuleAsync(pagemodule); string url = NavigateUrl();
break; switch (action)
case "down": {
pagemodule.Order += 1; case "up":
await PageModuleService.UpdatePageModuleAsync(pagemodule); pagemodule.Order += -1;
break; await PageModuleService.UpdatePageModuleAsync(pagemodule);
case "settings": break;
url = EditUrl(pagemodule.ModuleId, "Settings"); case "down":
break; pagemodule.Order += 1;
case "delete": await PageModuleService.UpdatePageModuleAsync(pagemodule);
await PageModuleService.DeletePageModuleAsync(pagemodule.PageModuleId); break;
break; case "settings":
default: // move to pane url = EditUrl(pagemodule.ModuleId, "Settings");
pagemodule.Pane = action; break;
await PageModuleService.UpdatePageModuleAsync(pagemodule); case "delete":
break; await PageModuleService.DeletePageModuleAsync(pagemodule.PageModuleId);
break;
default: // move to pane
pagemodule.Pane = action;
await PageModuleService.UpdatePageModuleAsync(pagemodule);
break;
}
PageState.Reload = Constants.ReloadPage;
UriHelper.NavigateTo(url);
} }
PageState.Reload = Constants.ReloadPage;
UriHelper.NavigateTo(url);
} }
public class ActionViewModel public class ActionViewModel

View File

@ -21,7 +21,7 @@ namespace Oqtane.Repository
public IEnumerable<Profile> GetProfiles(int SiteId) public IEnumerable<Profile> GetProfiles(int SiteId)
{ {
return db.Profile.Where(item => item.SiteId == SiteId); return db.Profile.Where(item => item.SiteId == SiteId || item.SiteId == null);
} }
public Profile AddProfile(Profile Profile) public Profile AddProfile(Profile Profile)

View File

@ -383,28 +383,28 @@ GO
SET IDENTITY_INSERT [dbo].[Profile] ON SET IDENTITY_INSERT [dbo].[Profile] ON
GO GO
INSERT [dbo].[Profile]([ProfileId], [SiteId], [Name], [Title], [Description], [Category], [ViewOrder], [MaxLength], [DefaultValue], [IsRequired], [IsPrivate], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) INSERT [dbo].[Profile]([ProfileId], [SiteId], [Name], [Title], [Description], [Category], [ViewOrder], [MaxLength], [DefaultValue], [IsRequired], [IsPrivate], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
VALUES (1, 1, 'FirstName', 'First Name', 'Your First Or Given Name', 'Name', 1, 50, '', 1, 0, '', getdate(), '', getdate()) VALUES (1, null, 'FirstName', 'First Name', 'Your First Or Given Name', 'Name', 1, 50, '', 1, 0, '', getdate(), '', getdate())
GO GO
INSERT [dbo].[Profile]([ProfileId], [SiteId], [Name], [Title], [Description], [Category], [ViewOrder], [MaxLength], [DefaultValue], [IsRequired], [IsPrivate], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) INSERT [dbo].[Profile]([ProfileId], [SiteId], [Name], [Title], [Description], [Category], [ViewOrder], [MaxLength], [DefaultValue], [IsRequired], [IsPrivate], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
VALUES (2, 1, 'LastName', 'Last Name', 'Your Last Or family Name', 'Name', 2, 50, '', 1, 0, '', getdate(), '', getdate()) VALUES (2, null, 'LastName', 'Last Name', 'Your Last Or family Name', 'Name', 2, 50, '', 1, 0, '', getdate(), '', getdate())
GO GO
INSERT [dbo].[Profile]([ProfileId], [SiteId], [Name], [Title], [Description], [Category], [ViewOrder], [MaxLength], [DefaultValue], [IsRequired], [IsPrivate], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) INSERT [dbo].[Profile]([ProfileId], [SiteId], [Name], [Title], [Description], [Category], [ViewOrder], [MaxLength], [DefaultValue], [IsRequired], [IsPrivate], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
VALUES (3, 1, 'Street', 'Street', 'Street Or Building Address', 'Address', 3, 50, '', 1, 0, '', getdate(), '', getdate()) VALUES (3, null, 'Street', 'Street', 'Street Or Building Address', 'Address', 3, 50, '', 1, 0, '', getdate(), '', getdate())
GO GO
INSERT [dbo].[Profile]([ProfileId], [SiteId], [Name], [Title], [Description], [Category], [ViewOrder], [MaxLength], [DefaultValue], [IsRequired], [IsPrivate], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) INSERT [dbo].[Profile]([ProfileId], [SiteId], [Name], [Title], [Description], [Category], [ViewOrder], [MaxLength], [DefaultValue], [IsRequired], [IsPrivate], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
VALUES (4, 1, 'City', 'City', 'City', 'Address', 4, 50, '', 1, 0, '', getdate(), '', getdate()) VALUES (4, null, 'City', 'City', 'City', 'Address', 4, 50, '', 1, 0, '', getdate(), '', getdate())
GO GO
INSERT [dbo].[Profile]([ProfileId], [SiteId], [Name], [Title], [Description], [Category], [ViewOrder], [MaxLength], [DefaultValue], [IsRequired], [IsPrivate], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) INSERT [dbo].[Profile]([ProfileId], [SiteId], [Name], [Title], [Description], [Category], [ViewOrder], [MaxLength], [DefaultValue], [IsRequired], [IsPrivate], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
VALUES (5, 1, 'Region', 'Region', 'State Or Province', 'Address', 5, 50, '', 1, 0, '', getdate(), '', getdate()) VALUES (5, null, 'Region', 'Region', 'State Or Province', 'Address', 5, 50, '', 1, 0, '', getdate(), '', getdate())
GO GO
INSERT [dbo].[Profile]([ProfileId], [SiteId], [Name], [Title], [Description], [Category], [ViewOrder], [MaxLength], [DefaultValue], [IsRequired], [IsPrivate], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) INSERT [dbo].[Profile]([ProfileId], [SiteId], [Name], [Title], [Description], [Category], [ViewOrder], [MaxLength], [DefaultValue], [IsRequired], [IsPrivate], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
VALUES (6, 1, 'Country', 'Country', 'Country', 'Address', 6, 50, '', 1, 0, '', getdate(), '', getdate()) VALUES (6, null, 'Country', 'Country', 'Country', 'Address', 6, 50, '', 1, 0, '', getdate(), '', getdate())
GO GO
INSERT [dbo].[Profile]([ProfileId], [SiteId], [Name], [Title], [Description], [Category], [ViewOrder], [MaxLength], [DefaultValue], [IsRequired], [IsPrivate], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) INSERT [dbo].[Profile]([ProfileId], [SiteId], [Name], [Title], [Description], [Category], [ViewOrder], [MaxLength], [DefaultValue], [IsRequired], [IsPrivate], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
VALUES (7, 1, 'PostalCode', 'Postal Code', 'Postal Code Or Zip Code', 'Address', 7, 50, '', 1, 0, '', getdate(), '', getdate()) VALUES (7, null, 'PostalCode', 'Postal Code', 'Postal Code Or Zip Code', 'Address', 7, 50, '', 1, 0, '', getdate(), '', getdate())
GO GO
INSERT [dbo].[Profile]([ProfileId], [SiteId], [Name], [Title], [Description], [Category], [ViewOrder], [MaxLength], [DefaultValue], [IsRequired], [IsPrivate], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) INSERT [dbo].[Profile]([ProfileId], [SiteId], [Name], [Title], [Description], [Category], [ViewOrder], [MaxLength], [DefaultValue], [IsRequired], [IsPrivate], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
VALUES (8, 1, 'Phone', 'Phone Number', 'Phone Number', 'Contact', 8, 50, '', 1, 0, '', getdate(), '', getdate()) VALUES (8, null, 'Phone', 'Phone Number', 'Phone Number', 'Contact', 8, 50, '', 1, 0, '', getdate(), '', getdate())
GO GO
SET IDENTITY_INSERT [dbo].[Profile] OFF SET IDENTITY_INSERT [dbo].[Profile] OFF
GO GO

View File

@ -5,7 +5,7 @@ namespace Oqtane.Models
public class Profile : IAuditable public class Profile : IAuditable
{ {
public int ProfileId { get; set; } public int ProfileId { get; set; }
public int SiteId { get; set; } public int? SiteId { get; set; }
public string Name { get; set; } public string Name { get; set; }
public string Title { get; set; } public string Title { get; set; }
public string Description { get; set; } public string Description { get; set; }