Base solution for your next web application

Activities of "mamak"

Question

I want to handle new exception types, as done for AbpAuthorizationException, AbpValidationException ...

I mean, for ex when an exception about delete conflict occurs, i want to handle it and show specific message to user. (for ex: "You cant delete this record. Because it has been used") But now this delete conflict hasn't been handled, default message is shown to the user.

How can i do this?

Hi there, I have an simple entity like that

public class AnnouncementEntity { public int Id { get; set;} public string Header {get; set;} public string Content {get; set;} }

In my application service i have an update method: public async Task UpdateAnnouncement(EditAnnouncementInputDto input) {

        AnnouncementEntity announce  = new AnnouncementEntity()
        {
            Id = input.Id,
            Header = input.Header
        };

        await _announceRepository.UpdateAsync(announce);
    }

this method updates the entity but i have a Content column and this update makes Content NULL.

How can i update columns that i want not all columns?

Hi, I have a simple service method that getting binary obejcts from db.

public async Task<BinaryObject> GetBinaryObj(Guid Id) { BinaryObject binObj = await _binaryObjectManager.GetOrNullAsync(Id); return binObj; }

but when i call this service from chrome its response is nothing.

But In ProfileController :

private async Task<FileResult> GetProfilePictureById(Guid profilePictureId) { var file = await _binaryObjectManager.GetOrNullAsync(profilePictureId); if (file == null) { return GetDefaultProfilePicture(); }

        return File(file.Bytes, MimeTypeNames.ImageJpeg);
    }

this code works fine. But when i want to make it a service in application layer, there is no response.

If user hasn't permission for any Service Method, error msg is ok, is about permission. ("Required permissions were not met...") But for Controller method (returns PartialView) error msg is "an internal error occured..". Not about permission.

I want Controller to show error msg about permission as Service. what can I do?

In my left outer join; when I update all of right table's(Ihtiyac_Muayene_Iliski) IsDeleted = True, no Result returns. But I have a record in my left table(Muayene), so it must return my left table's rows...

My query:

var query = from HstTkp_Hasta in _hastaRepository.GetAll() join HstTkp_Muayene in _muayeneRepository.GetAll() on new { Id = HstTkp_Hasta.Id } equals new { Id = HstTkp_Muayene.HastaId } join HstTkp_Yapilan_Islem_Hasta in _yapilanIslemHastaRepository.GetAll() on new { Id = HstTkp_Muayene.Id } equals new { Id = HstTkp_Yapilan_Islem_Hasta.MuayeneId } join HstTkp_Yapilan_Islem_Iliski in _yapilanIslemIliskiRepository.GetAll() on new { Id = HstTkp_Yapilan_Islem_Hasta.Id } equals new { Id = HstTkp_Yapilan_Islem_Iliski.Yapilan_Islem_Hasta_Id } into HstTkp_Yapilan_Islem_Iliski_join from HstTkp_Yapilan_Islem_Iliski in HstTkp_Yapilan_Islem_Iliski_join.DefaultIfEmpty() join HstTkp_Yapilan_Islem_Parametre in _yapilanIslemParametreRepository.GetAll() on new { Id = HstTkp_Yapilan_Islem_Iliski.Yapilan_Islem_Parametre_Id } equals new { Id = HstTkp_Yapilan_Islem_Parametre.Id } join HstTkp_Ihtiyac_Muayene_Iliski in _ihtiyacMuayeneIliskiRepository.GetAll() on new { Id = HstTkp_Muayene.Id } equals new { Id = HstTkp_Ihtiyac_Muayene_Iliski.Muayene_Id } into HstTkp_Ihtiyac_Muayene_Iliski_join from HstTkp_Ihtiyac_Muayene_Iliski in HstTkp_Ihtiyac_Muayene_Iliski_join.DefaultIfEmpty() join HstTkp_Ihtiyac in _ihtiyacRepository.GetAll() on new { Id = HstTkp_Ihtiyac_Muayene_Iliski.Ihtiyac_Id } equals new { Id = HstTkp_Ihtiyac.Id }

                    select new MuayeneDetayliListDto
                    {
                        HastaId = HstTkp_Hasta.Id,
                        TcKimlikNo = HstTkp_Hasta.TcKimlikNo,
                        Adi = HstTkp_Hasta.Adi,
                        Soyadi = HstTkp_Hasta.Soyadi,
                        DogumTarihi = HstTkp_Hasta.DogumTarihi,
                        EvTel = HstTkp_Hasta.EvTel,
                        CepTel = HstTkp_Hasta.CepTel,
                        MuayeneId = HstTkp_Muayene.Id,
                        Muayene_Tarihi = HstTkp_Muayene.Muayene_Tarihi,
                        Sikayet = HstTkp_Muayene.Sikayet,
                        Deri = HstTkp_Muayene.Deri,
                        Bas_Boyun = HstTkp_Muayene.Bas_Boyun,
                        Solunum_Sistemi = HstTkp_Muayene.Solunum_Sistemi,
                        Sindirim_Sistemi = HstTkp_Muayene.Sindirim_Sistemi,
                        Kardiyovaskuler_Sistem = HstTkp_Muayene.Kardiyovaskuler_Sistem,
                        Norolojik_Muayene = HstTkp_Muayene.Norolojik_Muayene,
                        Kas_Eklem_Sistemi = HstTkp_Muayene.Kas_Eklem_Sistemi,
                        Genel = HstTkp_Muayene.Genel,
                        Hasta_Durumu = HstTkp_Muayene.Hasta_Durumu,
                        Tani = HstTkp_Muayene.Tani,
                        Buyuk_Tansiyon = HstTkp_Yapilan_Islem_Hasta.Buyuk_Tansiyon,
                        Kucuk_Tansiyon = HstTkp_Yapilan_Islem_Hasta.Kucuk_Tansiyon,
                        Nabiz = HstTkp_Yapilan_Islem_Hasta.Nabiz,
                        Solunum_Sayisi  = HstTkp_Yapilan_Islem_Hasta.Solunum_Sayisi,
                        Kan_Sekeri = HstTkp_Yapilan_Islem_Hasta.Kan_Sekeri,
                        Sonuc = HstTkp_Yapilan_Islem_Hasta.Sonuc,
                        Karar = HstTkp_Yapilan_Islem_Hasta.Karar,
                        Yapilan_Islem_Adi = HstTkp_Yapilan_Islem_Parametre.Parametre_Adi,
                        Ihtiyac_Adi = HstTkp_Ihtiyac.Ihtiyac_Adi
                    };

        query = query
            .WhereIf(input.HastaId.HasValue, item => item.HastaId.Equals(input.HastaId))
            .AsQueryable();

        var results = query.ToList();

In my service method after getting data from db and mapping to my dto, I want my dto's some properties to be null or empty string if user doesn't have permission to see these. Can Abp do this automatically or should i do manually using PermissionChecker.IsGranted for each prop?

Showing 1 to 6 of 6 entries