Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "hitaspdotnet"

OR You can add new string array property to your entity

string[] RequiredPermissions {get; set;}

Usage:

@if (IsGranted(AppPermissions.Pages_SomePermission))
 {
    @foreach (var object in Model.YourObject.Where(e =>  e.RequiredPermissions.Contains("yourSomePermission")))
    {
        @Html.Partial("_ObjectPartialView", object)
    }
}
    @foreach (var object in Model.YourObject.Where(e =>  e.RequiredPermissions.Contains("yourOtherRequiredPermission")))
    {
        @Html.Partial("_ObjectPartialView", object)
    }

Hi,

I think isn't possible for dynamical items. If you have static items list then you can use hard codes in your razor

<select class="form-control" name="IsApprovedFilter" id="IsApprovedFilterId">
                           @if (IsGranted(Pages_Blogs_Comments))
                            {
                                      <option value="-1">@L("All")</option>
                                      <option value="1">@L("True")</option>
                            }
                                <option value="0">@L("False")</option>
                            </select>

Thanks for any tips! :(

<cite>MikaTmlVertti: </cite> @ismcagdas Hi, I am unable to see links contents. My github profile (MikaTml) is linked to aspnetzero, but not aspnetboilerplate.

That repository changed.

New link to this files

<a class="postlink" href="https://github.com/aspnetboilerplate/module-zero-forsaken/blob/dev/src/Abp.Zero.Common/Organizations/OrganizationUnitManagerExtensions.cs">https://github.com/aspnetboilerplate/mo ... ensions.cs</a>

<a class="postlink" href="https://github.com/aspnetboilerplate/module-zero-forsaken/blob/dev/src/Abp.Zero.Common/Organizations/OrganizationUnitManager.cs">https://github.com/aspnetboilerplate/mo ... Manager.cs</a>

Hi, I'm a HighSchool student. I can suggest you to use DEVELOPING STEP BY STEP. Well document for all level of knowing

Could someone explain to me with a real code? For example, How to caching the list of all the countries from DB in the cache then calling the caches for country list output? :( :? :cry: :| :roll:

Hi, Thank you for reply. So how can you get/set item list in memory cache using Abp cache for entities with minor modifications and high usage? e.x Countries list and they States or Provinces (for a address based app)?

Hi again. I can't find my solution in ABP docs. I have a cache named "App.Adresses". In this cache I have more keys pattern named "Addresses." , "AddressAttribute." and "AddressAttributeValue." Then I writing my items with something like this method :

public async Task<IList<AddressAttributeDto>> GetAllAddressAttributes()
        {
            var key = "AddressAttribute.";

            return await _cacheManager.GetCache("App.Adresses").Get(key, async () =>
             {
                 var query = from aa in (await _addressAttributeRepository.GetAllListAsync())
                             orderby aa.DisplayOrder, aa.Id
                             select aa;
                 return ObjectMapper.Map<IList<AddressAttributeDto>>(query.ToList());
             });

       }
public async Task<AddressAttributeDto> GetAddressAttributeById(EntityDto<long> input)
        {
            var key = string.Format("AddressAttribute.id-{0}", input.Id);

            return await _cacheManager.GetCache("App.Adresses").Get(key, async () =>
            {
                var addressAttribute = await _addressAttributeRepository.FirstOrDefaultAsync(input.Id);
                var output = ObjectMapper.Map<AddressAttributeDto>(addressAttribute);
            });

        }

Question is How you can remove all items in App.Addresses WHERE cache item name contains "AddressAttribute." No matter the item identifier and clear all(only AddressAttribute items) .

Thank you! I missed few lines of documents.

If your question is related to the base fields in YourProject.xml/json you need to implement a method to read xml/json and write it on the database. The fact that you can include a variety of sources(xml/json/system file/resx) in your code is one of the unique features of this framework. As a customer, we can not expect the development team to include 750 translation fields in database seed when that xml/json source solve users need's.

So, you can use ApplicationTextRepository and ApplicationTextManager to add your own locale keys or xml resources to Db.

public async Task ImportResourcesFromXml(ApplicationLanguage language, string xml, bool updateExistingResources = true)
{
    var xmlDoc = new XmlDocument();
    xmlDoc.LoadXml(xml);
    var nodes = xmlDoc.SelectNodes(@"AddressToYourXml");

    var existingResources = _appTxtRepo.GetAll().Where(txt => txt.LanguageName == language.Name);

    foreach (XmlNode node in nodes)
    {
        var name = node.Attributes["name"].InnerText.Trim();
        var value = "";
        var valueNode = node.SelectSingleNode("value");
        if (valueNode != null)
            value = valueNode.InnerText;

        if (string.IsNullOrEmpty(name))
            continue;

        var resource = existingResources.FirstOrDefault(x => x.Key.Equals(name, StringComparison.InvariantCultureIgnoreCase));
        if (resource != null)
        {
            if (updateExistingResources)
            {
                resource.Value = value;
            }
        }
        else
        {
            await _appTxtManager.UpdateStringAsync(language.Name, CultureInfoHelper.Get(language.Name), name, value );
        }
    }
}

CODE NOT COMPILED It's just for sample. If you need help for read/write xml resource please leave comment here I can help you with simple code.

Showing 21 to 30 of 49 entries