How did I not see it !!! ?? It was to test the length of the ParentId Code, not the ParentId itself. :oops: :geek: Thank you very much!!! Now everything is working.
Hi,
I sent my project via email as you requested. Please help me and thanks for your attention.
I fill in the value of the field inside the CreateOrganizationUnit routine.
<span style="color:#BF0000">String lFlgTipoOU = "";
If (input.ParentId.ToString (). Length == 0) {lFlgTipoOU = "P"; }; If (input.ParentId.ToString (). Length == 5) {lFlgTipoOU = "A"; }; If (input.ParentId.ToString (). Length == 11) {lFlgTipoOU = "D"; }; ... FlgTipoOrganizationUnit = lFlgTipoOU,</span>
Creating a root OrganizationUnit is working correctly. Only the sub-OrganizationUnit is experiencing a problem. I think it's something in relation to the Code field, because only when I pass the ParentId field does the error occur.
Yes, I solved the problem. It was my mistake. Tks.
Hi for all!!!! I figured out how to do it!!! Tks for all!!!!
In the file CreateOrUpdateUnitModal.js add $uibModalInstance, $uibModal:
appModule.controller('common.views.organizationUnits.createOrEditUnitModal', [
'$scope', '$uibModalInstance', '$uibModal', 'abp.services.app.organizationUnit', 'organizationUnit',
function ($scope, $uibModalInstance, $uibModal, organizationUnitService, organizationUnit) {
var vm = this;
vm.createContato = function (organizationUnit) {
openCreateOrEditOUContatoModal(organizationUnit, null);
};
vm.editContato = function (organizationUnit, contato) {
openCreateOrEditOUContatoModal(organizationUnit, contato);
};
function openCreateOrEditOUContatoModal(organizationUnit, contato) {
var modalInstance = $uibModal.open({
templateUrl: '~/App/common/views/organizationUnits/createOrEditOUContatoModal.cshtml',
controller: 'common.views.organizationUnits.createOrEditOUContatoModal as vm',
backdrop: 'static',
resolve: {
param: function () {
return { 'organizationUnit': organizationUnit, 'contato': contato };
}
}
});
modalInstance.result.then(function (result) {
vm.getOrganizationUnits();
});
}
And add the function openCreateOrEditOUContatoModal:
(function () { appModule.controller('common.views.organizationUnits.createOrEditOUContatoModal', [ '$scope', '$uibModalInstance', 'abp.services.app.organizationUnit', 'param', function ($scope, $uibModalInstance, organizationUnitService, param) { var vm = this;
vm.organizationUnit = param.organizationUnit;
vm.contato = param.contato;
vm.cancel = function () {
$uibModalInstance.dismiss();
};
vm.save = function () {
vm.contato.organizationUnitId = param.organizationUnit.id;
if (vm.contato.depositoContatoId) {
organizationUnitService
.updateContato(vm.contato)
.then(function (result) {
abp.notify.info(app.localize('SavedSuccessfully'));
$uibModalInstance.close(result.data);
});
} else {
organizationUnitService
.createContato(vm.contato)
.then(function (result) {
abp.notify.info(app.localize('SavedSuccessfully'));
$uibModalInstance.close(result.data);
});
}
};
}
]);
})();
That's it. I want to get this information to limit the number of simultaneous users connected to the system.