I have fields that need to enter a minimun and maximun of characters but also these fields can be blank or null or ' '.
In this first picture you can see the Attributes
In this secound picture I use js code to disable or delte the attributes. ` this.save = function () { debugger;
if (!_$tenantPersonnelInformationForm.valid()) {
return;
}
if ( $('#TenantPersonnel_MiddleName').val() == '')
{
var input = $('#TenantPersonnel_MiddleName');
var is_name = input.val();
if (is_name) {
input.removeClass("invalid").addClass("valid");
input.prop('required', false);
}
else {
//input.removeClass("invalid").addClass("valid");
//input.prop('maxlength', false);
//input.prop('minlength', false);
//input.removeAttr('minLength');
//input.removeAttr('maxlength');
//input.removeClass('minLength');
//input.removeClass('maxlength');
}
}
As you can see in the picuture above the Atributs are gone which is what I wanted. But now, I keep getting the same error like the attributes were still there.
Can you please help us on this... where do I take the attributes. If the user does not need to fill up the field then it must be ' ' and when the user add data it has to be between that range. All help will be really appreciated. Thank you
Using the Power Tools I have create the followiing code. I need to present Assigneed People The table Document hast the assignees Ids this Ids belong to personnel. Documets are assinged to personnel. So the field Assignee in the Document Repository has only the Ids of the Personel in the format 1,2,5,12,11, etc. So What will be the best way to replace this numbers by names in the AppService. This app service it is already generated. Assignne has to have the names to be presented to the user. This is the picture where the numbers appear
Below is the code the (//) are the parts that I been done however I have This error (There is already an open DataReader associated with this Command which must be closed first) in this line ( var btRecord = _tenantPersonnelRepository.FirstOrDefault(id);)
Note: I can replace it at times the Ids for the Names and the changes are made it in the row tables without inserting option... This is really wear.
``
public async Task<PagedResultDto<GetTenantDocumentForViewDto>> GetAll(GetAllTenantDocumentsInput input)
{
// //Add Assignees Full Name.
// var tenantDocu = _tenantDocumentRepository.GetAll().ToList();
// if (tenantDocu.Count() > 0)
// {
// foreach (var Item in tenantDocu)
// {
// if (Item.Assignees != null && Item.Assignees != "")
// {
// string bt = Item.Assignees;
// Item.Assignees = "";
// string[] splitbt = bt.Split(new char[] { ',' });
// int[] myIntsbt = splitbt.Select(int.Parse).ToArray();
// try
// {
// var assigneed = "";
// for (int i = 0; i < splitbt.Length; i++)
// {
// var id = myIntsbt[i];
// var btRecord = _tenantPersonnelRepository.FirstOrDefault(id);
// assigneed = assigneed + btRecord.FirstName + " " + btRecord.LastName + " ";
// }
// Item.Assignees = assigneed;
// }
// catch (Exception ex)
// {
// throw new UserFriendlyException("Error Adding Assignees..." + ex.Message, ex.Message);
// };
// };
// };
// };
var filteredTenantDocuments = _tenantDocumentRepository.GetAll()
.Include( e => e.DocumentTypeFk)
.Include( e => e.DocumentStatuFk)
.WhereIf(!string.IsNullOrWhiteSpace(input.Filter), e => false || e.Name.Contains(input.Filter) || e.Description.Contains(input.Filter) || e.DocumentPath.Contains(input.Filter) || e.Assignees.Contains(input.Filter))
.WhereIf(!string.IsNullOrWhiteSpace(input.NameFilter), e => e.Name == input.NameFilter)
.WhereIf(!string.IsNullOrWhiteSpace(input.DescriptionFilter), e => e.Description == input.DescriptionFilter)
.WhereIf(!string.IsNullOrWhiteSpace(input.DocumentPathFilter), e => e.DocumentPath == input.DocumentPathFilter)
.WhereIf(input.MinSignDateFilter != null, e => e.SignDate >= input.MinSignDateFilter)
.WhereIf(input.MaxSignDateFilter != null, e => e.SignDate <= input.MaxSignDateFilter)
.WhereIf(input.MinStartDateFilter != null, e => e.StartDate >= input.MinStartDateFilter)
.WhereIf(input.MaxStartDateFilter != null, e => e.StartDate <= input.MaxStartDateFilter)
.WhereIf(input.MinExpirationDateFilter != null, e => e.ExpirationDate >= input.MinExpirationDateFilter)
.WhereIf(input.MaxExpirationDateFilter != null, e => e.ExpirationDate <= input.MaxExpirationDateFilter)
.WhereIf(input.MinReviewDateFilter != null, e => e.ReviewDate >= input.MinReviewDateFilter)
.WhereIf(input.MaxReviewDateFilter != null, e => e.ReviewDate <= input.MaxReviewDateFilter)
.WhereIf(!string.IsNullOrWhiteSpace(input.AssigneesFilter), e => e.Assignees == input.AssigneesFilter)
.WhereIf(!string.IsNullOrWhiteSpace(input.DocumentTypeNameFilter), e => e.DocumentTypeFk != null && e.DocumentTypeFk.Name == input.DocumentTypeNameFilter)
.WhereIf(!string.IsNullOrWhiteSpace(input.DocumentStatuNameFilter), e => e.DocumentStatuFk != null && e.DocumentStatuFk.Name == input.DocumentStatuNameFilter);
// HERE IS WHERE THE INSERTION ON THE TABLE HABPPENS ... THIS IS WEAR... WHY INSERT IN THE DABASE... CHANGE THE IDS FOR NAMES IN THE TABLE.
//foreach (var item in filteredTenantDocuments)
//{
// if (item.Assignees != null && item.Assignees != "")
// {
// var fRecord = tenantDocu.FirstOrDefault(x => x.Id == item.Id);
// item.Assignees = fRecord.Assignees;
// }
//}
var pagedAndFilteredTenantDocuments = filteredTenantDocuments
.OrderBy(input.Sorting ?? "id asc")
.PageBy(input);
var tenantDocuments = from o in pagedAndFilteredTenantDocuments
join o1 in _lookup_documentTypeRepository.GetAll() on o.DocumentTypeId equals o1.Id into j1
from s1 in j1.DefaultIfEmpty()
join o2 in _lookup_documentStatuRepository.GetAll() on o.DocumentStatuId equals o2.Id into j2
from s2 in j2.DefaultIfEmpty()
select new GetTenantDocumentForViewDto() {
TenantDocument = new TenantDocumentDto
{
Name = o.Name,
Description = o.Description,
DocumentPath = o.DocumentPath,
SignDate = o.SignDate,
StartDate = o.StartDate,
ExpirationDate = o.ExpirationDate,
ReviewDate = o.ReviewDate,
Assignees = o.Assignees,
Id = o.Id
},
DocumentTypeName = s1 == null ? "" : s1.Name.ToString(),
DocumentStatuName = s2 == null ? "" : s2.Name.ToString()
};
//foreach (var item in tenantDocuments.)
//{
// if (item.Assignees != null && item.Assignees != "")
// {
// var fRecord = tenantDocu.FirstOrDefault(x => x.Id == item.Id);
// item.Assignees = fRecord.Assignees;
// }
//}
var totalCount = await filteredTenantDocuments.CountAsync();
return new PagedResultDto<GetTenantDocumentForViewDto>(
totalCount,
await tenantDocuments.ToListAsync()
);
}
``
Previous title: Cancel Page and Call Edit Again does not bring controls datad
This is an extrage behavior that I am getting I have this page where I am going to edit the data that already enter . I am going to EDIT the Data Here I can see the Select2 controls of Buisiness Types, Industry Types and NAICS Names. Which are ok Then I decide not to change anything and Cancel the page so I press the button cancel To cancel gets me back to where I begin. and that is ok, but then I decide that I really need to change some data so I press again EDIT so I can Edit my Data Woooohhhh! what happend with my Select2 Controls they are empty. I have set up debugger in the js file and also break lines in the server code and nothing happends. If I press EDIT again it suppost to go back to the server and render the data like the first time but it does not.
Any help here will be really appreciated. Thank you in advance... BE SAFE.
As you can see in the picture I have created two pages using power tools in one the TenantExtended I can easy access the Model Properties so I can Change them if need it before the save is done. In the other page the document. TenantDocuments I can not access any of the model properties before save them.
Please help. Thank you
I have the regular button that is created using the power tools to create a document file. Power files creeates the Index.chtml and the _CreteandEditModal.chtmlml forms and the rest of he code. looking at the form index.chtml it create this button <div class="kt-subheader__toolbar"> <div class="kt-subheader__wrapper"> @if (IsGranted(AppPermissions.Pages_Administration_TenantDocuments_Create)) { <button id="CreateNewTenantDocumentButton" class="btn btn-primary blue"><i class="fa fa-plus"></i> @L("CreateNewTenantDocument")</button> } </div> </div>
This button does not refresh the _CreteandEditModal.chtml., and it is causing that my componet google documet viewer does not reaload for the case that I am creating a document where I filling some fiedls about the docuiment like document Name for insance and I decedid to cancel the document so I press the button Cancel, then I press the button Create a new Document this page is not refreh and causing not to load the google view document..
How I can make that the page_CreteandEditModal.chtml refresh again so my componets get reload it.
All help will be really appreciated.
Does anyone has a plug in (free) document viewer that works with asp.net zero? at least 5MB viewer I been trying with google docs viewer but it does not embed the viewer in the page, instead opend other page and then if I close the page the app closees All help will be really appreciated. Thank you
I have big issues here with the abp.ajax. I cannot find documentation about it. just the one is on the asp.net zero site. second I am using it and I get this following errors //Get States select controls added by Cesar [AbpAuthorize(AppPermissions.Pages_Administration_TenantExtendeds)] [HttpPost] [WrapResult(WrapOnSuccess = false, WrapOnError = false)] public List<NameValue<string>> GetAllStates(int Id) { var states = _stateRepository.GetAll().ToList().Where(m => m.CountryId == Id); var stateslist = new List<NameValue<string>>(); foreach (var item in states) { stateslist.Add(new NameValue { Name = item.Name, Value = item.Id.ToString() });
}
return stateslist.ToList();
}
// end States by Cesar
This is the Ajax // Country State $(document).ready(function () { debugger; var country = $("#CountryId"); var state = $("#StateId"); state.prop("disabled", true);
country.change(function () {
if ($(this).val() == "0") {
state.prop("disabled", true);
state.val("0");
console.log($(this).val());
}
else {
debugger;
abp.ajax({
url: abp.appPath + "api/services/app/TenantExtendeds/GetAllStates?Id=" + $(this).val(),
method: "Post",
success: function (data) {
state.prop("disabled", false);
state.empty();
$(data).each(function (index, item) {
state.append($('<option/>', { value: item.id, text: item.Name }));
});
}
});
}
});
});
I have the following errors Missing type map configuration or unsupported mapping
AutoMapper.AutoMapperMappingException HResult=0x80131500 Message=Missing type map configuration or unsupported mapping. Source=<Cannot evaluate the exception source> StackTrace: <Cannot evaluate the exception stack trace>
"Error detail not sent by server." "You should be authenticated (sign in) in order to perform this operation." "You are not authenticated!" "You are not allowed to perform this operation." "The resource requested could not found on the server."
Any help here will be really appreciated Thank you
INTERFACE List<NameValue<string>> GetAllBusinessType(string searchTerm);
SERVICE private readonly IRepository<BusinessType> _businesstypeRepository;
[AbpAuthorize(AppPermissions.Pages_Administration_TenantExtendeds)]
public List<NameValue<string>> GetAllBusinessType(string searchTerm)
{
var busineestype = _businesstypeRepository.GetAll().WhereIf(
!searchTerm.IsNullOrWhiteSpace(),
p => p.Name.ToLower().Contains(searchTerm.ToLower())
)
.OrderBy(p => p.Name);
return busineestype.Select(p => new NameValue<BusinessType>(p.Name, p)).ToList();
}
PAGE <div class="form-group"> <label for="TenantExtended_BusinessType">@L("Business Type")</label> @Html.DropDownList("businesstype", new SelectList(Model.TenantExtendedBusinessTypeList, "Id", "DisplayName", (Model.IsEditMode ? Model.TenantExtended.BusinessType.ToString() : "")), @L("Select Business Type"), new { @class = "form-control kt-select2" }) </div>
JQUERY $(".kt-select2").select2({ placeholder: 'Select', ajax: { url: abp.appPath + "api/services/app/TenantExtendeds/GetAllBusinessTypeForTableDropdown", dataType: 'json', delay: 250, data: function (params) { return { searchTerm: params.term, // search term page: params.page }; }, processResults: function (data, params) { params.page = params.page || 1;
return {
results: $.map(data.result, function (item) {
return {
text: item.name,
id: item.value
}
}),
pagination: {
more: (params.page * 30) < data.result.length
}
};
},
cache: true
},
minimumInputLength: 1,
language: abp.localization.currentCulture.name
});
========= On the below line on SERVICE got the error, and I am following the same advise I .
return busineestype.Select(p => new NameValue<BusinessType>(p.Name, p)).ToList();
Severity Code Description Project File Line Suppression State Error CS0029 Cannot implicitly convert type 'System.Collections.Generic.List<Abp.NameValue<OneServDemo.BusinessTypes.BusinessType>>' to 'System.Collections.Generic.List<Abp.NameValue<string>>' OneServDemo.Application E:\Multi Tenant Demos\OneNetZero Demos\OneServ DropDownBox\cesarzam26\OneServDemo\src\OneServDemo.Application\TenantExtendeds\TenantExtendedsAppService.cs 257 Active
Can you please help me out on this I have work all day on this and I can get it resolved. All help it is really appreciated. Thank you