Naming conventions
This commit is contained in:
		@ -70,7 +70,9 @@
 | 
			
		||||
    string _permissions;
 | 
			
		||||
    string _pageId;
 | 
			
		||||
 | 
			
		||||
#pragma warning disable 649
 | 
			
		||||
    PermissionGrid _permissionGrid;
 | 
			
		||||
#pragma warning restore 649
 | 
			
		||||
 | 
			
		||||
    RenderFragment DynamicComponent { get; set; }
 | 
			
		||||
    object _settings;
 | 
			
		||||
 | 
			
		||||
@ -24,18 +24,18 @@
 | 
			
		||||
@code {
 | 
			
		||||
    public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Admin; } }
 | 
			
		||||
 | 
			
		||||
    private async Task DeletePage(Page Page)
 | 
			
		||||
    private async Task DeletePage(Page page)
 | 
			
		||||
    {
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            Page.IsDeleted = true;
 | 
			
		||||
            await PageService.UpdatePageAsync(Page);
 | 
			
		||||
            await logger.LogInformation("Page Deleted {Page}", Page);
 | 
			
		||||
            page.IsDeleted = true;
 | 
			
		||||
            await PageService.UpdatePageAsync(page);
 | 
			
		||||
            await logger.LogInformation("Page Deleted {Page}", page);
 | 
			
		||||
            NavigationManager.NavigateTo(NavigateUrl("admin/pages"));
 | 
			
		||||
        }
 | 
			
		||||
        catch (Exception ex)
 | 
			
		||||
        {
 | 
			
		||||
            await logger.LogError(ex, "Error Deleting Page {Page} {Error}", Page, ex.Message);
 | 
			
		||||
            await logger.LogError(ex, "Error Deleting Page {Page} {Error}", page, ex.Message);
 | 
			
		||||
            AddModuleMessage("Error Deleting Page", MessageType.Error);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -9,7 +9,7 @@
 | 
			
		||||
                <label  class="control-label">Name: </label>
 | 
			
		||||
            </td>
 | 
			
		||||
            <td>
 | 
			
		||||
                <input class="form-control" @bind="@name" />
 | 
			
		||||
                <input class="form-control" @bind="@_name" />
 | 
			
		||||
            </td>
 | 
			
		||||
        </tr>
 | 
			
		||||
        <tr>
 | 
			
		||||
@ -17,7 +17,7 @@
 | 
			
		||||
                <label  class="control-label">Title: </label>
 | 
			
		||||
            </td>
 | 
			
		||||
            <td>
 | 
			
		||||
                <input class="form-control" @bind="@title" />
 | 
			
		||||
                <input class="form-control" @bind="@_title" />
 | 
			
		||||
            </td>
 | 
			
		||||
        </tr>
 | 
			
		||||
        <tr>
 | 
			
		||||
@ -25,7 +25,7 @@
 | 
			
		||||
                <label  class="control-label">Description: </label>
 | 
			
		||||
            </td>
 | 
			
		||||
            <td>
 | 
			
		||||
                <textarea class="form-control" @bind="@description" rows="5" />
 | 
			
		||||
                <textarea class="form-control" @bind="@_description" rows="5"></textarea>
 | 
			
		||||
            </td>
 | 
			
		||||
        </tr>
 | 
			
		||||
        <tr>
 | 
			
		||||
@ -33,7 +33,7 @@
 | 
			
		||||
                <label  class="control-label">Category: </label>
 | 
			
		||||
            </td>
 | 
			
		||||
            <td>
 | 
			
		||||
                <input class="form-control" @bind="@category" />
 | 
			
		||||
                <input class="form-control" @bind="@_category" />
 | 
			
		||||
            </td>
 | 
			
		||||
        </tr>
 | 
			
		||||
        <tr>
 | 
			
		||||
@ -41,7 +41,7 @@
 | 
			
		||||
                <label  class="control-label">Order: </label>
 | 
			
		||||
            </td>
 | 
			
		||||
            <td>
 | 
			
		||||
                <input class="form-control" @bind="@vieworder" />
 | 
			
		||||
                <input class="form-control" @bind="@_vieworder" />
 | 
			
		||||
            </td>
 | 
			
		||||
        </tr>
 | 
			
		||||
        <tr>
 | 
			
		||||
@ -49,7 +49,7 @@
 | 
			
		||||
                <label  class="control-label">Length: </label>
 | 
			
		||||
            </td>
 | 
			
		||||
            <td>
 | 
			
		||||
                <input class="form-control" @bind="@maxlength" />
 | 
			
		||||
                <input class="form-control" @bind="@_maxlength" />
 | 
			
		||||
            </td>
 | 
			
		||||
        </tr>
 | 
			
		||||
        <tr>
 | 
			
		||||
@ -57,7 +57,7 @@
 | 
			
		||||
                <label  class="control-label">Default Value: </label>
 | 
			
		||||
            </td>
 | 
			
		||||
            <td>
 | 
			
		||||
                <input class="form-control" @bind="@defaultvalue" />
 | 
			
		||||
                <input class="form-control" @bind="@_defaultvalue" />
 | 
			
		||||
            </td>
 | 
			
		||||
        </tr>
 | 
			
		||||
        <tr>
 | 
			
		||||
@ -65,7 +65,7 @@
 | 
			
		||||
                <label  class="control-label">Required? </label>
 | 
			
		||||
            </td>
 | 
			
		||||
            <td>
 | 
			
		||||
                <select class="form-control" @bind="@isrequired">
 | 
			
		||||
                <select class="form-control" @bind="@_isrequired">
 | 
			
		||||
                    <option value="True">Yes</option>
 | 
			
		||||
                    <option value="False">No</option>
 | 
			
		||||
                </select>
 | 
			
		||||
@ -76,7 +76,7 @@
 | 
			
		||||
                <label  class="control-label">Private? </label>
 | 
			
		||||
            </td>
 | 
			
		||||
            <td>
 | 
			
		||||
                <select class="form-control" @bind="@isprivate">
 | 
			
		||||
                <select class="form-control" @bind="@_isprivate">
 | 
			
		||||
                    <option value="True">Yes</option>
 | 
			
		||||
                    <option value="False">No</option>
 | 
			
		||||
                </select>
 | 
			
		||||
@ -90,16 +90,16 @@
 | 
			
		||||
    public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Admin; } }
 | 
			
		||||
    public override string Actions { get { return "Add,Edit"; } }
 | 
			
		||||
 | 
			
		||||
    int profileid = -1;
 | 
			
		||||
    string name = "";
 | 
			
		||||
    string title = "";
 | 
			
		||||
    string description = "";
 | 
			
		||||
    string category = "";
 | 
			
		||||
    string vieworder = "0";
 | 
			
		||||
    string maxlength = "0";
 | 
			
		||||
    string defaultvalue = "";
 | 
			
		||||
    string isrequired = "False";
 | 
			
		||||
    string isprivate = "False";
 | 
			
		||||
    int _profileid = -1;
 | 
			
		||||
    string _name = "";
 | 
			
		||||
    string _title = "";
 | 
			
		||||
    string _description = "";
 | 
			
		||||
    string _category = "";
 | 
			
		||||
    string _vieworder = "0";
 | 
			
		||||
    string _maxlength = "0";
 | 
			
		||||
    string _defaultvalue = "";
 | 
			
		||||
    string _isrequired = "False";
 | 
			
		||||
    string _isprivate = "False";
 | 
			
		||||
 | 
			
		||||
    protected override async Task OnInitializedAsync()
 | 
			
		||||
    {
 | 
			
		||||
@ -107,25 +107,25 @@
 | 
			
		||||
        {
 | 
			
		||||
            if (PageState.QueryString.ContainsKey("id"))
 | 
			
		||||
            {
 | 
			
		||||
                profileid = Int32.Parse(PageState.QueryString["id"]);
 | 
			
		||||
                Profile profile = await ProfileService.GetProfileAsync(profileid);
 | 
			
		||||
                _profileid = Int32.Parse(PageState.QueryString["id"]);
 | 
			
		||||
                Profile profile = await ProfileService.GetProfileAsync(_profileid);
 | 
			
		||||
                if (profile != null)
 | 
			
		||||
                {
 | 
			
		||||
                    name = profile.Name;
 | 
			
		||||
                    title = profile.Title;
 | 
			
		||||
                    description = profile.Description;
 | 
			
		||||
                    category = profile.Category;
 | 
			
		||||
                    vieworder = profile.ViewOrder.ToString();
 | 
			
		||||
                    maxlength = profile.MaxLength.ToString();
 | 
			
		||||
                    defaultvalue = profile.DefaultValue;
 | 
			
		||||
                    isrequired = profile.IsRequired.ToString();
 | 
			
		||||
                    isprivate = profile.IsPrivate.ToString();
 | 
			
		||||
                    _name = profile.Name;
 | 
			
		||||
                    _title = profile.Title;
 | 
			
		||||
                    _description = profile.Description;
 | 
			
		||||
                    _category = profile.Category;
 | 
			
		||||
                    _vieworder = profile.ViewOrder.ToString();
 | 
			
		||||
                    _maxlength = profile.MaxLength.ToString();
 | 
			
		||||
                    _defaultvalue = profile.DefaultValue;
 | 
			
		||||
                    _isrequired = profile.IsRequired.ToString();
 | 
			
		||||
                    _isprivate = profile.IsPrivate.ToString();
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        catch (Exception ex)
 | 
			
		||||
        {
 | 
			
		||||
            await logger.LogError(ex, "Error Loading Profile {ProfileId} {Error}", profileid, ex.Message);
 | 
			
		||||
            await logger.LogError(ex, "Error Loading Profile {ProfileId} {Error}", _profileid, ex.Message);
 | 
			
		||||
            AddModuleMessage("Error Loading Profile", MessageType.Error);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
@ -135,30 +135,30 @@
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            Profile profile;
 | 
			
		||||
            if (profileid != -1)
 | 
			
		||||
            if (_profileid != -1)
 | 
			
		||||
            {
 | 
			
		||||
                profile = await ProfileService.GetProfileAsync(profileid);
 | 
			
		||||
                profile = await ProfileService.GetProfileAsync(_profileid);
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                profile = new Profile();
 | 
			
		||||
            }
 | 
			
		||||
            profile.Name = name;
 | 
			
		||||
            profile.Title = title;
 | 
			
		||||
            profile.Description = description;
 | 
			
		||||
            profile.Category = category;
 | 
			
		||||
            profile.ViewOrder = int.Parse(vieworder);
 | 
			
		||||
            profile.MaxLength = int.Parse(maxlength);
 | 
			
		||||
            profile.DefaultValue = defaultvalue;
 | 
			
		||||
            profile.IsRequired = (isrequired == null ? false : Boolean.Parse(isrequired));
 | 
			
		||||
            profile.IsPrivate = (isprivate == null ? false : Boolean.Parse(isprivate));
 | 
			
		||||
            profile.Name = _name;
 | 
			
		||||
            profile.Title = _title;
 | 
			
		||||
            profile.Description = _description;
 | 
			
		||||
            profile.Category = _category;
 | 
			
		||||
            profile.ViewOrder = int.Parse(_vieworder);
 | 
			
		||||
            profile.MaxLength = int.Parse(_maxlength);
 | 
			
		||||
            profile.DefaultValue = _defaultvalue;
 | 
			
		||||
            profile.IsRequired = (_isrequired == null ? false : Boolean.Parse(_isrequired));
 | 
			
		||||
            profile.IsPrivate = (_isprivate == null ? false : Boolean.Parse(_isprivate));
 | 
			
		||||
            profile = await ProfileService.UpdateProfileAsync(profile);
 | 
			
		||||
            await logger.LogInformation("Profile Saved {Profile}", profile);
 | 
			
		||||
            NavigationManager.NavigateTo(NavigateUrl());
 | 
			
		||||
        }
 | 
			
		||||
        catch (Exception ex)
 | 
			
		||||
        {
 | 
			
		||||
            await logger.LogError(ex, "Error Saving Profile {ProfleId} {Error}", profileid, ex.Message);
 | 
			
		||||
            await logger.LogError(ex, "Error Saving Profile {ProfleId} {Error}", _profileid, ex.Message);
 | 
			
		||||
            AddModuleMessage("Error Saving Profile", MessageType.Error);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -2,7 +2,7 @@
 | 
			
		||||
@inherits ModuleBase
 | 
			
		||||
@inject IProfileService ProfileService
 | 
			
		||||
 | 
			
		||||
@if (Profiles == null)
 | 
			
		||||
@if (_profiles == null)
 | 
			
		||||
{
 | 
			
		||||
    <p><em>Loading...</em></p>
 | 
			
		||||
}
 | 
			
		||||
@ -10,7 +10,7 @@ else
 | 
			
		||||
{
 | 
			
		||||
    <ActionLink Action="Add" Security="SecurityAccessLevel.Admin" Text="Add Profile" />
 | 
			
		||||
 | 
			
		||||
    <Pager Items="@Profiles">
 | 
			
		||||
    <Pager Items="@_profiles">
 | 
			
		||||
        <Header>
 | 
			
		||||
            <th> </th>
 | 
			
		||||
            <th> </th>
 | 
			
		||||
@ -27,25 +27,25 @@ else
 | 
			
		||||
@code {
 | 
			
		||||
    public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Admin; } }
 | 
			
		||||
 | 
			
		||||
    List<Profile> Profiles;
 | 
			
		||||
    List<Profile> _profiles;
 | 
			
		||||
 | 
			
		||||
    protected override async Task OnInitializedAsync()
 | 
			
		||||
    {
 | 
			
		||||
        Profiles = await ProfileService.GetProfilesAsync(PageState.Site.SiteId);
 | 
			
		||||
        _profiles = await ProfileService.GetProfilesAsync(PageState.Site.SiteId);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private async Task DeleteProfile(int ProfileId)
 | 
			
		||||
    private async Task DeleteProfile(int profileId)
 | 
			
		||||
    {
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            await ProfileService.DeleteProfileAsync(ProfileId);
 | 
			
		||||
            await logger.LogInformation("Profile Deleted {ProfileId}", ProfileId);
 | 
			
		||||
            await ProfileService.DeleteProfileAsync(profileId);
 | 
			
		||||
            await logger.LogInformation("Profile Deleted {ProfileId}", profileId);
 | 
			
		||||
            AddModuleMessage("Profile Deleted", MessageType.Success);
 | 
			
		||||
        }
 | 
			
		||||
        catch (Exception ex)
 | 
			
		||||
        {
 | 
			
		||||
            await logger.LogError(ex, "Error Deleting Profile {ProfileId} {Error}", ProfileId, ex.Message);
 | 
			
		||||
            await logger.LogError(ex, "Error Deleting Profile {ProfileId} {Error}", profileId, ex.Message);
 | 
			
		||||
            AddModuleMessage("Error Deleting Profile", MessageType.Error);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -23,14 +23,14 @@
 | 
			
		||||
 | 
			
		||||
        <div class="tab-content">
 | 
			
		||||
            <div id="Pages" class="tab-pane fade show active" role="tabpanel">
 | 
			
		||||
                @if (pages == null)
 | 
			
		||||
                @if (_pages == null)
 | 
			
		||||
                {
 | 
			
		||||
                    <br />
 | 
			
		||||
                    <p>No Deleted Pages</p>
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    <Pager Items="@pages">
 | 
			
		||||
                    <Pager Items="@_pages">
 | 
			
		||||
                        <Header>
 | 
			
		||||
                            <th> </th>
 | 
			
		||||
                            <th> </th>
 | 
			
		||||
@ -49,14 +49,14 @@
 | 
			
		||||
                }
 | 
			
		||||
            </div>
 | 
			
		||||
            <div id="Modules" class="tab-pane fade" role="tabpanel">
 | 
			
		||||
                @if (modules == null)
 | 
			
		||||
                @if (_modules == null)
 | 
			
		||||
                {
 | 
			
		||||
                    <br />
 | 
			
		||||
                    <p>No Deleted Modules</p>
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    <Pager Items="@modules">
 | 
			
		||||
                    <Pager Items="@_modules">
 | 
			
		||||
                        <Header>
 | 
			
		||||
                            <th> </th>
 | 
			
		||||
                            <th> </th>
 | 
			
		||||
@ -83,8 +83,8 @@
 | 
			
		||||
@code {
 | 
			
		||||
    public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Admin; } }
 | 
			
		||||
 | 
			
		||||
    List<Page> pages;
 | 
			
		||||
    List<Module> modules;
 | 
			
		||||
    List<Page> _pages;
 | 
			
		||||
    List<Module> _modules;
 | 
			
		||||
 | 
			
		||||
    protected override async Task OnInitializedAsync()
 | 
			
		||||
    {
 | 
			
		||||
@ -101,84 +101,84 @@
 | 
			
		||||
 | 
			
		||||
    private async Task Load()
 | 
			
		||||
    {
 | 
			
		||||
        pages = await PageService.GetPagesAsync(PageState.Site.SiteId);
 | 
			
		||||
        pages = pages.Where(item => item.IsDeleted).ToList();
 | 
			
		||||
        _pages = await PageService.GetPagesAsync(PageState.Site.SiteId);
 | 
			
		||||
        _pages = _pages.Where(item => item.IsDeleted).ToList();
 | 
			
		||||
 | 
			
		||||
        modules = await ModuleService.GetModulesAsync(PageState.Site.SiteId);
 | 
			
		||||
        modules = modules.Where(item => item.IsDeleted).ToList();
 | 
			
		||||
        _modules = await ModuleService.GetModulesAsync(PageState.Site.SiteId);
 | 
			
		||||
        _modules = _modules.Where(item => item.IsDeleted).ToList();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private async Task RestorePage(Page Page)
 | 
			
		||||
    private async Task RestorePage(Page page)
 | 
			
		||||
    {
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            Page.IsDeleted = false;
 | 
			
		||||
            await PageService.UpdatePageAsync(Page);
 | 
			
		||||
            await logger.LogInformation("Page Restored {Page}", Page);
 | 
			
		||||
            page.IsDeleted = false;
 | 
			
		||||
            await PageService.UpdatePageAsync(page);
 | 
			
		||||
            await logger.LogInformation("Page Restored {Page}", page);
 | 
			
		||||
            await Load();
 | 
			
		||||
            StateHasChanged();
 | 
			
		||||
            NavigationManager.NavigateTo(NavigateUrl());
 | 
			
		||||
        }
 | 
			
		||||
        catch (Exception ex)
 | 
			
		||||
        {
 | 
			
		||||
            await logger.LogError(ex, "Error Restoring Deleted Page {Page} {Error}", Page, ex.Message);
 | 
			
		||||
            await logger.LogError(ex, "Error Restoring Deleted Page {Page} {Error}", page, ex.Message);
 | 
			
		||||
            AddModuleMessage("Error Restoring Deleted Page", MessageType.Error);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private async Task DeletePage(Page Page)
 | 
			
		||||
    private async Task DeletePage(Page page)
 | 
			
		||||
    {
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            await PageService.DeletePageAsync(Page.PageId);
 | 
			
		||||
            await logger.LogInformation("Page Permanently Deleted {Page}", Page);
 | 
			
		||||
            await PageService.DeletePageAsync(page.PageId);
 | 
			
		||||
            await logger.LogInformation("Page Permanently Deleted {Page}", page);
 | 
			
		||||
            await Load();
 | 
			
		||||
            StateHasChanged();
 | 
			
		||||
            NavigationManager.NavigateTo(NavigateUrl());
 | 
			
		||||
        }
 | 
			
		||||
        catch (Exception ex)
 | 
			
		||||
        {
 | 
			
		||||
            await logger.LogError(ex, "Error Permanently Deleting Page {Page} {Error}", Page, ex.Message);
 | 
			
		||||
            await logger.LogError(ex, "Error Permanently Deleting Page {Page} {Error}", page, ex.Message);
 | 
			
		||||
            AddModuleMessage(ex.Message, MessageType.Error);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private async Task RestoreModule(Module Module)
 | 
			
		||||
    private async Task RestoreModule(Module module)
 | 
			
		||||
    {
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            PageModule pagemodule = await PageModuleService.GetPageModuleAsync(Module.PageModuleId);
 | 
			
		||||
            PageModule pagemodule = await PageModuleService.GetPageModuleAsync(module.PageModuleId);
 | 
			
		||||
            pagemodule.IsDeleted = false;
 | 
			
		||||
            await PageModuleService.UpdatePageModuleAsync(pagemodule);
 | 
			
		||||
            await logger.LogInformation("Module Restored {Module}", Module);
 | 
			
		||||
            await logger.LogInformation("Module Restored {Module}", module);
 | 
			
		||||
            await Load();
 | 
			
		||||
            StateHasChanged();
 | 
			
		||||
        }
 | 
			
		||||
        catch (Exception ex)
 | 
			
		||||
        {
 | 
			
		||||
            await logger.LogError(ex, "Error Restoring Deleted Module {Module} {Error}", Module, ex.Message);
 | 
			
		||||
            await logger.LogError(ex, "Error Restoring Deleted Module {Module} {Error}", module, ex.Message);
 | 
			
		||||
            AddModuleMessage("Error Restoring Deleted Module", MessageType.Error);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private async Task DeleteModule(Module Module)
 | 
			
		||||
    private async Task DeleteModule(Module module)
 | 
			
		||||
    {
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            await PageModuleService.DeletePageModuleAsync(Module.PageModuleId);
 | 
			
		||||
            await PageModuleService.DeletePageModuleAsync(module.PageModuleId);
 | 
			
		||||
            // check if there are any remaining module instances in the site
 | 
			
		||||
            modules = await ModuleService.GetModulesAsync(PageState.Site.SiteId);
 | 
			
		||||
            if (!modules.Exists(item => item.ModuleId == Module.ModuleId))
 | 
			
		||||
            _modules = await ModuleService.GetModulesAsync(PageState.Site.SiteId);
 | 
			
		||||
            if (!_modules.Exists(item => item.ModuleId == module.ModuleId))
 | 
			
		||||
            {
 | 
			
		||||
                await ModuleService.DeleteModuleAsync(Module.ModuleId);
 | 
			
		||||
                await ModuleService.DeleteModuleAsync(module.ModuleId);
 | 
			
		||||
            }
 | 
			
		||||
            await logger.LogInformation("Module Permanently Deleted {Module}", Module);
 | 
			
		||||
            await logger.LogInformation("Module Permanently Deleted {Module}", module);
 | 
			
		||||
            await Load();
 | 
			
		||||
            StateHasChanged();
 | 
			
		||||
        }
 | 
			
		||||
        catch (Exception ex)
 | 
			
		||||
        {
 | 
			
		||||
            await logger.LogError(ex, "Error Permanently Deleting Module {Module} {Error}", Module, ex.Message);
 | 
			
		||||
            await logger.LogError(ex, "Error Permanently Deleting Module {Module} {Error}", module, ex.Message);
 | 
			
		||||
            AddModuleMessage("Error Permanently Deleting Module", MessageType.Error);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -3,31 +3,31 @@
 | 
			
		||||
@inject NavigationManager NavigationManager
 | 
			
		||||
@inject IUserService UserService
 | 
			
		||||
 | 
			
		||||
@if  (Message != "")
 | 
			
		||||
@if  (_message != "")
 | 
			
		||||
{
 | 
			
		||||
    <ModuleMessage Message="@Message" Type="MessageType.Info" />
 | 
			
		||||
    <ModuleMessage Message="@_message" Type="MessageType.Info" />
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
<div class="container">
 | 
			
		||||
    <div class="form-group">
 | 
			
		||||
        <label for="Username" class="control-label">Username: </label>
 | 
			
		||||
        <input type="text" class="form-control" placeholder="Username" @bind="@Username" />
 | 
			
		||||
        <input type="text" class="form-control" placeholder="Username" @bind="@_username" id="Username"/>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="form-group">
 | 
			
		||||
        <label for="Password" class="control-label">Password: </label>
 | 
			
		||||
        <input type="password" class="form-control" placeholder="Password" @bind="@Password" />
 | 
			
		||||
        <input type="password" class="form-control" placeholder="Password" @bind="@_password" id="Password"/>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="form-group">
 | 
			
		||||
        <label for="Password" class="control-label">Confirm Password: </label>
 | 
			
		||||
        <input type="password" class="form-control" placeholder="Password" @bind="@Confirm" />
 | 
			
		||||
        <label for="Confirm" class="control-label">Confirm Password: </label>
 | 
			
		||||
        <input type="password" class="form-control" placeholder="Password" @bind="@_confirm"id="Confirm" />
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="form-group">
 | 
			
		||||
        <label for="Username" class="control-label">Email: </label>
 | 
			
		||||
        <input type="text" class="form-control" placeholder="Email" @bind="@Email" />
 | 
			
		||||
        <label for="Email" class="control-label">Email: </label>
 | 
			
		||||
        <input type="text" class="form-control" placeholder="Email" @bind="@_email" id="Email"/>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="form-group">
 | 
			
		||||
        <label for="DisplayName" class="control-label">Full Name: </label>
 | 
			
		||||
        <input type="text" class="form-control" placeholder="Full Name" @bind="@DisplayName" />
 | 
			
		||||
        <input type="text" class="form-control" placeholder="Full Name" @bind="@_displayName" id="DisplayName"/>
 | 
			
		||||
    </div>
 | 
			
		||||
    <button type="button" class="btn btn-primary" @onclick="Register">Register</button>
 | 
			
		||||
    <button type="button" class="btn btn-secondary" @onclick="Cancel">Cancel</button>
 | 
			
		||||
@ -36,38 +36,40 @@
 | 
			
		||||
@code {
 | 
			
		||||
    public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Anonymous; } }
 | 
			
		||||
 | 
			
		||||
    string Message = "Please Note That Registration Requires A Valid Email Address In Order To Verify Your Identity";
 | 
			
		||||
    string Username = "";
 | 
			
		||||
    string Password = "";
 | 
			
		||||
    string Confirm = "";
 | 
			
		||||
    string Email = "";
 | 
			
		||||
    string DisplayName = "";
 | 
			
		||||
    string _message = "Please Note That Registration Requires A Valid Email Address In Order To Verify Your Identity";
 | 
			
		||||
    string _username = "";
 | 
			
		||||
    string _password = "";
 | 
			
		||||
    string _confirm = "";
 | 
			
		||||
    string _email = "";
 | 
			
		||||
    string _displayName = "";
 | 
			
		||||
 | 
			
		||||
    private async Task Register()
 | 
			
		||||
    {
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            Message = "";
 | 
			
		||||
            if (Username != "" && Password != "" && Confirm != "" && Email != "")
 | 
			
		||||
            _message = "";
 | 
			
		||||
            if (_username != "" && _password != "" && _confirm != "" && _email != "")
 | 
			
		||||
            {
 | 
			
		||||
                if (Password == Confirm)
 | 
			
		||||
                if (_password == _confirm)
 | 
			
		||||
                {
 | 
			
		||||
                    User user = new User();
 | 
			
		||||
                    user.SiteId = PageState.Site.SiteId;
 | 
			
		||||
                    user.Username = Username;
 | 
			
		||||
                    user.DisplayName = (DisplayName == "" ? Username : DisplayName);
 | 
			
		||||
                    user.Email = Email;
 | 
			
		||||
                    user.Password = Password;
 | 
			
		||||
                    User user = new User
 | 
			
		||||
                    {
 | 
			
		||||
                        SiteId = PageState.Site.SiteId,
 | 
			
		||||
                        Username = _username,
 | 
			
		||||
                        DisplayName = (_displayName == "" ? _username : _displayName),
 | 
			
		||||
                        Email = _email,
 | 
			
		||||
                        Password = _password
 | 
			
		||||
                    };
 | 
			
		||||
                    user = await UserService.AddUserAsync(user);
 | 
			
		||||
 | 
			
		||||
                    if (user != null)
 | 
			
		||||
                    {
 | 
			
		||||
                        await logger.LogInformation("User Created {Username} {Email}", Username, Email);
 | 
			
		||||
                        await logger.LogInformation("User Created {Username} {Email}", _username, _email);
 | 
			
		||||
                        AddModuleMessage("User Account Created. Please Check Your Email For Verification Instructions.", MessageType.Info);
 | 
			
		||||
                    }
 | 
			
		||||
                    else
 | 
			
		||||
                    {
 | 
			
		||||
                        await logger.LogError("Error Adding User {Username} {Email}", Username, Email);
 | 
			
		||||
                        await logger.LogError("Error Adding User {Username} {Email}", _username, _email);
 | 
			
		||||
                        AddModuleMessage("Error Adding User. Please Ensure Password Meets Complexity Requirements And Username Is Not Already In Use.", MessageType.Error);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
@ -83,7 +85,7 @@
 | 
			
		||||
        }
 | 
			
		||||
        catch (Exception ex)
 | 
			
		||||
        {
 | 
			
		||||
            await logger.LogError(ex, "Error Adding User {Username} {Email} {Error}", Username, Email, ex.Message);
 | 
			
		||||
            await logger.LogError(ex, "Error Adding User {Username} {Email} {Error}", _username, _email, ex.Message);
 | 
			
		||||
            AddModuleMessage("Error Adding User", MessageType.Error);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -17,7 +17,7 @@
 | 
			
		||||
            <label  class="control-label">Description: </label>
 | 
			
		||||
        </td>
 | 
			
		||||
        <td>
 | 
			
		||||
            <textarea class="form-control" @bind="@description" rows="5" />
 | 
			
		||||
            <textarea class="form-control" @bind="@description" rows="5"></textarea>
 | 
			
		||||
        </td>
 | 
			
		||||
    </tr>
 | 
			
		||||
    <tr>
 | 
			
		||||
 | 
			
		||||
@ -9,7 +9,7 @@
 | 
			
		||||
            <label  class="control-label">Name: </label>
 | 
			
		||||
        </td>
 | 
			
		||||
        <td>
 | 
			
		||||
            <input class="form-control" @bind="@name" />
 | 
			
		||||
            <input class="form-control" @bind="@_name" />
 | 
			
		||||
        </td>
 | 
			
		||||
    </tr>
 | 
			
		||||
    <tr>
 | 
			
		||||
@ -17,7 +17,7 @@
 | 
			
		||||
            <label  class="control-label">Description: </label>
 | 
			
		||||
        </td>
 | 
			
		||||
        <td>
 | 
			
		||||
            <textarea class="form-control" @bind="@description" rows="5" />
 | 
			
		||||
            <textarea class="form-control" @bind="@_description" rows="5"></textarea>
 | 
			
		||||
        </td>
 | 
			
		||||
    </tr>
 | 
			
		||||
    <tr>
 | 
			
		||||
@ -25,7 +25,7 @@
 | 
			
		||||
            <label  class="control-label">Auto Assigned? </label>
 | 
			
		||||
        </td>
 | 
			
		||||
        <td>
 | 
			
		||||
            <select class="form-control" @bind="@isautoassigned">
 | 
			
		||||
            <select class="form-control" @bind="@_isautoassigned">
 | 
			
		||||
                <option value="True">Yes</option>
 | 
			
		||||
                <option value="False">No</option>
 | 
			
		||||
            </select>
 | 
			
		||||
@ -36,7 +36,7 @@
 | 
			
		||||
            <label  class="control-label">System Role? </label>
 | 
			
		||||
        </td>
 | 
			
		||||
        <td>
 | 
			
		||||
            <select class="form-control" @bind="@issystem">
 | 
			
		||||
            <select class="form-control" @bind="@_issystem">
 | 
			
		||||
                <option value="True">Yes</option>
 | 
			
		||||
                <option value="False">No</option>
 | 
			
		||||
            </select>
 | 
			
		||||
@ -49,40 +49,40 @@
 | 
			
		||||
@code {
 | 
			
		||||
    public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Admin; } }
 | 
			
		||||
 | 
			
		||||
    int roleid;
 | 
			
		||||
    string name = "";
 | 
			
		||||
    string description = "";
 | 
			
		||||
    string isautoassigned = "False";
 | 
			
		||||
    string issystem = "False";
 | 
			
		||||
    int _roleid;
 | 
			
		||||
    string _name = "";
 | 
			
		||||
    string _description = "";
 | 
			
		||||
    string _isautoassigned = "False";
 | 
			
		||||
    string _issystem = "False";
 | 
			
		||||
 | 
			
		||||
    protected override async Task OnInitializedAsync()
 | 
			
		||||
    {
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            roleid = Int32.Parse(PageState.QueryString["id"]);
 | 
			
		||||
            Role role = await RoleService.GetRoleAsync(roleid);
 | 
			
		||||
            _roleid = Int32.Parse(PageState.QueryString["id"]);
 | 
			
		||||
            Role role = await RoleService.GetRoleAsync(_roleid);
 | 
			
		||||
            if (role != null)
 | 
			
		||||
            {
 | 
			
		||||
                name = role.Name;
 | 
			
		||||
                description = role.Description;
 | 
			
		||||
                isautoassigned = role.IsAutoAssigned.ToString();
 | 
			
		||||
                issystem = role.IsSystem.ToString();
 | 
			
		||||
                _name = role.Name;
 | 
			
		||||
                _description = role.Description;
 | 
			
		||||
                _isautoassigned = role.IsAutoAssigned.ToString();
 | 
			
		||||
                _issystem = role.IsSystem.ToString();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        catch (Exception ex)
 | 
			
		||||
        {
 | 
			
		||||
            await logger.LogError(ex, "Error Loading Role {RoleId} {Error}", roleid, ex.Message);
 | 
			
		||||
            await logger.LogError(ex, "Error Loading Role {RoleId} {Error}", _roleid, ex.Message);
 | 
			
		||||
            AddModuleMessage("Error Loading Role", MessageType.Error);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private async Task SaveRole()
 | 
			
		||||
    {
 | 
			
		||||
        Role role = await RoleService.GetRoleAsync(roleid);
 | 
			
		||||
        role.Name = name;
 | 
			
		||||
        role.Description = description;
 | 
			
		||||
        role.IsAutoAssigned = (isautoassigned == null ? false : Boolean.Parse(isautoassigned));
 | 
			
		||||
        role.IsSystem = (issystem == null ? false : Boolean.Parse(issystem));
 | 
			
		||||
        Role role = await RoleService.GetRoleAsync(_roleid);
 | 
			
		||||
        role.Name = _name;
 | 
			
		||||
        role.Description = _description;
 | 
			
		||||
        role.IsAutoAssigned = (_isautoassigned != null && Boolean.Parse(_isautoassigned));
 | 
			
		||||
        role.IsSystem = (_issystem != null && Boolean.Parse(_issystem));
 | 
			
		||||
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
 | 
			
		||||
@ -2,7 +2,7 @@
 | 
			
		||||
@inherits ModuleBase
 | 
			
		||||
@inject IRoleService RoleService
 | 
			
		||||
 | 
			
		||||
@if (Roles == null)
 | 
			
		||||
@if (_roles == null)
 | 
			
		||||
{
 | 
			
		||||
    <p><em>Loading...</em></p>
 | 
			
		||||
}
 | 
			
		||||
@ -10,7 +10,7 @@ else
 | 
			
		||||
{
 | 
			
		||||
    <ActionLink Action="Add" Text="Add Role" />
 | 
			
		||||
 | 
			
		||||
    <Pager Items="@Roles">
 | 
			
		||||
    <Pager Items="@_roles">
 | 
			
		||||
        <Header>
 | 
			
		||||
            <th> </th>
 | 
			
		||||
            <th> </th>
 | 
			
		||||
@ -27,25 +27,25 @@ else
 | 
			
		||||
@code {
 | 
			
		||||
    public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Admin; } }
 | 
			
		||||
 | 
			
		||||
    List<Role> Roles;
 | 
			
		||||
    List<Role> _roles;
 | 
			
		||||
 | 
			
		||||
    protected override async Task OnParametersSetAsync()
 | 
			
		||||
    {
 | 
			
		||||
        Roles = await RoleService.GetRolesAsync(PageState.Site.SiteId);
 | 
			
		||||
        _roles = await RoleService.GetRolesAsync(PageState.Site.SiteId);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private async Task DeleteRole(Role Role)
 | 
			
		||||
    private async Task DeleteRole(Role role)
 | 
			
		||||
    {
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            await RoleService.DeleteRoleAsync(Role.RoleId);
 | 
			
		||||
            await logger.LogInformation("Role Deleted {Role}", Role);
 | 
			
		||||
            await RoleService.DeleteRoleAsync(role.RoleId);
 | 
			
		||||
            await logger.LogInformation("Role Deleted {Role}", role);
 | 
			
		||||
            StateHasChanged();
 | 
			
		||||
        }
 | 
			
		||||
        catch (Exception ex)
 | 
			
		||||
        {
 | 
			
		||||
            await logger.LogError(ex, "Error Deleting Role {Role} {Error}", Role, ex.Message);
 | 
			
		||||
            await logger.LogError(ex, "Error Deleting Role {Role} {Error}", role, ex.Message);
 | 
			
		||||
            AddModuleMessage("Error Deleting Role", MessageType.Error);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -31,7 +31,7 @@
 | 
			
		||||
                <label  class="control-label">Aliases: </label>
 | 
			
		||||
            </td>
 | 
			
		||||
            <td>
 | 
			
		||||
                <textarea class="form-control" @bind="@urls" rows="3" />
 | 
			
		||||
                <textarea class="form-control" @bind="@urls" rows="3"></textarea>
 | 
			
		||||
            </td>
 | 
			
		||||
        </tr>
 | 
			
		||||
        <tr>
 | 
			
		||||
 | 
			
		||||
@ -7,7 +7,7 @@
 | 
			
		||||
@inject IThemeService  ThemeService
 | 
			
		||||
@inject IUserService UserService
 | 
			
		||||
 | 
			
		||||
@if (tenants == null)
 | 
			
		||||
@if (_tenants == null)
 | 
			
		||||
{
 | 
			
		||||
    <p><em>Loading...</em></p>
 | 
			
		||||
}
 | 
			
		||||
@ -21,7 +21,7 @@ else
 | 
			
		||||
        <td>
 | 
			
		||||
            <select class="form-control" @onchange="(e => TenantChanged(e))">
 | 
			
		||||
                <option value="-1"><Select Tenant></option>
 | 
			
		||||
                @foreach (Tenant tenant in tenants)
 | 
			
		||||
                @foreach (Tenant tenant in _tenants)
 | 
			
		||||
                {
 | 
			
		||||
                    <option value="@tenant.TenantId">@tenant.Name</option>
 | 
			
		||||
                }
 | 
			
		||||
@ -33,7 +33,7 @@ else
 | 
			
		||||
            <label  class="control-label">Name: </label>
 | 
			
		||||
        </td>
 | 
			
		||||
        <td>
 | 
			
		||||
            <input class="form-control" @bind="@name" />
 | 
			
		||||
            <input class="form-control" @bind="@_name" />
 | 
			
		||||
        </td>
 | 
			
		||||
    </tr>
 | 
			
		||||
    <tr>
 | 
			
		||||
@ -41,7 +41,7 @@ else
 | 
			
		||||
            <label  class="control-label">Aliases: </label>
 | 
			
		||||
        </td>
 | 
			
		||||
        <td>
 | 
			
		||||
            <textarea class="form-control" @bind="@urls" rows="3" />
 | 
			
		||||
            <textarea class="form-control" @bind="@_urls" rows="3"></textarea>
 | 
			
		||||
        </td>
 | 
			
		||||
    </tr>
 | 
			
		||||
    <tr>
 | 
			
		||||
@ -51,7 +51,7 @@ else
 | 
			
		||||
        <td>
 | 
			
		||||
            <select class="form-control" @onchange="(e => ThemeChanged(e))">
 | 
			
		||||
                <option value=""><Select Theme></option>
 | 
			
		||||
                @foreach (KeyValuePair<string, string> item in themes)
 | 
			
		||||
                @foreach (KeyValuePair<string, string> item in _themes)
 | 
			
		||||
                {
 | 
			
		||||
                    <option value="@item.Key">@item.Value</option>
 | 
			
		||||
                }
 | 
			
		||||
@ -63,9 +63,9 @@ else
 | 
			
		||||
            <label  class="control-label">Default Layout: </label>
 | 
			
		||||
        </td>
 | 
			
		||||
        <td>
 | 
			
		||||
            <select class="form-control" @bind="@layouttype">
 | 
			
		||||
            <select class="form-control" @bind="@_layouttype">
 | 
			
		||||
                <option value=""><Select Layout></option>
 | 
			
		||||
                @foreach (KeyValuePair<string, string> panelayout in panelayouts)
 | 
			
		||||
                @foreach (KeyValuePair<string, string> panelayout in _panelayouts)
 | 
			
		||||
                {
 | 
			
		||||
                    <option value="@panelayout.Key">@panelayout.Value</option>
 | 
			
		||||
                }
 | 
			
		||||
@ -77,23 +77,23 @@ else
 | 
			
		||||
            <label  class="control-label">Default Container: </label>
 | 
			
		||||
        </td>
 | 
			
		||||
        <td>
 | 
			
		||||
            <select class="form-control" @bind="@containertype">
 | 
			
		||||
            <select class="form-control" @bind="@_containertype">
 | 
			
		||||
                <option value=""><Select Container></option>
 | 
			
		||||
                @foreach (KeyValuePair<string, string>container in containers)
 | 
			
		||||
                @foreach (KeyValuePair<string, string>container in _containers)
 | 
			
		||||
                {
 | 
			
		||||
                    <option value="@container.Key">@container.Value</option>
 | 
			
		||||
                }
 | 
			
		||||
            </select>
 | 
			
		||||
        </td>
 | 
			
		||||
    </tr>
 | 
			
		||||
    @if (!isinitialized)
 | 
			
		||||
    @if (!_isinitialized)
 | 
			
		||||
    {
 | 
			
		||||
        <tr>
 | 
			
		||||
            <td>
 | 
			
		||||
                <label  class="control-label">Host Username:</label>
 | 
			
		||||
            </td>
 | 
			
		||||
            <td>
 | 
			
		||||
                <input class="form-control" @bind="@username" readonly />
 | 
			
		||||
                <input class="form-control" @bind="@_username" readonly />
 | 
			
		||||
            </td>
 | 
			
		||||
        </tr>
 | 
			
		||||
        <tr>
 | 
			
		||||
@ -101,7 +101,7 @@ else
 | 
			
		||||
                <label  class="control-label">Host Password:</label>
 | 
			
		||||
            </td>
 | 
			
		||||
            <td>
 | 
			
		||||
                <input type="password" class="form-control" @bind="@password" />
 | 
			
		||||
                <input type="password" class="form-control" @bind="@_password" />
 | 
			
		||||
            </td>
 | 
			
		||||
        </tr>
 | 
			
		||||
    }
 | 
			
		||||
@ -113,50 +113,50 @@ else
 | 
			
		||||
@code {
 | 
			
		||||
    public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Host; } }
 | 
			
		||||
 | 
			
		||||
    Dictionary<string, string> themes = new Dictionary<string, string>();
 | 
			
		||||
    Dictionary<string, string> panelayouts = new Dictionary<string, string>();
 | 
			
		||||
    Dictionary<string, string> containers = new Dictionary<string, string>();
 | 
			
		||||
    Dictionary<string, string> _themes = new Dictionary<string, string>();
 | 
			
		||||
    Dictionary<string, string> _panelayouts = new Dictionary<string, string>();
 | 
			
		||||
    Dictionary<string, string> _containers = new Dictionary<string, string>();
 | 
			
		||||
 | 
			
		||||
    List<Theme> Themes;
 | 
			
		||||
    List<Tenant> tenants;
 | 
			
		||||
    string tenantid = "-1";
 | 
			
		||||
    string name = "";
 | 
			
		||||
    string urls = "";
 | 
			
		||||
    string themetype = "";
 | 
			
		||||
    string layouttype = "";
 | 
			
		||||
    string containertype = "";
 | 
			
		||||
    bool isinitialized = true;
 | 
			
		||||
    string username = "";
 | 
			
		||||
    string password = "";
 | 
			
		||||
    List<Theme> _themeList;
 | 
			
		||||
    List<Tenant> _tenants;
 | 
			
		||||
    string _tenantid = "-1";
 | 
			
		||||
    string _name = "";
 | 
			
		||||
    string _urls = "";
 | 
			
		||||
    string _themetype = "";
 | 
			
		||||
    string _layouttype = "";
 | 
			
		||||
    string _containertype = "";
 | 
			
		||||
    bool _isinitialized = true;
 | 
			
		||||
    string _username = "";
 | 
			
		||||
    string _password = "";
 | 
			
		||||
 | 
			
		||||
    protected override async Task OnInitializedAsync()
 | 
			
		||||
    {
 | 
			
		||||
        Themes = await ThemeService.GetThemesAsync();
 | 
			
		||||
        tenants = await TenantService.GetTenantsAsync();
 | 
			
		||||
        urls = PageState.Alias.Name;
 | 
			
		||||
        themes = ThemeService.GetThemeTypes(Themes);
 | 
			
		||||
        containers = ThemeService.GetContainerTypes(Themes);
 | 
			
		||||
        username = Constants.HostUser;
 | 
			
		||||
        _themeList = await ThemeService.GetThemesAsync();
 | 
			
		||||
        _tenants = await TenantService.GetTenantsAsync();
 | 
			
		||||
        _urls = PageState.Alias.Name;
 | 
			
		||||
        _themes = ThemeService.GetThemeTypes(_themeList);
 | 
			
		||||
        _containers = ThemeService.GetContainerTypes(_themeList);
 | 
			
		||||
        _username = Constants.HostUser;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private async void TenantChanged(ChangeEventArgs e)
 | 
			
		||||
    {
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            tenantid = (string)e.Value;
 | 
			
		||||
            if (tenantid != "-1")
 | 
			
		||||
            _tenantid = (string)e.Value;
 | 
			
		||||
            if (_tenantid != "-1")
 | 
			
		||||
            {
 | 
			
		||||
                Tenant tenant = tenants.Where(item => item.TenantId == int.Parse(tenantid)).FirstOrDefault();
 | 
			
		||||
                Tenant tenant = _tenants.Where(item => item.TenantId == int.Parse(_tenantid)).FirstOrDefault();
 | 
			
		||||
                if (tenant != null)
 | 
			
		||||
                {
 | 
			
		||||
                    isinitialized = tenant.IsInitialized;
 | 
			
		||||
                    _isinitialized = tenant.IsInitialized;
 | 
			
		||||
                    StateHasChanged();
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        catch (Exception ex)
 | 
			
		||||
        {
 | 
			
		||||
            await logger.LogError(ex, "Error Loading Tenant {TenantId} {Error}", tenantid, ex.Message);
 | 
			
		||||
            await logger.LogError(ex, "Error Loading Tenant {TenantId} {Error}", _tenantid, ex.Message);
 | 
			
		||||
            AddModuleMessage("Error Loading Tenant", MessageType.Error);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
@ -165,31 +165,31 @@ else
 | 
			
		||||
    {
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            themetype = (string)e.Value;
 | 
			
		||||
            if (themetype != "")
 | 
			
		||||
            _themetype = (string)e.Value;
 | 
			
		||||
            if (_themetype != "")
 | 
			
		||||
            {
 | 
			
		||||
                panelayouts = ThemeService.GetPaneLayoutTypes(Themes, themetype);
 | 
			
		||||
                _panelayouts = ThemeService.GetPaneLayoutTypes(_themeList, _themetype);
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                panelayouts = new Dictionary<string, string>();
 | 
			
		||||
                _panelayouts = new Dictionary<string, string>();
 | 
			
		||||
            }
 | 
			
		||||
            StateHasChanged();
 | 
			
		||||
        }
 | 
			
		||||
        catch (Exception ex)
 | 
			
		||||
        {
 | 
			
		||||
            await logger.LogError(ex, "Error Loading Pane Layouts For Theme {ThemeType} {Error}", themetype, ex.Message);
 | 
			
		||||
            await logger.LogError(ex, "Error Loading Pane Layouts For Theme {ThemeType} {Error}", _themetype, ex.Message);
 | 
			
		||||
            AddModuleMessage("Error Loading Pane Layouts For Theme", MessageType.Error);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private async Task SaveSite()
 | 
			
		||||
    {
 | 
			
		||||
        if (tenantid != "-1" && name != "" && urls != "" && !string.IsNullOrEmpty(themetype) && (panelayouts.Count == 0 || !string.IsNullOrEmpty(layouttype)) && !string.IsNullOrEmpty(containertype))
 | 
			
		||||
        if (_tenantid != "-1" && _name != "" && _urls != "" && !string.IsNullOrEmpty(_themetype) && (_panelayouts.Count == 0 || !string.IsNullOrEmpty(_layouttype)) && !string.IsNullOrEmpty(_containertype))
 | 
			
		||||
        {
 | 
			
		||||
            bool unique = true;
 | 
			
		||||
            List<Alias> aliases = await AliasService.GetAliasesAsync();
 | 
			
		||||
            foreach (string name in urls.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
 | 
			
		||||
            foreach (string name in _urls.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
 | 
			
		||||
            {
 | 
			
		||||
                if (aliases.Exists(item => item.Name == name))
 | 
			
		||||
                {
 | 
			
		||||
@ -200,12 +200,12 @@ else
 | 
			
		||||
            {
 | 
			
		||||
                bool isvalid = true;
 | 
			
		||||
 | 
			
		||||
                if (!isinitialized)
 | 
			
		||||
                if (!_isinitialized)
 | 
			
		||||
                {
 | 
			
		||||
                    User user = new User();
 | 
			
		||||
                    user.SiteId = PageState.Site.SiteId;
 | 
			
		||||
                    user.Username = username;
 | 
			
		||||
                    user.Password = password;
 | 
			
		||||
                    user.Username = _username;
 | 
			
		||||
                    user.Password = _password;
 | 
			
		||||
                    user = await UserService.LoginUserAsync(user, false, false);
 | 
			
		||||
                    isvalid = user.IsAuthenticated;
 | 
			
		||||
                }
 | 
			
		||||
@ -215,24 +215,24 @@ else
 | 
			
		||||
                    ShowProgressIndicator();
 | 
			
		||||
 | 
			
		||||
                    aliases = new List<Alias>();
 | 
			
		||||
                    urls = urls.Replace("\n", ",");
 | 
			
		||||
                    foreach (string name in urls.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
 | 
			
		||||
                    _urls = _urls.Replace("\n", ",");
 | 
			
		||||
                    foreach (string name in _urls.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
 | 
			
		||||
                    {
 | 
			
		||||
                        Alias alias = new Alias();
 | 
			
		||||
                        alias.Name = name;
 | 
			
		||||
                        alias.TenantId = int.Parse(tenantid);
 | 
			
		||||
                        alias.TenantId = int.Parse(_tenantid);
 | 
			
		||||
                        alias.SiteId = -1;
 | 
			
		||||
                        alias = await AliasService.AddAliasAsync(alias);
 | 
			
		||||
                        aliases.Add(alias);
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    Site site = new Site();
 | 
			
		||||
                    site.TenantId = int.Parse(tenantid);
 | 
			
		||||
                    site.Name = name;
 | 
			
		||||
                    site.TenantId = int.Parse(_tenantid);
 | 
			
		||||
                    site.Name = _name;
 | 
			
		||||
                    site.LogoFileId = null;
 | 
			
		||||
                    site.DefaultThemeType = themetype;
 | 
			
		||||
                    site.DefaultLayoutType = (layouttype == null ? "" : layouttype);
 | 
			
		||||
                    site.DefaultContainerType = containertype;
 | 
			
		||||
                    site.DefaultThemeType = _themetype;
 | 
			
		||||
                    site.DefaultLayoutType = (_layouttype == null ? "" : _layouttype);
 | 
			
		||||
                    site.DefaultContainerType = _containertype;
 | 
			
		||||
                    site = await SiteService.AddSiteAsync(site, aliases[0]);
 | 
			
		||||
 | 
			
		||||
                    foreach (Alias alias in aliases)
 | 
			
		||||
@ -241,19 +241,19 @@ else
 | 
			
		||||
                        await AliasService.UpdateAliasAsync(alias);
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    if (!isinitialized)
 | 
			
		||||
                    if (!_isinitialized)
 | 
			
		||||
                    {
 | 
			
		||||
                        User user = new User();
 | 
			
		||||
                        user.SiteId = site.SiteId;
 | 
			
		||||
                        user.Username = username;
 | 
			
		||||
                        user.Password = password;
 | 
			
		||||
                        user.Username = _username;
 | 
			
		||||
                        user.Password = _password;
 | 
			
		||||
                        user.Email = PageState.User.Email;
 | 
			
		||||
                        user.DisplayName = PageState.User.DisplayName;
 | 
			
		||||
                        user = await UserService.AddUserAsync(user, aliases[0]);
 | 
			
		||||
 | 
			
		||||
                        if (user != null)
 | 
			
		||||
                        {
 | 
			
		||||
                            Tenant tenant = tenants.Where(item => item.TenantId == int.Parse(tenantid)).FirstOrDefault();
 | 
			
		||||
                            Tenant tenant = _tenants.FirstOrDefault(item => item.TenantId == int.Parse(_tenantid));
 | 
			
		||||
                            tenant.IsInitialized = true;
 | 
			
		||||
                            await TenantService.UpdateTenantAsync(tenant);
 | 
			
		||||
                        }
 | 
			
		||||
@ -265,7 +265,7 @@ else
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    await logger.LogError("Invalid Password Entered For Host {Username}", username);
 | 
			
		||||
                    await logger.LogError("Invalid Password Entered For Host {Username}", _username);
 | 
			
		||||
                    AddModuleMessage("Invalid Host Password", MessageType.Error);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user