Just an FYI.
8.9, jquery.
Scenario: An employee can belong to multiple departments. Using the Power Tool, I can pick a FK relationship, but it's only one to one.
Per this post: https://support.aspnetzero.com/QA/Questions/6933/How-to-generate-relational-entities-using-abp-Power-tool One to Many is supported.
How do we do this?
If this is no longer the case? How do we accomplish this in the asp.net zero / aspboilerplate way?
I have an input with a DateTime.
Looking at raw source, what comes down is correct
6/23/2020 9:00:00 AM
In the createoredit.js, there is:
$('.date-picker').datetimepicker({
locale: abp.localization.currentLanguage.name,
format: 'L'
});
by default.
If I set format to 'L LT' is displays correctly.
If I set format to LT, it changes the time to "6:00 AM".
The only way I can get the correct time to show is to format my DateTime with .ToString("t")
Is this something I'm doing wrong?
Thanks for any advice.
-> 8.9, Jquery
When the RAD tool scaffolds an entity with a boolean property, that uses filtering, it generates WHEREIF statements such as
.WhereIf(input.HasScheduleFilter > -1, e => (input.HasScheduleFilter == 1 && e.HasSchedule) || (input.HasScheduleFilter == 0 && !e.HasSchedule))
What I'm seeing is the input object's int property is 0 by default, resulting in it always being filtered.
Is anyone else experiencing this, or am I doing something wrong.
If I'm doing it correctly, then my solution has been to set a default value for boolean properties in the GetAll<entity>Input class, such as:
public int HasScheduleFilter { get; set; } = -1;
For scaffolding purposes, I'd suggest setting that default value for boolean properties (which are ints in the input class it creats) in the GetAllForLookupTableInput template files for RAD tool, if you're going to use this logic for the WhereIf, to avoid having to explicitly set this to -1 when doing something like:
var Object = await _<entity>AppService.GetAll(new GetAll<entity>Input()
{
HasScheduleFilter = -1,
});
2nd question - does my setting these default values to -1 raise any potential issues I'm not aware of?
if using OUs and entities. it's straightforward to get an entity and it's children based on the examples. ( adding keyword for searching Orginazational Units )
How might one leverage this to find the "deepest" value in the tree for a specific child?
For example, if my entities have a nullable property called manager. Lets assume the root entity has a value of Bob.
4 layers deep an entity has the manager property set to a different value, Sharon.
finally, below that, there is an entity for employee, Mike.
How might one find out who Mike's immediate manager is?
if i start with Mike and recusively examine parents upward until i get a value, this can be done.
But if i have 1000s of employees?
is the only solution to do this recursive upward query, or is there a best practice when getting children to get the "deepest" manager to the child?
Can the OU code be leveraged somehow to get the employee element with the manager value of Sharon without recursivly crawling up the OU parents for enery child untill i get a value, each time?
i see this as highly inefficient and would hurt performance.
if i have two entities, and i need some metadata on their relatuonship, is best pactice to create an entity with FKs and properties, and use the rad tool to generate with no UI, etc?
See subject -
Wondering if there's a community.
8.7, jQuery
I have an entity, after editing, it saves, and the ajax calls fires clearForm().
Clear Form is:
function clearForm(){
_$employeeInformationForm[0].reset();
}
This erases all edits. If the user hits save it overwrites their changes.
Same thing when adding an entity.
Shouldn't the entity refresh?
8.7 - jquery version - IIS 10
I setup a background worker and everything works fine, except it doesn't fire when the site is idle.
I have my app pool idle set to 0, and start mode to "Always Running".
I was expecting an email this morning and didn't receive it.
I went to the site and immediately got the email.
So background workers only fire when a request is made to the website - or is it something else?
Should I be using hangfire?
Or should I just create a windows service / console application to do these jobs?
I need a worker to do multitenant work on the database - so in the DoWork function I would like to use the DB context.
The worker class lives the Core project.
The reason is I need to to linq queries involving datetimes and these don't work through reposities.
my linq looks like this:
allShifts = allShifts
.Where(s =>
TimeSpan.Compare(s.Deadline.ToUniversalTime().AddHours(s.NotifyHoursBeforeDeadline * -1).TimeOfDay, _notificationSweep.TimeOfDay) < 0 // The deadline is after now
&&
_notificationSweep.TimeOfDay.TotalMinutes - s.Deadline.ToUniversalTime().AddHours(s.NotifyHoursBeforeDeadline * -1).TimeOfDay.TotalMinutes < NotificationWindowInMinutes + 5 // it's within 30 minutes, adding 5 minutes to account for sending time
)
.ToList();
If I can get to the workDbContext, I should be able to use some of the dbFunctions specified here: https://docs.microsoft.com/en-us/dotnet/api/microsoft.entityframeworkcore.sqlserverdbfunctionsextensions?view=efcore-3.1
What this is trying to do:
I have a datetime object I only need the timeofday - so I have now which is the notificationsweep variable.
I need to get time of day values that are within 30 minutes of the job running.
My hope is geting the DB context would allow better querying flexibilty.