Base solution for your next web application

Activities of "CNS"

thanks ismcagdas. its very helpful

Hi,

But on angular side there is a <fileupload> tag by ng-prime for uploading a file but I can't find a tag to preview a file or attachment.

all other services are working fine but on this service we are facing problem. I already shared whole problematic code with you.

System.ObjectDisposedException: 'Cannot access a disposed object. A common cause of this error is disposing a context that was resolved from dependency injection and then later trying to use the same context instance elsewhere in your application. This may occur if you are calling Dispose() on the context, or wrapping the context in a using statement. If you are using dependency injection, you should let the dependency injection container take care of disposing context instances. Object name: 'ERPDbContext'.'

Your app has entered a break state, but there is no code to show because all threads were executing external code (typically system or framework code).

this error arises normally when 2 time loop executed

where to know about the abp version

hi @ismcagdas if u have this sample project please send at [email protected] i think @velu not here.

hi everyone if any one have sample project (asp.net core && angular) please send at [email protected]

Hi @velu please send sample code . kindly send to [email protected]

#ismcagdas thanks

1 Step :

    private async void ProcessReceiptTransfer(VoucherPostingDto input)
    {
        var receiptHeader = _porecHeaderRepository.GetAll().Where(o => o.TenantId == AbpSession.TenantId
        && o.DocNo >= input.FromDoc && o.DocNo &lt;= input.ToDoc &amp;&amp; o.Posted == false).ToList();

        foreach (var item in receiptHeader)
        {
            CreateOrEditPORECHeaderDto receipt = new CreateOrEditPORECHeaderDto()
            {
                Id = item.Id
            };
            await _receiptEntryAppService.ProcessReceiptEntry(receipt);
        }
    }
    
    

