Here you go.
public async Task<long> CreateContact(CreateContactInput input)
{
var contact = ObjectMapper.Map<Contact>(input);
if (AbpSession.TenantId != null)
{
contact.TenantId = (int)AbpSession.TenantId;
}
var newId = await _contactRepository.InsertAndGetIdAsync(contact);
return newId;
}
Please ignore this issue. There was unused object injected in my app service class.
I am trying to implement notifications for my app. I am following the documents here and here.
So far I have just setup one notification, for one entity to ensure I have things working correctly.
I have made the following code changes:
Configuration.Notifications.Providers.Add<MyAppNotificationProvider>();
I am able to build and run the application without any errors. However soon as I try to open my entity index page for the entity I setup for notifications, I get the error shown below.
An unhandled exception occurred while processing the request.
HandlerException: Can't create component 'Abp.Localization.Sources.Resource.ResourceFileLocalizationSource' as it has dependencies to be satisfied.
'Abp.Localization.Sources.Resource.ResourceFileLocalizationSource' is waiting for the following dependencies:
- Parameter 'name' which was not provided. Did you forget to set the dependency?
- Service 'System.Resources.ResourceManager' which was not registered.
Castle.MicroKernel.Handlers.DefaultHandler.AssertNotWaitingForDependency()
In my application I have the entity shown below.
public class CreateContactInput : ICustomValidate
{
[Required]
public int Type { get; set; }
[MaxLength(ContactConsts.EmailMaxLength)]
public string Email { get; set; }
[MaxLength(ContactConsts.PhoneMaxLength)]
public string Phone { get; set; }
[Required]
[MaxLength(ContactConsts.ContactNameMaxLength)]
public string ContactName { get; set; }
private static bool IsValidEmailAddress(string emailAddress)
{
return new EmailAddressAttribute().IsValid(emailAddress);
}
private static bool IsValidPhoneNumber(string phoneNumber)
{
return new PhoneAttribute().IsValid(phoneNumber);
}
public void AddValidationErrors(CustomValidationContext context)
{
if (Type == 17 && string.IsNullOrEmpty(Email))
context.Results.Add(new ValidationResult("Email address is required"));
if (Type == 17 && !string.IsNullOrEmpty(Email))
{
if (!IsValidEmailAddress(Email))
context.Results.Add(new ValidationResult("Please enter a valid email address."));
}
if (Type == 18 && string.IsNullOrEmpty(Phone))
context.Results.Add(new ValidationResult("Phone number is required."));
if (Type == 18 && !string.IsNullOrEmpty(Phone))
{
if (!IsValidPhoneNumber(Phone))
context.Results.Add(new ValidationResult("Please enter a valid phone number."));
}
}
}
I was using IValidatableObject interface before I added ICustomValidate today. However neither of these interfaces is firing the validation and its allowing the creation of a contact record with invalid email addresses?
I read ABP validation document.
I also found this thread on support forum, which seems to report the same issue.
Can someone please help me with this issue?
I cloned my repo into a new directory and the issue went away. Not sure why but my issues is resolved now.
I just completed the V7 upgrade (Asp.Net Core Mvc/Jquery) and Metronic 6 UI changes to my solution on my "Development.upgrade" branch. I have just completed my pull request merge to my "Development.master" branch. I am able to compile the solution without any errors. I am able to run the application.
However, when I run the "npm run create-bundles" cmd on the MVC folder, I get multiple errors like the examples below.
ERROR in ./wwwroot/view-resources/Areas/MyApp/Views/_Bundles/vendors.bundle.css (./node_modules/css-loader/dist/cjs.js!./wwwroot/view-resources/Areas/MyApp/Views/_Bundles/vendors.bundle.css)
Module not found: Error: Can't resolve '../../../../../metronic/src/vendors/metronic/fonts/Metronic_fda1334c35d0f5fe2afb3afebbb6774a.woff2' in '\GIT\ABP\ABPMyApp.Development\src\EXLNT.MyApp.Web.Mvc\wwwroot\view-resources\Areas\MyApp\Views\_Bundles'
@ ./wwwroot/view-resources/Areas/MyApp/Views/_Bundles/vendors.bundle.css (./node_modules/css-loader/dist/cjs.js!./wwwroot/view-resources/Areas/MyApp/Views/_Bundles/vendors.bundle.css) 48:42-151
ERROR in ./wwwroot/view-resources/Areas/MyApp/Views/_Bundles/vendors.bundle.css (./node_modules/css-loader/dist/cjs.js!./wwwroot/view-resources/Areas/MyApp/Views/_Bundles/vendors.bundle.css)
Module not found: Error: Can't resolve '../../../../../metronic/src/vendors/fontawesome5/webfonts/fa-solid-900.woff2' in '\GIT\ABP\ABPMyApp.Development\src\EXLNT.MyApp.Web.Mvc\wwwroot\view-resources\Areas\MyApp\Views\_Bundles'
@ ./wwwroot/view-resources/Areas/MyApp/Views/_Bundles/vendors.bundle.css (./node_modules/css-loader/dist/cjs.js!./wwwroot/view-resources/Areas/MyApp/Views/_Bundles/vendors.bundle.css) 31:42-129
Almost all of the errors shown in the console are for the vendors.bundle files.
Here are the steps I followed after I updated my desktop copy.
I did NOT face any of these errors on my "Development.Upgrade" branch. If someone can point in the right direction on how to resolve these errors and/or let me know what I am missing?
I found the solution. I just noticed that ABP team has added a custom CSS class for the date-time-picker in __Bundles/demo-ui-components.cs, specifically in DemoDateAndTimePickers.css
I added the below line into my modals CSHTML and issue was resolved.
<link rel="stylesheet" abp-href="/view-resources/Areas/MyApp/Views/_Bundles/demo-ui-components.css" asp-append-version="true" />
I'm working on the upgrade of my solution to V7 and Metronic 6 UI. I am making the CSS class name changes and other Metronic 6 related changes. One issue that I cannot seem to fix is the visual appearance of the date pickers, see example below.
No matter what I do, even if I copy the code directly from the "DemoUIComponents" cshtml file it just will not display properly. I have even copied the HTML and JS code directly from the Metronic 6 demo site and same issue persists!
I am using the "datetimepicker" plugin. Example code shown below.
$(".date-picker").datetimepicker({
locale: abp.localization.currentLanguage.name,
format: "L",
maxDate: end,
minDate: start
});
Any help you can provide here would be much appreciated!
In the areas/myapp/views/shared/components/CareOpsTopBar/default.cshtml file you have code shown below. Is there any documentation on how this works and what tools, plugins and/or extensions are being used to make this work?
Are the things like {{tenantId}}
coming from the view model used on the page?
<script id="linkedAccountsSubMenuTemplate" type="x-tmpl-mustache">
{{#items}}
<li class="kt-nav__item py-2">
<a href="" data-user-id="{{id}}" data-tenant-id="{{tenantId}}" class="recently-linked-user">
<span class="kt-nav__link-bullet">
<span></span>
</span>
<span class="kt-nav__link-text">
{{shownUserName}}
</span>
</a>
</li>
{{/items}}
</script>
I have a partial view that could use similar code. I'm currently writing all this HTML from a JS script file. I would like to implement the solution shown above, if possible?
@ismcagdas - Thanks the webpack update fixed the build error.
However, when I add my own section into bundle.json, as shown below, its not creating my bundle?
"exlntScripts": [
{
"output": "view-resources/Areas/CareOps/Views/_Bundles/exlnt-edit-view.bundle.min.js",
"input": [
"wwwroot/view-resources/Areas/MyApp/Views/EXLNT/EXLNT-Notes.js",
"wwwroot/view-resources/Areas/MyApp/Views/EXLNT/EXLNT-AddressCards.js",
"wwwroot/view-resources/Areas/MyApp/Views/EXLNT/EXLNT-ContactCards.js"
]
}
]