Here you go.
protected int? CurrentCompanyId = null;
protected int? CurrentNurseHomeId = null;
protected bool IsCompanyFilterEnabled => CurrentCompanyId != null && CurrentUnitOfWorkProvider?.Current?.IsFilterEnabled("CompanyFilter") == true;
protected bool IsNurseHomeFilterEnabled => CurrentNurseHomeId != null && CurrentUnitOfWorkProvider?.Current?.IsFilterEnabled("NurseHomeFilter") == true;
@aaron - Thanks! I noticed those differences just after I posted my last message. I applied those changes, but the filtering is still not working.
protected override bool ShouldFilterEntity<TEntity>(IMutableEntityType entityType)
{
if (typeof(IHasCompany).IsAssignableFrom(typeof(TEntity)))
{
return true;
}
if (typeof(IHasNurseHome).IsAssignableFrom(typeof(TEntity)))
{
return true;
}
return base.ShouldFilterEntity<TEntity>(entityType);
}
protected override Expression<Func<TEntity, bool>> CreateFilterExpression<TEntity>()
{
var expression = base.CreateFilterExpression<TEntity>();
if (typeof(IHasCompany).IsAssignableFrom(typeof(TEntity)))
{
Expression<Func<TEntity, bool>> companyFilter = e => ((IHasCompany)e).CompanyId == CurrentCompanyId || (((IHasCompany)e).CompanyId == CurrentCompanyId) == IsCompanyFilterEnabled;
expression = expression == null ? companyFilter : CombineExpressions(expression, companyFilter);
}
if (typeof(IHasNurseHome).IsAssignableFrom(typeof(TEntity)))
{
Expression<Func<TEntity, bool>> nurseHomeFilter = e => ((IHasNurseHome)e).NurseHomeId == CurrentNurseHomeId || (((IHasNurseHome)e).NurseHomeId == CurrentNurseHomeId) == IsCompanyFilterEnabled;
expression = expression == null ? nurseHomeFilter : CombineExpressions(expression, nurseHomeFilter);
}
return expression;
}
Here in debug you can see that both filter are enabled and have values.
I have just updated my solution V6.8 now and this data filtering is still not working for me.
Here on the Index view app service method, at the very first using statement, you can see the immediate window shows that both filters are enabled.
Here are the methods, which are in my base app service class, that get the current user company and home values. In this test, you can see both values are populated.
Yet when the code in the method executes, the query still returns all rows in the result?
Thanks!
I had to delete the entire .Web.Mvc\wwwroot\assets\Jcrop\src folder. As I see that folder no longer exists in your solution.
As a follow-up to my last post here. I have now copied and merged all of my app level changes throughout the solution. The app runs fine, however I am getting some JS errors in the browser console, as shown below.
I have run the YARN command on the solution, before I ever opened in in VS2017. When I build the solution from VS2017 all of the bundles are created without any errors. However when I run the "npm run create-bundles" from the command line, it fails and logs the below errors into a log file.
9 verbose lifecycle [email protected]~create-bundles: CWD: X:\GIT\ABP\ANZCareOpsUpgrade.V680Upgrade\src\EXLNT.CareOps.Web.Mvc
10 silly lifecycle [email protected]~create-bundles: Args: [ '/d /s /c',
10 silly lifecycle 'gulp copy:node_modules && gulp minify:less && npm run bundle-clean:bundle' ]
11 silly lifecycle [email protected]~create-bundles: Returned: code: 1 signal: null
12 info lifecycle [email protected]~create-bundles: Failed to exec create-bundles script
13 verbose stack Error: [email protected] create-bundles: `gulp copy:node_modules && gulp minify:less && npm run bundle-clean:bundle`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (C:\Users\xxx\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:182:13)
13 verbose stack at ChildProcess.<anonymous> (C:\Users\xxx\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:182:13)
13 verbose stack at maybeClose (internal/child_process.js:962:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
14 verbose pkgid [email protected]
15 verbose cwd X:\GIT\ABP\ANZCareOpsUpgrade.V680Upgrade\src\EXLNT.CareOps.Web.Mvc
16 verbose Windows_NT 10.0.17763
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\xxx\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "create-bundles"
18 verbose node v10.13.0
19 verbose npm v6.4.1
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] create-bundles: `gulp copy:node_modules && gulp minify:less && npm run bundle-clean:bundle`
22 error Exit status 1
23 error Failed at the [email protected] create-bundles script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
Here are the commands I ran from my command window.
**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.9.9
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
X:\GIT\ABP\ANZCareOpsUpgrade.V680Upgrade\src\EXLNT.CareOps.Web.Mvc>yarn
yarn install v1.12.3
warning package.json: No license field
warning [email protected]: No license field
[1/4] Resolving packages...
success Already up-to-date.
Done in 0.35s.
X:\GIT\ABP\ANZCareOpsUpgrade.V680Upgrade\src\EXLNT.CareOps.Web.Mvc>npm run create-bundles
> [email protected] create-bundles X:\GIT\ABP\ANZCareOpsUpgrade.V680Upgrade\src\EXLNT.CareOps.Web.Mvc
> gulp copy:node_modules && gulp minify:less && npm run bundle-clean:bundle
[14:06:35] Using gulpfile X:\GIT\ABP\ANZCareOpsUpgrade.V680Upgrade\src\EXLNT.CareOps.Web.Mvc\gulpfile.js
[14:06:35] Starting 'copy:node_modules'...
[14:06:37] Finished 'copy:node_modules' after 1.81 s
[14:06:38] Using gulpfile X:\GIT\ABP\ANZCareOpsUpgrade.V680Upgrade\src\EXLNT.CareOps.Web.Mvc\gulpfile.js
[14:06:38] Starting 'minify:less'...
less()
{ [Error: 'bs/less/utilities.less' wasn't found. Tried - X:\GIT\ABP\ANZCareOpsUpgrade.V680Upgrade\src\EXLNT.CareOps.Web.Mvc\wwwroot\assets\Jcrop\src\css\bs\less\utilities.less,npm://bs\less\utilities.less,bs\less\utilities.less in file X:\GIT\ABP\ANZCareOpsUpgrade.V680Upgrade\src\EXLNT.CareOps.Web.Mvc\wwwroot\assets\Jcrop\src\css\_bootstrap.less line no. 63]
message:
'\'bs/less/utilities.less\' wasn\'t found. Tried - D:\\VisualStudioOnline\\GIT\\ABP\\ANZCareOpsUpgrade.V680Upgrade\\src\\EXLNT.CareOps.Web.Mvc\\wwwroot\\assets\\Jcrop\\src\\css\\bs\\less\\utilities.less,npm://bs\\less\\utilities.less,bs\\less\\utilities.less in file D:\\VisualStudioOnline\\GIT\\ABP\\ANZCareOpsUpgrade.V680Upgrade\\src\\EXLNT.CareOps.Web.Mvc\\wwwroot\\assets\\Jcrop\\src\\css\\_bootstrap.less line no. 63',
stack: undefined,
type: 'File',
filename:
'X:\\GIT\\ABP\\ANZCareOpsUpgrade.V680Upgrade\\src\\EXLNT.CareOps.Web.Mvc\\wwwroot\\assets\\Jcrop\\src\\css\\_bootstrap.less',
index: 1670,
line: 63,
column: 0,
callLine: NaN,
callExtract: undefined,
extract:
[ '// Utility classes',
'@import "bs/less/utilities.less"; // Has to be last to override when necessary',
'' ],
lineNumber: 63,
fileName:
'X:\\GIT\\ABP\\ANZCareOpsUpgrade.V680Upgrade\\src\\EXLNT.CareOps.Web.Mvc\\wwwroot\\assets\\Jcrop\\src\\css\\_bootstrap.less',
name: 'Error',
plugin: 'gulp-less',
showProperties: true,
showStack: false,
__safety: { toString: [Function: bound ] } }
[14:06:39] The following tasks did not complete: minify:less
[14:06:39] Did you forget to signal async completion?
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] create-bundles: `gulp copy:node_modules && gulp minify:less && npm run bundle-clean:bundle`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] create-bundles script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\xxx\AppData\Roaming\npm-cache\_logs\2019-03-22T21_06_39_457Z-debug.log
X:\GIT\ABP\ANZCareOpsUpgrade.V680Upgrade\src\EXLNT.CareOps.Web.Mvc>
In VS2017 I searched the solution for utilities.less file and could not find it anywhere.
I searched for the file via windows explorer and did find the file in folder; \src\EXLNT.CareOps\Web\Public\bower_components\bootstrap\less, but nowhere in the .Mvc project. Is this the issue?
I just checked the AspNetZero solution code in the AspNetZero teams GIT Repo and applied the below change in all the classes that were reporting the error and build is now successfull. I hope this was the proper fix?
I removed the using statement (using EXLNT.CareOps.Configuration.Dto) from:
I just downloaded a fresh copy of AspNetZero V680 into my "master" repo. This repo just contains the raw unedited downloaded code from my account downloads page. Here are the steps I have taken so far:
Bump.
Has anyone been able to get this to work? I really would prefer to test against a live DB. The in-memory DB testing is not realistic. As my application is advancing and more tables are introduced, I would have to create so many data entries into the "Databuilder" class. Plus worry about all the FK relationships. It's just not practical.
Windows server 2016 IIS 10. On winhost. Com.
I just deployed my ANZ V6.6.1 to my hosting provider site. I validated all functions on my desktop and they work just fine. However, on the hosted site application the Host Settings update button click keeps throwing a PUT error of "405 Method Not Allowed". I am trying to setup my SMTP, password and registration settings for tenants from the host site. This works perfectly on my desktop, I dont get any errors.
Here is the data that is getting posted on the hosting "host" app.
{"general":{},"tenantManagement":
{"AllowSelfRegistration":"true","UseCaptchaOnRegistration":"true","DefaultEditionId":""},"userManagement":
{},"email":{"DefaultFromAddress":"[email protected]","DefaultFromDisplayName":"Exlnt
test","SmtpHost":"smtp.sendgrid.net","SmtpPort":"587","SmtpDomain":"","SmtpUserName":"api","SmtpPass
word":"123"},"chat":{},"billing":{"LegalName":"","Address":""},"security":
{"useDefaultPasswordComplexitySettings":true,"passwordComplexity":
{"RequiredLength":"3"},"defaultPasswordComplexity":{"RequiredLength":"3"},"userLockOut":
{"IsEnabled":"true","MaxFailedAccessAttemptsBeforeLockout":"5","DefaultAccountLockoutSeconds":"300"},"two
FactorLogin":
{"IsEmailProviderEnabled":"true","IsSmsProviderEnabled":"true","IsRememberBrowserEnabled":"true"}}}
Here is the data that is getting posted on my desktop "host" app.
{"general":{},"tenantManagement":
{"UseCaptchaOnRegistration":"true","DefaultEditionId":""},"userManagement":{},"email":
{"DefaultFromAddress":"[email protected]","DefaultFromDisplayName":"Exlnt
test","SmtpHost":"smtp.sendgrid.net","SmtpPort":"587","SmtpDomain":"","SmtpUserName":"api","SmtpPass
word":"123"},"chat":{},"billing":{"LegalName":"","Address":""},"security":
{"useDefaultPasswordComplexitySettings":true,"passwordComplexity":
{"RequiredLength":"3"},"defaultPasswordComplexity":{"RequiredLength":"3"},"userLockOut":
{"IsEnabled":"true","MaxFailedAccessAttemptsBeforeLockout":"5","DefaultAccountLockoutSeconds":"300"},"two
FactorLogin":
{"IsEmailProviderEnabled":"true","IsSmsProviderEnabled":"true","IsRememberBrowserEnabled":"true"}}}
I cannot seem to find any difference in these two JS calls. Even when I change the environment variable on my hosted site app from "Development" to "Staging" it makes no difference. I keep getting the PUT error. I checked the application logs on the server, in the "app_data" folder and there is nothing getting logged. This error seems to be happening on the client side only.
Any ideas on what could be causing this?
Due to this error, I am unable to set my SMTP and other settings as the update is never reaching the server side app service method.
Here is an image from the chrome console, showing the error. On this call, I did not change any settings and just clicked the save button with all the default settings and still the error comes up!