2 Step:

    public async Task&lt;string&gt; ProcessReceiptEntry(CreateOrEditPORECHeaderDto input)
    {
        var alertMsg = "";
        var currency = _voucherEntryAppService.GetBaseCurrency();
        var user = _userRepository.GetAll().Where(o => o.Id == AbpSession.UserId).SingleOrDefault().UserName;
        var transBook = _icSetupRepository.GetAll().Where(o => o.TenantId == AbpSession.TenantId).SingleOrDefault().TRBookID;
        var receiptHeader = _porecHeaderRepository.FirstOrDefault(o => o.TenantId == AbpSession.TenantId && o.Id == input.Id);
        var receiptDetail = _porecDetailRepository.GetAll().Where(o => o.TenantId == AbpSession.TenantId && o.DetID == input.Id);
        var icItem = _itemRepository.GetAll().Where(o => o.TenantId == AbpSession.TenantId);
        string narration = receiptHeader.Narration;
        var additionalData = _icrecaExpRepository.GetAll().Where(o => o.TenantId == AbpSession.TenantId && o.LocID == input.LocID && o.DocNo == input.DocNo);

        List&lt;CreateOrEditGLTRDetailDto&gt; gltrdetailsList = new List&lt;CreateOrEditGLTRDetailDto&gt;();

        var transferDetailList = from o in receiptDetail
                                 join i in icItem on new { A = o.ItemID, B = o.TenantId } equals new { A = i.ItemId, B = i.TenantId }
                                 group o by new { i.Seg1Id } into gd
                                 select new PORECDetailDto
                                 {
                                     Amount = gd.Sum(x => x.Amount),
                                     ItemID = gd.Key.Seg1Id,
                                 };

        foreach (var item in transferDetailList)
        {
            var caID = _inventoryGlLinkRepository.GetAll().Where(o => o.TenantId == AbpSession.TenantId && o.LocID == receiptHeader.LocID && o.SegID == item.ItemID).FirstOrDefault().AccRec;
            var daID = _inventoryGlLinkRepository.GetAll().Where(o => o.TenantId == AbpSession.TenantId && o.LocID == receiptHeader.LocID && o.SegID == item.ItemID).FirstOrDefault().AccRec;
            //Credit Amount
            gltrdetailsList.Add(new CreateOrEditGLTRDetailDto
            {
                Amount = -Convert.ToDouble(item.Amount),
                AccountID = caID,
                Narration = narration,
                SubAccID = 0,
                LocId = receiptHeader.LocID,
                IsAuto = true
            });

            //Debit Amount
            gltrdetailsList.Add(new CreateOrEditGLTRDetailDto
            {
                Amount = Convert.ToDouble(item.Amount),
                AccountID = daID,
                Narration = narration,
                SubAccID = 0,
                LocId = Convert.ToInt32(receiptHeader.LocID),
                IsAuto = false
            });
        }

        foreach (var item in additionalData)
        {
            //Debit Amount
            gltrdetailsList.Add(new CreateOrEditGLTRDetailDto
            {
                Amount = Convert.ToDouble(item.Amount),
                AccountID = item.AccountID,
                Narration = narration,
                SubAccID = 0,
                LocId = Convert.ToInt32(item.LocID),
                IsAuto = false
            });
        }

        VoucherEntryDto autoEntry = new VoucherEntryDto()
        {
            GLTRHeader = new CreateOrEditGLTRHeaderDto
            {
                BookID = transBook,
                NARRATION = narration,
                DocDate = Convert.ToDateTime(receiptHeader.DocDate),
                DocMonth = Convert.ToDateTime(receiptHeader.DocDate).Month,
                Approved = true,
                AprovedBy = user,
                AprovedDate = DateTime.Now,
                Posted = false,
                LocId = receiptHeader.LocID,
                CreatedBy = user,
                CreatedOn = DateTime.Now,
                AuditUser = user,
                AuditTime = DateTime.Now,
                CURID = currency.Id,
                CURRATE = currency.CurrRate,
                ConfigID = 0
            },
            GLTRDetail = gltrdetailsList
        };

        if (autoEntry.GLTRDetail.Count() > 0 && autoEntry.GLTRHeader != null)
        {
            var voucher = await _voucherEntryAppService.ProcessVoucherEntry(autoEntry);
            receiptHeader.Posted = true;
            //receiptHeader.PostedBy = user;
            // receiptHeader.PostedDate = DateTime.Now;
            receiptHeader.LinkDetID = voucher[0].Id;
            var transh = await _porecHeaderRepository.FirstOrDefaultAsync((int)receiptHeader.Id);
            ObjectMapper.Map(receiptHeader, transh);

            alertMsg = "Save";
        }
        else
        {
            alertMsg = "NoRecord";
        }
        return alertMsg;
    }
    
    

3 Step:

    public async Task&lt;List&lt;GLTRHeaderDto&gt;> ProcessVoucherEntry(VoucherEntryDto input)
    {
        var gltrHeader = ObjectMapper.Map&lt;GLTRHeader&gt;(input.GLTRHeader);

        if (AbpSession.TenantId != null)
        {
            gltrHeader.TenantId = (int)AbpSession.TenantId;
        }

        gltrHeader.DocNo = GetMaxDocId(input.GLTRHeader.BookID);
        var getGenratedId = await _gltrHeaderRepository.InsertAndGetIdAsync(gltrHeader);


        foreach (var item in input.GLTRDetail)
        {

            var gltrDetail = ObjectMapper.Map&lt;GLTRDetail&gt;(item);

            if (AbpSession.TenantId != null)
            {
                gltrDetail.TenantId = (int)AbpSession.TenantId;

            }
            gltrDetail.LocId = input.GLTRHeader.LocId;
            gltrDetail.DetID = getGenratedId;
            await _gltrDetailRepository.InsertAsync(gltrDetail);
        }

        List&lt;GLTRHeaderDto&gt; returnList = new List&lt;GLTRHeaderDto&gt;();
        returnList.Add(new GLTRHeaderDto
        {
            Id=getGenratedId,
            DocNo = gltrHeader.DocNo,
            LocId=gltrHeader.LocId
        });

        return returnList;
    }

    
Showing 1 to 10 of 18 entries